NOTE:
This project is no longer being maintained: it was developed for my masters thesis, which was completed in early 1997. I still, however, welcome any questions or comments that people may have.

[Home] [ToC] [Prev] [Next]


iHTML Python Language

Standard ihWidget Module

The ihWidget module provides a low-level interface to the browser's graphical user interface. The classes that comprise this module may be grouped into two major functionalities, containment (i.e., the Container class) and interaction (i.e., the Widget class).

Containment classes are the structural glue, used to group together other classes. They define the application's instance hierarchy, and through this and their own layout algorithms determine how the display real-estate will divided up amongst all of the GUI classes in the application. Thus the primary responsibility of a containment class is that of deciding the size and position of the classes that it holds.

Interaction classes are the pieces that define the capabilities and expression of the application's user interface. Interaction classes are primarily interested in events and rendering: i.e., "what is the user and system doing, and what should I display?"

In addition, this module defined various low-level types for handling the actual drawing of graphics, colors, and other services often needed in a graphical environment.


Exported Values


There are no global values defined by this module.


Exported Exceptions


WidgetParentError

This exception is raised when a Container, or one of its sub-classes, is instantiated without a parent.


Exported Functions


There are no global functions defined by this module.


Exported Types


Pixmap

The Pixmap is a on- or off-screen buffer that can be drawn into. A new Pixmap can be created with Container.MakePixmap().

Methods

