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