Class Component

Superclasses :
lang::Object
util::SetFields
util::Connectable
Subclasses :
gui::BarArea
gui::Button
gui::Circulate
gui::ComponentScrollAreaView
gui::Dialog
gui::DrawScrollAreaView
gui::DropDown
gui::Icon
gui::Image
gui::Label
gui::Line
gui::MenuBar
gui::MenuButton
gui::OverlayItem
gui::OverlaySet
gui::Panel
gui::PopupMenu
gui::ProgressBar
gui::ScrollArea
gui::ScrollBar
gui::Sizer
gui::Slider
gui::SliderArea
gui::Spin
gui::TabItem
gui::TabSet
gui::Table
gui::TableHeader
gui::TextField
Package :
gui

This is the parent class of all the GUI components. All of its methods and variables therefore apply to its sub-classes.

Source

Class summary
Methods inherited from lang::Object
clone(seen) equals(other, seen) get_class() get_class_name() get_id() hash_code(depth, seen) is_instance(name) to_string(depth, seen)
Methods inherited from util::SetFields
as_attrib(attr, val) attrib(a[]) cset_val(attr, val) field_error(s) int_val(attr, val) int_vals(attr, val, n) numeric_val(attr, val) numeric_vals(attr, val, n) set_fields(l) string_val(attr, val) string_vals(attr, val, n) test_flag(attr, val)
Methods inherited from util::Connectable
connect(obj, meth, type) disconnect(l) fire(type, param) fire_event(e)
Variables inherited from util::Connectable
listeners
Methods defined in this class
accepts_focus() add(c, i) all_valid() can_drag(ev) can_drop(d) child_validated(c) clear_accepts_focus() clear_allow_drag() clear_allow_drop() clear_draw_border() clear_is_shaded() compute_absolutes() create_event_and_fire(type, param) display(buffer_flag) do_handle_event(e) do_shading(W) drag_event(d) drag_reset() end_drag(d, c) fatal(s) finally() find_accel(e) find_focus() fire_icon_events_on_mouse(p, e) firstly() generate_components() get_accel() get_cbwin_reference() get_children() get_cwin_reference() get_h_reference() get_parent() get_parent_buffer_win() get_parent_dialog() get_parent_dialog_reference() get_parent_win() get_w_reference() get_x_reference() get_y_reference() got_focus(e) handle_accel(e) handle_event(e) in_region() init() initially() invalidate() invoke_can_drag(ev) invoke_can_drop(d) invoke_drag_event(d) invoke_drag_reset() invoke_end_drag(d, c) is_attrib(s) is_dialog_open() is_hidden() is_shaded() is_ticking() is_unhidden() is_unshaded() keeps(e) lost_focus(e) parse_pos(total, s) remove(c) resize() retime_ticker(n) set_abs_coords(x, y) set_abs_size(w, h) set_accel(k) set_accepts_focus() set_align(x_align, y_align) set_allow_drag() set_allow_drop() set_attribs(x[]) set_attribs_list(l) set_draw_border() set_is_shaded() set_one(attr, val) set_parent(c) set_parent_dialog(c) set_pos(x_spec, y_spec) set_size(w_spec, h_spec) set_ticker(n, d) set_tooltip(x) stop_ticker() tick() toggle_draw_border() toggle_is_shaded() unique_end(x) unique_start() validate()
Variables defined in this class
accel accepts_focus_flag allow_drag_flag allow_drop_flag attribs cbwin children cwin draw_border_flag h h_spec has_focus is_shaded_flag parent parent_dialog ticker tooltip valid w w_spec x x_align x_spec y y_align y_spec

Method detail

accepts_focus()

Determines whether the component accepts the tab focus
Source

add(c, i)

Add the Component to the list of children.
Parameters :
c - The Component to add.
i - The index to add at; if omitted then the new component is appended to the end.
Source

all_valid()

Succeed iff all of the components rooted at this component are valid.
Source

can_drag(ev)

Invoked on a drag gesture; if the component wishes to start a drag and drop session, it should succeed, otherwise it should fail.

NB - this method will only be invoked if the allow_drag flag is non-null.

Parameters :
ev - the Icon event, one of &ldrag, &rdrag, &mdrag.
Source

can_drop(d)

Invoked on a drop. If the component accepts the drop, it should handle it and succeed; otherwise it should fail.

