Function reference |
MX-Windows help
|
Bool AddDialogWindow(Dialog
dialog, Window window);
If the given window does not belong to any dialog,
this function adds it as the top window of the given dialog and returns
FALSE else it returns TRUE.
Bool
CheckIfValidDepth(Window window, int depth);
Returns true if a window can be inserted under another
window at the given depth; else it returns false.
Cursor
CreateCursor(BITMAP *bmp, int x, int y);
Creates a cursor structure and returns its
handle; sprite focus is at given x, y;
Window
CreateRootWindow( void *extension, void (*event_handler)(WindowInfo *,
Event *));
A shortcut function to create a root window;
the returned window has no parent and it lets all events propagate.
Dialog CreateDialog(Cursor
cursor, void (*event_handler)(Dialog, Event *), Window window, ...);
Creates a dialog; the given cursor is set
when the mouse pointer is not over a dialog window; any events that happen
in a window that is not part of the dialog are received to the given event
handler; last given window is the dialog top window.
Window CreateWindow(Window
parent, void *extension, void (*event_handler)(WindowInfo *, Event *),
int x, int y, int width, int height, int border_width, int processed_events,
int propagated_events);
Creates a window with the given attributes;
if parent is given and parent is visible on the screen then the child is
drawn, too.
Bool DestroyCursor(Cursor
*cursor);
If the given cursor is different than the current
one then its structure is deallocated and the function returns TRUE; else
it returns FALSE.
void DestroyDialog(Dialog
*dialog);
Destroys the given dialog; its windows are
not destroyed nor they are removed from the screen; If it is called while
the dialog executes then it is destroyed after the event execution ends.
void DestroyWindow(Window
*window);
Destroys the given window and its children;
the window and its children are removed from the screen.
Bool DoWindowDrawing(Window
window, Bool overwrite_children, void (*paint_function)(WindowInfo *, ExposeEvent
*));
Executes the given function for each visible area;
the result is that something temporary is drawn on the screen but without
destroying the windows in the foreground.
int GetWindowBorderWidth(Window
window);
Returns window' s border width in pixels.
int GetClickThreshold();
Returns the time in miliseconds that must
be ellapsed in order to internally reset the click counter;
Window
GetXYChild(Window parent, int x, int y);
Returns the child window at the given global x,
y(that means given x, y is measured from screen 0, 0).
Window
GetWindowBottomChild(Window window);
Returns the bottom child of the given window;
that is the one that is furthest from the screen plane;
Dialog GetWindowDialog(Window
window);
Returns the dialog the given window belongs
to(if any).
int GetWindowHeight(Window
window);
Returns the height of the window in pixels.
Window GetWindowHigher(Window
window);
Returns the window that is on top of the
given one; when we say 'on top' we mean the window next in the window list
and not the window that is physically located on top of it.
int GetWindowInput(Window
window);
Returns the events that the given window
is registered to respond to.
Window GetWindowLower(Window
window);
Returns the window below the given one (not
the window that is physically located under it but the window that is previous
to it according to the window list).
Window GetWindowParent(Window
window);
Returns the parent of the given window.
Rect GetWindowPosition(Window
window);
Returns the global physical position (measured
from screen 0, 0) of the window.
int GetWindowPropagation(Window
window);
Returns the events that the window is registered
to send to its children.
Window GetWindowTopChild(Window
window);
Returns the child window that is top.
Rect GetWindowViewport(Window
window);
Returns the global physical (measured from
screen 0, 0) rectangle into which the children of the given window are
shown.
int GetWindowViewportWidth(Window
window);
Returns the width of the space between left
and right border of the window.
int GetWindowViewportHeight(Window
window);
Returns the height of the space between top
and bottom border of the window.
Bool GetWindowVisible(Window
window);
Checks if the window lies within its parent
viewport and if any window obscures it.
int GetWindowWidth(Window
window);
Returns the physical width of the window.
int GetWindowX(Window
window);
Returns the local horizontal position of
the window within its parent viewport.
int GetWindowY(Window
window);
Same as above but for the vertical position.
int
GetWindowZOrder(Window window, int direction);
Returns the z-order (or depth) of the given
window; if direction > 0 then the count starts from the top window and
goes into the screen; if direction < 0 then the count starts from the
bottom window and goes towards the screen.
Bool GrabEvents(Window
window);
All mouse events are reported into the window
that they have happened in except when a window grabs events; then all
events happen into the window tree that the mouse pointer was in at the
time of the grab.
void InitMX();
Use this first of all MX functions to initialize
Allegro, mouse, timer, keyboard and MX events handler.
Bool
InsertWindow(Window window, Window parent, int pos);
If the given window is not inserted into
any other window then it is inserted under the given parent at the specified
z-order; if pos > 0 then z-order counts from top to bottom else if pos
< 0 z-order counts from bottom to top; If the given parent is visible
and has been drawn the newly inserted window is drawn to;
Bool InstallRootWindow(Window
window);
Since a root window can be inserted into
another window in order to draw it on the screen you may use this function
to draw windows that they have no parent(namely root windows). A root window
always gets the dimensions of the screen (Allegro SCREEN_W, SCREEN_H).
Bool PaintWindow(Window
window);
This function refreshes the given window.
void RedirectKeyboard(Window
window);
Keyboard presses are redirected to the given
window and received as events.
Bool RefreshWindow(Window
window);
This function refreshes the whole window
tree.
Bool ReleaseEvents(Window
window);
This reverses the effect that the function
'GrabEvents' has; when called all events are then reported to the window
they happenned in.
Bool RemoveDialogWindow(Window
window);
If the given window is the top dialog window then
it is removed from the dialog(not removed from the screen, though).
Bool RemoveWindow(Window
window);
It removes the given window from its parent;
root windows can not be removed.
void RunDialog(Dialog
*dialog);
Runs the given dialog; it executes it once
and exits; in order to continuously run events put this function into a
loop that exits on a user-defined condition.
void SendEventToWindow(Window
window, Event *event);
It sends a user-defined event to the given window.
void SetClickThreshold(int
msecs);
Sets the click threshold in miliseconds;
if this time ellapses then clicks are reset; next button event will receive
clicks = 1;
void
SetWindowBorderWidth(Window window, int val);
Sets the given window's border width.
void SetWindowCursor(Window
window, Cursor cursor);
Set the cursor of the given window; if the
mouse pointer is on the window then the cursor is also activated.
void
SetWindowHeight(Window window, int val);
Sets the height of the given window.
void SetWindowInput(Window
window, int val);
Selects which events the window is registered
to process. See events.
void
SetWindowPropagation(Window window, int val);
Selects which events the window is registered
to pass to its children. See events.
void SetWindowWidth(Window
window, int val);
Sets the given window's width.
void SetWindowX(Window
window, int val);
Sets the given window's X position.
void SetWindowY(Window
window, int val);
Sets the given window's Y position.
Bool
SetWindowZOrder(Window window, int pos);
Sets the given window's z-order. Window may
be raised and thus exposed or get below some other windows that may be
exposed, depending on its previous depth.
void
TranslateCoords(Window src, Window dst, int x, int y, int *outx, int *outy);
If the source window is given then the given
coordinates are considered local to it; it the destination window is given
then the output is considered local to it; thus you can convert local coordinates
from one window to another; of course if one of the windows is root or
not given (NULL passed) then the relevant coordinates are considered global.
void UpdateWindowGeometry(Window
window);
After you have set the window's geometry attributes
with the above functions, you may use this function to render all changes
on the screen. It updates the screen as needed. If you would like to update
a root window, (perhaps after a change of video mode) then you should use
the function 'InstallRootWindow'.