BackPen()
BackPen(color)
Summary
Set or get the current background pen color.
Arguments
color
A Color to use as the new background pen; if not supplied, the background pen is not changed.
Result
The current Color being used as the background pen.
Description
This method is used to control the current background rendering pen. If the color argument is supplied, it sets the current background to that; if not supplied, the background is unchanged. In either case, it returns the Color now being used for drawing.
ClearRectangle(x, y, w, h)
Summary
Erase a rectangular region.
Arguments
x
An integer representing the left edge of the rectangle.
y
An integer representing the top edge of the rectangle.
w
An integer representing the width of the rectangle.
h
An integer representing the height of the rectangle.
Result
nothing.
Description
Erases a rectangular region of the widget, whose top-left pixel is at (x,y) that is w pixels wide and h pixels high. If w or h are zero, no rectangle is drawn. The region is filled with either the current background fill color or pattern.
Dimensions()
Summary
Retrieve current dimensions.
Arguments
none.
Result
A tuple of the form ( x, y, w, h ), where:
x
Is an integer representing the current left edge, relative to its display area, of the Pixmap. (This is usually zero).
y
Is an integer representing the current top edge, relative to its display area, of the Pixmap. (This is usually zero).
w
Is an integer representing the total pixel width of the Pixmap.
h
Is an integer representing the total pixel height of the Pixmap.
Description
Retrieves the current dimensions (and position) of the Pixmap.
DrawArc(x, y, w, h, a1, a2)
Summary
Draw an unfilled oval or arc.
Arguments
x
An integer representing the left edge of the arc.
y
An integer representing the top edge of the arc.
w
An integer representing the width of the arc.
h
An integer representing the height of the arc.
a1
A float representing the angle (in degrees) at which to start the arc. If not supplied, 0.0 is assumed.
a2
A float representing the angle (in degrees) at which to end the arc. If not supplied, 360.0 is assumed.
Result
nothing.
Description
Draws an unfilled arc in the current foreground pen, whose farthest left pixel is at x, farthest top pixel is at y, and that is w pixels wide and h pixels high. The arc starts at the a1 degree position, and extends to the a2 degree position. If w or h are zero, no arc is drawn.
DrawLine(x1, y1, x2, y2)
Summary
Draw a raster line.
Arguments
x1
An integer representing the x coordinate of the first pixel in the line.
y1
An integer representing the y coordinate of the first pixel in the line.
x2
An integer representing the x coordinate of the last pixel in the line.
y2
An integer representing the y coordinate of the last pixel in the line.
Result
nothing.
Description
Draws a line from (x1,y1) to (x2,y2) in the current foreground color.
DrawRectangle(x, y, w, h)
Summary
Draw an unfilled rectangle.
Arguments
x
An integer representing the left edge of the rectangle.
y
An integer representing the top edge of the rectangle.
w
An integer representing the width of the rectangle.
h
An integer representing the height of the rectangle.
Result
nothing.
Description
Draws an unfilled rectangle in the current foreground pen, whose top-left pixel is at (x,y) that is w pixels wide and h pixels high. If w or h are zero, no rectangle is drawn.
DrawText(x, base, text, just)
Summary
Draw a line of ASCII text.
Arguments
x
An integer representing the pixel location at which to render; its relationship to the text position depends on the justification flag, as described below.
base
An integer representing the pixel location at which the text's baseline is rendered.
text
A string representing the actual text to render.
just
An integer representing the justification of the text. Possible values are:
1
Left justified: x is the left-most position of the text.
0
Centered: x is the center position of the text.
-1
Right justified: x is the right-most position of the text.
All other values are invalid, and should not be used.
Result
nothing.
Description
Renders a raw line of text to the screen, in the current foreground color and font.
FillArc(x, y, w, h, a1, a2)
Summary
Draw a filled oval or arc.
Arguments
x
An integer representing the left edge of the arc.
y
An integer representing the top edge of the arc.
w
An integer representing the width of the arc.
h
An integer representing the height of the arc.
a1
A float representing the angle (in degrees) at which to start the arc. If not supplied, 0.0 is assumed.
a2
A float representing the angle (in degrees) at which to end the arc. If not supplied, 360.0 is assumed.
Result
nothing.
Description
Draws a filled arc in the current foreground pen, whose farthest left pixel is at x, farthest top pixel is at y, and that is w pixels wide and h pixels high. The arc starts at the a1 degree position, and extends to the a2 degree position. If w or h are zero, no arc is drawn.
FillRectangle(x, y, w, h)
Summary
Draw a filled rectangle.
Arguments
x
An integer representing the left edge of the rectangle.
y
An integer representing the top edge of the rectangle.
w
An integer representing the width of the rectangle.
h
An integer representing the height of the rectangle.
Result
nothing.
Description
Draws a filled rectangle in the current foreground pen, whose top-left pixel is at (x,y) that is w pixels wide and h pixels high. If w or h are zero, no rectangle is drawn.
ForePen()
ForePen(color)
Summary
Set or get the current foreground pen color.
Arguments
color
A Color to use as the new foreground pen; if not supplied, the foreground pen is not changed.
Result
The current Color being used as the foreground pen.
Description
This method is used to control the current foreground rendering pen. If the color argument is supplied, it sets the current foreground to that; if not supplied, the foreground is unchanged. In either case, it returns the Color now being used for drawing.
Paste(x, y, src, xsrc, ysrc, w, h)
Summary
Copy a Pixmap into the on-screen display.
Arguments
x
An integer representing the left edge at which to place src.
y
An integer representing the top edge at which to place src.
src
The Pixmap that is to be copied.
xsrc
An integer representing the left-most edge in src that is to be copied. If not supplied, it defaults to the 0, the extreme left.
ysrc
An integer representing the top-most edge in src that is to be copied. If not supplied, it defaults to 0, the extreme right.
w
An integer representing the number of horizontal pixels in src that are to be copied. If not supplied, it defaults to the the total width minus xsrc.
h
An integer representing the number of vertical pixels in src that are to be copied. If not supplied, it defaults to the the total height minus ysrc.
Result
nothing.
Description
This performs a bit-blit operation from src into the pixmap. If only the first three arguments are supplied, the entire image is copied into the specified location; the additional arguments can be used to limit how much of the image is copied.
TextExtent(text)
Summary
Retrieve dimension information about a string of text.
Arguments
text
A string representing the text to measure.
Result
A tuple of the form ( w, h, asc, desc ), where:
w
Is an integer representing the total pixel width of the string.
h
Is an integer representing the total pixel height of the string.
asc
Is an integer representing the pixel distance from the text's baseline to top edge, for this string.
desc
Is an integer representing the pixel distance from the text's baseline to bottom edge, for this string.
Description
This method measures the dimensions of a particular string of text, returning the dimensions that would be used if it were actually rendered to the screen in the current font.

