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