Class Component

Summary

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

#
  x position as specified by {set_pos()}, eg "50%"

Superclasses:
MetaComponent, Ticker

Package:
(main)
File:
component.icn
Methods:
accepts_tab_focus, attrib, clear_accepts_tab_focus, clear_draw_border, clear_is_shaded, clear_no_updates, display, do_shading, error, final_setup, finally, firstly, generate_all_components, generate_components, get_cbwin_reference, get_cwin_reference, get_h_reference, get_parent_Dialog, get_parent_buffer_win, get_parent_win, get_visible_reference, get_w_reference, get_x_reference, get_y_reference, got_focus, handle_event, handle_notify, in_region, is_hidden, is_shaded, is_unhidden, is_unshaded, lost_focus, parse_pos, redisplay, resize, set_abs_coords, set_abs_size, set_accepts_tab_focus, set_align, set_attribs, set_attribs_list, set_draw_border, set_is_shaded, set_no_updates, set_parent_Dialog, set_pos, set_size, set_tooltip, toggle_draw_border, toggle_is_shaded, unique_end, unique_start

Methods inherited from MetaComponent:
set_fields

Methods inherited from Ticker:
is_ticking, retime_ticker, set_ticker, stop_ticker, tick

Fields:
accepts_tab_focus_flag, attribs, cbwin, cwin, draw_border_flag, h, h_spec, has_focus, is_shaded_flag, keeps_tabs, no_updates_count, parent_Component, parent_Dialog, tooltip, w, w_spec, x, x_align, x_spec, y, y_align, y_spec

Source code.

Details
Constructor

Component(argv)

Methods:

accepts_tab_focus()


attrib(x)

#
  Set the Icon attribs of the component to the given parameter
  @example
  @ w.attrib("font=helvetica", "bg=pale blue")
  @ w.set_attribs("font=helvetica", "bg=pale blue")


clear_accepts_tab_focus()


clear_draw_border()

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


clear_is_shaded()

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


clear_no_updates()


display(buffer_flag)

#
  This draws, or re-draws, the component in the dialog
  window.
  @param 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).


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}).


error(s)


final_setup(x, y)


finally()

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


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.


generate_all_components()

#
  Generate all the components, including non-visible ones in
  this component.


generate_components()

#
  Generate all the components that are visible in this
  component (which may be a container).


get_cbwin_reference()


get_cwin_reference()


get_h_reference()


get_parent_Dialog()

#
  Returns the dialog holding the component.


get_parent_buffer_win()


get_parent_win()

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


get_visible_reference()


get_w_reference()


get_x_reference()


get_y_reference()


got_focus()

#
  Method called when the component gets the keyboard focus; may be extended.


handle_event(e)

#
  This method is over-ridden by all this class's subclasses.
  It is the method which handles an Icon event e.  It would
  not normally be called by a user program.  It should either
  fail, or return an {_Event} structure.  This will then be
  passed to the  {dialog_event()} method of the dialog.  The
  first two fields of the _Event structure should be the Icon
  event e and the object itself.  The third field is the code,
  which can be any integer.


handle_notify(e)


in_region()

#
  Succeeds if the component is not shaded and the values of {&x}
  and {&y} lie within the component.


is_hidden()

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


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.


is_unhidden()

#
  Succeed if the component is not hidden.


is_unshaded()

#
  Succeed if the component is not shaded.


lost_focus()

#
  Method called when the component loses the keyboard focus; may be extended.


parse_pos(total, s)

#

 Parse a position specification into an absolute value.
 @param total   The total value
 @param s  The size specifier


redisplay()


resize()

#
  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.


set_abs_coords(x, y)


set_abs_size(w, h)


set_accepts_tab_focus()


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''.

  @param x_align   The x alignment
  @param y_align   The y alignment


set_attribs(x)


set_attribs_list(l)

#
  Equivalent to {set_attribs()}, above, but takes a list as a
  parameter.
  @param l   The list of attribs.
  @example
  @ w$set_attribs_list(["font=helvetica", "bg=pale blue"])


set_draw_border()

#
  Set the component such that a border is drawn.


set_is_shaded()

#
  Set the shaded status of the component to shaded.


set_no_updates()


set_parent_Dialog(c)

#
  Sets the owning _Dialog of the component.  This method
  needs to be extended for a component which contains other
  components.

  @param c   The parent dialog.


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.
  @param x_spec   The x specification.
  @param y_spec   The y specification.
  @example
  @ c$set_pos(100, "25%")
  @ c$set_pos("50%-20", "25%+100")


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.


set_tooltip(x)

#
  Set a tooltip string.  This is presently only used by
  the {Toolbar} class.


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.


toggle_is_shaded()

#
  Swap the shaded status of the component.


unique_end(x)


unique_start()


Fields:
accepts_tab_focus_flag -- # Flag indicating whether the Component should have a border drawn around it; {&null} means no. Many {Components} (such as {TextButtons}) ignore this flag.

attribs -- # Flag indicating whether the {Component} currently has keyboard focus; {&null} means it hasn't.

cbwin -- # Flag indicating whether the {Component} accepts keyboard focus by way of the tab key being pressed; {&null} means it doesn't.

cwin -- # A cloned window created by combining a buffer window with the {Component's} attributes. This is used solely for double-buffering purposes.

draw_border_flag

h -- # The {_Dialog} class instance of which this {Component} is a part.

h_spec -- # x alignment as specified in set_align(), eg "l".

has_focus -- # Flag indicating whether the {Component} currently is shaded; {&null} means it isn't.

is_shaded_flag -- # A cloned window created by combining the Dialog's canvas with the Component's attributes, so drawing into this window will draw straight to the Dialog window with the correct attributes.

keeps_tabs

no_updates_count -- # Tooltip string for use with {ToolBar} objects.

parent_Component -- tells whether ordinary tab characters are used by the component; if not, they shift focus to the next component. shift-tab should always shift focus to the next component.

parent_Dialog -- # A list of strings being the Icon graphics attributes, eg ["bg=blue", "resize=on"].

tooltip -- # Reference to enclosing {Component} object.

w -- # Absolute height in pixels.

w_spec -- # height specifier as specified in set_size(),

x -- # Absolute y position.

x_align -- # y alignment as specified in set_align(), eg "b".

x_spec -- # y position as specified by set_pos().

y -- # Absolute width in pixels computed from w_spec and the dimensions of the enclosing object or window.

y_align -- # Absolute x position in pixels computed from x_spec and the dimensions of the enclosing object or window.

y_spec -- # width specifier as specified in set_size(), eg "100%"


This page produced by UniDoc on 2021/04/15 @ 23:59:53.