NB - this method will only be invoked if the allow_drop flag is non-null.

Parameters :
d - the current Drag object.
Source

child_validated(c)

This is invoked when a child component has been validated.
Source

clear_accepts_focus()

Clear the flag indicating that the component accepts tab focus.
Source

clear_allow_drag()

Configure the component to disallow drags.
Source

clear_allow_drop()

Configure the component to disallow drops.
Source

clear_draw_border()

Set the component such that a border is not drawn.
Source

clear_is_shaded()

Set the shaded status of the component to not shaded.
Source

compute_absolutes()

Compute the absolute positions and sizes from the specifications given by set_pos() and set_size(). This method needs to be extended for a component which contains other components.
Source

create_event_and_fire(type, param)

For backward compatibility only...(now use fire()).
Source

display(buffer_flag)

This draws, or re-draws, the component and all its children in the dialog window.
Parameters :
buffer_flag - If this parameter is not null, then the component is displayed into the buffer window, not the dialog window (this is used for double-buffering purposes).
Source

do_handle_event(e)

Invoke handle_event and some basic icon events.
Source

do_shading(W)

Called from a component's display() method, this method filters the component to give a shaded appearance, if the is_shaded_flag is set. W is the window to draw into (normally self.cwin).
Source

drag_event(d)

Invoked during a drag. The component may update itself accordingly to indicate a potential drop. If it succeeds, then the mouse cursor will be changed accordingly, to indicate this.

NB - this method will only be invoked if the allow_drop flag is non-null.

Parameters :
d - the current Drag object.
Source

drag_reset()

Invoked at the end of drag and drop (on all components) to clear any drag state
Source

end_drag(d, c)

Invoked on the component that started the drag, after a successful drop
Parameters :
d - the current Drag object.
c - the component that accepted the drop
Source

fatal(s)

Source

finally()

This method may be extended. It is invoked just before the window is closed.
Source

find_accel(e)

Search for a component with the matching accelerator key within components rooted at this component.
Source

find_focus()

Search for a component which will accept focus on a mouse click amongst the components rooted at this component.
Source

fire_icon_events_on_mouse(p, e)

Private method, not intended for client invocation

firstly()

This method may be extended. It is invoked after the position of the object has been computed and the window has been opened, but before the object has been displayed in the window.
Source

generate_components()

Generate all the components, including subcomponents
Source

get_accel()

Get the accelerator key, if any.
Source

get_cbwin_reference()

Get the cloned buffer window, as seen by a child component.
Source

get_children()

Get the list of Components in this Container.
Returns :
The list of Components
Source

get_cwin_reference()

Get the cloned window, as seen by a child component.
Source

get_h_reference()

Get the height, as seen by a child component.
Source

get_parent()

Get the component's parent component.
Source

get_parent_buffer_win()

Return the Icon buffer window of the dialog in which the component resides.
Source

get_parent_dialog()

Returns the dialog holding the component.
Source

get_parent_dialog_reference()

The parent dialog, as seen by a child component.
Source

get_parent_win()

Return the Icon window of the dialog in which the component resides.
Source

get_w_reference()

Get the width, as seen by a child component.
Source

get_x_reference()

Get the x position, as seen by a child component.
Source

get_y_reference()

Get the y position, as seen by a child component.
Source

got_focus(e)

Method called when the component gets the keyboard focus; may be extended.
Parameters :
e - the event causing the change of focus, if any
Source

handle_accel(e)

Handle the component's keyboard accelerator key. By default, this requests the keyboard focus (if the component is configured to accept it).
Source

handle_event(e)

This handles an Icon event e. It would not normally be called by a user program.
Source

in_region()

The test for whether &x and &y lie within the bounds of the component
Source

init()

Complete the final setup before display by initializing the parent dialog reference and creating the cloned windows.
Source

initially()

Overrides initially() in util::Connectable

invalidate()

Invalidate the component so that it will be redrawn at the next opportunity.
Source

invoke_can_drag(ev)

Drag and drop helper to invoke can_drag
Source

invoke_can_drop(d)

Drag and drop helper to invoke can_drop
Source

invoke_drag_event(d)

Drag and drop helper to invoke drag_event
Source

invoke_drag_reset()

Drag and drop helper to invoke drag_reset
Source

invoke_end_drag(d, c)

Drag and drop helper to invoke end_drag
Source

is_attrib(s)

Source

is_dialog_open()