Members

No member variables are defined by this type.

Description

A Pixmap is a graphics buffer into which a program can render. When created by the program with Container.MakePixmap() its dimensions must be specified, and can not change for the life of the object. It includes various methods needed for drawing and copying images within and between Pixmaps.


FutureCall

The FutureCall is an object that encapsulates a call to a function, which will happen at some later date. A new FutureCall can be created with Container.FutureCall().

Methods

Stop()
Summary
Terminate the future function call.
Arguments
none.
Result
nothing.
Description
This keeps the future call from occurring, if it hasn't already. Normally, the call is automatically stopped when the object is deallocated, but it is a good idea to call this method to be sure that no outstanding references on the object don't cause it to unexpectedly stay around.

Members

Widget
Read-only. This is the Widget (or Container's closest parent Widget) that created the object.
Function
A callable object that is the function to be invoked when the FutureCall goes off.
Arguments
A tuple of arguments to pass to the above function.
Keywords
A dictionary of keyword arguments to pass to the above function.

Description

A FutureCall object is a handle on an event that is to happen at some time in the future. It encapsulates all of the information needed to perform any arbitrary Python function call, and sets up a timer to occur at the appointed time. When created by the program with Container.FutureCall(), it is initialized with the time to make the call, and the called function, standard parameters, and keyword parameters. The returned object can be used to examine or change all but the first value, or to force the call to abort prior to it executing.


Color

A palette color that can be used to draw with. A new Color can be created with Container.MakeColor().

Methods

No methods are defined by this type.

Members

No member variables are defined by this type.

Description

This is a handle on an allocated palette color, to be used in calls to Pixmap.ForePen(), Pixmap.BackPen(), and Container.Background(). It can not be manipulated or examined, but can be compared with other Color object to see if they are the same. When created by the program with Container.MakeColor(), a new palette color is allocated from the operating system and associated with the new object; this color is deallocated when the Color object has no more references on it and is released.


Exported Classes


Container

This is the base-class of all other GUI classes. Its only responsibility is to hold and organize a list of child Container classes (or subclasses).

Hierarchy

Superclass
none.
Subclasses
Widget.

Methods

__init__(self, parent, ...)
Summary
Create and attach a new layout Container.
Arguments
parent
This container's parent container. This must be a valid container; a top-level container's parent is the Application class.
Result
A new instance of the class.
Exceptions
WidgetParentError
Description
The instance hierarchy of an application's containers is defined when they are instantiated -- the new container's parent must be supplied at this time, and the parent is automatically asked to add the new container to its list of children.
Background(self)
Background(self, color)
Summary
Set or get the Container's background color.
Arguments
color
A Color to use as the new background color; if not supplied, the background color is not changed.
Result
The current Color being used as the background color.
Description
This method is used to control the current background color. This is the color that the Container fills itself with when it is erased; its initial value is the background color of the document.
BackPen(self)
BackPen(self, color)
Summary
See Pixmap.BackPen(). If this object is not a Widget, this method operates in the closest parent Widget's context.
Destroy(self)
Summary
Get rid of the container.
Arguments
none.
Result
nothing.
Description
Calling this method removes the container from its instance hierarchy -- it does not actually delete the container object, but removes it from its parent's list of children, destroys all of its own children, and frees any display resources associated with it. A container contains references to both its parents and children; this circularity means that Python won't automatically free containers when they are no longer used, so this method must be explicitly called to break those references. This will typically be automatically done by the applet's Application class.
Dimensions(self)
Summary
Retrieve current dimensions.
Arguments
none.
Result
A tuple of the form ( x, y, w, h ), where:
x
Is an integer representing the current left edge, relative to its parent, of the Container.
y
Is an integer representing the current top edge, relative to its parent, of the Container.
w
Is an integer representing the current total pixel width of the Container.
h
Is an integer representing the current total pixel height of the Container.
Description
Retrieves the current dimensions (and position) of the Container.
DoResize(self, x, y, w, h)
Summary
Change the physical size of the container.
Arguments
x
An integer representing the new left edge of the Container, or None to leave it the same.
y
An integer representing the new top edge of the Container, or None to leave it the same.
w
An integer representing the new width of the Container, or None to leave it the same.
h
An integer representing the new height of the Container, or None to leave it the same.
Description
Changes the current physical dimensions of the container. This updates the Containers current X, Y, Width, Height, XOffset, and YOffset values, and results in a Resize event being sent to it.

Note that calling this method will note automatically call the parent container's Layout method; you must manually do this if you would like the parent to update its layout.

DrawArc(self, x, y, w, h, a1, a2)
Summary
See Pixmap.DrawArc(). If this object is not a Widget, this method operates in the closest parent Widget's context.
DrawLine(self, x1, y1, x2, y2)
Summary
See Pixmap.DrawLine(). If this object is not a Widget, this method operates in the closest parent Widget's context.
DrawRectangle(self, x, y, w, h)
Summary
See Pixmap.DrawRectangle(). If this object is not a Widget, this method operates in the closest parent Widget's context.
DrawText(self, x, base, text, just)
Summary
See Pixmap.DrawText(). If this object is not a Widget, this method operates in the closest parent Widget's context.
FillArc(self, x, y, w, h, a1, a2)
Summary
See Pixmap.FillArc(). If this object is not a Widget, this method operates in the closest parent Widget's context.
FillRectangle(self, x, y, w, h)
Summary
See Pixmap.FillRectangle(). If this object is not a Widget, this method operates in the closest parent Widget's context.
Flush(self)
Summary
Finish all rendering operations.
Arguments
none.
Result
nothing.
Description
Calling this method forces all previous drawing operations (DrawLine(), FillArc(), etc.) to complete. It should be called when you would like to ensure that the display is in a stable state, or prior to accessing (e.g., using Paste()) a Pixmap that you have just drawn into.
FutureCall(self, time, func, args, keys)
Summary
Execute a function call at a future time.
Arguments
time
A float indicating the number of seconds in the future at which the call is to be made.
func
The function to call at this time. It can be any Python object that is callable -- a function, method, class, instance, etc.
args
A tuple of arguments to supply to the function, as in the second parameter of Python's apply() operation. If not given, no arguments are supplied.
keys
A dictionary of keyword arguments to supply to the function, as in the third parameter of Python's apply() operation. If not given, no keyword arguments are supplied.
Result
A new object of type FutureCall.
Description
This method creates a new FutureCall object, which encapsulates the context for a function call that will happen at some later date.
ForePen(self)
ForePen(self, color)
Summary
See Pixmap.ForePen(). If this object is not a Widget, this method operates in the closest parent Widget's context.
KeyState(self)
Summary
Gets the current pressed/released state of the modifier keys.
Arguments
none.
Result
An integer whose bits represent the state of individual keys -- see ihEvent.Event.KeyState for details on the meaning of this value.
Description
This method retrieves the most recent known modifier key status. You will typically want to use the key status supplied in events as you process them, but you can use this method if you don't want to process events or need the absolutely most recent value.
Layout(self)
Summary
Layout the Container's children.
Arguments
none.
Result
nothing.
Description
This method positions the children of the Container. The default method simply positions them at its (0,0) corner, with the same width and height as the Container; subclasses will typically override this code to implement their own layout algorithms.
MakeColor(self, r, g, b)
Summary
Allocate a new palette color.
Arguments
r
A float representing the red component of the color, ranging from 0 (black) to 1 (most intense).
g
A float representing the green component of the color, ranging from 0 (black) to 1 (most intense).
b
A float representing the blue component of the color, ranging from 0 (black) to 1 (most intense).
Result
An object, of type Color that can be used to set rendering pens, etc.
Description
Allocates a new color from the system that matches, as closely as possible, the requested color.
MakePixmap(self, w, h)
Summary
Create a new off-screen rendering area.
Arguments
w
An integer representing the number of horizontal pixels in the buffer.
h
An integer representing the number of vertical pixels in the buffer.
Result
An object, of type Pixmap, that can be drawn into.
Description
Allocates the data and context for a new off-screen rendering buffer. This is typically used for double-buffering applications, in which a program renders everything into the off-screen buffers, and then copies the picture into its on-screen display when complete.
MaxDimensions(self, maxw, maxh)
Summary
Compute the maximum size of the Container.
Arguments
maxw
An integer supplying the desired maximum width of the container, or None if there is no limit.
maxh
An integer supplying the desired maximum height of the container, or None if there is no limit.
Result
A tuple of the form ( w, h ), where:
w
Is an integer representing the maximum pixel width that the Container can be.
h
Is an integer representing the maximum pixel height that the Container can be.
See Also
MinDimensions(), PrefDimensions().
Description
This method returns the maximum dimensions of the Container -- this is the amount of space needed to display all of its data, at which point any extra space will go unused. Note that the object should always be prepared to grow larger than this size; it is just an advisory for the parent, so that it can make more intelligent use of its layout area, if it chooses to do so.

The two optional parameters can be used to apply constraints on the return dimensions. For example, a window may apply a horizontal constraint when laying out out a menu bar. If these are set, the object should try to return maximum dimensions that still allow it to fit within the constraints; doing so may mean bringing the limited dimension down into its "minimum" size range.

MinDimensions(self, maxw, maxh)
Summary
Compute the minimum size of the Container.
Arguments
maxw
An integer supplying the desired maximum width of the container, or None if there is no limit.
maxh
An integer supplying the desired maximum height of the container, or None if there is no limit.
Result
A tuple of the form ( w, h ), where:
w
Is an integer representing the minimum pixel width that the Container can be.
h
Is an integer representing the minimum pixel height that the Container can be.
See Also
PrefDimensions(), MaxDimensions().
Description
This method returns the absolute minimum dimensions that the Container can be made -- this is the size to which it can be reduced while still being usable, but with all unneeded space removed. While the parent should never make the Component smaller than these dimensions, be sure that it won't crash if it does happen to end up smaller!

The two optional parameters can be used to apply constraints on the return dimensions. For example, a window may apply a horizontal constraint when laying out out a menu bar. If these are set, the object should try to return minimum dimensions that will allow it to fit within the constraints.

MousePosition(self)
Summary
Get the current mouse position.
Arguments
none.
Result
A tuple of the form ( x, y ), where:
x
Is an integer representing the mouse pointer's current x pixel location in the container.
y
Is an integer representing the mouse pointer's current y pixel location in the container.
Description
This method retrieves the most recent known mouse pointer location. You will typically want to use the pointer location supplied in events as you process them, but you can use this method if you don't want to process events or need the absolutely most recent position.
MouseState(self)
Summary
Gets the current pressed/released state of the mouse buttons.
Arguments
none.
Result
An integer whose bits represent the state the individual mouse buttons -- see ihEvent.Event.MouseState for details on the meaning of this value.
Description
This method retrieves the most recent known mouse button status. You will typically want to use the button status supplied in events as you process them, but you can use this method if you don't want to process events or need the absolutely most recent value.
OnRedraw(self, x, y, w, h)
Summary
Specialized handler called for widget redraw events.
Arguments
x
An integer representing the left edge of the area that needs to be redrawn.
y
An integer representing the top edge of the area that needs to be redrawn.
w
An integer representing the width of the area that needs to be redrawn.
h
An integer representing the height of the area that needs to be redrawn.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
This is the event handler corresponding to the specific Redraw event; it may be sent directly to the object if this is a Widget, or if this is a simple Container directly called by its parent object.

Note that ev may be None, and if you override this class you must be sure to call the superclass's method.

OnResize(self, x, y, w, h)
Summary
Specialized handler called for widget resize events.
Arguments
x
An integer representing the left edge of the new dimensions.
y
An integer representing the top edge of the new dimensions.
w
An integer representing the width of the new dimensions.
h
An integer representing the height of the new dimensions.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
This is the event handler corresponding to the specific Resize event; it may be sent directly to the object if this is a Application, but more typically is called as a result of a DoResize() request.

Note that ev may be None.

Paste(self, x, y, src, xsrc, ysrc, w, h)
Summary
See Pixmap.Paste(). If this object is not a Widget, this method operates in the closest parent Widget's context.
PrefDimensions(self, maxw, maxh)
Summary
Compute the preferred size of the Container.
Arguments
maxw
An integer supplying the desired maximum width of the container, or None if there is no limit.
maxh
An integer supplying the desired maximum height of the container, or None if there is no limit.
Result
A tuple of the form ( w, h ), where:
w
Is an integer representing the preferred pixel width that the Container can be.
h
Is an integer representing the preferred pixel height that the Container can be.
See Also
MinDimensions(), MaxDimensions().
Description
This method returns the preferred dimensions of the Container -- this is the size that it would like to be for a comfortable display. Note that this is not, for example in the case of a text editing field, the size needed to display all of its data, but simply the size needed to make the graphics as readable as possible while displaying a reasonable amount of information; in the case of the text field, this may be something like 1/4 of the total amount of editable text.

The two optional parameters can be used to apply constraints on the return dimensions. For example, a window may apply a horizontal constraint when laying out out a menu bar. If these are set, the object should try to return preferred dimensions that will allow it to fit within the constraints; doing so may mean bringing the limited dimension down into its "minimum" size range.

TextExtent(self, text)
Summary
See Pixmap.TextExtent(). If this object is not a Widget, this method operates in the closest parent Widget's context.

Members

_Document_
Read-only. The instance of the Document class, representing the document this container is on.
Children
Read-only. An array of the Containers that are direct children of this one in the instance hierarchy. Subclasses of this class will typically use this array to position their children in their Layout method.
Height
Read-only. The current height, in pixels, of the Container.
Width
Read-only. The current height, in pixels, of the Container.
X
Read-only. The current left edge of the Container within its parent.
XOffset
Read-only. The current left edge of the Container relative to its closest parent Widget. If the object is an actual Widget, XOffset is always set to zero. Otherwise, this value must be added to all X locations when drawing.
Y
Read-only. The current top edge of the Container within its parent.
YOffset
Read-only. The current top edge of the Container relative to its closest parent Widget. If the object is an actual Widget, YOffset is always set to zero. Otherwise, this value must be added to all Y locations when drawing.

Description

The Container encapsulates the basic functionality needed to organize and layout a Widget instance hierarchy. Its primary responsibilities are to keep track of its immediate children in the instance hierarchy -- allowing them to be added, removed, and retrieved -- and to provide the layout mechanisms used to logically position and dimension the hierarchy.

This class does note directly supply any drawing or event handling functions. For the former, it depends on the closest Widget above it in the instance hierarchy. All drawing operations are done in that object's context. The most important implication of this is that the drawing operations are performed in the other object's coordinate system: all positions must have the values XOffset and YOffset added to them, and the clipping rectangle in use is also that of the other object.

In addition, the Container does not normally receive any user interface events except for Resize and Redraw, making it unsuitable for user interface components unless special attention is made to send events to it; instead, this class is most often used for creating layout managers and other components that do not directly interact with the user.


Widget

A Container that has its own display context and event handling.

Hierarchy

Superclass
Container.
Subclasses
ihApp.Application.

Methods

__init__(self, parent, ...)
Summary
Create and attach a new GUI Widget.
Arguments
parent
This Widget's parent container. This must be a valid Container; a top-level Widget's parent is the Application class.
Result
A new instance of the class.
Exceptions
WidgetParentError
Description
Instantiating a Widget adds a new container to its parents instance hierarchy that has its own graphics context and event handling. See Container.__init__ for more details.
OnEnter(self, ev)
Summary
Specialized handler called for the event created by the mouse entering the Widget.
Arguments
ev
The Event object corresponding to the user-interface event.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
This is the specialized event handler for Enter events. It is called when the Widget receives this event, indicating that the mouse pointer has just entered its display area.
OnEvent(self, ev)
Summary
Handle a user-interface event.
Arguments
ev
The Event object corresponding to the user-interface event.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
This is the generic event handler, called if one of the more specialized handlers for this event does not exist.
OnKey(self, ev, key, state)
OnKeyPress(self, ev, key, state)
OnKeyRelease(self, ev, key, state)
Summary
Specialized handlers called for keyboard events.
Arguments
ev
The Event object corresponding to the user-interface event.
key
An integer representing the ASCII value of the key.
state
An integer representing the current state of the key modifiers, as per the Event class's KeyState member.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
These are handlers for various types of keyboard events. OnKeyPress() and OnKeyRelease() correspond to the specific events KeyPress and KeyRelease, respectively; OnKey() is called when one of the specific handlers is not available for an event.
OnLeave(self, ev)
Summary
Specialized handler called for the event created by the mouse leaving the Widget.
Arguments
ev
The Event object corresponding to the user-interface event.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
This is the specialized event handler for Leave events. It is called when the Widget receives this event, indicating that the mouse pointer has just left its display area.
OnMouse(self, ev, x, y, state, button)
OnMouseMove(self, ev, x, y, state, button)
OnMousePress(self, ev, x, y, state, button)
OnMouseRelease(self, ev, x, y, state, button)
Summary
Specialized handlers called for mouse events.
Arguments
ev
The Event object corresponding to the user-interface event.
x
An integer representing the mouse pointer's current horizontal position with respect to the widget.
y
An integer representing the mouse pointer's current vertical position with respect to the widget.
state
An integer representing the current state of the mouse buttons, as per the Event class's MouseState member.
button
(Only valid for MousePress and MouseRelease events.) An integer representing the button that changed, as per the Event class's MouseButton member.
Result
An integer -- if true (non-zero), the event was handled; if false (zero), it continues through the higher-level event handlers.
See Also
ihEvent module.
Description
These are handlers for various types of mouse events. OnMouseMove(), OnMousePress(), and OnMouseRelease() correspond to the specific events MouseMove, MousePress, and MouseRelease, respectively; OnMouse() is called when one of the specific handlers is not available for an event.

Members

No new member variables are defined by the class.

Description

The Widget is a subclass of the Container: to the latter's instance hierarchy and layout functionality, it adds its own drawing environment and event handling mechanisms.

This class's coordinate system is always arranged so that (0,0) is the top-left corner of the Widget, and drawing operations are clipped at its boundaries. This means that its XOffset and YOffset members are always zero, and thus do not be taken into account when computing screen locations. In addition, all drawing is clipped to the Widget's boundaries.


[Home] [ToC] [Prev] [Next]

_________.oo_Q_Q_oo.____________________________________________
Dianne Kyra Hackborn <hackbod@angryredplanet.com>
Last modified: Thu Oct 17 21:49:09 PDT 1996

This web page and all material contained herein is Copyright (c) 1997 Dianne Hackborn, unless otherwise noted. All rights reserved.