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