Succeed iff the component is in a dialog which is open.
Source

is_hidden()

Succeed if the component is hidden; for example if it is within a tabbed pane not presently visible.
Source

is_shaded()

Succeeds if the component is shaded; fails otherwise. A shaded component, such as a button, may be displayed differently, and will not generate events.
Source

is_ticking()

Is the ticker ticking?
Source

is_unhidden()

Succeed if the component is not hidden.
Source

is_unshaded()

Succeed if the component is not shaded.
Source

keeps(e)

This method can be overridden to succeed if the component should keep an event rather than allow it to be used by the parent dialog to move the focus between c
Source

lost_focus(e)

Method called when the component loses the keyboard focus; may be extended.
Parameters :
e - the event causing the change of focus, if any
Source

parse_pos(total, s)

Parse a position specification into an absolute value.
Parameters :
total - The total value
s - The size specifier
Source

remove(c)

Remove the Component from the list of children.
Parameters :
c - The Component to remove.
Source

resize()

Resize this component using compute_absolutes, and then resize all its children.
Source

retime_ticker(n)

Change the interval of the ticker
Parameters :
n - the new interval.
Source

set_abs_coords(x, y)

Set the absolute x,y co-ordinates.
Source

set_abs_size(w, h)

Set the absolute width and height.
Source

set_accel(k)

Set the accelerator key, which will be used with the Alt key to provide keyboard accelerators.
Source

set_accepts_focus()

Set the flag indicating that the component accepts tab focus.
Source

set_align(x_align, y_align)

Set the alignment of the component. Options for x_align are ``l'', ``c'' and ``r'', for left, centre, and right alignment. Options for y_align are ``t'', ``c'' and ``b'', for top centre and bottom alignment. The default alignment is ``l'', ``t''.
Parameters :
x_align - The x alignment
y_align - The y alignment
Source

set_allow_drag()

Configure the component to allow drags, if it is so capable.
Source

set_allow_drop()

Configure the component to allow drops, if it is so capable.
Source

set_attribs(x[])

Add the Icon attribs of the component to the given parameter
Example :
w.set_attribs("font=helvetica", "bg=pale blue")
Source

set_attribs_list(l)

Equivalent to set_attribs(), above, but takes a list as a parameter.
Example :
w.set_attribs_list(["font=helvetica", "bg=pale blue"])
Parameters :
l - The list of attribs.
Source

set_draw_border()

Set the component such that a border is drawn.
Source

set_is_shaded()

Set the shaded status of the component to shaded.
Source

set_one(attr, val)

Overrides set_one(attr, val) in util::SetFields
Source

set_parent(c)

Set the component's parent component.
Source

set_parent_dialog(c)

Sets the owning Dialog of the component. This method needs to be extended for a component which contains other components.
Parameters :
c - The parent dialog.
Source

set_pos(x_spec, y_spec)

Set the x and y position of the component. Each coordinate can be either an absolute pixel position, or can be given in the form of a percentage plus or minus an offset.
Example :
c.set_pos(100, "25%")
c.set_pos("50%-20", "25%+100")
Parameters :
x_spec - The x specification.
y_spec - The y specification.
Source

set_size(w_spec, h_spec)

Set the size of the component. The parameters are in the same format as for set_pos() above. Some components will set sensible default sizes, but for others the size must be set explicitly.
Source

set_ticker(n, d)

Convenience method to start a ticker that invokes the "tick()" method in this class.
Source

set_tooltip(x)

Set a tooltip string. This is presently only used by the Toolbar class.
Source

stop_ticker()

Stop the ticker.
Source

tick()

This method should be implemented to make use of the component's default ticker.
Source

toggle_draw_border()

Toggle whether or not to draw a border around the component. Different objects respond differently to this flag being set; some ignore it altogether.
Source

toggle_is_shaded()

Swap the shaded status of the component.
Source

unique_end(x)

End unique processing for this component.
Source

unique_start()

Begin unique processing for this component.
Source

validate()

Validate the component, which means displaying it and setting the valid flag
Source

Variable detail

accel


accepts_focus_flag


allow_drag_flag


allow_drop_flag


attribs


cbwin


children


cwin


draw_border_flag


h


h_spec


has_focus


is_shaded_flag


parent


parent_dialog


ticker


tooltip


valid


w


w_spec


x


x_align


x_spec


y


y_align


y_spec