]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/controlbar.h
use given position for page insertion instead of trying to find the page to insert...
[wxWidgets.git] / contrib / include / wx / fl / controlbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: controlbar.h
3 // Purpose: Central header file for control-bar related classes
4 //
5 // Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
6 // Modified by:
7 // Created: 06/09/98
8 // RCS-ID: $Id$
9 // Copyright: (c) Aleksandras Gluchovas
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __CONTROLBAR_G__
14 #define __CONTROLBAR_G__
15
16 #if defined(__GNUG__) && !defined(__APPLE__)
17 #pragma interface "controlbar.h"
18 #endif
19
20 #include "wx/defs.h"
21 #include "wx/string.h"
22 #include "wx/pen.h"
23 #include "wx/window.h"
24 #include "wx/dynarray.h"
25 #include "wx/fl/fldefs.h"
26
27 #define WXCONTROLBAR_VERSION 1.3
28
29 // forward declarations
30
31 class WXDLLIMPEXP_FL wxFrameLayout;
32
33 class WXDLLIMPEXP_FL cbDockPane;
34 class WXDLLIMPEXP_FL cbUpdatesManagerBase;
35 class WXDLLIMPEXP_FL cbBarDimHandlerBase;
36 class WXDLLIMPEXP_FL cbPluginBase;
37 class WXDLLIMPEXP_FL cbPluginEvent;
38 class WXDLLIMPEXP_FL cbPaneDrawPlugin;
39
40 class WXDLLIMPEXP_FL cbBarInfo;
41 class WXDLLIMPEXP_FL cbRowInfo;
42 class WXDLLIMPEXP_FL cbDimInfo;
43 class WXDLLIMPEXP_FL cbCommonPaneProperties;
44
45 typedef cbBarInfo* BarInfoPtrT;
46 typedef cbRowInfo* RowInfoPtrT;
47
48 WXFL_DEFINE_ARRAY_PTR( BarInfoPtrT, BarArrayT );
49 WXFL_DEFINE_ARRAY_PTR( RowInfoPtrT, RowArrayT );
50
51 // control bar states
52
53 #define wxCBAR_DOCKED_HORIZONTALLY 0
54 #define wxCBAR_DOCKED_VERTICALLY 1
55 #define wxCBAR_FLOATING 2
56 #define wxCBAR_HIDDEN 3
57
58 // the states are enumerated above
59 #define MAX_BAR_STATES 4
60
61 // control bar alignments
62
63 #if !defined(FL_ALIGN_TOP)
64
65 #define FL_ALIGN_TOP 0
66 #define FL_ALIGN_BOTTOM 1
67 #define FL_ALIGN_LEFT 2
68 #define FL_ALIGN_RIGHT 3
69
70 #endif
71
72 // one pane for each alignment
73 #define MAX_PANES 4
74
75 // masks for each pane
76
77 #define FL_ALIGN_TOP_PANE 0x0001
78 #define FL_ALIGN_BOTTOM_PANE 0x0002
79 #define FL_ALIGN_LEFT_PANE 0x0004
80 #define FL_ALIGN_RIGHT_PANE 0x0008
81
82 #define wxALL_PANES 0x000F
83
84 // enumeration of hittest results, see cbDockPane::HitTestPaneItems(..)
85
86 enum CB_HITTEST_RESULT
87 {
88 CB_NO_ITEMS_HITTED,
89
90 CB_UPPER_ROW_HANDLE_HITTED,
91 CB_LOWER_ROW_HANDLE_HITTED,
92 CB_LEFT_BAR_HANDLE_HITTED,
93 CB_RIGHT_BAR_HANDLE_HITTED,
94 CB_BAR_CONTENT_HITTED
95 };
96
97 /*
98 Helper class, used for spying for unhandled mouse events on control bars
99 and forwarding them to the frame layout.
100 */
101
102 class WXDLLIMPEXP_FL cbBarSpy : public wxEvtHandler
103 {
104 public:
105 DECLARE_DYNAMIC_CLASS( cbBarSpy )
106
107 wxFrameLayout* mpLayout;
108 wxWindow* mpBarWnd;
109
110 public:
111 // Default constructor.
112
113 cbBarSpy(void);
114
115 // Constructor, taking a parent pane.
116
117 cbBarSpy( wxFrameLayout* pPanel );
118
119 // Sets the bar window.
120
121 void SetBarWindow( wxWindow* pWnd );
122
123 // Performs special event processing.
124
125 virtual bool ProcessEvent(wxEvent& event);
126 };
127
128 /*
129 wxFrameLayout manages containment and docking of control bars,
130 which can be docked along the top, bottom, right, or left side of the
131 parent frame.
132 */
133
134 class WXDLLIMPEXP_FL wxFrameLayout : public wxEvtHandler
135 {
136 public:
137 // Default constructor, used only for serialization.
138
139 wxFrameLayout();
140
141 // Constructor, taking parent window, the (MDI) client of the parent if there
142 // is one, and flag specifying whether to activate the layout.
143
144 wxFrameLayout( wxWindow* pParentFrame,
145 wxWindow* pFrameClient = NULL,
146 bool activateNow = true );
147
148 // Destructor. It does not destroy the bar windows.
149
150 virtual ~wxFrameLayout();
151
152 // Enables floating behaviour. By default floating of control bars is on.
153
154 virtual void EnableFloating( bool enable = true );
155
156 // Activate can be called after some other layout has been deactivated,
157 // and this one must take over the current contents of the frame window.
158 //
159 // Effectively hooks itself to the frame window, re-displays all non-hidden
160 // bar windows and repaints the decorations.
161
162 virtual void Activate();
163
164 // Deactivate unhooks itself from frame window, and hides all non-hidden windows.
165 //
166 // Note: two frame layouts should not be active at the same time in the
167 // same frame window, since it would cause messy overlapping of bar windows
168 // from both layouts.
169
170 virtual void Deactivate();
171
172 // Hides the bar windows, and also the client window if present.
173
174 void HideBarWindows();
175
176 // Destroys the bar windows.
177
178 virtual void DestroyBarWindows();
179
180 // Passes the client window (e.g. MDI client window) to be controlled by
181 // frame layout, the size and position of which should be adjusted to be
182 // surrounded by controlbar panes, whenever the frame is resized or the dimensions
183 // of control panes change.
184
185 void SetFrameClient( wxWindow* pFrameClient );
186
187 // Returns the frame client, or NULL if not present.
188
189 wxWindow* GetFrameClient();
190
191 // Returns the parent frame.
192
193 wxWindow& GetParentFrame() { return *mpFrame; }
194
195 // Returns an array of panes. Used by update managers.
196
197 cbDockPane** GetPanesArray() { return mPanes; }
198
199 // Returns a pane for the given alignment. See pane alignment types.
200
201 cbDockPane* GetPane( int alignment )
202
203 { return mPanes[alignment]; }
204
205 // Adds bar information to the frame layout. The appearance of the layout is not refreshed
206 // immediately; RefreshNow() can be called if necessary.
207 //
208 // Notes: the argument pBarWnd can by NULL, resulting in bar decorations to be drawn
209 // around the empty rectangle (filled with default background colour).
210 // Argument dimInfo can be reused for adding any number of bars, since
211 // it is not used directly - instead its members are copied. If the dimensions
212 // handler is present, its instance is shared (reference counted). The dimension
213 // handler should always be allocated on the heap.
214
215 // pBarWnd is the window to be managed.
216
217 // dimInfo contains dimension information.
218
219 // alignment is a value such as FL_ALIGN_TOP.
220
221 // rowNo is the vertical position or row in the pane (if in docked state).
222
223 // columnPos is the horizontal position within the row in pixels (if in docked state).
224
225 // name is a name by which the bar can be referred in layout customization dialogs.
226
227 // If spyEvents is true, input events for the bar should be "spyed" in order
228 // to forward unhandled mouse clicks to the frame layout, for example to enable
229 // easy draggablity of toolbars just by clicking on their interior regions.
230 // For widgets like text/tree control this value should be false,
231 // since there's no certain way to detect whether the event was actually handled.
232
233 // state is the initial state, such as wxCBAR_DOCKED_HORIZONTALLY,
234 // wxCBAR_FLOATING, wxCBAR_HIDDEN.
235
236 virtual void AddBar( wxWindow* pBarWnd,
237 const cbDimInfo& dimInfo,
238
239 // defaults:
240 int alignment = FL_ALIGN_TOP,
241 int rowNo = 0,
242 int columnPos = 0,
243 const wxString& name = wxT("bar"),
244 bool spyEvents = false,
245 int state = wxCBAR_DOCKED_HORIZONTALLY
246 );
247
248 // ReddockBar can be used for repositioning existing bars. The given bar is first removed
249 // from the pane it currently belongs to, and inserted into the pane, which "matches"
250 // the given rectangular area. If pToPane is not NULL, the bar is docked to this given pane.
251 // To dock a bar which is floating, use the wxFrameLayout::DockBar method.
252
253 virtual bool RedockBar( cbBarInfo* pBar, const wxRect& shapeInParent,
254 cbDockPane* pToPane = NULL, bool updateNow = true );
255
256 // Finds the bar in the framelayout, by name.
257
258 cbBarInfo* FindBarByName( const wxString& name );
259
260 // Finds the bar in the framelayout, by window.
261
262 cbBarInfo* FindBarByWindow( const wxWindow* pWnd );
263
264 // Gets an array of bars.
265
266 BarArrayT& GetBars();
267
268 // Changes the bar's docking state (see possible control bar states).
269
270 void SetBarState( cbBarInfo* pBar, int newStatem, bool updateNow );
271
272 // Toggles the bar between visible and hidden.
273
274 void InverseVisibility( cbBarInfo* pBar );
275
276 // Reflects changes in bar information structure visually.
277 // For example, moves the bar, changes its dimension information,
278 // or changes the pane to which it is docked.
279
280 void ApplyBarProperties( cbBarInfo* pBar );
281
282 // Removes the bar from the layout permanently, and hides its corresponding window if present.
283
284 void RemoveBar( cbBarInfo* pBar );
285
286 // Recalculates the layout of panes, and all bars/rows in each pane.
287
288 virtual void RecalcLayout( bool repositionBarsNow = false );
289
290 // Returns the client height.
291
292 int GetClientHeight();
293
294 // Returns the client width.
295
296 int GetClientWidth();
297
298 // Returns the client's rectangle.
299
300 wxRect& GetClientRect() { return mClntWndBounds; }
301
302 // Returns a reference to the updates manager.
303 // Note: in future, the updates manager will become a normal plugin.
304
305 cbUpdatesManagerBase& GetUpdatesManager();
306
307 // Destroys the previous manager if any, and sets the new one.
308
309 void SetUpdatesManager( cbUpdatesManagerBase* pUMgr );
310
311 // Gets the pane properties for the given alignment.
312
313 virtual void GetPaneProperties( cbCommonPaneProperties& props, int alignment = FL_ALIGN_TOP );
314
315 // Sets the pane properties for the given alignment.
316 // Note: changing properties of panes does not result immediate on-screen update.
317
318 virtual void SetPaneProperties( const cbCommonPaneProperties& props,
319 int paneMask = wxALL_PANES );
320
321 // Sets the margins for the given panes.
322 // The margins should go into cbCommonPaneProperties in the future.
323 //
324 // Note: this method should be called before any custom plugins are attached.
325
326 virtual void SetMargins( int top, int bottom, int left, int right,
327 int paneMask = wxALL_PANES );
328
329 // Sets the pane background colour.
330
331 virtual void SetPaneBackground( const wxColour& colour );
332
333 // Recalculates layout and performs on-screen update of all panes.
334
335 void RefreshNow( bool recalcLayout = true );
336
337 // Event handler for a size event.
338
339 void OnSize ( wxSizeEvent& event );
340
341 // Event handler for a left down button event.
342
343 void OnLButtonDown( wxMouseEvent& event );
344
345 // Event handler for a left doubleclick button event.
346
347 void OnLDblClick ( wxMouseEvent& event );
348
349 // Event handler for a left button up event.
350
351 void OnLButtonUp ( wxMouseEvent& event );
352
353 // Event handler for a right button down event.
354
355 void OnRButtonDown( wxMouseEvent& event );
356
357 // Event handler for a right button up event.
358
359 void OnRButtonUp ( wxMouseEvent& event );
360
361 // Event handler for a mouse move event.
362
363 void OnMouseMove ( wxMouseEvent& event );
364
365 // This function should be used instead of passing the event to the ProcessEvent method
366 // of the top-level plugin directly. This method checks if events are currently
367 // captured and ensures that plugin-event is routed correctly.
368
369 virtual void FirePluginEvent( cbPluginEvent& event );
370
371 // Captures user input events for the given plugin.
372 // Input events are: mouse movement, mouse clicks, keyboard input.
373
374 virtual void CaptureEventsForPlugin ( cbPluginBase* pPlugin );
375
376 // Releases user input events for the given plugin.
377 // Input events are: mouse movement, mouse clicks, keyboard input
378
379 virtual void ReleaseEventsFromPlugin( cbPluginBase* pPlugin );
380
381 // Called by plugins; also captures the mouse in the parent frame.
382
383 void CaptureEventsForPane( cbDockPane* toPane );
384
385 // Called by plugins; also releases mouse in the parent frame.
386
387 void ReleaseEventsFromPane( cbDockPane* fromPane );
388
389 // Returns the current top-level plugin (the one that receives events first,
390 // except if input events are currently captured by some other plugin).
391
392 virtual cbPluginBase& GetTopPlugin();
393
394 // Hooking custom plugins to frame layout.
395 //
396 // Note: when hooking one plugin on top of the other,
397 // use SetNextHandler or similar methods
398 // of wxEvtHandler class to compose the chain of plugins,
399 // than pass the left-most handler in this chain to
400 // the above methods (assuming that events are delegated
401 // from left-most towards right-most handler).
402 //
403 // This secenario is very inconvenient and "low-level",
404 // so use the Add/Push/PopPlugin methods instead.
405
406 virtual void SetTopPlugin( cbPluginBase* pPlugin );
407
408 // Similar to wxWindow's "push/pop-event-handler" methods, execept
409 // that the plugin is deleted upon "popping".
410
411 virtual void PushPlugin( cbPluginBase* pPugin );
412
413 // Similar to wxWindow's "push/pop-event-handler" methods, execept
414 // that the plugin is deleted upon "popping".
415
416 virtual void PopPlugin();
417
418 // Pop all plugins.
419 virtual void PopAllPlugins();
420
421 // Adds the default plugins. These are cbPaneDrawPlugin, cbRowLayoutPlugin, cbBarDragPlugin,
422 // cbAntiflickerPlugin, cbSimpleCustomizePlugin.
423 //
424 // This method is automatically invoked if no plugins were found upon
425 // firing of the first plugin-event, i.e. when wxFrameLayout configures itself.
426
427 virtual void PushDefaultPlugins();
428
429 // An advanced methods for plugin configuration using their
430 // dynamic class information, for example CLASSINFO(pluginClass).
431
432 // First checks if the plugin of the given class is already "hooked up".
433 // If not, adds it to the top of the plugins chain.
434
435 virtual void AddPlugin( wxClassInfo* pPlInfo, int paneMask = wxALL_PANES );
436
437 // First checks if the plugin of the given class is already hooked.
438 // If so, removes it, and then inserts it into the chain
439 // before the plugin of the class given by pNextPlInfo.
440 //
441 // Note: this method is handy in some cases where the order
442 // of the plugin-chain could be important, for example when one plugin overrides
443 // some functionality of another already-hooked plugin,
444 // so that the former plugin should be hooked before the one
445 // whose functionality is being overridden.
446
447 virtual void AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
448 int paneMask = wxALL_PANES );
449
450 // Checks if the plugin of the given class is hooked, and removes
451 // it if found.
452
453 virtual void RemovePlugin( wxClassInfo* pPlInfo );
454
455 // Finds a plugin with the given class, or returns NULL if a plugin of the given
456 // class is not hooked.
457
458 virtual cbPluginBase* FindPlugin( wxClassInfo* pPlInfo );
459
460 // Returns true if there is a top plugin.
461
462 bool HasTopPlugin();
463
464 DECLARE_EVENT_TABLE()
465 DECLARE_DYNAMIC_CLASS( wxFrameLayout )
466
467 public: /* protected really, acessed only by plugins and serializers */
468
469 friend class cbDockPane;
470 friend class wxBarHandler;
471
472 wxWindow* mpFrame; // parent frame
473 wxWindow* mpFrameClient; // client window
474 cbDockPane* mPanes[MAX_PANES]; // panes in the panel
475
476 // misc. cursors
477 wxCursor* mpHorizCursor;
478 wxCursor* mpVertCursor;
479 wxCursor* mpNormalCursor;
480 wxCursor* mpDragCursor;
481 wxCursor* mpNECursor; // no-entry cursor
482
483 // pens for decoration and shades
484
485 wxPen mDarkPen; // default wxSYS_COLOUR_3DSHADOW
486 wxPen mLightPen; // default wxSYS_COLOUR_3DHILIGHT
487 wxPen mGrayPen; // default wxSYS_COLOUR_3DFACE
488 wxPen mBlackPen; // default wxColour( 0, 0, 0)
489 wxPen mBorderPen; // default wxSYS_COLOUR_3DFACE
490
491 wxPen mNullPen; // transparent pen
492
493 // pane to which the all mouse input is currently directed (caputred)
494
495 cbDockPane* mpPaneInFocus;
496
497 // pane, from which mouse pointer had just left
498
499 cbDockPane* mpLRUPane;
500
501 // bounds of client window in parent frame's coordinates
502
503 wxRect mClntWndBounds;
504 wxRect mPrevClntWndBounds;
505
506 bool mFloatingOn;
507 wxPoint mNextFloatedWndPos;
508 wxSize mFloatingPosStep;
509
510 // current plugin (right-most) plugin which receives events first
511
512 cbPluginBase* mpTopPlugin;
513
514 // plugin, which currently has captured all input events, otherwise NULL
515
516 cbPluginBase* mpCaputesInput;
517
518 // list of event handlers which are "pushed" onto each bar, to catch
519 // mouse events which are not handled by bars, and froward them to the ,
520 // frome-layout and further to plugins
521
522 wxList mBarSpyList;
523
524 // list of top-most frames which contain floated bars
525
526 wxList mFloatedFrames;
527
528 // linked list of references to all bars (docked/floated/hidden)
529
530 BarArrayT mAllBars;
531
532 // FOR NOW:: dirty stuff...
533 bool mClientWndRefreshPending;
534 bool mRecalcPending;
535 bool mCheckFocusWhenIdle;
536
537 public: /* protected really (accessed only by plugins) */
538
539 // refrence to custom updates manager
540 cbUpdatesManagerBase* mpUpdatesMgr;
541
542 // Called to apply the calculated layout to window objects.
543
544 void PositionClientWindow();
545
546 // Called to apply the calculated layout to window objects.
547
548 void PositionPanes();
549
550 // Creates the cursors.
551
552 void CreateCursors();
553
554 // Applies the calculated layout to a floating bar.
555
556 void RepositionFloatedBar( cbBarInfo* pBar );
557
558 // Applies the state to the window objects.
559
560 void DoSetBarState( cbBarInfo* pBar );
561
562 // The purpose of this function is unknown.
563
564 bool LocateBar( cbBarInfo* pBarInfo,
565 cbRowInfo** ppRow,
566 cbDockPane** ppPane );
567
568
569 // Returns true if the position is within the given pane.
570
571 bool HitTestPane( cbDockPane* pPane, int x, int y );
572
573 // Returns the pane for which the rectangle hit test succeeds, giving
574 // preference to the given pane if supplied.
575
576 cbDockPane* HitTestPanes( const wxRect& rect, cbDockPane* pCurPane );
577
578 // Returns the pane to which the given bar belongs.
579
580 cbDockPane* GetBarPane( cbBarInfo* pBar );
581
582 // Delegated from "bar-spy".
583 void ForwardMouseEvent( wxMouseEvent& event,
584 cbDockPane* pToPane,
585 int eventType );
586
587 // Routes the mouse event to the appropriate pane.
588
589 void RouteMouseEvent( wxMouseEvent& event, int pluginEvtType );
590
591 // Shows all floated windows.
592
593 void ShowFloatedWindows( bool show );
594
595 // Unhooks the layout from the frame.
596
597 void UnhookFromFrame();
598
599 // Hooks the layout up to the frame (pushes the layout onto the
600 // frame's event handler stack).
601
602 void HookUpToFrame();
603
604 // Returns true if the platform allows reparenting. This may not return true
605 // for all platforms. Reparenting allows control bars to be floated.
606
607 bool CanReparent();
608
609 // Reparents pChild to have parent pNewParent.
610
611 void ReparentWindow( wxWindow* pChild, wxWindow* pNewParent );
612
613 // Returns the previous client window rectangle.
614
615 wxRect& GetPrevClientRect() { return mPrevClntWndBounds; }
616
617 // Handles paint events, calling PaintPane for each pane.
618
619 void OnPaint( wxPaintEvent& event );
620
621 // Handles background erase events. Currently does nothing.
622
623 void OnEraseBackground( wxEraseEvent& event );
624
625 // Handles focus kill events. Currently does nothing.
626
627 void OnKillFocus( wxFocusEvent& event );
628
629 // Handles focus set events. Currently does nothing.
630
631 void OnSetFocus( wxFocusEvent& event );
632
633 // Handles activation events. Currently does nothing.
634
635 void OnActivate( wxActivateEvent& event );
636
637 // Handles idle events.
638
639 void OnIdle( wxIdleEvent& event );
640
641 // Returns a new cbGCUpdatesMgr object.
642
643 virtual cbUpdatesManagerBase* CreateUpdatesManager();
644 };
645
646 /*
647 A structure that is present in each item of layout,
648 used by any particular updates-manager to store
649 auxiliary information to be used by its updating algorithm.
650 */
651
652 class WXDLLIMPEXP_FL cbUpdateMgrData : public wxObject
653 {
654 DECLARE_DYNAMIC_CLASS( cbUpdateMgrData )
655 public:
656 wxRect mPrevBounds; // previous state of layout item (in parent frame's coordinates)
657
658 bool mIsDirty; // overrides result of current-against-previous bounds comparison,
659 // i.e. requires item to be updated, regardless of it's current area
660
661 wxObject* mpCustomData; // any custom data stored by specific updates mgr.
662
663 // Default constructor. Is-dirty flag is set true initially.
664
665 cbUpdateMgrData();
666
667 // Store the item state.
668
669 void StoreItemState( const wxRect& boundsInParent );
670
671 // Set the dirty flag.
672
673 void SetDirty( bool isDirty = true );
674
675 // Set custom data.
676
677 void SetCustomData( wxObject* pCustomData );
678
679 // Returns the is-dirty flag.
680
681 inline bool IsDirty() { return mIsDirty; }
682 };
683
684 /*
685 Abstract interface for bar-size handler classes.
686 These objects receive notifications whenever the docking
687 state of the bar is changed, thus they provide the possibility
688 to adjust the values in cbDimInfo::mSizes accordingly.
689 Specific handlers can be hooked up to specific types of bar.
690 */
691
692 class WXDLLIMPEXP_FL cbBarDimHandlerBase : public wxObject
693 {
694 DECLARE_ABSTRACT_CLASS( cbBarDimHandlerBase )
695
696 public:
697 int mRefCount; // since one dim-handler can be assigned
698 // to multiple bars, it's instance is
699 // reference-counted
700 public:
701
702 // Default constructor. The initial reference count is 0, since
703 // the handler is not used until the first invocation of AddRef().
704
705 cbBarDimHandlerBase();
706
707 // Increments the reference count.
708
709 void AddRef();
710
711 // Decrements the reference count, and if the count is at zero,
712 // delete 'this'.
713
714 void RemoveRef();
715
716 // Responds to "bar-state-changes" notifications.
717
718 virtual void OnChangeBarState(cbBarInfo* pBar, int newState ) = 0;
719
720 // Responds to bar resize notifications.
721
722 virtual void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred ) = 0;
723 };
724
725 /*
726 Helper class used internally by the wxFrameLayout class.
727 Holds and manages information about bar dimensions.
728 */
729
730 class WXDLLIMPEXP_FL cbDimInfo : public wxObject
731 {
732 DECLARE_DYNAMIC_CLASS( cbDimInfo )
733 public:
734 wxSize mSizes[MAX_BAR_STATES]; // preferred sizes for each possible bar state
735
736 wxRect mBounds[MAX_BAR_STATES]; // saved positions and sizes for each
737 // possible state, values contain (-1)s if
738 // not initialized yet
739
740 int mLRUPane; // pane to which this bar was docked before it was floated
741 // (FL_ALIGN_TOP,FL_ALIGN_BOTTOM,..)
742
743 // top/bottom gap, separates decorations
744 // from the bar's actual window, filled
745 // with frame's beckground color, default: 0
746
747 int mVertGap;
748
749 // left/right gap, separates decorations
750 // from the bar's actual wndow, filled
751 // with frame's beckground colour, default: 0
752
753 int mHorizGap; // NOTE:: gaps are given in frame's coord. orientation
754
755 // true, if vertical/horizontal dimensions cannot be mannualy adjusted
756 // by user using resizing handles. If false, the frame-layout
757 // *automatically* places resizing handles among not-fixed bars
758
759 bool mIsFixed;
760
761 cbBarDimHandlerBase* mpHandler; // NULL, if no handler present
762
763 public:
764
765 // Default constructor.
766
767 cbDimInfo(void);
768
769 // Constructor.
770 // isFixed is true if vertical/horizontal dimensions cannot be manually adjusted
771 // by the user using resizing handles. If false, the frame-layout
772 // automatically places resizing handles among bars that do are not fixed.
773
774 cbDimInfo( cbBarDimHandlerBase* pDimHandler,
775 bool isFixed // (see comments on mIsFixed member)
776 );
777
778 // Constructor taking dimenstion information.
779 //
780 // dh_x, dh_y are the dimensions when docked horizontally.
781 //
782 // dv_x, dv_y are the dimensions when docked vertically.
783 //
784 // f_x, f_y are the dimensions when floating.
785 //
786 // For information on isFixed, see comments above.
787 //
788 // horizGap is the left/right gap, separating decorations
789 // from the bar's actual wndow, filled with the frame's background colour.
790 // The dimension is given in the frame's coordinates.
791 //
792 // vertGap is the top/bottom gap, separating decorations
793 // from the bar's actual wndow, filled with the frame's background colour.
794 // The dimension is given in the frame's coordinates.
795
796 cbDimInfo( int dh_x, int dh_y,
797 int dv_x, int dv_y,
798 int f_x, int f_y,
799
800 bool isFixed = true,
801 int horizGap = 6,
802 int vertGap = 6,
803
804 cbBarDimHandlerBase* pDimHandler = NULL
805 );
806
807 // Constructor.
808
809 cbDimInfo( int x, int y,
810 bool isFixed = true,
811 int gap = 6,
812 cbBarDimHandlerBase* pDimHandler = NULL
813 );
814
815 // Destructor. Destroys handler automatically, if present.
816
817 ~cbDimInfo();
818
819 // Assignment operator.
820
821 const cbDimInfo& operator=( const cbDimInfo& other );
822
823 // Returns the handler, if any.
824
825 inline cbBarDimHandlerBase* GetDimHandler() { return mpHandler; }
826 };
827
828 // FIXME: this array definition compiles but probably doesn't do what was intended (GD)
829 WXFL_DEFINE_ARRAY_LONG(float, cbArrayFloat);
830
831 /*
832 Helper class used internally by the wxFrameLayout class.
833 Holds and manages information about bar rows.
834 */
835
836 class cbRowInfo : public wxObject
837 {
838 DECLARE_DYNAMIC_CLASS( cbRowInfo )
839 public:
840
841 BarArrayT mBars; // row content
842
843 // row flags (set up according to row-relations)
844
845 bool mHasUpperHandle;
846 bool mHasLowerHandle;
847 bool mHasOnlyFixedBars;
848 int mNotFixedBarsCnt;
849
850 int mRowWidth;
851 int mRowHeight;
852 int mRowY;
853
854 // stores precalculated row's bounds in parent frame's coordinates
855 wxRect mBoundsInParent;
856
857 // info stored for updates-manager
858 cbUpdateMgrData mUMgrData;
859
860 cbRowInfo* mpNext;
861 cbRowInfo* mpPrev;
862
863 cbBarInfo* mpExpandedBar; // NULL, if non of the bars is currently expanded
864
865 cbArrayFloat mSavedRatios; // length-ratios bofore some of the bars was expanded
866
867 public:
868 // Constructor.
869
870 cbRowInfo(void);
871
872 // Destructor.
873
874 ~cbRowInfo();
875
876 // Returns the first bar.
877
878 inline cbBarInfo* GetFirstBar()
879
880 { return mBars.GetCount() ? mBars[0] : NULL; }
881 };
882
883 /*
884 Helper class used internally by the wxFrameLayout class.
885 Holds and manages bar information.
886 */
887
888 class cbBarInfo : public wxObject
889 {
890 DECLARE_DYNAMIC_CLASS( cbBarInfo )
891 public:
892 // textual name, by which this bar is referred in layout-customization dialogs
893 wxString mName;
894
895 // stores bar's bounds in pane's coordinates
896 wxRect mBounds;
897
898 // stores precalculated bar's bounds in parent frame's coordinates
899 wxRect mBoundsInParent;
900
901 // back-ref to the row, which contains this bar
902 cbRowInfo* mpRow;
903
904 // are set up according to the types of the surrounding bars in the row
905 bool mHasLeftHandle;
906 bool mHasRightHandle;
907
908 // determines if this bar can float. The layout's setting as priority. For
909 // example, if the layout's mFloatingOn is false, this setting is irrelevant
910 // since nothing will float at all. If the layout's floating is on, use this
911 // setting to prevent specific bars from floating. In other words, all bars
912 // float by default and floating can be turned off on individual bars.
913 bool mFloatingOn; // default: ON (which is also the layout's mFloatingOn default setting)
914
915 cbDimInfo mDimInfo; // preferred sizes for each, control bar state
916
917 int mState; // (see definition of controlbar states)
918
919 int mAlignment; // alignment of the pane to which this
920 // bar is currently placed
921
922 int mRowNo; // row, into which this bar would be placed,
923 // when in the docking state
924
925 wxWindow* mpBarWnd; // the actual window object, NULL if no window
926 // is attached to the control bar (possible!)
927
928 double mLenRatio; // length ratio among not-fixed-size bars
929
930 wxPoint mPosIfFloated; // stored last position when bar was in "floated" state
931 // poistion is stored in parent-window's coordinates
932
933 cbUpdateMgrData mUMgrData; // info stored for updates-manager
934
935 cbBarInfo* mpNext; // next. bar in the row
936 cbBarInfo* mpPrev; // prev. bar in the row
937
938 public:
939 // Constructor.
940
941 cbBarInfo(void);
942
943 // Destructor.
944
945 ~cbBarInfo();
946
947 // Returns true if this bar is fixed.
948
949 inline bool IsFixed() const { return mDimInfo.mIsFixed; }
950
951 // Returns true if this bar is expanded.
952
953 inline bool IsExpanded() const { return this == mpRow->mpExpandedBar; }
954 };
955
956 /*
957 Used for storing the original bar's positions in the row, when the 'non-destructive-friction'
958 option is turned on.
959 */
960
961 class cbBarShapeData : public wxObject
962 {
963 public:
964 wxRect mBounds;
965 double mLenRatio;
966 };
967
968 /*
969 Used for traversing through all bars of all rows in the pane.
970 */
971
972 class wxBarIterator
973 {
974 RowArrayT* mpRows;
975 cbRowInfo* mpRow;
976 cbBarInfo* mpBar;
977
978 public:
979 // Constructor, taking row array.
980
981 wxBarIterator( RowArrayT& rows );
982
983 // Resets the iterator to the start of the first row.
984
985 void Reset();
986
987 // Advances the iterator and returns true if a bar is available.
988
989 bool Next();
990
991 // Gets the current bar information.
992
993 cbBarInfo& BarInfo();
994
995 // Returns a reference to the currently traversed row.
996
997 cbRowInfo& RowInfo();
998 };
999
1000 /*
1001 A structure holding configuration options,
1002 which are usually the same for all panes in
1003 a frame layout.
1004 */
1005
1006 class WXDLLIMPEXP_FL cbCommonPaneProperties : public wxObject
1007 {
1008 DECLARE_DYNAMIC_CLASS( cbCommonPaneProperties )
1009
1010 // look-and-feel configuration
1011
1012 bool mRealTimeUpdatesOn; // default: ON
1013 bool mOutOfPaneDragOn; // default: ON
1014 bool mExactDockPredictionOn; // default: OFF
1015 bool mNonDestructFrictionOn; // default: OFF
1016
1017 bool mShow3DPaneBorderOn; // default: ON
1018
1019 // FOR NOW:: the below properties are reserved for the "future"
1020
1021 bool mBarFloatingOn; // default: OFF
1022 bool mRowProportionsOn; // default: OFF
1023 bool mColProportionsOn; // default: ON
1024 bool mBarCollapseIconsOn; // default: OFF
1025 bool mBarDragHintsOn; // default: OFF
1026
1027 // minimal dimensions for not-fixed bars in this pane (16x16 default)
1028
1029 wxSize mMinCBarDim;
1030
1031 // width/height of resizing sash
1032
1033 int mResizeHandleSize;
1034
1035 // Default constructor.
1036
1037 cbCommonPaneProperties(void);
1038
1039 // Copy constructor
1040
1041 cbCommonPaneProperties(const cbCommonPaneProperties&);
1042
1043 // Assignment operator
1044
1045 cbCommonPaneProperties& operator=(const cbCommonPaneProperties&);
1046 };
1047
1048 /*
1049 This class manages containment and control of control bars
1050 along one of the four edges of the parent frame.
1051 */
1052
1053 class cbDockPane : public wxObject
1054 {
1055 public:
1056 DECLARE_DYNAMIC_CLASS( cbDockPane )
1057
1058 // look-and-feel configuration for this pane
1059 cbCommonPaneProperties mProps;
1060
1061 // pane margins (in frame's coordinate-syst. orientation)
1062
1063 int mLeftMargin; // default: 2 pixels
1064 int mRightMargin; // default: 2 pixels
1065 int mTopMargin; // default: 2 pixels
1066 int mBottomMargin; // default: 2 pixels
1067
1068 public:
1069 // position of the pane in frame's coordinates
1070 wxRect mBoundsInParent;
1071
1072 // pane width and height in pane's coordinates
1073 int mPaneWidth;
1074 int mPaneHeight;
1075
1076 int mAlignment;
1077
1078 // info stored for updates-manager
1079 cbUpdateMgrData mUMgrData;
1080
1081 public: /* protected really */
1082
1083 RowArrayT mRows;
1084 wxFrameLayout* mpLayout; // back-ref
1085
1086 // transient properties
1087
1088 wxList mRowShapeData; // shapes of bars of recently modified row,
1089 // stored when in "non-destructive-friction" mode
1090 cbRowInfo* mpStoredRow; // row-info for which the shapes are stored
1091
1092 friend class wxFrameLayout;
1093
1094 public: /* protected really (accessed only by plugins) */
1095
1096 // Returns the row info for a row index. Internal function called by plugins.
1097
1098 cbRowInfo* GetRow( int row );
1099
1100 // Returns the row index for the given row info. Internal function called by plugins.
1101
1102 int GetRowIndex( cbRowInfo* pRow );
1103
1104 // Returns the row at the given vertical position.
1105 // Returns -1 if the row is not present at given vertical position.
1106 // Internal function called by plugins.
1107
1108 int GetRowAt( int paneY );
1109
1110 // Returns the row between the given vertical positions.
1111 // Returns -1 if the row is not present.
1112 // Internal function called by plugins.
1113
1114 int GetRowAt( int upperY, int lowerY );
1115
1116 // Sets up flags in the row information structure, so that
1117 // they match the changed state of row items correctly.
1118 // Internal function called by plugins.
1119
1120 void SyncRowFlags( cbRowInfo* pRow );
1121
1122 // Returns true if the bar's dimension information indicates a fixed size.
1123 // Internal function called by plugins.
1124
1125 bool IsFixedSize( cbBarInfo* pInfo );
1126
1127 // Returns the number of bars whose size is not fixed.
1128 // Internal function called by plugins.
1129
1130 int GetNotFixedBarsCount( cbRowInfo* pRow );
1131
1132 // Gets the vertical position at the given row.
1133 // Internal function called by plugins.
1134
1135 int GetRowY( cbRowInfo* pRow );
1136
1137 // Returns true if there are any variable-sized rows above this one.
1138 // Internal function called by plugins.
1139
1140 bool HasNotFixedRowsAbove( cbRowInfo* pRow );
1141
1142 // Returns true if there are any variable-sized rows below this one.
1143 // Internal function called by plugins.
1144
1145 bool HasNotFixedRowsBelow( cbRowInfo* pRow );
1146
1147 // Returns true if there are any variable-sized rows to the left of this one.
1148 // Internal function called by plugins.
1149
1150 bool HasNotFixedBarsLeft ( cbBarInfo* pBar );
1151
1152 // Returns true if there are any variable-sized rows to the right of this one.
1153 // Internal function called by plugins.
1154
1155 bool HasNotFixedBarsRight( cbBarInfo* pBar );
1156
1157 // Calculate lengths.
1158 // Internal function called by plugins.
1159
1160 virtual void CalcLengthRatios( cbRowInfo* pInRow );
1161
1162 // Generates a cbLayoutRowEvent event to recalculate row layouts.
1163 // Internal function called by plugins.
1164
1165 virtual void RecalcRowLayout( cbRowInfo* pRow );
1166
1167 // Expands the bar.
1168 // Internal function called by plugins.
1169
1170 virtual void ExpandBar( cbBarInfo* pBar );
1171
1172 // Contracts the bar.
1173 // Internal function called by plugins.
1174
1175 virtual void ContractBar( cbBarInfo* pBar );
1176
1177 // Sets up links between bars.
1178 // Internal function called by plugins.
1179
1180 void InitLinksForRow( cbRowInfo* pRow );
1181
1182 // Sets up links between bars.
1183 // Internal function called by plugins.
1184
1185 void InitLinksForRows();
1186
1187 // Coordinate translation between parent's frame and this pane.
1188 // Internal function called by plugins.
1189
1190 void FrameToPane( int* x, int* y );
1191
1192 // Coordinate translation between parent's frame and this pane.
1193 // Internal function called by plugins.
1194
1195 void PaneToFrame( int* x, int* y );
1196
1197 // Coordinate translation between parent's frame and this pane.
1198 // Internal function called by plugins.
1199
1200 void FrameToPane( wxRect* pRect );
1201
1202 // Coordinate translation between parent's frame and this pane.
1203 // Internal function called by plugins.
1204
1205 void PaneToFrame( wxRect* pRect );
1206
1207 // Returns true if pos is within the given rectangle.
1208 // Internal function called by plugins.
1209
1210 inline bool HasPoint( const wxPoint& pos, int x, int y, int width, int height );
1211
1212 // Returns the minimal row height for the given row.
1213 // Internal function called by plugins.
1214
1215 int GetMinimalRowHeight( cbRowInfo* pRow );
1216
1217 // Sets the row height for the given height. newHeight includes the height of row handles, if present.
1218 // Internal function called by plugins.
1219
1220 void SetRowHeight( cbRowInfo* pRow, int newHeight );
1221
1222 // Inserts the bar at the given row number.
1223 // Internal function called by plugins.
1224
1225 void DoInsertBar( cbBarInfo* pBar, int rowNo );
1226
1227 public: /* protected really (accessed only by plugins) */
1228
1229 // Generates a cbDrawBarDecorEvent and sends it to the layout to paint the bar decorations.
1230 // Internal function called by plugins.
1231
1232 virtual void PaintBarDecorations( cbBarInfo* pBar, wxDC& dc );
1233
1234 // Generates a cbDrawBarHandlesEvent and sends it to the layout to paint the bar handles.
1235 // Internal function called by plugins.
1236
1237 virtual void PaintBarHandles( cbBarInfo* pBar, wxDC& dc );
1238
1239 // Calls PaintBarDecorations and PaintBarHandles.
1240 // Internal function called by plugins.
1241
1242 virtual void PaintBar( cbBarInfo* pBar, wxDC& dc );
1243
1244 // Generates cbDrawRowHandlesEvent and cbDrawRowDecorEvent and sends them to the layout.
1245 // Internal function called by plugins.
1246
1247 virtual void PaintRowHandles( cbRowInfo* pRow, wxDC& dc );
1248
1249 // Generates cbDrawRowBkGroundEvent and sends it to the layout.
1250 // Internal function called by plugins.
1251
1252 virtual void PaintRowBackground ( cbRowInfo* pRow, wxDC& dc );
1253
1254 // Calls PaintBarDecorations for each row.
1255 // Internal function called by plugins.
1256
1257 virtual void PaintRowDecorations( cbRowInfo* pRow, wxDC& dc );
1258
1259 // Calls PaintRowBackground, PaintRowDecorations, PaintRowHandles.
1260 // Internal function called by plugins.
1261
1262 virtual void PaintRow( cbRowInfo* pRow, wxDC& dc );
1263
1264 // Generates cbDrawPaneBkGroundEvent and sends it to the layout.
1265 // Internal function called by plugins.
1266
1267 virtual void PaintPaneBackground( wxDC& dc );
1268
1269 // Generates cbDrawPaneDecorEvent and sends it to the layout.
1270 // Internal function called by plugins.
1271
1272 virtual void PaintPaneDecorations( wxDC& dc );
1273
1274 // Paints the pane background, the row background and decorations,
1275 // and finally the pane decorations.
1276 // Internal function called by plugins.
1277
1278 virtual void PaintPane( wxDC& dc );
1279
1280 // Generates a cbSizeBarWndEvent and sends it to the layout.
1281 // Internal function called by plugins.
1282
1283 virtual void SizeBar( cbBarInfo* pBar );
1284
1285 // Calls SizeBar for each bar in the row.
1286 // Internal function called by plugins.
1287
1288 virtual void SizeRowObjects( cbRowInfo* pRow );
1289
1290 // Calls SizeRowObjects for each row.
1291 // Internal function called by plugins.
1292
1293 virtual void SizePaneObjects();
1294
1295 // Generates cbStartDrawInAreaEvent and sends it to the layout.
1296 // Internal function called by plugins.
1297
1298 virtual wxDC* StartDrawInArea ( const wxRect& area );
1299
1300 // Generates cbFinishDrawInAreaEvent and sends it to the layout.
1301 // Internal function called by plugins.
1302
1303 virtual void FinishDrawInArea( const wxRect& area );
1304
1305 public: /* public members */
1306
1307 // Default constructor.
1308
1309 cbDockPane(void);
1310
1311 // Constructor, taking alignment and layout panel.
1312
1313 cbDockPane( int alignment, wxFrameLayout* pPanel );
1314
1315 // Sets pane's margins in frame's coordinate orientations.
1316
1317 void SetMargins( int top, int bottom, int left, int right );
1318
1319 // Destructor.
1320
1321 virtual ~cbDockPane();
1322
1323 // Removes the bar from this pane. Does not destroy the bar.
1324
1325 virtual void RemoveBar( cbBarInfo* pBar );
1326
1327 // Inserts the bar into this pane. rect is given in the parent frame's coordinates.
1328
1329 virtual void InsertBar( cbBarInfo* pBar, const wxRect& rect );
1330
1331 // Inserts the bar into the given row, with dimensions and position
1332 // stored in pBarInfo->mBounds. Returns the node of inserted bar.
1333
1334 virtual void InsertBar( cbBarInfo* pBar, cbRowInfo* pIntoRow );
1335
1336 // Inserts bar and sets its position according to the preferred settings
1337 // given in pBarInfo.
1338
1339 virtual void InsertBar( cbBarInfo* pBarInfo );
1340
1341 // Removes the row from this pane. Does not destroy the row object.
1342
1343 virtual void RemoveRow( cbRowInfo* pRow );
1344
1345 // Inserts a row. Does not refresh the inserted row immediately.
1346 // If pBeforeRowNode is NULL, the row is appended to the end of pane's row list.
1347
1348 virtual void InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow );
1349
1350 // Sets pane's width in the pane's coordinates (including margins).
1351
1352 void SetPaneWidth(int width);
1353
1354 // Set the position and dimensions of the pane in the parent frame's coordinates.
1355
1356 void SetBoundsInParent( const wxRect& rect );
1357
1358 // Returns the bounds of the pane, in parent coordinates.
1359
1360 inline wxRect& GetRealRect() { return mBoundsInParent; }
1361
1362 // Returns an array of rows. Used by updates-managers.
1363
1364 inline RowArrayT& GetRowList() { return mRows; }
1365
1366 // Returns the first row.
1367
1368 inline cbRowInfo* GetFirstRow()
1369
1370 { return mRows.GetCount() ? mRows[0] : NULL; }
1371
1372 // Returns true if the given bar is present in this pane.
1373
1374 bool BarPresent( cbBarInfo* pBar );
1375
1376 // Returns the height in the pane's coordinates.
1377
1378 int GetPaneHeight();
1379
1380 // Returns the alignment for this pane. The value is one of
1381 // FL_ALIGN_TOP, FL_ALIGN_BOTTOM, FL_ALIGN_LEFT, FL_ALIGN_RIGHT.
1382
1383 int GetAlignment();
1384
1385 // Returns true if the given mask matches the pane's mask.
1386
1387 bool MatchesMask( int paneMask );
1388
1389 // Returns true if the pane is aligned to the top or bottom.
1390
1391 inline bool IsHorizontal()
1392 {
1393 return (mAlignment == FL_ALIGN_TOP ||
1394 mAlignment == FL_ALIGN_BOTTOM );
1395 }
1396
1397 // Generates events to perform layout calculations.
1398
1399 virtual void RecalcLayout();
1400
1401 // Returns wxCBAR_DOCKED_HORIZONTALLY if the alignment is top or bottom,
1402 // or wxCBAR_DOCKED_VERTICALLY otherwise.
1403
1404 virtual int GetDockingState();
1405
1406 // Returns the result of hit-testing items in the pane.
1407 // See CB_HITTEST_RESULT enumerated type.
1408 // pos is the position in this pane's coordinates.
1409
1410 virtual int HitTestPaneItems( const wxPoint& pos,
1411 cbRowInfo** ppRow,
1412 cbBarInfo** ppBar
1413 );
1414
1415 // Returns the bar's resize range.
1416
1417 void GetBarResizeRange( cbBarInfo* pBar, int* from, int *till, bool forLeftHandle );
1418
1419 // Returns the row's resize range.
1420
1421 void GetRowResizeRange( cbRowInfo* pRow, int* from, int* till, bool forUpperHandle );
1422
1423 // Finds the bar information by corresponding window.
1424
1425 cbBarInfo* GetBarInfoByWindow( wxWindow* pBarWnd );
1426
1427 public: /* protected really (accessed only by plugins) */
1428
1429 // Row/bar resizing related helper-method.
1430
1431 void DrawVertHandle ( wxDC& dc, int x, int y, int height );
1432
1433 // Row/bar resizing related helper-method.
1434
1435 void DrawHorizHandle( wxDC& dc, int x, int y, int width );
1436
1437 // Row/bar resizing related helper-method.
1438
1439 void ResizeRow( cbRowInfo* pRow, int ofs, bool forUpperHandle );
1440
1441 // Row/bar resizing related helper-method.
1442
1443 void ResizeBar( cbBarInfo* pBar, int ofs, bool forLeftHandle );
1444
1445 // Returns row shape data.
1446 // cbBarShapeData objects will be added to the given pLst.
1447 // cbBarShapeData is used for storing the original bar's positions in the row,
1448 // when the 'non-destructive-friction' option is turned on.
1449
1450 void GetRowShapeData( cbRowInfo* pRow, wxList* pLst );
1451
1452 // Sets the shape data for the given row, using the data provided in pLst.
1453 // cbBarShapeData is used for storing the original bar's positions in the row,
1454 // when the 'non-destructive-friction' option is turned on.
1455
1456 void SetRowShapeData( cbRowInfo* pRowNode, wxList* pLst );
1457 };
1458
1459 /*
1460 This class declares an abstract interface for optimized logic that should refresh
1461 areas of frame layout that actually need to be updated. This should be extended in future
1462 to implement a custom updating strategy.
1463 */
1464
1465 class WXDLLIMPEXP_FL cbUpdatesManagerBase : public wxObject
1466 {
1467 DECLARE_ABSTRACT_CLASS( cbUpdatesManagerBase )
1468
1469 public: /* protected really, accessed by serializer (if any) */
1470
1471 wxFrameLayout* mpLayout;
1472
1473 public:
1474 // Default constructor
1475
1476 cbUpdatesManagerBase(void)
1477 : mpLayout( 0 ) {}
1478
1479 // Constructor taking layout panel.
1480
1481 cbUpdatesManagerBase( wxFrameLayout* pPanel )
1482 : mpLayout( pPanel ) {}
1483
1484 // Destructor.
1485
1486 virtual ~cbUpdatesManagerBase() {}
1487
1488 // Sets the associated layout.
1489
1490 void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; }
1491
1492 // This function receives a notification from the frame layout (in the order in which
1493 // they would usually be invoked). Custom updates-managers may utilize
1494 // these notifications to implement a more fine-grained updating strategy.
1495
1496 virtual void OnStartChanges() = 0;
1497
1498 // This function receives a notification from the frame layout (in the order in which
1499 // they would usually be invoked). Custom updates-managers may utilize
1500 // these notifications to implement a more fine-grained updating strategy.
1501
1502 virtual void OnRowWillChange( cbRowInfo* WXUNUSED(pRow), cbDockPane* WXUNUSED(pInPane) ) {}
1503
1504 // This function receives a notification from the frame layout (in the order in which
1505 // they would usually be invoked). Custom updates-managers may utilize
1506 // these notifications to implement a more fine-grained updating strategy.
1507
1508 virtual void OnBarWillChange( cbBarInfo* WXUNUSED(pBar), cbRowInfo* WXUNUSED(pInRow), cbDockPane* WXUNUSED(pInPane) ) {}
1509
1510 // This function receives a notification from the frame layout (in the order in which
1511 // they would usually be invoked). Custom updates-managers may utilize
1512 // these notifications to implement a more fine-grained updating strategy.
1513
1514 virtual void OnPaneMarginsWillChange( cbDockPane* WXUNUSED(pPane) ) {}
1515
1516 // This function receives a notification from the frame layout (in the order in which
1517 // they would usually be invoked). Custom updates-managers may utilize
1518 // these notifications to implement a more fine-grained updating strategy.
1519
1520 virtual void OnPaneWillChange( cbDockPane* WXUNUSED(pPane) ) {}
1521
1522 // This function receives a notification from the frame layout (in the order in which
1523 // they would usually be invoked). Custom updates-managers may utilize
1524 // these notifications to implement a more fine-grained updating strategy.
1525
1526 virtual void OnFinishChanges() {}
1527
1528 // Refreshes parts of the frame layout that need an update.
1529
1530 virtual void UpdateNow() = 0;
1531 };
1532
1533 /*
1534 Base class for all control-bar plugin events.
1535 This is not a dynamically-creatable class.
1536 */
1537
1538 class cbPluginEvent : public wxEvent
1539 {
1540 public:
1541 // NULL if event is not addressed to any specific pane.
1542
1543 cbDockPane* mpPane;
1544
1545 // Not used, but required.
1546
1547 virtual wxEvent* Clone() const { return NULL; }
1548
1549 // Constructor, taking event type and pane.
1550
1551 cbPluginEvent( wxEventType eventType, cbDockPane* pPane )
1552 : mpPane( pPane )
1553
1554 { m_eventType = eventType; }
1555 };
1556
1557 // event types handled by plugins
1558
1559 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DOWN;
1560 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_UP;
1561 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_DOWN;
1562 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_UP;
1563 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_MOTION;
1564
1565 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DCLICK;
1566
1567 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROW;
1568 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_ROW;
1569 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROWS;
1570 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_INSERT_BAR;
1571 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_BAR;
1572 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_REMOVE_BAR;
1573 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_SIZE_BAR_WND;
1574
1575 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_DECOR;
1576 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_DECOR;
1577 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_DECOR;
1578 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_HANDLES;
1579 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_HANDLES;
1580 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_BKGROUND;
1581 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_BKGROUND;
1582
1583 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_BAR_DRAGGING;
1584 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_HINT_RECT;
1585
1586 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_DRAW_IN_AREA;
1587 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA;
1588
1589 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_BAR;
1590 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT;
1591
1592 extern WXDLLIMPEXP_FL wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT;
1593
1594 // Forward declarations, separated by categories.
1595
1596 class cbLeftDownEvent;
1597 class cbLeftUpEvent;
1598 class cbRightDownEvent;
1599 class cbRightUpEvent;
1600 class cbMotionEvent;
1601 class cbLeftDClickEvent;
1602
1603 class cbLayoutRowEvent;
1604 class cbResizeRowEvent;
1605 class cbLayoutRowsEvent;
1606 class cbInsertBarEvent;
1607 class cbResizeBarEvent;
1608 class cbRemoveBarEvent;
1609 class cbSizeBarWndEvent;
1610
1611 class cbDrawBarDecorEvent;
1612 class cbDrawRowDecorEvent;
1613 class cbDrawPaneDecorEvent;
1614 class cbDrawBarHandlesEvent;
1615 class cbDrawRowHandlesEvent;
1616 class cbDrawRowBkGroundEvent;
1617 class cbDrawPaneBkGroundEvent;
1618
1619 class cbStartBarDraggingEvent;
1620 class cbDrawHintRectEvent;
1621
1622 class cbStartDrawInAreaEvent;
1623 class cbFinishDrawInAreaEvent;
1624
1625 class cbCustomizeBarEvent;
1626 class cbCustomizeLayoutEvent;
1627
1628 // Definitions for for handler-methods.
1629
1630 typedef void (wxEvtHandler::*cbLeftDownHandler )(cbLeftDownEvent&);
1631 typedef void (wxEvtHandler::*cbLeftUpHandler )(cbLeftUpEvent&);
1632 typedef void (wxEvtHandler::*cbRightDownHandler )(cbRightDownEvent&);
1633 typedef void (wxEvtHandler::*cbRightUpHandler )(cbRightUpEvent&);
1634 typedef void (wxEvtHandler::*cbMotionHandler )(cbMotionEvent&);
1635 typedef void (wxEvtHandler::*cbLeftDClickHandler )(cbLeftDClickEvent&);
1636
1637 typedef void (wxEvtHandler::*cbLayoutRowHandler )(cbLayoutRowEvent&);
1638 typedef void (wxEvtHandler::*cbResizeRowHandler )(cbResizeRowEvent&);
1639 typedef void (wxEvtHandler::*cbLayoutRowsHandler )(cbLayoutRowsEvent&);
1640 typedef void (wxEvtHandler::*cbInsertBarHandler )(cbInsertBarEvent&);
1641 typedef void (wxEvtHandler::*cbResizeBarHandler )(cbResizeBarEvent&);
1642 typedef void (wxEvtHandler::*cbRemoveBarHandler )(cbRemoveBarEvent&);
1643 typedef void (wxEvtHandler::*cbSizeBarWndHandler )(cbSizeBarWndEvent&);
1644
1645 typedef void (wxEvtHandler::*cbDrawBarDecorHandler )(cbDrawBarDecorEvent&);
1646 typedef void (wxEvtHandler::*cbDrawRowDecorHandler )(cbDrawRowDecorEvent&);
1647 typedef void (wxEvtHandler::*cbDrawPaneDecorHandler )(cbDrawPaneDecorEvent&);
1648 typedef void (wxEvtHandler::*cbDrawBarHandlesHandler )(cbDrawBarHandlesEvent&);
1649 typedef void (wxEvtHandler::*cbDrawRowHandlesHandler )(cbDrawRowHandlesEvent&);
1650 typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler )(cbDrawRowBkGroundEvent&);
1651 typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler)(cbDrawPaneBkGroundEvent&);
1652
1653 typedef void (wxEvtHandler::*cbStartBarDraggingHandler )(cbStartBarDraggingEvent&);
1654 typedef void (wxEvtHandler::*cbDrawHintRectHandler )(cbDrawHintRectEvent&);
1655
1656 typedef void (wxEvtHandler::*cbStartDrawInAreaHandler )(cbStartDrawInAreaEvent&);
1657 typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler)(cbFinishDrawInAreaEvent&);
1658
1659 typedef void (wxEvtHandler::*cbCustomizeBarHandler )(cbCustomizeBarEvent&);
1660 typedef void (wxEvtHandler::*cbCustomizeLayoutHandler )(cbCustomizeLayoutEvent&);
1661
1662 // Macros for creating event table entries for plugin-events.
1663
1664 #define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ),
1665 #define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ),
1666 #define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ),
1667 #define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ),
1668 #define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ),
1669 #define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ),
1670
1671 #define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ),
1672 #define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ),
1673 #define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ),
1674 #define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ),
1675 #define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ),
1676 #define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ),
1677 #define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ),
1678
1679 #define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ),
1680 #define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ),
1681 #define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ),
1682 #define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ),
1683 #define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ),
1684 #define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ),
1685 #define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ),
1686
1687 #define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ),
1688 #define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ),
1689
1690
1691 #define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ),
1692 #define EVT_PL_FINISH_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func, (wxObject *) NULL ),
1693
1694 #define EVT_PL_CUSTOMIZE_BAR(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func, (wxObject *) NULL ),
1695 #define EVT_PL_CUSTOMIZE_LAYOUT(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func, (wxObject *) NULL ),
1696
1697 /*
1698 Abstract base class for all control-bar related plugins.
1699 Note: pointer positions of mouse events sent to plugins
1700 are always in the pane's coordinates (the pane to which
1701 this plugin is hooked).
1702 */
1703
1704 class cbPluginBase : public wxEvtHandler
1705 {
1706 DECLARE_ABSTRACT_CLASS( cbPluginBase )
1707 public:
1708 // Back-reference to the frame layout.
1709
1710 wxFrameLayout* mpLayout;
1711
1712 // Specifies panes for which this plugin receives events
1713 // (see pane masks definitions).
1714
1715 int mPaneMask;
1716
1717 // Is true when plugin is ready to handle events.
1718
1719 bool mIsReady;
1720
1721 public:
1722 // Default constructor.
1723
1724 cbPluginBase()
1725
1726 : mpLayout ( 0 ),
1727 mPaneMask( wxALL_PANES ),
1728 mIsReady ( false )
1729 {}
1730
1731 // Constructor taking layout panel and a mask.
1732
1733 cbPluginBase( wxFrameLayout* pPanel, int paneMask = wxALL_PANES )
1734
1735 : mpLayout ( pPanel ),
1736 mPaneMask( paneMask ),
1737 mIsReady ( false )
1738 {}
1739
1740 // Returns the pane mask.
1741
1742 inline int GetPaneMask() { return mPaneMask; }
1743
1744 // Destructor. Destroys the whole plugin chain of connected plugins.
1745
1746 virtual ~cbPluginBase();
1747
1748 // Override this method to do plugin-specific initialization.
1749 // At this point plugin is already attached to the frame layout,
1750 // and pane masks are set.
1751
1752 virtual void OnInitPlugin() { mIsReady = true; }
1753
1754 // Returns true if the plugin is ready to receive events.
1755
1756 bool IsReady() { return mIsReady; }
1757
1758 // Overridden to determine whether the target pane specified in the
1759 // event matches the pane mask of this plugin (specific plugins
1760 // do not override this method).
1761
1762 virtual bool ProcessEvent(wxEvent& event);
1763 };
1764
1765 /*
1766 Class for mouse left down events.
1767 */
1768
1769 class cbLeftDownEvent : public cbPluginEvent
1770 {
1771 public:
1772 wxPoint mPos;
1773
1774 // Constructor, taking mouse position and pane.
1775
1776 cbLeftDownEvent( const wxPoint& pos, cbDockPane* pPane )
1777
1778 : cbPluginEvent( cbEVT_PL_LEFT_DOWN, pPane ),
1779 mPos( pos )
1780 {}
1781 };
1782
1783 /*
1784 Class for mouse left up events.
1785 */
1786
1787 class cbLeftUpEvent : public cbPluginEvent
1788 {
1789 public:
1790 wxPoint mPos;
1791
1792 // Constructor, taking mouse position and pane.
1793
1794 cbLeftUpEvent( const wxPoint& pos, cbDockPane* pPane )
1795
1796 : cbPluginEvent( cbEVT_PL_LEFT_UP, pPane ),
1797 mPos( pos )
1798 {}
1799 };
1800
1801 /*
1802 Class for mouse right down events.
1803 */
1804
1805 class cbRightDownEvent : public cbPluginEvent
1806 {
1807 public:
1808 wxPoint mPos;
1809
1810 // Constructor, taking mouse position and pane.
1811
1812 cbRightDownEvent( const wxPoint& pos, cbDockPane* pPane )
1813
1814 : cbPluginEvent( cbEVT_PL_RIGHT_DOWN, pPane ),
1815 mPos( pos )
1816 {}
1817 };
1818
1819 /*
1820 Class for mouse right up events.
1821 */
1822
1823 class cbRightUpEvent : public cbPluginEvent
1824 {
1825 public:
1826 wxPoint mPos;
1827
1828 // Constructor, taking mouse position and pane.
1829
1830 cbRightUpEvent( const wxPoint& pos, cbDockPane* pPane )
1831
1832 : cbPluginEvent( cbEVT_PL_RIGHT_UP, pPane ),
1833 mPos( pos )
1834 {}
1835 };
1836
1837 /*
1838 Class for mouse motion events.
1839 */
1840
1841 class cbMotionEvent : public cbPluginEvent
1842 {
1843 public:
1844 wxPoint mPos;
1845
1846 // Constructor, taking mouse position and pane.
1847
1848 cbMotionEvent( const wxPoint& pos, cbDockPane* pPane )
1849
1850 : cbPluginEvent( cbEVT_PL_MOTION, pPane ),
1851 mPos( pos )
1852 {}
1853 };
1854
1855 /*
1856 Class for mouse left double click events.
1857 */
1858
1859 class cbLeftDClickEvent : public cbPluginEvent
1860 {
1861 public:
1862 wxPoint mPos;
1863
1864 // Constructor, taking mouse position and pane.
1865
1866 cbLeftDClickEvent( const wxPoint& pos, cbDockPane* pPane )
1867
1868 : cbPluginEvent( cbEVT_PL_LEFT_DCLICK, pPane ),
1869 mPos( pos )
1870 {}
1871 };
1872
1873 /*
1874 Class for single row layout events.
1875 */
1876
1877 class cbLayoutRowEvent : public cbPluginEvent
1878 {
1879 public:
1880 cbRowInfo* mpRow;
1881
1882 // Constructor, taking row information and pane.
1883
1884 cbLayoutRowEvent( cbRowInfo* pRow, cbDockPane* pPane )
1885
1886 : cbPluginEvent( cbEVT_PL_LAYOUT_ROW, pPane ),
1887 mpRow( pRow )
1888 {}
1889 };
1890
1891 /*
1892 Class for row resize events.
1893 */
1894
1895 class cbResizeRowEvent : public cbPluginEvent
1896 {
1897 public:
1898 cbRowInfo* mpRow;
1899 int mHandleOfs;
1900 bool mForUpperHandle;
1901
1902 // Constructor, taking row information, two parameters of currently unknown use, and pane.
1903
1904 cbResizeRowEvent( cbRowInfo* pRow, int handleOfs, bool forUpperHandle, cbDockPane* pPane )
1905
1906 : cbPluginEvent( cbEVT_PL_RESIZE_ROW, pPane ),
1907 mpRow( pRow ),
1908 mHandleOfs( handleOfs ),
1909 mForUpperHandle( forUpperHandle )
1910 {}
1911 };
1912
1913 /*
1914 Class for multiple rows layout events.
1915 */
1916
1917 class cbLayoutRowsEvent : public cbPluginEvent
1918 {
1919 public:
1920
1921 // Constructor, taking pane.
1922
1923 cbLayoutRowsEvent( cbDockPane* pPane )
1924
1925 : cbPluginEvent( cbEVT_PL_LAYOUT_ROWS, pPane )
1926 {}
1927 };
1928
1929 /*
1930 Class for bar insertion events.
1931 */
1932
1933 class cbInsertBarEvent : public cbPluginEvent
1934 {
1935 public:
1936 cbBarInfo* mpBar;
1937 cbRowInfo* mpRow;
1938
1939 // Constructor, taking bar information, row information, and pane.
1940
1941 cbInsertBarEvent( cbBarInfo* pBar, cbRowInfo* pIntoRow, cbDockPane* pPane )
1942
1943 : cbPluginEvent( cbEVT_PL_INSERT_BAR, pPane ),
1944
1945 mpBar( pBar ),
1946 mpRow( pIntoRow )
1947 {}
1948 };
1949
1950 /*
1951 Class for bar resize events.
1952 */
1953
1954 class cbResizeBarEvent : public cbPluginEvent
1955 {
1956 public:
1957 cbBarInfo* mpBar;
1958 cbRowInfo* mpRow;
1959
1960 // Constructor, taking bar information, row information, and pane.
1961
1962 cbResizeBarEvent( cbBarInfo* pBar, cbRowInfo* pRow, cbDockPane* pPane )
1963
1964 : cbPluginEvent( cbEVT_PL_RESIZE_BAR, pPane ),
1965 mpBar( pBar ),
1966 mpRow( pRow )
1967 {}
1968 };
1969
1970 /*
1971 Class for bar removal events.
1972 */
1973
1974 class cbRemoveBarEvent : public cbPluginEvent
1975 {
1976 public:
1977 cbBarInfo* mpBar;
1978
1979 // Constructor, taking bar information and pane.
1980
1981 cbRemoveBarEvent( cbBarInfo* pBar, cbDockPane* pPane )
1982
1983 : cbPluginEvent( cbEVT_PL_REMOVE_BAR, pPane ),
1984 mpBar( pBar )
1985 {}
1986 };
1987
1988 /*
1989 Class for bar window resize events.
1990 */
1991
1992 class cbSizeBarWndEvent : public cbPluginEvent
1993 {
1994 public:
1995 cbBarInfo* mpBar;
1996 wxRect mBoundsInParent;
1997
1998 // Constructor, taking bar information and pane.
1999
2000 cbSizeBarWndEvent( cbBarInfo* pBar, cbDockPane* pPane )
2001
2002 : cbPluginEvent( cbEVT_PL_SIZE_BAR_WND, pPane ),
2003 mpBar( pBar ),
2004 mBoundsInParent( pBar->mBoundsInParent )
2005 {}
2006 };
2007
2008 /*
2009 Class for bar decoration drawing events.
2010 */
2011
2012 class cbDrawBarDecorEvent : public cbPluginEvent
2013 {
2014 public:
2015 cbBarInfo* mpBar;
2016 wxDC* mpDc;
2017 wxRect mBoundsInParent;
2018
2019 // Constructor, taking bar information, device context, and pane.
2020
2021 cbDrawBarDecorEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane )
2022
2023 : cbPluginEvent( cbEVT_PL_DRAW_BAR_DECOR, pPane ),
2024 mpBar( pBar ),
2025 mpDc( &dc ),
2026 mBoundsInParent( pBar->mBoundsInParent )
2027 {}
2028 };
2029
2030 /*
2031 Class for row decoration drawing events.
2032 */
2033
2034 class cbDrawRowDecorEvent : public cbPluginEvent
2035 {
2036 public:
2037 cbRowInfo* mpRow;
2038 wxDC* mpDc;
2039
2040 // Constructor, taking row information, device context, and pane.
2041
2042 cbDrawRowDecorEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2043
2044 : cbPluginEvent( cbEVT_PL_DRAW_ROW_DECOR, pPane ),
2045 mpRow( pRow ),
2046 mpDc( &dc )
2047 {}
2048 };
2049
2050 /*
2051 Class for pane decoration drawing events.
2052 */
2053
2054 class cbDrawPaneDecorEvent : public cbPluginEvent
2055 {
2056 public:
2057 wxDC* mpDc;
2058
2059 // Constructor, taking device context and pane.
2060
2061 cbDrawPaneDecorEvent( wxDC& dc, cbDockPane* pPane )
2062
2063 : cbPluginEvent( cbEVT_PL_DRAW_PANE_DECOR, pPane ),
2064 mpDc( &dc )
2065 {}
2066 };
2067
2068 /*
2069 Class for bar handles drawing events.
2070 */
2071
2072 class cbDrawBarHandlesEvent : public cbPluginEvent
2073 {
2074 public:
2075 cbBarInfo* mpBar;
2076 wxDC* mpDc;
2077
2078 // Constructor, taking bar information, device context, and pane.
2079
2080 cbDrawBarHandlesEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane )
2081
2082 : cbPluginEvent( cbEVT_PL_DRAW_BAR_HANDLES, pPane ),
2083 mpBar( pBar ),
2084 mpDc( &dc )
2085 {}
2086 };
2087
2088 /*
2089 Class for row handles drawing events.
2090 */
2091
2092 class cbDrawRowHandlesEvent : public cbPluginEvent
2093 {
2094 public:
2095 cbRowInfo* mpRow;
2096 wxDC* mpDc;
2097
2098 // Constructor, taking row information, device context, and pane.
2099
2100 cbDrawRowHandlesEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2101
2102 : cbPluginEvent( cbEVT_PL_DRAW_ROW_HANDLES, pPane ),
2103 mpRow( pRow ),
2104 mpDc( &dc )
2105 {}
2106 };
2107
2108 /*
2109 Class for row background drawing events.
2110 */
2111
2112 class cbDrawRowBkGroundEvent : public cbPluginEvent
2113 {
2114 public:
2115 cbRowInfo* mpRow;
2116 wxDC* mpDc;
2117
2118 // Constructor, taking row information, device context, and pane.
2119
2120 cbDrawRowBkGroundEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2121
2122 : cbPluginEvent( cbEVT_PL_DRAW_ROW_BKGROUND, pPane ),
2123 mpRow( pRow ),
2124 mpDc( &dc )
2125 {}
2126 };
2127
2128 /*
2129 Class for pane background drawing events.
2130 */
2131
2132 class cbDrawPaneBkGroundEvent : public cbPluginEvent
2133 {
2134 public:
2135 wxDC* mpDc;
2136
2137 // Constructor, taking device context and pane.
2138
2139 cbDrawPaneBkGroundEvent( wxDC& dc, cbDockPane* pPane )
2140
2141 : cbPluginEvent( cbEVT_PL_DRAW_PANE_BKGROUND, pPane ),
2142 mpDc( &dc )
2143 {}
2144 };
2145
2146 /*
2147 Class for start-bar-dragging events.
2148 */
2149
2150 class cbStartBarDraggingEvent : public cbPluginEvent
2151 {
2152 public:
2153 cbBarInfo* mpBar;
2154 wxPoint mPos; // is given in frame's coordinates
2155
2156 // Constructor, taking bar information, mouse position, and pane.
2157
2158 cbStartBarDraggingEvent( cbBarInfo* pBar, const wxPoint& pos, cbDockPane* pPane )
2159
2160 : cbPluginEvent( cbEVT_PL_START_BAR_DRAGGING, pPane ),
2161 mpBar( pBar ),
2162 mPos( pos )
2163 {}
2164 };
2165
2166 /*
2167 Class for hint-rectangle drawing events.
2168 */
2169
2170 class cbDrawHintRectEvent : public cbPluginEvent
2171 {
2172 public:
2173 wxRect mRect; // is given in frame's coordinates
2174
2175
2176 bool mLastTime; // indicates that this event finishes "session" of on-screen drawing,
2177 // thus associated resources can be freed now
2178 bool mEraseRect; // does not have any impact, if recangle is drawn using XOR-mask
2179
2180 bool mIsInClient;// in cleint area hint could be drawn differently,
2181 // e.g. with fat/hatched border
2182
2183
2184 // Constructor, taking hint rectangle and three flags.
2185
2186 cbDrawHintRectEvent( const wxRect& rect, bool isInClient, bool eraseRect, bool lastTime )
2187
2188 : cbPluginEvent( cbEVT_PL_DRAW_HINT_RECT, 0 ),
2189 mRect ( rect ),
2190 mLastTime ( lastTime ),
2191 mEraseRect ( eraseRect ),
2192 mIsInClient( isInClient )
2193 {}
2194 };
2195
2196 /*
2197 Class for start drawing in area events.
2198 */
2199
2200 class cbStartDrawInAreaEvent : public cbPluginEvent
2201 {
2202 public:
2203 wxRect mArea;
2204 wxDC** mppDc; // points to pointer, where the reference
2205 // to the obtained buffer-context should be placed
2206
2207 // Constructor, taking rectangular area, device context pointer to a pointer, and pane.
2208
2209 cbStartDrawInAreaEvent( const wxRect& area, wxDC** ppDCForArea, cbDockPane* pPane )
2210
2211 : cbPluginEvent( cbEVT_PL_START_DRAW_IN_AREA, pPane ),
2212 mArea( area ),
2213 mppDc( ppDCForArea )
2214 {}
2215 };
2216
2217 /*
2218 Class for finish drawing in area events.
2219 */
2220
2221 class cbFinishDrawInAreaEvent : public cbPluginEvent
2222 {
2223 public:
2224 wxRect mArea;
2225
2226 // Constructor, taking rectangular area and pane.
2227
2228 cbFinishDrawInAreaEvent( const wxRect& area, cbDockPane* pPane )
2229
2230 : cbPluginEvent( cbEVT_PL_FINISH_DRAW_IN_AREA, pPane ),
2231 mArea( area )
2232 {}
2233 };
2234
2235 /*
2236 Class for bar customization events.
2237 */
2238
2239 class cbCustomizeBarEvent : public cbPluginEvent
2240 {
2241 public:
2242 wxPoint mClickPos; // in parent frame's coordinates
2243 cbBarInfo* mpBar;
2244
2245 // Constructor, taking bar information, mouse position, and pane.
2246
2247 cbCustomizeBarEvent( cbBarInfo* pBar, const wxPoint& clickPos, cbDockPane* pPane )
2248
2249 : cbPluginEvent( cbEVT_PL_CUSTOMIZE_BAR, pPane ),
2250 mClickPos( clickPos ),
2251 mpBar( pBar )
2252 {}
2253 };
2254
2255 /*
2256 Class for layout customization events.
2257 */
2258
2259 class cbCustomizeLayoutEvent : public cbPluginEvent
2260 {
2261 public:
2262 wxPoint mClickPos; // in parent frame's coordinates
2263
2264 // Constructor, taking mouse position.
2265
2266 cbCustomizeLayoutEvent( const wxPoint& clickPos )
2267
2268 : cbPluginEvent( cbEVT_PL_CUSTOMIZE_LAYOUT, 0 ),
2269 mClickPos( clickPos )
2270 {}
2271 };
2272
2273 #endif /* __CONTROLBAR_G__ */
2274