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