home *** CD-ROM | disk | FTP | other *** search
- <html>
- <title>Window</title>
-
- <h1>Window</h1>
-
- <h2>Synopsis</h2>
-
- <pre>
-
- class Window : virtual public DeferredDelete
- {
- friend class Task ;
- friend class Icon ;
-
- public:
- enum <a href="file:window#wflags">wflags</a> ;
- enum <a href="file:window#wanchor">wanchor</a> ;
- struct <a href="file:window#state1">State</a> ;
- struct <a href="file:window#info1">Info</a> ;
-
- public:
- int <a href="file:window#handle">handle</a> ;
- int <a href="file:window#is_open">is_open</a> ;
- int <a href="file:window#anchor">anchor</a> ;
- Task *<a href="file:window#task">task</a> ;
- Window *<a href="file:window#next">next</a> ;
- Window *<a href="file:window#next">prev</a> ;
- Window *<a href="file:window#sub">sub_windows, *last_sub_window</a> ;
- Window *<a href="file:window#parent">parent</a> ;
- int <a href="file:window#x0">x0</a> ;
- int <a href="file:window#x0">y0</a> ;
- int <a href="file:window#x0">x1</a> ;
- int <a href="file:window#y0">y1</a> ;
- int <a href="file:window#scx">scx</a> ;
- int <a href="file:window#scx">scy</a> ;
- Menu *<a href="file:window#default_menu">default_menu</a> ;
- Icon *<a href="file:window#icons">icons, *last_icon</a> ;
- Object *<a href="file:window#objects">objects, *last_object</a> ;
- MouseTracker *<a href="file:window#tracker">tracker</a> ;
-
- public:
- <a href="file:window#ct1">Window</a>(Task *task, char *tname, char *menu = 0) ;
- <a href="file:window#ct2">Window</a>(Window *w, char *tname, int anchor = A_NONE, char *menu = 0) ;
- virtual <a href="file:window#dt">~Window</a>() ;
-
- //
- // command functions
- //
-
- virtual void <a href="file:window#do_open1">do_open</a>(int x0, int y0, int x1, int y1, int scx = 0, int scy = 0, int behind = -1) ;
- virtual void <a href="file:window#do_open2">do_open</a>(int behind = -1) ;
- virtual void <a href="file:window#do_open3">do_open</a>(int x0, int y0, int behind = -1) ;
- virtual void <a href="file:window#do_close">do_close</a>() ;
- virtual void <a href="file:window#do_redraw1">do_redraw</a>(int x0, int y0, int x1, int y1) ;
- virtual void <a href="file:window#do_redraw2">do_redraw</a>() ;
- virtual void <a href="file:window#do_update1">do_update</a>(int x0, int y0, int x1, int y1) ;
- virtual void <a href="file:window#do_update2">do_update</a>() ;
- virtual void <a href="file:window#do_drag">do_drag</a> (int type, int x0, int y0, int x1, int y1,
- int px0 = -1, int py0 = -1,
- int px1= -1, int py1 = -1) ;
- State *<a href="file:window#state2">state</a>() ;
- Info *<a href="file:window#info2">info</a>() ;
- void <a href="file:window#read_position">read_position</a>() ;
- virtual void <a href="file:window#set_extent1">set_extent</a>(int x0, int y0, int x1, int y1) ;
- virtual void <a href="file:window#set_extent2">set_extent</a> (int width, int height) ;
- virtual void <a href="file:window#set_width1">set_width</a> (int x0, int x1) ;
- virtual void <a href="file:window#set_height1">set_height</a> (int y0, int y1) ;
- virtual void <a href="file:window#set_width2">set_width</a> (int width) ;
- virtual void <a href="file:window#set_height2">set_height</a> (int height) ;
- virtual void <a href="file:window#get_outline">get_outline</a>(int &x0, int &y0, int &x1, int &y1) ;
- virtual void <a href="file:window#set_title">set_title</a> (char *format...) ;
- virtual char *<a href="file:window#title">title</a>() ;
- Menu *<a href="file:window#display_menu">display_menu</a>(int x, int y, int button, int icon) ;
- virtual void <a href="file:window#pre_menu">pre_menu</a>(Menu *m, int x, int y, int button, int icon) ;
- virtual char *<a href="file:window#get_menu">get_menu</a> (int x, int y, int button, int icon) ;
- int <a href="file:window#coords">xtoscreen</a> (int wx) { return (parent == NULL?x0:parent->subx0(this)) + wx - scx ; }
- int <a href="file:window#coords">ytoscreen</a> (int wy) { return (parent == NULL?y1:parent->suby1(this)) + wy - scy ; }
- int <a href="file:window#coords">xtowindow</a> (int sx) { return sx + scx - (parent==NULL?x0:parent->subx0(this)) ; }
- int <a href="file:window#coords">ytowindow</a> (int sy) { return sy + scy - (parent==NULL?y1:parent->suby1(this)) ; }
-
- int subx0(Window *w) ; // sub window's x0 coordinate in screen coords
- int suby1(Window *w) ; // sub window's y1 coordinate in screen coords
-
- //
- // event functions - sent to object by WIMP
- //
- virtual void <a href="file:window#redraw">redraw</a>() ;
- virtual void <a href="file:window#open">open</a>(int x0, int y0, int x1, int y1, int scx, int scy, int behind) ;
- virtual void <a href="file:window#close">close</a>() ;
- virtual void <a href="file:window#pointer">pointer</a>(int entering) ;
- virtual void <a href="file:window#click">click</a>(int mx, int my, int buttons, int icon) ;
- virtual void <a href="file:window#drag">drag</a>(int x0, int y0, int x1, int y1, int id) ;
- virtual void <a href="file:window#key">key</a>(int icon, int x, int y, int height, int index, int code) ;
- virtual void <a href="file:window#menu">menu</a>(MenuItem items[]) ; // menu hit
- virtual void <a href="file:window#scrol">scroll</a>(int x0, int y0, int x1, int y1, int scx, int scy, int behind, int xdir, int ydir) ;
- virtual void <a href="file:window#caret">caret</a>(int gaining, int icon, int x, int y, int height, int index) ;
- virtual void <a href="file:window#mode_change">mode_change</a>() ;
- virtual char *<a href="file:window#help">help</a> (int mx, int my, int buttons, int icon) ; // give help
-
- } ;
-
- </pre>
-
- <h2>Description</h2>
-
- A Window represents a window which appears on the screen. This is a fairly
- complex class but normally a class is derived from it which is much simpler.
- The idea of this class is that it provides all the basic functions
- necessary to draw a window on the screen and maintain it. This means that
- with no other work it would be possible to use this class to create
- a window which can be dragged about the screen, resized, redrawn and closed.
- It can also display a menu (but not act on clicks on it).
- <p>
- Of course, there are other things necessary to make the window usable.
- These other things cannot be provided by this class directly, but you
- should derive a new class from this one and provide new functions to
- override the default actions. Indeed, Vista contains a number of
- classes which do just this. They are described later.
- <p>
- In order to understand the descriptions given for this class it is
- necessary that you understand the fundamental concepts of the behaviour
- of windows under RISC OS. This information can be obtained in the
- Acorn Programmers Reference Manuals (PRM).
- <p>
- Once a Window class is created it can be opened on the screen. While open
- it is vulnerable to user activities which will cause it to receive commands
- in order to make it respond as the user wishes. A Window is an object
- which provides a set of methods (functions) which will be invoked (called)
- when certain conditions arise. The set of methods provided by the
- Window class split into 2 camps:
- <p>
- <ol>
- <li>Command methods
- <p>
- These are function which the user can call to make the window do
- something. Exmples are: <a href="file:window#do_open1">do_open</a>,
- <a href="file:window#do_close">do_close</a>,
- <a href="file:window#do_redraw1">do_redraw</a> etc.
- <p>
- <li>Event methods
- <p>
-
- These are functions (virtual) which are called by Vista when something
- has happened to the window about which the user needs to know. Although
- these functions are provided by the Window class, the idea is that you
- should replace them with your own functions if you want to override
- their default functionality (which may be to do nothing).
- </ol>
- <p>
- Windows contain a set of <a href="file:icon">Icons</a>. These are classes that
- represent WIMP icons. A window needs to known what icons exist within
- it so that it may act appropriately when user user activates one of them.
- <p>
- Windows also contain a set of <a href="file:window#object">Objects.</a>
- These are things which exist
- inside a window, but are not part of the window. An example would
- be an object which consists of a block of text, or an object which
- draws a 3D representation of a space ship. Objects receive a request
- to redraw themselves when the Window is redrawn. They are passed the
- coordinates of the area to be redrawn. Vista contains set of
- useful objects which can be used as an example when writing your own.
- <p>
- Finally, windows contain a set of <a href="file:window#subwins">sub-windows.</a>
- A sub-window is simply
- another window which has been created using the appropriate constructor.
- A window containing sub-windows automatically takes care of keeping them
- in the same relative position when the main window is moved. Sub-windows
- can be used to provide the 'panes' described in the PRM.
- <p>
- Like Tasks, the Windows in Vista can display <a href="file:menu">menus</a>.
- The way in which
- menus are handled is the same as for a Task. On creation, the user
- may supply the name of a default menu which will be displayed automatically
- when the user clicks 'menu' over the window. The tailoring of the menus
- and handling clicks is exactly the same as the Task class.
-
-
- <p>
- <a name="object"></a>
- <h3>Objects</h3>
-
- A Window in Vista can contain a number of 'Objects'. These are things which reside
- inside the window are need to be redrawn. Icons are effectively objects which are
- handled by the WIMP. An object is created inside a window and every time the
- window needs redrawn (for a resize or scroll) the objects are asked to redraw
- themselves by the Window. They are passed the WORK AREA coordinates within the
- window which needs updated. They can be used to perform clipping of the
- redraw in order to make it more efficient.
- <p>
- All objects in a window are derived from the class <a href="file:objects">Object</a>:
-
- This is an abstract class from which all useful object are derived. Each object exists
- inside a window at a certain position. The position of the object is in 'window
- coordinates' which have their origin at the top left of the window. The object
- has a bounding box that specifies its size. Because of the use of window
- coordinates, the Y coordinates for an object will mostly be negative.
- <p>
- Objects behave like icons. They can receive clicks and key presses, be selected
- and be dragged around the screen. An object knows how to redraw itself and
- is given this opportunity when requested by the WIMP.
- <p>
- Objects are told when the mouse pointer has entered or left the bounding
- box of the object. This enables the object to become active when the mouse
- is over it.
- <p>
- Each object has a priority associated with it. The priority of an object
- determines how it behaves in the situation of overlapping objects. The
- higher the priority an object has, the further up the 'stack' it appears
- as far as key presses, mouse events, and so on. The default priority is
- 1.
-
-
- <p>
- <a name="subwins"></a>
- <h3>Sub Windows</h3>
-
- A window can contain other windows. This is not really nesting (as in Microsoft
- Windows), but is an implementation of what are known as 'panes'. Subwindows
- can be 'anchored' or free within the parent window. If the subwindow is
- anchored, it will not scroll with the parent window and can be used for
- toolbars. The anchor can have 4 positions: A_LEFT, A_RIGHT, A_TOP
- and A_BOTTOM. These refer to the left, right, top and bottom edges of
- the parent window respectively. Anchored subwindows always move with the
- parent window and will stay attached to the appropriate edge when the
- parent is resized.
- <p>
- A free subwindow will scroll with the parent, but since these are not
- nested windows, will appear to leave the parent if scrolled beyond the
- edge of the parent window.
- <p>
- To create a subwindow it is a simple matter of placing the window in
- the appropriate position using a template editor and using the
- window constructor:
- <pre>
-
- Window::Window (Window *w, char *tname, int anchor = A_NONE, char *menu = 0)
-
- </pre>
-
- The first parameter is the parent window. The 'anchor' parameter specifies
- whether the window is anchored or not and, if so, where.
-
- <p>
- <h2>Members</h2>
-
- <p>
- <a name="wflags"></a>
- <h3>Window::wflags</h3>
-
- This enumeration contains values for the various flags within a window. Each
- flag begins with an upper case 'W'.
-
-
- <p>
- <a name="wanchor"></a>
- <h3>Window::wanchor</h3>
-
- This enumeration holds the values for the anchors in subwindows.
-
-
- <p>
- <a name="state1"></a>
- <h3>Window::State</h3>
-
- This is a structure which is returned from the state() function. It is defined as:
-
- struct State
- {
- int handle ;
- Box box ;
- int scx ;
- int scy ;
- int behind ;
- wflags flags ;
- } ;
-
- and is exactly as returned from the WIMP.
-
-
- <p>
- <a name="info1"></a>
- <h3>Window::Info</h3>
-
- This structure is returned from the info() function and contains the
- current information returned from the WIMP for the window. It is
- defined as:
-
- struct Info
- {
- int handle ;
- Box box ;
- int scx ;
- int scy ;
- int behind ;
- wflags flags ;
- char colours[8] ;
- Box extent ;
- Icon::iconflags titleflags ;
- Icon::iconflags workflags ;
- void *sprite_area ;
- int min_size ;
- IconData title ;
- int num_icons ;
- } ;
-
-
- <p>
- <a name="handle"></a>
- <h3>Window::handle</h3>
-
- This is the handle assigned by the WIMP for this window.
-
-
- <p>
- <a name="is_open"></a>
- <h3>Window::is_open</h3>
-
- This holds whether the window is open or closed.
-
-
- <p>
- <a name="anchor"></a>
- <h3>Window::anchor</h3>
-
- This is anchor value for a subwindow.
-
-
- <p>
- <a name="task"></a>
- <h3> Window::task</h3>
-
- This is the task to which the window belongs
-
-
- <p>
- <a name="next"></a>
- <h3> Window::next, Window::prev</h3>
-
- These are pointers to the next and previous windows in the task.
-
-
- <p>
- <a name="sub"></a>
- <h3> Window::sub_windows, Window::last_sub_window</h3>
-
- These are pointers to the subwindows within this window.
-
-
- <p>
- <a name="parent"></a>
- <h3> Window::parent</h3>
-
- This is a pointer to the parent if the window is a subwindow.
-
-
- <p>
- <a name="x0"></a>
- <h3> Window::x0, Window::y0, Window::x1, Window::y1</h3>
-
- These are the bounding coordinates for the window. What they mean
- depends on whether the window is a subwindow or not. If the window
- is not a subwindow, they are the screen coordinates at which the window
- is open. If the window is a subwindow, they are the coordinates of the
- pane relative to the window origin. Note that this means that the
- Y coordinates will be negative.
-
-
- <p>
- <a name="scx"></a>
- <h3> Window::scx, Window::scy</h3>
-
- These are the scroll position of the window.
-
-
- <p>
- <a name="default_menu"></a>
- <h3> Window::default_menu</h3>
-
- This is a pointer to the manu to be used by default when the menu
- button is pressed over the window.
-
-
- <p>
- <a name="icons"></a>
- <h3> Window::icons, Window::last_icon</h3>
-
- These are pointers to the list of icons in the window.
-
-
- <p>
- <a name="objects"></a>
- <h3> Window::objects, Window::last_object</h3>
-
- These are pointers to the list of objects in the window.
-
-
- <p>
- <a name="tracker"></a>
- <h3> Window::tracker</h3>
-
- When the mouse enters a window, a MouseTracker thread is created to track
- the mouse and inform each of the objects when the mouse is over them. The
- MouseTracker thread is defined as:
- <pre>
-
- class MouseTracker : public Thread
- {
- public:
- MouseTracker (Window *w) ;
- ~MouseTracker() ;
- void run() ;
- private:
- Window *window ;
- } ;
-
- </pre>
-
- and simply loops reading the mouse position and checking for the mouse
- entering and leaving an object. The tracker is deleted when the mouse
- exits the window again.
-
-
- <p>
- <a name="ct1"></a>
- <h3>Window::Window (Task *task,
- char *tname,
- char *menu = 0)</h3>
-
- This constructor creates a new window within a task. The 'tname' parameter is
- the name of the template to use when creating the window. This must exist
- in the Templates file. The 'menu' parameter is the name of the menu to display
- when the menu button is pressed over the window. A value of NULL (0) indicates
- that there is no default menu, in which case the 'get_menu' function will
- be used.
-
-
- <p>
- <a name="ct2"></a>
- <h3>Window::Window (Window *w,
- char *tname,
- int anchor = A_NONE,
- char *menu = 0)</h3>
-
- This constructor is used to create a subwindow. The 'w' parameter specifies
- the parent for the window. The 'tname' is the template to be used from
- the Templates file. 'anchor' is a value to indicate whether the window
- is anchored to the parent or not (see the section on Sub Windows above).
- The 'menu' parameter is the menu to display when the menu button is
- pressed over the window. If the value is NULL (0) then the
- get_menu function will be used to get a menu.
-
-
-
- <p>
- <a name="dt"></a>
- <h3> Window::~Window()</h3>
-
- This is the window destructor which is called when the window is deleted.
-
-
- <p>
- <a name="do_open1"></a>
- <h3>Window::do_open (int x0, int y0, int x2, in y1,
- int scx = 0, int scy = 0,
- int behind = -1)</h3>
-
- This function causes the window to appear on the screen at the given coordinates. The
- coordinates are screen coordinates whose origin is the bottom left of the screen. The
- 'scx', 'scy' and 'behind' parameters are as specified in the PRM. Opening a window
- will cause all the subwindows to open also.
-
-
- <p>
- <a name="do_open2"></a>
- <h3> Window::do_open (int behind = -1)</h3>
-
- This causes the window to appear on the screen at the current position. The 'behind'
- parameter can be used to specify the window to open behind. The current position
- begins at that set by the template editor. All sub windows will open also. Ths position
- of the subwindows is set by the template editor and will always be in the same position
- relative to the main window.
-
- <p>
- <a name="do_open3"></a>
- <h3> Window::do_open (int x0, int y0, int behind = -1)</h3>
-
- This function causes the window to open at the given coordinates. The
- (x,y) coordinates given are screen coordinates and are the bottom
- left corner of the window. The 'behind'
- parameter can be used to specify the window to open behind.
-
-
- <p>
- <a name="do_close"></a>
- <h3> Window::do_close()</h3>
-
- This causes the window, and all sub windows, to disappear from the screen.
-
-
- <p>
- <a name="do_redraw1"></a>
- <h3> Window::do_redraw (int x0, int y0, int x1, int y1)</h3>
-
- Redraw part of a window. The coordinates are window coordinates relative to the
- window origin (top left).
-
-
-
- <p>
- <a name="do_redraw2"></a>
- <h3> Window::do_redraw()</h3>
-
- Redraw the whole window.
-
-
- <p>
- <a name="do_update1"></a>
- <h3> Window::do_update (int x0, int y0, int x1, int y1)</h3>
-
- Update part of a window. The coordinates are window coordinates relative
- to the window origin (top left).
-
-
- <p>
- <a name="do_update2"></a>
- <h3> Window::do_update()</h3>
-
- Update the whole window.
-
-
- <p>
- <a name="do_drag"></a>
- <h3>Window::do_drag (int type, int x0, int y0, int x1, int y1,
- int px0 = -1, int py0 = -1,
- int px1= -1, int py1 = -1) </h3>
-
- Begin a new drag operation. See the PRM for full information about
- Wimp_DragBox.
-
-
- <p>
- <a name="state2"></a>
- <h3> Window::state()</h3>
-
- This returns a pointer to a variable of type Window::State. This is held
- within the window and will be overwritten on the next call to state(). This
- function calls Wimp_GetWindowState.
-
-
- <p>
- <a name="info2"></a>
- <h3> Window::info()</h3>
-
- This returns a pointer to the current window information. The information
- is returned by a call to Wimp_GetWindowInfo and is held in the window
- class. It will be overwritten by another call to this function.
-
-
- <p>
- <a name="read_position"></a>
- <h3> Window::read_position()</h3>
-
- This call reads the position for a window and stores it in the internal
- variables. It is used to update the known position after a window has
- been moved.
-
-
- <p>
- <a name="set_extent1"></a>
- <h3> Window::set_extent (int x0, int y0, int x1, int y1)</h3>
-
- Set the 'extent' for the window to the coordinates given (in window
- units).
-
-
- <p>
- <a name="set_extent2"></a>
- <h3> Window::set_extent (int width, int height)</h3>
-
- Set the extent of a window to a given width and height.
-
-
- <p>
- <a name="set_width1"></a>
- <h3> Window::set_width (int x0, int x1)</h3>
-
- Set the extent of the window to the given width. The parameters specify the
- minimum and maximum values for the extent.
-
-
- <p>
- <a name="set_height1"></a>
- <h3> Window::set_height (int y0, int y1)</h3>
-
- Set the extent of the window to the given height. The parameters specify the
- minimum and maximum values for the extent.
-
-
- <p>
- <a name="set-width2"></a>
- <h3> Window::set_width (int width)</h3>
-
- Set the extent of the window to the given width. The minimum X value remains
- the same.
-
-
- <p>
- <a name="set_height2"></a>
- <h3> Window::set_height (int height)</h3>
-
- Set the extent of the window to the given height. The minimum Y value remains
- the same.
-
-
- <p>
- <a name="get_outline"></a>
- <h3> Window::get_outline (int &x0, int &y0, int &x1, int &y1)</h3>
-
- Read the outline of the window into the reference variables passed.
-
-
- <p>
- <a name="set_title"></a>
- <h3> Window::set_title (char *format...)</h3>
-
- Set the title of the window. The 'format' is a printf style format
- string with additional parameters passed after it. The window must
- have an indirected title in order for this to work.
-
- <p>
- <a name="title"></a>
- <h3> Window::title()</h3>
-
- Read the title of a window. The value returned is a pointer to the
- indirected title string.
-
- <p>
- <a name="display_menu"></a>
- <h3> Window::display_menu (Menu *m, int x, int y, int button, int icon)</h3>
-
- This function is used to display a menu for this window. If the window
- has been created with a default menu, this will be displayed. Otherwise
- the function get_menu will be called. If the default menu is being
- displayed, the function pre_menu will be called in order to allow the user
- to change the default menu.
-
- <p>
- <a name="pre_menu"></a>
- <h3> Window::pre_menu (Menu *m, int x, int y, int button, int icon)</h3>
-
- This virtual function is called just before a menu is displayed on the
- screen. The purpose is to allow the user to change the contents of the
- menu.
-
-
- <p>
- <a name="get_menu"></a>
- <h3> Window::get_menu (int x, int y, int button, int icon)</h3>
-
- This is called when there was no default menu provided to the constructor.
- It is a virtual function which should be supplied by a derived class
- if it needs to decide on a number of menus. It returns the name
- of the menu to display.
-
-
- <p>
- <a name="redraw"></a>
- <h3> Window::redraw()</h3>
-
- This is invoked when the task received a redraw event from the WIMP. The default
- function runs though the objects and redraws them by invoking their redraw
- functions. Multi-threading is disabled throughout this process.
-
-
- <p>
- <a name="open"></a>
- <h3> Window::open (int x0, int y0, int x1, int y1, int scx, int scy, int behind)</h3>
-
- This is invoked when the WIMP sends an open request to the task. The default
- action is to open the window at the requested coordinates.
-
- <p>
- <a name="close"></a>
- <h3> Window::close()</h3>
-
- This is invoked when the WIMP sends a close request to the task. The default
- action is to close the window.
-
-
- <p>
- <a name="pointer"></a>
- <h3> Window::pointer (int entering)</h3>
-
- This is invoked when the WIMP detects the mouse entering or leafing the task.
- The parameter tells the function whether the mouse is entering or leaving the
- window. If it is entering the default action is to create a MouseTracker
- thread. if it is leaving the window, the MouseTracker thread is deleted.
-
-
- <p>
- <a name="click"></a>
- <h3> Window::click (int mx, int my, int buttons, int icon)</h3>
-
- This is invoked when the WIMP detects a mouse click in a window belonging
- to the task. The default action is to do nothing.
-
-
- <p>
- <a name="drag"></a>
- <h3> Window::drag(int x0, int y0, int x1, int y1, int id)</h3>
-
- This is invoked when the WIMP detects a drag operation has terminated.
- The default action is to do nothing.
-
-
-
- <p>
- <a name="key"></a>
- <h3> Window::key(int icon, int x, int y, int height, int index, int code)</h3>
-
- This is invoked when the WIMP detects a key press in a window belonging
- to the task. The default action is to do nothing.
-
-
-
- <p>
- <a name="menu"></a>
- <h3> Window::menu(MenuItem items[])</h3>
-
- This is invoked when the user has made a menu selection from a menu belonging
- to the window. If the program wishes to deal with menu hits, this function
- must be provided by a derived class. The function is passed an array of
- MenuItem structures which detail the selection made. It is up to the
- function to determine the action based on the selection.
-
- <p>
- <a name="scroll"></a>
- <h3> Window::scroll(int x0, int y0, int x1, int y1, int scx, int scy, int behind, int xdir, int ydir)</h3>
-
- This is invoked when the WIMP detects a scroll request in a window belonging
- to the task. The default action is to do nothing.
-
-
- <p>
- <a name="caret"></a>
- <h3> Window::caret(int gaining, int icon, int x, int y, int height, int index)</h3>
-
- This is invoked when a window belonging to the task either gains or loses
- the caret. The 'gaining' parameter says whether the caret has been
- gained or lost (non zero = gain). The default action is to do nothing.
-
-
- <p>
- <a name="mode_change"></a>
- <h3> Window::mode_change()</h3>
-
- This is invoked when the screen mode has been changed. The default action is
- to cycle through the objects informing them of the mode change.
-
- <p>
- <a name="coords"></a>
- <h3> Window::xtoscreen(int wx), ytoscreen (int wy), xtowindow (int sx), ytowindow (int sy)</h3>
-
- These functions convert between the two coordinate systems. Window coordinates are
- relative to the window origin which is the top left of the window. This means that
- the Y coordinate is always negative inside a window. Screen coordinates are
- relative to the screen origin which is (normally) the bottom left of the
- screen.
- <p>
- The 4 functions provided are:
- <ul>
- <li><b>xtoscreen</b>: Convert a window X coordinate to screen coordinate
- <li><b>ytoscreen</b>: Convert a window Y coordinate to screen coordinate
- <li><b>xtowindow</b>: Convert a screen X coordinate to window coordinate
- <li><b>ytowindow</b>: Convert a screen X coordinate to window coordinate
- </ul>
- <p>
- The functions are defined 'inline' so they will not result in a function
- call being generated and will therefore be quick to execute. They
- take care of any scroll offsets in the window (scx snd scy).
- <p>
- They also take care of any nesting of windows.
-
-
- <p>
- <a name="help"></a>
- <h3> Window::help (int mx, int my, int buttons, int icon)</h3>
-
- This function is called when help is being requested. The default
- action is to return NULL, meaning that the window is not prepared
- to give anything away. Derived classes may provide their own
- help function. The function return a string (char *) which
- is a pointer to the help text.
- <p>
- This function is called if all of the icons and objects within the
- window refuse to offer any help. Of course it will also
- be called if there are no objects or icons, or if the mouse
- pointer is not over an object or icon.
-
-