4 * Interactor ancestor class.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.45 2003/03/17 07:34:58 robertj
31 * Added Close() function for all interactors. Default behaviour closes the
32 * parent interactor till it gets to a PTitledWindow or PDialog.
34 * Revision 1.44 2001/05/22 12:49:33 robertj
35 * Did some seriously wierd rewrite of platform headers to eliminate the
36 * stupid GNU compiler warning about braces not matching.
38 * Revision 1.43 2000/01/10 02:25:24 craigs
39 * Added macro to allow multiple ancestors
41 * Revision 1.42 1999/07/18 15:07:12 robertj
42 * Fixed missing return type
44 * Revision 1.41 1999/03/10 03:49:51 robertj
45 * More documentation adjustments.
47 * Revision 1.40 1999/03/09 08:01:48 robertj
48 * Changed comments for doc++ support (more to come).
50 * Revision 1.39 1999/02/16 08:08:45 robertj
51 * MSVC 6.0 compatibility changes.
53 * Revision 1.38 1998/09/23 06:23:58 robertj
54 * Added open source copyright license.
56 * Revision 1.37 1996/05/15 10:08:20 robertj
57 * Added screen coordinate conversion functions with separate parameters.
59 * Revision 1.36 1996/04/30 12:33:33 robertj
60 * Changed "inPixels" boolean to enum for three coordinate systems.
62 * Revision 1.35 1995/12/23 03:44:14 robertj
63 * Added screen to local coordinate transforms.
64 * Added FindWindow() function
66 * Revision 1.34 1995/10/14 14:56:33 robertj
67 * Changed return values to references for efficency.
69 * Revision 1.33 1995/07/31 12:04:23 robertj
70 * Drag track documentation and semantic adjustment.
72 * Revision 1.32 1995/07/02 01:17:41 robertj
73 * Added drag tracking support.
74 * Removed OnDoubleClick() and added BOOL to OnMouseDown() for double click.
76 * Revision 1.31 1995/06/17 11:08:00 robertj
77 * Changed OnKeyDown to return BOOL indicating OnKeyInput is to be used.
78 * Documentation update.
80 * Revision 1.30 1995/06/04 12:42:46 robertj
81 * Redesign of caret driver functions (made a lot more common).
83 * Revision 1.29 1995/04/02 09:27:20 robertj
84 * Added "balloon" help.
86 * Revision 1.28 1995/03/14 12:41:36 robertj
87 * Updated documentation to use HTML codes.
89 * Revision 1.27 1995/02/19 04:19:09 robertj
90 * Added dynamically linked command processing.
92 * Revision 1.26 1995/02/05 00:48:40 robertj
95 * Revision 1.25 1995/01/21 05:16:20 robertj
96 * Modified ShowAll so PScrollable does not change show state of scroll bars..
98 * Revision 1.24 1995/01/16 13:02:24 robertj
101 * Revision 1.23 1995/01/15 04:54:51 robertj
102 * Fixed global cursor set logic.
104 * Revision 1.22 1995/01/06 10:43:48 robertj
105 * Changed PRealFont usage from pointer to reference.
107 * Revision 1.21 1995/01/02 12:24:58 robertj
109 * Added global cursor setting for wait cursor.
111 * Revision 1.20 1994/12/21 11:53:10 robertj
112 * Documentation and variable normalisation.
114 * Revision 1.19 1994/12/14 11:17:07 robertj
115 * Changed PDIMENSION to be unsigned causing untold number of changes.
117 * Revision 1.18 1994/10/30 11:46:43 robertj
118 * Changed mechanism for doing notification callback functions.
120 * Revision 1.17 1994/10/23 04:45:47 robertj
121 * Added function to get the drawing bounds of an interactor.
122 * Allowed cursor position to be obtained in pixels as well as font coords.
124 * Revision 1.16 1994/08/23 11:32:52 robertj
127 * Revision 1.15 1994/08/22 00:46:48 robertj
128 * Added pragma fro GNU C++ compiler.
130 * Revision 1.14 1994/08/21 23:43:02 robertj
131 * Added ability to get caret position in pixels.
132 * Created global class for list of interactors.
134 * Revision 1.13 1994/06/25 11:55:15 robertj
135 * Unix version synchronisation.
137 * Revision 1.12 1994/04/03 08:34:18 robertj
138 * Added help and focus functionality.
140 * Revision 1.11 1994/03/07 07:38:19 robertj
141 * Major enhancementsacross the board.
143 * Revision 1.10 1994/01/03 04:42:23 robertj
144 * Mass changes to common container classes and interactors etc etc etc.
146 * Revision 1.9 1993/12/16 06:20:57 robertj
147 * Changes to callback function definition due to GCC.
149 * Revision 1.8 1993/12/01 16:09:05 robertj
152 * Revision 1.7 1993/09/27 16:35:25 robertj
153 * Removed special constructor for dialog resource loading.
155 * Revision 1.6 1993/08/27 18:17:47 robertj
156 * Added background colour manipulation.
158 * Revision 1.5 1993/08/24 00:27:59 robertj
159 * Added inPixels capability to validate/invalidate functions.
161 * Revision 1.4 1993/08/19 18:03:28 robertj
162 * Made coordinate transform functions public.
164 * Revision 1.3 1993/07/14 12:49:16 robertj
165 * Fixed RCS keywords.
176 class PInteractorCanvas
;
180 PLIST(PInteractorList
, PInteractor
);
182 #ifndef PINTERACTOR_ANCESTOR
183 #define PINTERACTOR_ANCESTOR public PObject
187 /**This class defines the common behaviour of all user interface interaction
188 entity. This may or may not be a "Window" depending on the definition of
189 that term in the target GUI.
191 class PInteractor
: PINTERACTOR_ANCESTOR
194 PCLASSINFO(PInteractor
, PObject
);
197 /** Create a a new interactor attaching it to the parent interactor. */
199 PInteractor
* parent
, /// Interactor into which the interactor is placed.
200 BOOL hiddenChild
= FALSE
201 /**Whether the "hidden" from the application. If this is TRUE then the
202 interactor is not added to the parents child interactor list, thus it
203 will not be visible as a "child" interactor of the parent and will
204 not be automatically deleted when the parent is deleted.
208 /** Destroy the interactor, and all its child interactors. */
209 virtual ~PInteractor();
212 /**@name Overrides from class PObject */
213 /**Determine if the two interactors are the same. As two instances can
214 never {\bf be} the same interactor, this can never be EqualTo.
217 Always #GreaterThan#.
219 virtual Comparison
Compare(
220 const PObject
& obj
/// Interactor to compare against.
224 /**@name New functions for class */
225 /**Get the interactor layout that this interactor is contained in.
228 pointer to parent interactor.
230 PInteractor
* GetParent() const;
232 /**Determine if this interactor is a child or grandchild etc of the
233 interactor layout specified.
236 TRUE if interactor is a child of #parent#.
239 PInteractor
* parent
/// Interactor to check for parenthood.
242 /**Get the number of children the interactor currently contains.
245 number of child interactors.
247 PINDEX
GetNumChildren();
249 /**Get access to the child interactor at the specified index. The order in
250 which child interactors are attached to a parent interactor is initially
251 in their construction order.
254 reference to child interactor.
256 PInteractor
& operator[](
257 PINDEX index
/// Ordinal position of the child interactor.
260 /**Update all command sources. This will go to the utimate parent, a
261 \Ref{PTopLevelWindow}, and then recursively update every command
262 source, menu item or control, for being enabled or disabled. This uses
263 the \Ref{PNotifier} function for each source to get the new state.
265 The \Ref{PCommandSource} and \Ref{PCommandSink} classes are usually
266 used in conjunction with this function to control commands such as menu
267 items and tool bars etc.
269 virtual void UpdateCommandSources();
272 /**Set the font to be used by default by this interactor. A canvas created
273 on this interactor will initially have this font selected.
275 This also determines the coordinate system to be used for laying out
276 child interactors via the \Ref{SetPosition()} and
277 \Ref{SetDimensions()} functions. The coordinates used are 1/4 average
278 font width and 1/8 the font height.
280 If the #toChildren# parameter is TRUE then the font is
281 propagated down to all child interactors and grandchild interactors etc.
283 virtual void SetFont(
284 const PFont
& newFont
, /// New font specification fo rthe interactor.
285 BOOL toChildren
= TRUE
286 /// Flag to recursively change all child interactors.
289 /**Get the font to be used by default in all child interactors. A canvas
290 created on this interactor will initially have this font selected.
292 This also determines the coordinate system to be used for laying out
293 child interactors via the \Ref{SetPosition()} and
294 \Ref{SetDimensions()} functions. The coordinates used are 1/4 average
295 font width and 1/8 the font height.
298 Pointer to a realised font on a canvas for this interactor.
300 const PRealFont
& GetFont();
302 /** Convert the layout X coordinate value to screen pixels. */
303 PDIMENSION
ToPixelsDX(
304 PDIMENSION x
/// Horizontal dimension to convert.
307 /** Convert the layout Y coordinate value to screen pixels. */
308 PDIMENSION
ToPixelsDY(
309 PDIMENSION y
/// Vertical dimension to convert.
312 /** Convert the layout X coordinate value to screen pixels. */
314 PORDINATE x
/// Horizontal coordinate to convert.
317 /** Convert the layout Y coordinate value to screen pixels. */
319 PORDINATE y
/// Vertical coordinate to convert.
322 /** Convert the layout dimension value to screen pixels. */
324 const PDim
& dim
/// Dimensions to convert.
327 /** Convert the layout point value to screen pixels. */
329 const PPoint
& pt
/// Position to convvert.
332 /** Convert the layout rectange value to screen pixels. */
334 const PRect
& r
/// Rectangle to convert.
337 /** Convert the screen pixels to a layout X coordinate value. */
338 PDIMENSION
FromPixelsDX(
339 PDIMENSION x
/// Horizontal dimension to convert.
342 /** Convert the screen pixels to a layout Y coordinate value. */
343 PDIMENSION
FromPixelsDY(
344 PDIMENSION y
/// Vertical dimension to convert.
347 /** Convert the screen pixels to a layout X coordinate value. */
348 PORDINATE
FromPixelsX(
349 PORDINATE x
/// Horizontal coordinate to convert.
352 /** Convert the screen pixels to a layout Y coordinate value. */
353 PORDINATE
FromPixelsY(
354 PORDINATE y
/// Vertical coordinate to convert.
357 /** Convert the dimensions in screen pixels to layout coordinates. */
359 const PDim
& dim
/// Dimensions to convert.
362 /** Convert the point in screen pixels to layout coordinates. */
364 const PPoint
& pt
/// Position to convvert.
367 /** Convert the rectangle in screen pixels to layout coordinates. */
369 const PRect
& r
/// Rectangle to convert.
373 /**Origin specification for the \Ref{SetPosition()} function. This
374 determines how the horizontal and vertical position is interpreted to
375 the final placement of the interactor.
377 When scaling is used (eg #xOrigin = TopLeftParent#), the
378 coordinates used are 1/4 average font width and 1/8 the font height.
380 Note that some child interactors are clipped to be within their
381 parent. For these interactors, setting relative to the screen may cause
382 the interactor to become invisible.
384 enum PositionOrigin
{
385 /**Position the left of the interactor relative to the left of the
386 screen and the top of the interactor relative to the top of the
389 No scaling factor will be applied and x and y offset will be applied
390 in screen pixels. Offsets of zero will place the interactor in the
391 top left corner of the screen. Negative offsets will start to move
392 the interactor off the screen.
395 /**Position the centre of the interactor relative to the centre of the
396 screen in both the horizontal and vertical directions.
398 No scaling factor will be applied and x and y offset will be applied
399 in screen pixels. Offsets of zero will place the interactor in the
400 centre of the screen.
403 /**Position the right of the interactor relative to the right of the
404 screen and the bottom of the interactor relative to the bottom of the
407 No scaling factor will be applied and x and y offset will be applied
408 in screen pixels. Offsets of zero will place the interactor in the
409 bottom right corner of the screen. Positive offsets will start to move
410 the interactor off the screen.
413 /**Position the left of the interactor relative to the left of the
414 parent internal area and the top of the interactor relative to the
415 top of the parents internal area.
417 The coordinates are scaled according to the currently selected font
418 for the interactor. Offsets of zero will place the interactor in the
419 top left corner of the parent. Negative offsets will start to move
420 the interactor off the parent interactor.
423 /**Position the centre of the interactor relative to the centre of the
424 parent internal area in both the horizontal and vertical directions.
426 The coordinates are scaled according to the currently selected font
427 for the interactor. Offsets of zero will place the interactor in the
428 centre of the parent.
431 /**Position the right of the interactor relative to the right of the
432 parent internal area and the bottom of the interactor relative to the
433 bottom of the parents internal area.
435 The coordinates are scaled according to the currently selected font
436 for the interactor. Offsets of zero will place the interactor in the
437 bottom right corner of the parent. Positive offsets will start to move
438 the interactor off the parent interactor.
441 /**Position the left of the interactor relative to the left of the
442 parent internal area and the top of the interactor relative to the
443 top of the parents internal area.
445 No scaling factor will be applied and x and y offset will be applied
446 in screen pixels. Offsets of zero will place the interactor in the
447 top left corner of the parent. Negative offsets will start to move
448 the interactor off the parent interactor.
451 /**Position the centre of the interactor relative to the centre of the
452 parent internal area in both the horizontal and vertical directions.
454 No scaling factor will be applied and x and y offset will be applied
455 in screen pixels. Offsets of zero will place the interactor in the
456 centre of the parent.
459 /**Position the right of the interactor relative to the right of the
460 parent internal area and the bottom of the interactor relative to the
461 bottom of the parents internal area.
463 No scaling factor will be applied and x and y offset will be applied
464 in screen pixels. Offsets of zero will place the interactor in the
465 bottom right corner of the parent. Positive offsets will start to move
466 the interactor off the parent interactor.
472 const PPoint
& org
, /// Offset to apply to interactor.
473 PositionOrigin xOrigin
= TopLeftParent
, /// Origin for horizontal offset.
474 PositionOrigin yOrigin
= TopLeftParent
/// Origin for verical offset.
476 /**Set the position of the interactor. The #xOrigin# and
477 #yOrigin# parameters indicate the coordinate system to be
478 used for the offsets. If the font based layout coordinates are used
479 they will use the font of the {\it parents} interactor. The
480 interactors font is {\bf not} used.
482 Note that this sets the position of the exterior of the interactor,
483 including any decoration, eg title bars etc.
485 When scaling is used (eg #xOrigin = TopLeftParent#), the
486 coordinates used are 1/4 average font width and 1/8 the font height.
488 The user should not override this function. If some form of action is
489 required on changing the interactors position then the
490 \Ref{_SetPosition()} function should be overridden.
493 PORDINATE x
, /// Horizontal offset to apply to interactor.
494 PORDINATE y
, /// Vertical offset to apply to interactor.
495 PositionOrigin xOrigin
= TopLeftParent
, /// Origin for horizontal offset.
496 PositionOrigin yOrigin
= TopLeftParent
/// Origin for verical offset.
499 /** Coordinate system used for position & dimensions */
500 enum CoordinateSystem
{
501 /** Use interactor relative, font scaled coordinates. */
503 /** Use interactor relative coordinates in screen pixels. */
505 /** Use screen absolute coordinates */
509 /**Get the position of the interactor relative to its parent. If the
510 interactor has no parent, ie is a descendent of \Ref{PTopLevelWindow},
511 then the position is always in absolute screen coordinates.
513 If the #coords# parameter is #LocalCoords# then
514 the return value is in the coordinate system based in the interactors
515 current font. Otherwise it is returned in screen pixels.
517 If the #coords# parameter is #PixelCoords# then
518 the coordinates are still relative to its parent, while the
519 #ScreenCoords# value will return realtive to the absolute
522 Note that this gets the position of the exterior of the interactor,
523 including any decoration, eg title bars etc.
525 When scaling is used (#coords == LocalCoords#), the
526 coordinates used are 1/4 average font width and 1/8 the font height.
529 point for the interactors current position.
532 CoordinateSystem coords
/// Coordinate system to use.
535 /**Convert the point from the interactor relative coordinates to absolute
538 If the #coords# parameter is #LocalCoords# then
539 the return value is in the coordinate system based in the interactors
540 current font. Otherwise it is returned in screen pixels.
542 If the #coords# parameter is #PixelCoords# then
543 the coordinates are still relative to its parent, while the
544 #ScreenCoords# value will return realtive to the absolute
547 When scaling is used (#coords == LocalCoords#), the
548 coordinates used are 1/4 average font width and 1/8 the font height.
551 point converted to absolute screen coordinates.
556 CoordinateSystem coords
559 const PPoint
& pt
, /// Coordinate to convert.
560 CoordinateSystem coords
/// Coordinate system to use.
563 /**Convert the point from the absolute screen coordinates to interactor
564 relative coordinates.
566 If the #coords# parameter is #LocalCoords# then
567 the return value is in the coordinate system based in the interactors
568 current font. Otherwise it is returned in screen pixels.
570 If the #coords# parameter is #PixelCoords# then
571 the coordinates are still relative to its parent, while the
572 #ScreenCoords# value will return realtive to the absolute
575 When scaling is used (#coords == LocalCoords#), the
576 coordinates used are 1/4 average font width and 1/8 the font height.
579 point converted from absolute screen coordinates.
584 CoordinateSystem coords
587 const PPoint
& pt
, /// Coordinate to convert.
588 CoordinateSystem coords
/// Coordinate system to use.
592 /**Set the dimensions of the interactor. The new size is specified in
593 either the font based layout coordinates or in screen pixels as
594 specified by the #coords# parameter.
596 Note that this sets the dimension of the interior of the interactor,
597 excluding any decoration, eg title bars etc.
599 When scaling is used (#coords == LocalCoords#), the
600 coordinates used are 1/4 average font width and 1/8 the font height.
602 The user should not override this function. If some form of action is
603 required on changing the interactors size then the
604 \Ref{#_SetDimensions()#} function should be overridden.
607 PDIMENSION width
, /// New width to apply to interactor.
608 PDIMENSION height
, /// New height to apply to interactor.
609 CoordinateSystem coords
/// Coordinate system to use.
612 const PDim
& dim
, /// New dimensions to apply to interactor.
613 CoordinateSystem coords
/// Coordinate system to use.
616 /**Get the dimensions of the interactor.
618 If the #coords# parameter is #LocalCoords# then
619 the return value is in the coordinate system based in the interactors
620 current font. Otherwise it is returned in screen pixels.
622 If the #coords# parameter is #PixelCoords# then
623 the coordinates are still relative to its parent, while the
624 #ScreenCoords# value will return realtive to the absolute
627 Note that this gets the dimension of the interior of the interactor,
628 excluding any decoration, eg title bars etc.
630 When scaling is used (#coords == LocalCoords#), the
631 coordinates used are 1/4 average font width and 1/8 the font height.
634 dimensions for the interactors current size.
637 CoordinateSystem coords
/// Coordinate system to use.
640 /**Get the external bounds of the interactor. This includes things such as
641 title bars and borders etc. For most interactors this will be identical
642 to a rectangle formed from \Ref{GetPosition()} and
643 \Ref{GetDimensions()} as there are no external decorations to the
646 If the coordinate system used is in pixels
647 (#coords == ScreenCoords#) then the position is in absolute
648 screen coordinates. Otherwise it uses the interactors own coordinate
649 system. This usually means negative values for the rectangles top left
652 When scaling is used (#coords == LocalCoords#), the
653 coordinates used are 1/4 average font width and 1/8 the font height.
656 bounds rectangle for the interactor.
658 PRect
GetStructureBounds(
659 CoordinateSystem coords
/// Coordinate system to use.
662 /**Get the drawing bounds for the interactor. This is usually the internal
663 dimensions of the interactor. But could be other sizes depending on the
664 semantics of the interator. See \Ref{PScrollable} for an example of the
665 drawing bounds being larger than the size of the interactor.
667 This function is used by the \Ref{PInteractorCanvas} class to determine
668 the drawing bounds for the canvas.
670 When scaling is used (#coords == LocalCoords#), the
671 coordinates used are 1/4 average font width and 1/8 the font height.
674 drawing bounds rectangle for the interactor.
676 virtual PRect
GetDrawingBounds(
677 CoordinateSystem coords
/// Coordinate system to use.
680 /**Options for the \Ref{AutoAdjustBounds()} function. This controls how
681 the interactor will be repositioned and resized given a bounds
684 For all #AdjustBounds# option, the bounds rectangle is
685 reduced by the size of the interactor just placed.
687 enum AutoAdjustType
{
688 /**Set the interactors position and dimensions to the value specified in
692 /**Set the interactors position to the top left of the specified bounds
693 rectangle. The width of the interactor is set to the width of the
694 bounds rectangle and the height remains unchanged.
697 /**Set the interactors position to the bottom left of the specified
698 bounds rectangle. The width of the interactor is set to the width of
699 the bounds rectangle and the height remains unchanged.
702 /**Set the interactors position to the top left of the specified bounds
703 rectangle. The height of the interactor is set to the height of the
704 bounds rectangle and the width remains unchanged.
707 /**Set the interactors position to the bottom left of the specified
708 bounds rectangle. The width of the interactor is set to the width of
709 the bounds rectangle and the height remains unchanged.
712 /**Set the interactors position to the top right of the specified bounds
713 rectangle. The height of the interactor is set to the height of the
714 bounds rectangle and the width is set to the standard width for a
715 vertical scroll bar as defined by the
716 \Ref{PApplication::GetVScrollWidth()} function.
719 /**Set the interactors position to the bottom left of the specified
720 bounds rectangle. The width of the interactor is set to the width of
721 the bounds rectangle and the height is set to the standard height for
722 a horizontal scroll bar as defined by the
723 \Ref{PApplication::GetHScrollHeight()} function.
726 /**Set the interactors position to the top right of the specified bounds
727 rectangle. The height of the interactor is set to the height of the
728 bounds rectangle minus the height of a horizontal scroll bar. The
729 width is set to the standard width for a vertical scroll bar.
731 This option is used when both scroll bars are to be used and they must
732 be placed in the usual manner, with a small unused area in the bottom
733 right corner of the parent interactor.
735 AdjustVScrollBeforeHScroll
,
736 /**Set the interactors position to the bottom left of the specified
737 bounds rectangle. The width of the interactor is set to the width of
738 the bounds rectangle minus the width of a vertical scroll bar. The
739 height is set to the standard height for a horizontal scroll bar.
741 This option is used when both scroll bars are to be used and they must
742 be placed in the usual manner, with a small unused area in the bottom
743 right corner of the parent interactor.
745 AdjustHScrollAfterVScroll
748 /**Adjust the interactor relative to the specified bounds rect. The bounds
749 rectangle is the modified to remove the space that the interactor takes
750 up in the bounds. In this way successive calls to AutoAdjustBounds() on
751 child interactors by a parent can "tile" the interactors to correct
752 positions. For example, if a parent has a scroll bar, a button bar and
753 a status bar thes can be placed with three calls to AutoAdjustBounds()
754 in the \Ref{PTitledWindow::OnResize()} function.
756 void AutoAdjustBounds(
757 PRect
& bounds
, /// Bounds rectangle in which the interactor is adjusted.
758 AutoAdjustType type
= AdjustBounds
/// Option for adjustment to be made.
761 /**Determine if the point specified is inside the interactors area. Note
762 that the border or other decorations in a window are included in the
763 area that consitutes the interactor
765 The point is usually in absolute screen coordinates, ie when
766 #coords# parameter is #ScreenCoords#, but may also
767 be relative to the interactors origin or scaled to the interactors font
768 based layout coordinates.
770 When scaling is used (#coords == LocalCoords#), the
771 coordinates used are 1/4 average font width and 1/8 the font height.
774 TRUE if the point is within the interactor.
777 const PPoint
& pt
, /// Point in to check.
778 CoordinateSystem coords
/// Coordinate system to use.
781 /**Find the interactor that is at the specified coordinates. The
782 interactor must be owned by the application.
784 The point is usually in absolute screen coordinates, ie when
785 #coords# parameter is #ScreenCoords#, but may also
786 be relative to the interactors origin or scaled to the interactors font
787 based layout coordinates.
789 When scaling is used (#coords == LocalCoords#), the
790 coordinates used are 1/4 average font width and 1/8 the font height.
793 pointer to interactor at point or NULL if no interactor there.
795 PInteractor
* FindInteractor(
796 const PPoint
& pt
, /// Point to check.
797 CoordinateSystem coords
/// Coordinate system to use.
801 /**Close the interactor.
802 The default behavour calls the Close() function for the parent interactor.
805 TRUE if close has been queued.
807 virtual BOOL
Close();
809 /**Enable or disable the interactor. This will prevent all input from being
810 processed by the interactor. In some cases the visual appearance of the
811 interactor may change depending on the individual semantics of the
812 interactor. For example the text for a \Ref{PTextButton} would appear
815 Note if an PInteractor is disabled, all its children, grandchildren etc
819 BOOL enabled
= TRUE
/// New state for input processing of interactor.
822 /**Disable the interactor, ignoring all input to it.
824 This is identical to calling #Enable(FALSE)#.
828 /**Determine if the interactor is enabled and input may be processed.
831 TRUE if input processing enabled.
833 BOOL
IsEnabled() const;
836 /**Show the interactor and all child and grandchild etc interactors.
838 This enabled the interactor tree in post order, ie all children have
839 their ShowAll() function called and then the interactor itself is shown
840 using the \Ref{Show()} function.
842 virtual void ShowAll();
844 /**Show or hide the interactor. This will immediately remove the interactor
845 from view. Showing an interactor will cause content update events to
846 be queued for later call of the \Ref{OnRedraw()} function. The actual
847 display may be delayed.
850 BOOL visible
= TRUE
/// New state for the visibility of the interactor.
853 /**Hide the interactor from view.
855 This is identical to calling #Show(FALSE)#.
859 /**Determine if interactor may be visible. Note that this does not mean
860 that it is not obscured by another window on the screen. It simply means
861 that the interactor has had #Show(TRUE)# called last.
864 TRUE if the interactor is shown.
866 BOOL
IsVisible() const;
869 /**Bring the interactor to the top of any layering order for overlapping
870 windows or interactors. This only affects sibling interactors at a
871 particular level of the parent child hierarchy.
873 If the interactor is a \Ref{PTopLevelWindow} then the "siblings" it
874 uses are other applications top level windows. This is equivalent to the
875 "activating" of an application that the user may do using mouse and
876 keyboard in the platform dependent manner.
878 Note that this does not change the order of child interactors as
879 returned by the #\Ref{operator[]}# function, only the screen
880 appearence is altered.
882 virtual void BringToTop();
884 /**Determine if the interactor is currently on top of any layering order
885 for overlapping windows or interactors. This compares against sibling
886 interactors at a particular level of the parent child hierarchy.
889 TRUE if this interactor is the
891 virtual BOOL
IsOnTop() const;
894 /**Mark the area of the interactor as requiring a redraw. This adds the
895 specified rectangular area to an {\it update region}. If this region
896 is not empty then a request to redraw that area of the interactor is
897 queued to be processed by the message handling system. At some time
898 later the \Ref{OnRedraw()} function is called with its canvas clipping
899 region set to the update region.
901 The parameterless form will invalidate the entire interactor.
903 When scaling is used (#coords == LocalCoords#), the
904 coordinates used are 1/4 average font width and 1/8 the font height.
906 The user should not override this function. If some form of action is
907 required on changing the interactors update region then the
908 \Ref{_Invalidate()} function should be overridden.
912 /// X position of the top left corner of the rectangle to invalidate.
914 /// Y position of the top left corner of the rectangle to invalidate.
915 PDIMENSION width
, /// Width of the rectangle to invalidate.
916 PDIMENSION height
, /// Height of the rectangle to invalidate.
917 CoordinateSystem coords
/// Coordinate system to use.
920 const PPoint
& topLeft
,
921 /// X & Y position of the top left corner of the rectangle to invalidate.
923 /// The width & height of the rectangle to invalidate.
924 CoordinateSystem coords
/// Coordinate system to use.
927 const PPoint
& topLeft
,
928 /// X & Y position of the top left corner of the rectangle to invalidate.
929 const PPoint
& botRight
,
930 /**X & Y position of the bottom right corner of the rectangle to
933 CoordinateSystem coords
/// Coordinate system to use.
936 const PRect
& rect
, /// The rectangle to invalidate.
937 CoordinateSystem coords
/// Coordinate system to use.
941 /**Mark the area of the interactor as {\bf not} requiring a redraw. This
942 subtracts the specified rectangular area from an {\it update region}.
943 If this region is not empty then a request to redraw that area of the
944 interactor is queued to be processed by the message handling system. At
945 some time later the \Ref{OnRedraw()} function is called with its
946 canvas clipping region set to the update region.
948 The parameterless form will validate the entire interactor.
950 When scaling is used (#coords == LocalCoords#), the
951 coordinates used are 1/4 average font width and 1/8 the font height.
953 The user should not override this function. If some form of action is
954 required on changing the interactors update region then the
955 \Ref{_Validate()} function should be overridden.
959 /// X position of the top left corner of the rectangle to validate.
961 /// Y position of the top left corner of the rectangle to validate.
962 PDIMENSION width
, /// Width of the rectangle to validate.
963 PDIMENSION height
, /// Height of the rectangle to validate.
964 CoordinateSystem coords
/// Coordinate system to use.
967 const PPoint
& topLeft
,
968 /// X & Y position of the top left corner of the rectangle invalidate.
970 /// The width & height of the rectangle to validate.
971 CoordinateSystem coords
/// Coordinate system to use.
974 const PPoint
& topLeft
,
975 /// X & Y position of the top left corner of the rectangle to validate.
976 const PPoint
& botRight
,
977 /**X & Y position of the bottom right corner of the rectangle to
980 CoordinateSystem coords
/// Coordinate system to use.
983 const PRect
& rect
, /// The rectangle to validate.
984 CoordinateSystem coords
/// Coordinate system to use.
988 /**Force an immediate update of the window. This is used in conjuction with
989 the \Ref{Invalidate()} and \Ref{Validate()} functions. If the
990 {\it update region} specified by these functions is empty then this
991 function does nothing, otherwise an update of the interactor contents
994 This will do a synchronous \Ref{OnRedraw()} call and guarantees that
995 the screen is updated before returning. It us used to speed up the
996 interaction with the user by not waiting for the standard delayed
1002 /**Grab the mouse for exclusive use by this interactor. All mouse input,
1003 clicks etc will be directed to this interactor only regardless of the
1004 position of the mouse cursor.
1006 Note that the cursor grab is a system wide resource and {\bf must} be
1007 released by the application or it is possible to lock up the user
1008 interface for {\bf all} applications!
1012 /**Relenquish the exclusive use of the mouse after a \Ref{GrabMouse()}
1015 Note that the cursor grab is a system wide resource and {\bf must} be
1016 released by the application or it is possible to lock up the user
1017 interface for {\bf all} applications!
1019 void ReleaseMouse();
1021 /**Determine if this interactor currently has exclusive use of the mouse
1025 TRUE if has currently grabbed the mouse pointer.
1027 BOOL
HasMouse() const;
1030 /**Make this interactor have the user keyboard input focus. All keyboard
1031 input will now be directed to this interactor.
1033 Appropriate messages are sent to interactors for the focus change. The
1034 previous interactor receives a call to \Ref{OnLostFocus()} and the new
1035 interactor receives a \Ref{OnGainFocus()} call.
1039 /**Determine if this interactor currently has the keyboard focus.
1041 Return: TRUE if has the current focus.
1043 BOOL
HasFocus() const;
1046 /**Set the cursor to be used for this interactor. The cursor is
1047 automatically set to this shape while the mouse is anywhere over this
1048 interactors client area or while the mouse pointer has been "grabbed"
1049 by the \Ref{GrabMouse()} function.
1051 A call to this function will reset the cursor to parent flag that may
1052 be set by the \Ref{SetCursorToParent()} function.
1054 virtual void SetCursor(
1055 const PCursor
& newCursor
/// New shape for mouse cursor.
1058 /**Get the current cursor shape that is being used whenever the mouse
1059 pointer is over this interactor. This will be the cursor last set by the
1060 \Ref{SetCursor()} function and is {\bf not} subject to the
1061 \Ref{SetCursorToParent()} mode.
1064 current cursor object for interactor.
1066 PCursor
GetCursor() const;
1068 /**Set the cursor to always be whatever the interactors parent is using as
1069 a cursor shape. If the parents cursor is subsequently changed then the
1070 child interactors cursor is also changed.
1072 This does not change the current cursor as last set by the
1073 \Ref{SetCursor()} function.
1075 void SetCursorToParent(
1076 BOOL useParent
= TRUE
/// Flag for interactor to use parents cursor.
1079 /**Set the current cursor to the new shape and set all child interactors to
1080 temporarily use that cursor.
1082 Note that subsequent calls to the SetAllCursors() and
1083 \Ref{SetWaitCursor()} functions are ignored until the corresponding
1084 \Ref{RestoreAllCursors()} function is called. That it these functions
1085 may {\bf not} be nested.
1088 const PCursor
& newCursor
/// New shape for mouse cursor.
1091 /**Restore the current cursor and all child interactors cursor to parent
1092 flags to the state as of the previous call to \Ref{SetAllCursors()}.
1094 void RestoreAllCursors();
1096 /**Set the cursor for this interactor and all child interactors to the
1097 platform dependent standard {\it wait} cursor. This may be a watch or
1098 and hourglass as determined by the platform.
1100 This function is equivalent to calling
1101 #SetAllCursors(PCursor(PSTD_ID_CURSOR_WAIT))#.
1103 void SetWaitCursor();
1105 /**Set the position of the cursor. As there is only one cursor for the
1106 entire system this may affect other applications.
1108 The point is usually in absolute screen coordinates, ie when
1109 #coords# parameter is #ScreenCoords#, but may also
1110 be relative to the interactors origin or scaled to the interactors font
1111 based layout coordinates.
1113 Note, this may not be available on all platforms in which case it does
1114 nothing. For this and other reasons of user interfcace design, it is not
1115 recommended that this function be used.
1117 When scaling is used (#coords == LocalCoords#), the
1118 coordinates used are 1/4 average font width and 1/8 the font height.
1120 The user should not override this function. If some form of action is
1121 required on changing the cursor position then the
1122 \Ref{_SetCursorPos()} function should be overridden.
1125 PORDINATE x
, /// New X position of cursor.
1126 PORDINATE y
, /// New Y position of cursor.
1127 CoordinateSystem coords
/// Coordinate system to use.
1130 const PPoint
& pt
, /// New X & Y position of cursor.
1131 CoordinateSystem coords
/// Coordinate system to use.
1134 /**Get the current cursor position in the interactors coordinate system.
1136 The point is usually in absolute screen coordinates, ie when
1137 #coords# parameter is #ScreenCoords#, but may also
1138 be relative to the interactors origin or scaled to the interactors font
1139 based layout coordinates.
1141 When scaling is used (#coords == LocalCoords#), the
1142 coordinates used are 1/4 average font width and 1/8 the font height.
1144 PPoint
GetCursorPos(
1145 CoordinateSystem coords
/// Coordinate system to use.
1148 /**Show or hide the mouse cursor. To be able to nest calls to this function
1149 an internal count is used. Whenever #show# the display count
1150 is incremented otherwise it is decremented. The cursor is displayed only
1151 when the count is greater than or equal to zero. The count is initially
1154 virtual void ShowCursor(
1155 BOOL show
= TRUE
/// Flag for showing or hiding the cursor.
1158 /**Hide the mouse cursor, this is equivalent to
1159 #ShowCursor(FALSE)#.
1164 /**Set the text caret shape to be as specified.
1166 The text caret is a small rectangle used to indicate the current
1167 position for editing text strings. It should only be present in
1168 interactors that contain the current keyboard focus.
1171 const PCaret
& newCaret
/// New shape for the caret.
1174 /**Get the current text caret shape.
1176 The text caret is a small rectangle used to indicate the current
1177 position for editing text strings. It should only be present in
1178 interactors that contain the current keyboard focus.
1181 current caret object for interactor.
1183 PCaret
GetCaret() const;
1185 /**Set the position of the text caret within the interactor.
1187 When scaling is used (#coords == LocalCoords#), the
1188 coordinates used are 1/4 average font width and 1/8 the font height.
1190 The user should not override this function. If some form of action is
1191 required on changing the interactors caret position then the
1192 \Ref{_SetCaretPos()} function should be overridden.
1195 PORDINATE x
, /// New X position of caret.
1196 PORDINATE y
, /// New Y position of caret.
1197 CoordinateSystem coords
/// Coordinate system to use.
1200 const PPoint
& pt
, /// New X & Y position of caret.
1201 CoordinateSystem coords
/// Coordinate system to use.
1204 /**Get the position of the text caret within the interactor.
1206 When scaling is used (#coords == LocalCoords#), the
1207 coordinates used are 1/4 average font width and 1/8 the font height.
1210 current position of the text caret.
1213 CoordinateSystem coords
/// Coordinate system to use.
1216 /**Show or hide the text caret. To be able to nest calls to this function
1217 an internal count is used. Whenever #show# the display count
1218 is incremented otherwise it is decremented. The caret is displayed only
1219 when the count is greater than or equal to zero. The count is initially
1222 virtual void ShowCaret(BOOL show
= TRUE
);
1224 /**Hide the text caret, this is equivalent to
1229 /**Set the default foreground colour of the interactor.
1231 This will be the initial colour set in the \Ref{PInteractorCanvas}
1232 instance created via a \Ref{PDrawCanvas} creation or via
1233 \Ref{OnRedraw()} function call by the system providing a
1234 \Ref{PRedrawCanvas}.
1236 On creation of the interator this is set to the colour specified by the
1237 \Ref{PApplication::GetWindowFgColour()} function.
1239 virtual void SetForegroundColour(
1240 const PColour
& newColour
/// New foreground colour for interactor.
1243 /**Get the default foreground colour of the interactor.
1245 This will be the initial colour set in the \Ref{PInteractorCanvas}
1246 instance created via a \Ref{PDrawCanvas} creation or via
1247 \Ref{OnRedraw()} function call by the system providing a
1248 \Ref{PRedrawCanvas}.
1250 On creation of the interator this is set to the colour specified by the
1251 \Ref{PApplication::GetWindowFgColour()} function.
1254 colour for foreground of interactor.
1256 const PColour
& GetForegroundColour() const;
1258 /**Set the default background colour of the interactor.
1260 This will be the initial colour set in the \Ref{PInteractorCanvas}
1261 instance created via a \Ref{PDrawCanvas} creation or via
1262 \Ref{OnRedraw()} function call by the system providing a
1263 \Ref{PRedrawCanvas}.
1265 On creation of the interator this is set to the colour specified by the
1266 \Ref{PApplication::GetWindowBkColour()} function.
1268 virtual void SetBackgroundColour(
1269 const PColour
& newColour
/// New background colour for interactor.
1272 /**Get the default background colour of the interactor.
1274 This will be the initial colour set in the \Ref{PInteractorCanvas}
1275 instance created via a \Ref{PDrawCanvas} creation or via
1276 \Ref{OnRedraw()} function call by the system providing a
1277 \Ref{PRedrawCanvas}.
1279 On creation of the interator this is set to the colour specified by the
1280 \Ref{PApplication::GetWindowBkColour()} function.
1283 colour for background of interactor.
1285 const PColour
& GetBackgroundColour() const;
1287 /**Get the width of vertical border and height of horizontal border for
1290 This may be one of several values depending on the type of the
1291 interactor. For example a \Ref{PTitledWindow} would return a value as
1292 in the \Ref{PApplication::GetTitledBorderSize()} function.
1294 If the interactor does not have a border then #PDim(0,0)# is
1298 current width of borders on interactor.
1300 PDim
GetBorderSize() const;
1302 /**Get the colour of the interactors border.
1304 The actual colour returned is dependent on the type of interactor and
1305 the current mode of the interactor. For instance for a
1306 \Ref{PTitledWindow} that is active, the value returned would be as
1307 specified by the \Ref{PApplication::GetActiveBorderColour()} function.
1310 colour for the border of the interactor.
1312 const PColour
& GetBorderColour() const;
1315 /**Begin a mouse track operation, calling the \Ref{OnMouseTrack()}
1316 function for each mouse move. The #interactor# parameter is
1317 the object on which the \Ref{OnMouseTrack()} function is called.
1319 The first form will start to track a drag using the current interactor
1320 as the \Ref{OnMouseTrack()} functions target object.
1322 The mouse pointer is automatically grabbed (via \Ref{GrabMouse()})
1323 and released (via \Ref{ReleaseMouse()}). A canvas may also be
1324 automatically created and deleted, and is provided to the
1325 \Ref{OnMouseTrack()} function.
1328 Canvas created for the track operation.
1330 PCanvas
* StartMouseTrack(
1331 BOOL wantsCanvas
= FALSE
/// Create a canvas for the track operation.
1333 PCanvas
* StartMouseTrack(
1334 PInteractor
* interactor
, /// Interactor that is to be used for track.
1335 BOOL wantsCanvas
= FALSE
/// Create a canvas for the track operation.
1339 /**@name System callback functions. */
1340 /**The system calls this whenever the mouse moves over the interactors
1343 virtual void OnMouseMove(
1345 /**This key code is used to determine the modifiers (eg shift, control
1346 etc) that were active while the mouse was moved over the interactor.
1347 The value part of the key code is irrelevent.
1349 const PPoint
& where
1350 /**The position of the mouse pointer provided in pixels with its origin
1351 at the top left of the interactor.
1355 /**The system calls this whenever a mouse button is pressed in the
1356 interactors usable area.
1358 The two system parameters \Ref{PApplication::GetDoubleClickRect()} and
1359 \Ref{PApplication::GetDoubleClickTime()} control what constitutes a
1362 virtual void OnMouseDown(
1364 /**This key code is used to determine which mouse button was pressed and
1365 what modifiers that were active at that time. The mouse button that
1366 caused this call back is in the value part of the key code. The
1367 modifiers may indicate other mouse buttons being down at the same
1370 const PPoint
& where
,
1371 /**The position of the mouse pointer provided in pixels with its origin
1372 at the top left of the interactor.
1375 /// Is TRUE if the mouse down is the second click of a double click.
1378 /**The system calls this whenever a mouse button is released in the
1379 interactors usable area.
1381 virtual void OnMouseUp(
1383 /**This key code is used to determine which mouse button was pressed and
1384 what modifiers that were active at that time. The mouse button that
1385 caused this call back is in the value part of the key code. The
1386 modifiers may indicate other mouse buttons being down at the same
1389 const PPoint
& where
1390 /**The position of the mouse pointer provided in pixels with its origin
1391 at the top left of the interactor.
1395 /**The system calls this whenever a keyboard key was pressed and this
1396 interactor had the focus.
1398 The key code passed in this function is a platform independent
1399 representation of a key cap. No ASCII or ANSI translation is made.
1401 It may be assumed that the OnKeyDown() function occurs before the
1402 \Ref{OnKeyInput()} function, but it should {\bf not} be assumed
1403 that the \Ref{OnKeyUp()} function occurs after \Ref{OnKeyInput()}
1407 TRUE if the \Ref{OnKeyInput()} function is to be called with the
1408 translated key value.
1410 virtual BOOL
OnKeyDown(
1411 PKeyCode key
, /// Key code representation of key that was pressed.
1412 unsigned repeat
/// Count for auto-repeat.
1415 /**The system calls this whenever a keyboard key was released and this
1416 interactor had the focus.
1418 The key code passed in this function is a platform independent
1419 representation of a key cap. No ASCII or ANSI translation is made.
1421 It may be assumed that the OnKeyDown() function occurs before the
1422 \Ref{OnKeyInput()} function, but it should {\bf not} be assumed
1423 that the \Ref{OnKeyUp()} function occurs after \Ref{OnKeyInput()}
1426 virtual void OnKeyUp(
1427 PKeyCode key
/// Key code representation of key that was released.
1430 /**The system calls this whenever a keyboard key was pressed and this
1431 interactor had the focus. The string is the translated ANSI
1432 representation of the key combination.
1434 It may be assumed that the OnKeyDown() function occurs before the
1435 \Ref{OnKeyInput()} function, but it should {\bf not} be assumed
1436 that the \Ref{OnKeyUp()} function occurs after \Ref{OnKeyInput()}
1439 virtual void OnKeyInput(
1440 const PString
& str
/// ANSI string representation for the key press.
1443 /**The system calls this whenever the interactor is given the focus from
1444 another window in the system.
1446 This function is typically used to change the appearance of the
1447 interactor to indicate that it has the focus, for example in a
1448 \Ref{PEditBox} control the text caret is shown.
1450 virtual void OnGainFocus();
1452 /**The system calls this whenever the interactor had the focus and it has
1453 been changed to another window in the system.
1455 This function is typically used to change the appearance of the
1456 interactor to indicate that it no longer has the focus, for example in a
1457 \Ref{PEditBox} control the text caret is hidden.
1459 virtual void OnLostFocus();
1461 /**The system calls this whenever the interactor is given the focus the
1462 first time for a given \Ref{PTitledWindow} or \Ref{PInteractorLayout}.
1464 The interactor may have focus changed to interactors in other titled
1465 windows or interactor layouts but not to another interactor in the same
1466 window or layout before being approved by a call to
1469 This is primarily used to do field level validation within dialogs etc.
1471 virtual void OnStartInput();
1473 /**The system calls this whenever the system wishes to change focus to
1474 another interactor in a given \Ref{PTitledWindow} or
1475 \Ref{PInteractorLayout}.
1477 This function in conjunction with the keyboard focus changing and the
1478 \Ref{SetFocusInteractor()} function controls the transfer of focus
1479 from one interactor in a logical group (eg dialog) to another. It is
1480 primarily used for field level validation. For example, the
1481 \Ref{PIntegerEditBox} control uses this to prevent the user from
1482 exiting the control until a valid entry hash been made.
1484 Note that the focus {\bf does} actually change with appropriate calls
1485 to the \Ref{OnGainFocus()} and \Ref{OnLostFocus()} functions. The
1486 focus gets set back to the original interactor when this function
1487 disallows the focus change.
1490 FALSE will prevent the focus change from occurring and TRUE allows the
1493 virtual BOOL
OnEndInput();
1495 /**The system calls this whenever it requires that the interactors usable
1496 area needs to be updated and redrawn.
1498 The canvas is usually a \Ref{PRedrawCanvas} instance with its clip
1499 region set to the current update region as determined by the
1500 \Ref{Invalidate()} and \Ref{Validate()} functions as well as those
1501 areas that were obscured by overlapping windows.
1503 virtual void OnRedraw(
1504 PCanvas
& canvas
/// Canvas to use when drawing the interactor contents.
1507 /**This function is called whenever a control needs to notify its parent
1508 interactor that somthing has happened to it. The default behaviour
1509 of this function is is to call the notify function contained in the
1510 control object itself.
1512 virtual void OnControlNotify(
1513 PControl
& control
, /// Control that provides the notification.
1514 int option
/// Options for the type of notification.
1517 /**This function is called whenever a help select mode is activated and
1518 this interactor is selected.
1520 virtual void OnSelectHelp();
1522 /**This function is called whenever a balloon help function for the
1523 interactor is required.
1526 Pointer to balloon window containing balloon help text.
1528 virtual PBalloon
* OnBalloonHelp();
1531 /**This function is called whenever a drag track is in progress. This is
1532 begun with a call to the \Ref{StartMouseTrack()} function, which is
1533 typically called from within the \Ref{OnMouseDown()} function.
1535 The #lastTrack# parameter can be used to for special action
1536 at the end of the track operation.
1538 The mouse pointer is automatically grabbed (via \Ref{GrabMouse()})
1539 and released (via \Ref{ReleaseMouse()}). The canvas provided is
1540 also automatically created and deleted.
1542 virtual void OnMouseTrack(
1544 /// The canvas available while the drag operation is tracking.
1545 const PPoint
& where
,
1546 /**The position of the mouse pointer provided in pixels with its origin
1547 at the top left of the interactor.
1550 /// This is TRUE if the position is the last track of the drag operation.
1555 /** Special constructor used with PTopLevelWindow. */
1558 /**@name New functions for class */
1559 /**Set the position of the interactor. The #xOrigin# and
1560 #yOrigin# parameters indicate the coordinate system to be
1561 used for the offsets. If the font based layout coordinates are used
1562 they will use the font of the {\it parents} interactor. The
1563 interactors font is {\bf not} used.
1565 Note that this sets the position of the exterior of the interactor,
1566 including any decoration, eg title bars etc.
1568 When scaling is used (#coords == LocalCoords#), the
1569 coordinates used are 1/4 average font width and 1/8 the font height.
1571 virtual void _SetPosition(
1572 PORDINATE x
, /// Horizontal offset to apply to interactor.
1573 PORDINATE y
, /// Vertical offset to apply to interactor.
1574 PositionOrigin xOrigin
, /// Origin for horizontal offset.
1575 PositionOrigin yOrigin
/// Origin for verical offset.
1578 /**Set the dimensions of the interactor. The new size is specified in
1579 either the font based layout coordinates or in screen pixels as
1580 specified by the #coords# parameter.
1582 Note that this sets the dimension of the interior of the interactor,
1583 excluding any decoration, eg title bars etc.
1585 When scaling is used (#coords == LocalCoords#), the
1586 coordinates used are 1/4 average font width and 1/8 the font height.
1588 virtual void _SetDimensions(
1589 PDIMENSION width
, /// New width to apply to interactor.
1590 PDIMENSION height
, /// New height to apply to interactor.
1591 CoordinateSystem coords
/// Coordinate system to use.
1594 /**Mark the area of the interactor as requiring a redraw. This adds the
1595 specified rectangular area to an {\it update region}. If this region
1596 is not empty then a request to redraw that area of the interactor is
1597 queued to be processed by the message handling system. At some time
1598 later the \Ref{OnRedraw()} function is called with its canvas clipping
1599 region set to the update region.
1601 The parameterless form will invalidate the entire interactor.
1603 When scaling is used (#coords == LocalCoords#), the
1604 coordinates used are 1/4 average font width and 1/8 the font height.
1606 virtual void _Invalidate(
1608 /// X position of the top left corner of the rectangle to invalidate.
1610 /// Y position of the top left corner of the rectangle to invalidate.
1611 PDIMENSION width
, /// Width of the rectangle to invalidate.
1612 PDIMENSION height
, /// Height of the rectangle to invalidate.
1613 CoordinateSystem coords
/// Coordinate system to use.
1616 /**Mark the area of the interactor as {\bf not} requiring a redraw. This
1617 subtracts the specified rectangular area from an {\it update region}.
1618 If this region is not empty then a request to redraw that area of the
1619 interactor is queued to be processed by the message handling system. At
1620 some time later the \Ref{OnRedraw()} function is called with its
1621 canvas clipping region set to the update region.
1623 The parameterless form will validate the entire interactor.
1625 When scaling is used (#coords == LocalCoords#), the
1626 coordinates used are 1/4 average font width and 1/8 the font height.
1628 virtual void _Validate(
1630 /// X position of the top left corner of the rectangle to validate.
1632 /// Y position of the top left corner of the rectangle to validate.
1633 PDIMENSION width
, /// Width of the rectangle to validate.
1634 PDIMENSION height
, /// Height of the rectangle to validate.
1635 CoordinateSystem coords
/// Coordinate system to use.
1638 /**Set the position of the cursor. As there is only one cursor for the
1639 entire system this may affect other applications.
1641 The point is usually in absolute screen coordinates, ie when
1642 #coords# parameter is #ScreenCoords#, but may also
1643 be relative to the interactors origin or scaled to the interactors font
1644 based layout coordinates.
1646 Note, this may not be available on all platforms in which case it does
1647 nothing. For this and other reasons of user interfcace design, it is not
1648 recommended that this function be used.
1650 When scaling is used (#coords == LocalCoords#), the
1651 coordinates used are 1/4 average font width and 1/8 the font height.
1653 virtual void _SetCursorPos(
1654 PORDINATE x
, /// New X position of cursor.
1655 PORDINATE y
, /// New Y position of cursor.
1656 CoordinateSystem coords
/// Coordinate system to use.
1659 /**Set the position of the text caret within the interactor.
1661 When scaling is used (#coords == LocalCoords#), the
1662 coordinates used are 1/4 average font width and 1/8 the font height.
1664 virtual void _SetCaretPos(
1665 PORDINATE x
, /// New X position of caret.
1666 PORDINATE y
, /// New Y position of caret.
1667 CoordinateSystem coords
/// Coordinate system to use.
1671 /**Set the child interactor that has the focus in the \Ref{PTitledWindow}
1672 or \Ref{PInteractorLayout}.
1674 The interactor set here may not actually have the focus. It is the
1675 interactor that will be given the focus if the parent interactor,
1676 eg a dialog, is given the focus. The dialog itself never requires the
1679 The default behaviour is to pass the interactor on to its parent
1680 using its \Ref{SetFocusInteractor()} function.
1682 virtual void SetFocusInteractor(
1683 PInteractor
* interactor
/// Interactor that received focus.
1686 /**Get the child interactor that has the focus in the \Ref{PTitledWindow}
1687 or \Ref{PInteractorLayout}.
1689 The interactor returned here may not actually have the focus. It is
1690 the interactor that will be given the focus if the parent interactor,
1691 eg a dialog, is given the focus. The dialog itself never requires the
1694 The default behaviour is to get the interactor from its parent
1695 using its \Ref{GetFocusInteractor()} function.
1698 pointer to child or grandchild interactor that has focus.
1700 virtual PInteractor
* GetFocusInteractor() const;
1702 /**Scan through all child interactors and if they are a command source,
1703 execute their notification function to enable or disable the item.
1705 The default behaviour is to call \Ref{UpdateCommandSources()} for all
1708 This function is used internally by the library. It would normally not
1711 virtual void UpdateMyCommandSources();
1715 /** The interactors owner application */
1716 PApplication
* owner
;
1718 /** The interactor layout that contains this interactor. */
1719 PInteractor
* parent
;
1721 /** The list of children in this interactor layout. */
1722 PInteractorList children
;
1724 /** The font used by the interactor. */
1727 /** Flag to indicate that the parent interactor layouts cursor should be
1728 used with this interactor. */
1730 UseCurrentCursor
, UseParentCursor
, UseSetAllCursor
, UseSetAllParentCursor
1733 /** The normal mouse cursor to be used in this interactor. */
1736 /** The saved mouse cursor to be used in this interactor after a call to
1737 \Ref{RestoreAllCursors()}. */
1738 PCursor savedCursor
;
1740 /** The text caret to be used in this interactor. */
1743 /** The current location of the caret (in pixels). */
1744 PPoint caretPosition
;
1746 /** The current count for visibility of caret in interactor. */
1749 /** The foreground colour used in this interactor */
1750 PColour foregroundColour
;
1752 /** The background colour used in this interactor */
1753 PColour backgroundColour
;
1755 /** The interactor used in the dracking of a drag operation, if NULL no
1756 drag track is happening. */
1757 PInteractor
* mouseTrackInteractor
;
1759 /** The canvas used in the dracking of a drag operation, if NULL no drag
1760 track is happening. */
1761 PInteractorCanvas
* mouseTrackCanvas
;
1763 friend class PInteractorCanvas
;
1767 PInteractor(const PInteractor
& interactor
);
1768 PInteractor
& operator=(const PInteractor
& interactor
);
1769 // Cannot make copies of the interactor
1772 virtual void _OnMouseMove(PKeyCode button
, const PPoint
& where
);
1773 /* Internal function for on a mouse move, calls \Ref{OnMouseMove()} or
1774 \Ref{OnMouseTrack()}.
1777 virtual void _OnMouseUp(PKeyCode button
, const PPoint
& where
);
1778 /* Internal function for on a mouse move, calls \Ref{OnMouseUp()} or
1779 \Ref{OnMouseTrack()}.
1783 // Include platform dependent part of class
1784 #include <pwlib/interact.h>
1788 // End Of File ///////////////////////////////////////////////////////////////