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