4 * Splitter Interactor GUI 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.10 1999/03/09 08:01:47 robertj
31 * Changed comments for doc++ support (more to come).
33 * Revision 1.9 1999/02/16 08:08:28 robertj
34 * MSVC 6.0 compatibility changes.
36 * Revision 1.8 1998/09/23 06:19:59 robertj
37 * Added open source copyright license.
39 * Revision 1.7 1996/04/30 12:33:43 robertj
40 * Changed "inPixels" boolean to enum for three coordinate systems.
42 * Revision 1.6 1995/07/02 01:20:57 robertj
43 * Removed OnDoubleClick() and added BOOL to OnMouseDown() for double click.
45 * Revision 1.5 1995/06/17 11:13:27 robertj
46 * Documentation update.
48 * Revision 1.4 1995/06/04 12:37:17 robertj
49 * Added function to set splitter split by percentage.
51 * Revision 1.3 1995/03/14 12:42:41 robertj
52 * Updated documentation to use HTML codes.
54 * Revision 1.2 1995/01/16 09:42:06 robertj
57 * Revision 1.1 1994/10/23 04:58:43 robertj
71 /**An interactor that allow the placement of two other interactors next to
72 each other with a bar between them that allows the adjustment of the
73 proportions that the two interactors take up.
75 The last two child interactors of the splitter are used as the two
76 interactors to "split".
78 This is an abstract class for horizontal and vertical versions.
80 class PSplitter
: public PInteractor
82 PCLASSINFO(PSplitter
, PInteractor
);
85 /**@name Construction */
87 /** Create a splitter interactor. */
89 PInteractor
* parent
/// Parent interactor for splitter.
94 /**@name New functions for class */
96 /**This function sets the split to the specified percentage, adjusting the
97 child windows accordingly.
99 virtual void SetPercent(
100 PDIMENSION percent
/// Percentage split.
106 /**@name Overrides from class PInteractor */
108 /**The system calls this whenever the mouse moves over the interactors
111 This behaviour in a splitter is to track the movement of the "bar"
112 between the two interactors.
114 virtual void OnMouseMove(
116 /**This key code is used to determine the modifiers (eg shift, control
117 etc) that were active while the mouse was moved over the interactor.
118 The value part of the key code is irrelevent.
121 /**The position of the mouse pointer provided in pixels with its origin
122 at the top left of the interactor.
126 /**The system calls this whenever a mouse button is pressed in the
127 interactors usable area.
129 This behaviour in a splitter is to begin tracking the movement of the
130 "bar" between the two interactors.
132 virtual void OnMouseDown(
134 /**This key code is used to determine which mouse button was pressed and
135 what modifiers that were active at that time. The mouse button that
136 caused this call back is in the value part of the key code. The
137 modifiers may indicate other mouse buttons being down at the same
140 const PPoint
& where
,
141 /**The position of the mouse pointer provided in pixels with its origin
142 at the top left of the interactor.
145 /// Is TRUE if the mouse down is the second click of a double click.
149 /**The system calls this whenever a mouse button is released in the
150 interactors usable area.
152 This behaviour in a splitter is to finish tracking the movement of the
153 "bar" between the two interactors. The two child interactors are then
154 resized at this point via a call to the splitter
155 \ref{PInteractor::SetDimensions()} function.
157 virtual void OnMouseUp(
159 /**This key code is used to determine which mouse button was pressed and
160 what modifiers that were active at that time. The mouse button that
161 caused this call back is in the value part of the key code. The
162 modifiers may indicate other mouse buttons being down at the same
166 /**The position of the mouse pointer provided in pixels with its origin
167 at the top left of the interactor.
171 /**The system calls this whenever it requires that the interactors usable
172 area needs to be updated and redrawn.
174 This behaviour in a splitter is to draw the "bar" between the two
177 virtual void OnRedraw(
178 PCanvas
& canvas
/// Canvas to use when drawing the interactor contents.
183 /**@name New functions for class */
185 /**Track the adjustment of the splitter divider. This is called from the
186 ancestor class during the mouse tracking operation. It determines
187 whether the bar moves vertically or horzontally.
189 virtual void TrackSplitter(
190 const PPoint
& where
/// Mouse location during the track.
193 /**Adjust the child interactors according to the split.
195 void AdjustChildInteractors(
196 PDIMENSION width1
, /// Width of first child interactor.
197 PDIMENSION height1
, /// Height of first child interactor.
198 PORDINATE x2
, /// X position of second child interactor.
199 PORDINATE y2
, /// Y position of second child interactor.
200 PDIMENSION width2
, /// Width of second child interactor.
201 PDIMENSION height2
/// Height of second child interactor.
207 /// Rectangle for the position of the bar between the interactors.
210 /**Canvas used to draw the tracking of the movement of the bar between
211 the interactors. This is only non-null when the mouse was clicked in
212 the interactor, ie via \ref{OnMouseDown()}.
214 PDrawCanvas
* trackCanvas
;
218 /**An interactor that allow the placement of two other interactors next to
219 each other with a bar between them that allows the adjustment of the
220 proportions that the two interactors take up.
222 The last two child interactors of the splitter are used as the two
223 interactors to "split".
225 This places the two interactors to the left and right with a vertical "bar"
228 class PVerticalSplitter
: public PSplitter
230 PCLASSINFO(PVerticalSplitter
, PSplitter
);
233 /**@name Construction */
235 /** Create a verical splitter interactor. */
237 PInteractor
* parent
/// Parent interactor for splitter.
241 /**@name Overrides from class PSplitter */
243 /**This function sets the split to the specified percentage, adjusting the
244 child windows accordingly.
247 PDIMENSION percent
/// Percentage split.
253 /**@name Overrides from class PInteractor */
255 /**Set the dimensions of the interactor, and then resize the two child
256 interactors being split. The original proportions given to the child
257 interactors is maintained.
259 virtual void _SetDimensions(
260 PDIMENSION width
, /// New width to apply to interactor.
261 PDIMENSION height
, /// New height to apply to interactor.
262 CoordinateSystem coords
/// Coordinate system to use.
266 /**@name Overrides from class PSplitter */
268 /**Track the adjustment of the splitter divider. This is called from the
269 ancestor class during the mouse tracking operation. It determines
270 whether the bar moves vertically or horzontally. In this case
273 virtual void TrackSplitter(
274 const PPoint
& where
// Mouse location during the track.
281 /**An interactor that allow the placement of two other interactors next to
282 each other with a bar between them that allows the adjustment of the
283 proportions that the two interactors take up.
285 The last two child interactors of the splitter are used as the two
286 interactors to "split".
288 This places the two interactors to the top and bottom with a horizontal
291 class PHorizontalSplitter
: public PSplitter
293 PCLASSINFO(PHorizontalSplitter
, PSplitter
);
296 /**@name Construction */
299 PInteractor
* parent
// Parent interactor for splitter.
301 // Create a horizontal splitter interactor.
304 /**@name Overrides from class PSplitter */
306 /**This function sets the split to the specified percentage, adjusting the
307 child windows accordingly.
310 PDIMENSION percent
/// Percentage split.
316 /**@name Overrides from class PInteractor */
318 /**Set the dimensions of the interactor, and then resize the two child
319 interactors being split. The original proportions given to the child
320 interactors is maintained.
322 virtual void _SetDimensions(
323 PDIMENSION width
, /// New width to apply to interactor.
324 PDIMENSION height
, /// New height to apply to interactor.
325 CoordinateSystem coords
/// Coordinate system to use.
329 /**@name Overrides from class PSplitter */
331 /**Track the adjustment of the splitter divider. This is called from the
332 ancestor class during the mouse tracking operation. It determines
333 whether the bar moves vertically or horzontally. In this case
336 virtual void TrackSplitter(
337 const PPoint
& where
/// Mouse location during the track.
346 // End Of File ///////////////////////////////////////////////////////////////