1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Central header file for control-bar related classes
5 // Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
9 // Copyright: (c) Aleksandras Gluchovas
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __CONTROLBAR_G__
14 #define __CONTROLBAR_G__
17 #include "wx/string.h"
19 #include "wx/window.h"
20 #include "wx/dynarray.h"
21 #include "wx/fl/fldefs.h"
23 #define WXCONTROLBAR_VERSION 1.3
25 // forward declarations
27 class WXDLLIMPEXP_FL wxFrameLayout
;
29 class WXDLLIMPEXP_FL cbDockPane
;
30 class WXDLLIMPEXP_FL cbUpdatesManagerBase
;
31 class WXDLLIMPEXP_FL cbBarDimHandlerBase
;
32 class WXDLLIMPEXP_FL cbPluginBase
;
33 class WXDLLIMPEXP_FL cbPluginEvent
;
34 class WXDLLIMPEXP_FL cbPaneDrawPlugin
;
36 class WXDLLIMPEXP_FL cbBarInfo
;
37 class WXDLLIMPEXP_FL cbRowInfo
;
38 class WXDLLIMPEXP_FL cbDimInfo
;
39 class WXDLLIMPEXP_FL cbCommonPaneProperties
;
41 typedef cbBarInfo
* BarInfoPtrT
;
42 typedef cbRowInfo
* RowInfoPtrT
;
44 WXFL_DEFINE_ARRAY_PTR( BarInfoPtrT
, BarArrayT
);
45 WXFL_DEFINE_ARRAY_PTR( RowInfoPtrT
, RowArrayT
);
49 #define wxCBAR_DOCKED_HORIZONTALLY 0
50 #define wxCBAR_DOCKED_VERTICALLY 1
51 #define wxCBAR_FLOATING 2
52 #define wxCBAR_HIDDEN 3
54 // the states are enumerated above
55 #define MAX_BAR_STATES 4
57 // control bar alignments
59 #if !defined(FL_ALIGN_TOP)
61 #define FL_ALIGN_TOP 0
62 #define FL_ALIGN_BOTTOM 1
63 #define FL_ALIGN_LEFT 2
64 #define FL_ALIGN_RIGHT 3
68 // one pane for each alignment
71 // masks for each pane
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
78 #define wxALL_PANES 0x000F
80 // enumeration of hittest results, see cbDockPane::HitTestPaneItems(..)
82 enum CB_HITTEST_RESULT
86 CB_UPPER_ROW_HANDLE_HITTED
,
87 CB_LOWER_ROW_HANDLE_HITTED
,
88 CB_LEFT_BAR_HANDLE_HITTED
,
89 CB_RIGHT_BAR_HANDLE_HITTED
,
94 Helper class, used for spying for unhandled mouse events on control bars
95 and forwarding them to the frame layout.
98 class WXDLLIMPEXP_FL cbBarSpy
: public wxEvtHandler
101 DECLARE_DYNAMIC_CLASS( cbBarSpy
)
103 wxFrameLayout
* mpLayout
;
107 // Default constructor.
111 // Constructor, taking a parent pane.
113 cbBarSpy( wxFrameLayout
* pPanel
);
115 // Sets the bar window.
117 void SetBarWindow( wxWindow
* pWnd
);
119 // Performs special event processing.
121 virtual bool ProcessEvent(wxEvent
& event
);
125 wxFrameLayout manages containment and docking of control bars,
126 which can be docked along the top, bottom, right, or left side of the
130 class WXDLLIMPEXP_FL wxFrameLayout
: public wxEvtHandler
133 // Default constructor, used only for serialization.
137 // Constructor, taking parent window, the (MDI) client of the parent if there
138 // is one, and flag specifying whether to activate the layout.
140 wxFrameLayout( wxWindow
* pParentFrame
,
141 wxWindow
* pFrameClient
= NULL
,
142 bool activateNow
= true );
144 // Destructor. It does not destroy the bar windows.
146 virtual ~wxFrameLayout();
148 // Enables floating behaviour. By default floating of control bars is on.
150 virtual void EnableFloating( bool enable
= true );
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.
155 // Effectively hooks itself to the frame window, re-displays all non-hidden
156 // bar windows and repaints the decorations.
158 virtual void Activate();
160 // Deactivate unhooks itself from frame window, and hides all non-hidden windows.
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.
166 virtual void Deactivate();
168 // Hides the bar windows, and also the client window if present.
170 void HideBarWindows();
172 // Destroys the bar windows.
174 virtual void DestroyBarWindows();
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.
181 void SetFrameClient( wxWindow
* pFrameClient
);
183 // Returns the frame client, or NULL if not present.
185 wxWindow
* GetFrameClient();
187 // Returns the parent frame.
189 wxWindow
& GetParentFrame() { return *mpFrame
; }
191 // Returns an array of panes. Used by update managers.
193 cbDockPane
** GetPanesArray() { return mPanes
; }
195 // Returns a pane for the given alignment. See pane alignment types.
197 cbDockPane
* GetPane( int alignment
)
199 { return mPanes
[alignment
]; }
201 // Adds bar information to the frame layout. The appearance of the layout is not refreshed
202 // immediately; RefreshNow() can be called if necessary.
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.
211 // pBarWnd is the window to be managed.
213 // dimInfo contains dimension information.
215 // alignment is a value such as FL_ALIGN_TOP.
217 // rowNo is the vertical position or row in the pane (if in docked state).
219 // columnPos is the horizontal position within the row in pixels (if in docked state).
221 // name is a name by which the bar can be referred in layout customization dialogs.
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.
229 // state is the initial state, such as wxCBAR_DOCKED_HORIZONTALLY,
230 // wxCBAR_FLOATING, wxCBAR_HIDDEN.
232 virtual void AddBar( wxWindow
* pBarWnd
,
233 const cbDimInfo
& dimInfo
,
236 int alignment
= FL_ALIGN_TOP
,
239 const wxString
& name
= wxT("bar"),
240 bool spyEvents
= false,
241 int state
= wxCBAR_DOCKED_HORIZONTALLY
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.
249 virtual bool RedockBar( cbBarInfo
* pBar
, const wxRect
& shapeInParent
,
250 cbDockPane
* pToPane
= NULL
, bool updateNow
= true );
252 // Finds the bar in the framelayout, by name.
254 cbBarInfo
* FindBarByName( const wxString
& name
);
256 // Finds the bar in the framelayout, by window.
258 cbBarInfo
* FindBarByWindow( const wxWindow
* pWnd
);
260 // Gets an array of bars.
262 BarArrayT
& GetBars();
264 // Changes the bar's docking state (see possible control bar states).
266 void SetBarState( cbBarInfo
* pBar
, int newStatem
, bool updateNow
);
268 // Toggles the bar between visible and hidden.
270 void InverseVisibility( cbBarInfo
* pBar
);
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.
276 void ApplyBarProperties( cbBarInfo
* pBar
);
278 // Removes the bar from the layout permanently, and hides its corresponding window if present.
280 void RemoveBar( cbBarInfo
* pBar
);
282 // Recalculates the layout of panes, and all bars/rows in each pane.
284 virtual void RecalcLayout( bool repositionBarsNow
= false );
286 // Returns the client height.
288 int GetClientHeight();
290 // Returns the client width.
292 int GetClientWidth();
294 // Returns the client's rectangle.
296 wxRect
& GetClientRect() { return mClntWndBounds
; }
298 // Returns a reference to the updates manager.
299 // Note: in future, the updates manager will become a normal plugin.
301 cbUpdatesManagerBase
& GetUpdatesManager();
303 // Destroys the previous manager if any, and sets the new one.
305 void SetUpdatesManager( cbUpdatesManagerBase
* pUMgr
);
307 // Gets the pane properties for the given alignment.
309 virtual void GetPaneProperties( cbCommonPaneProperties
& props
, int alignment
= FL_ALIGN_TOP
);
311 // Sets the pane properties for the given alignment.
312 // Note: changing properties of panes does not result immediate on-screen update.
314 virtual void SetPaneProperties( const cbCommonPaneProperties
& props
,
315 int paneMask
= wxALL_PANES
);
317 // Sets the margins for the given panes.
318 // The margins should go into cbCommonPaneProperties in the future.
320 // Note: this method should be called before any custom plugins are attached.
322 virtual void SetMargins( int top
, int bottom
, int left
, int right
,
323 int paneMask
= wxALL_PANES
);
325 // Sets the pane background colour.
327 virtual void SetPaneBackground( const wxColour
& colour
);
329 // Recalculates layout and performs on-screen update of all panes.
331 void RefreshNow( bool recalcLayout
= true );
333 // Event handler for a size event.
335 void OnSize ( wxSizeEvent
& event
);
337 // Event handler for a left down button event.
339 void OnLButtonDown( wxMouseEvent
& event
);
341 // Event handler for a left doubleclick button event.
343 void OnLDblClick ( wxMouseEvent
& event
);
345 // Event handler for a left button up event.
347 void OnLButtonUp ( wxMouseEvent
& event
);
349 // Event handler for a right button down event.
351 void OnRButtonDown( wxMouseEvent
& event
);
353 // Event handler for a right button up event.
355 void OnRButtonUp ( wxMouseEvent
& event
);
357 // Event handler for a mouse move event.
359 void OnMouseMove ( wxMouseEvent
& event
);
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.
365 virtual void FirePluginEvent( cbPluginEvent
& event
);
367 // Captures user input events for the given plugin.
368 // Input events are: mouse movement, mouse clicks, keyboard input.
370 virtual void CaptureEventsForPlugin ( cbPluginBase
* pPlugin
);
372 // Releases user input events for the given plugin.
373 // Input events are: mouse movement, mouse clicks, keyboard input
375 virtual void ReleaseEventsFromPlugin( cbPluginBase
* pPlugin
);
377 // Called by plugins; also captures the mouse in the parent frame.
379 void CaptureEventsForPane( cbDockPane
* toPane
);
381 // Called by plugins; also releases mouse in the parent frame.
383 void ReleaseEventsFromPane( cbDockPane
* fromPane
);
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).
388 virtual cbPluginBase
& GetTopPlugin();
390 // Hooking custom plugins to frame layout.
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).
399 // This secenario is very inconvenient and "low-level",
400 // so use the Add/Push/PopPlugin methods instead.
402 virtual void SetTopPlugin( cbPluginBase
* pPlugin
);
404 // Similar to wxWindow's "push/pop-event-handler" methods, execept
405 // that the plugin is deleted upon "popping".
407 virtual void PushPlugin( cbPluginBase
* pPugin
);
409 // Similar to wxWindow's "push/pop-event-handler" methods, execept
410 // that the plugin is deleted upon "popping".
412 virtual void PopPlugin();
415 virtual void PopAllPlugins();
417 // Adds the default plugins. These are cbPaneDrawPlugin, cbRowLayoutPlugin, cbBarDragPlugin,
418 // cbAntiflickerPlugin, cbSimpleCustomizePlugin.
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.
423 virtual void PushDefaultPlugins();
425 // An advanced methods for plugin configuration using their
426 // dynamic class information, for example CLASSINFO(pluginClass).
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.
431 virtual void AddPlugin( wxClassInfo
* pPlInfo
, int paneMask
= wxALL_PANES
);
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.
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.
443 virtual void AddPluginBefore( wxClassInfo
* pNextPlInfo
, wxClassInfo
* pPlInfo
,
444 int paneMask
= wxALL_PANES
);
446 // Checks if the plugin of the given class is hooked, and removes
449 virtual void RemovePlugin( wxClassInfo
* pPlInfo
);
451 // Finds a plugin with the given class, or returns NULL if a plugin of the given
452 // class is not hooked.
454 virtual cbPluginBase
* FindPlugin( wxClassInfo
* pPlInfo
);
456 // Returns true if there is a top plugin.
460 DECLARE_EVENT_TABLE()
461 DECLARE_DYNAMIC_CLASS( wxFrameLayout
)
463 public: /* protected really, acessed only by plugins and serializers */
465 friend class cbDockPane
;
466 friend class wxBarHandler
;
468 wxWindow
* mpFrame
; // parent frame
469 wxWindow
* mpFrameClient
; // client window
470 cbDockPane
* mPanes
[MAX_PANES
]; // panes in the panel
473 wxCursor
* mpHorizCursor
;
474 wxCursor
* mpVertCursor
;
475 wxCursor
* mpNormalCursor
;
476 wxCursor
* mpDragCursor
;
477 wxCursor
* mpNECursor
; // no-entry cursor
479 // pens for decoration and shades
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
487 wxPen mNullPen
; // transparent pen
489 // pane to which the all mouse input is currently directed (caputred)
491 cbDockPane
* mpPaneInFocus
;
493 // pane, from which mouse pointer had just left
495 cbDockPane
* mpLRUPane
;
497 // bounds of client window in parent frame's coordinates
499 wxRect mClntWndBounds
;
500 wxRect mPrevClntWndBounds
;
503 wxPoint mNextFloatedWndPos
;
504 wxSize mFloatingPosStep
;
506 // current plugin (right-most) plugin which receives events first
508 cbPluginBase
* mpTopPlugin
;
510 // plugin, which currently has captured all input events, otherwise NULL
512 cbPluginBase
* mpCaputesInput
;
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
520 // list of top-most frames which contain floated bars
522 wxList mFloatedFrames
;
524 // linked list of references to all bars (docked/floated/hidden)
528 // FOR NOW:: dirty stuff...
529 bool mClientWndRefreshPending
;
531 bool mCheckFocusWhenIdle
;
533 public: /* protected really (accessed only by plugins) */
535 // refrence to custom updates manager
536 cbUpdatesManagerBase
* mpUpdatesMgr
;
538 // Called to apply the calculated layout to window objects.
540 void PositionClientWindow();
542 // Called to apply the calculated layout to window objects.
544 void PositionPanes();
546 // Creates the cursors.
548 void CreateCursors();
550 // Applies the calculated layout to a floating bar.
552 void RepositionFloatedBar( cbBarInfo
* pBar
);
554 // Applies the state to the window objects.
556 void DoSetBarState( cbBarInfo
* pBar
);
558 // The purpose of this function is unknown.
560 bool LocateBar( cbBarInfo
* pBarInfo
,
562 cbDockPane
** ppPane
);
565 // Returns true if the position is within the given pane.
567 bool HitTestPane( cbDockPane
* pPane
, int x
, int y
);
569 // Returns the pane for which the rectangle hit test succeeds, giving
570 // preference to the given pane if supplied.
572 cbDockPane
* HitTestPanes( const wxRect
& rect
, cbDockPane
* pCurPane
);
574 // Returns the pane to which the given bar belongs.
576 cbDockPane
* GetBarPane( cbBarInfo
* pBar
);
578 // Delegated from "bar-spy".
579 void ForwardMouseEvent( wxMouseEvent
& event
,
583 // Routes the mouse event to the appropriate pane.
585 void RouteMouseEvent( wxMouseEvent
& event
, int pluginEvtType
);
587 // Shows all floated windows.
589 void ShowFloatedWindows( bool show
);
591 // Unhooks the layout from the frame.
593 void UnhookFromFrame();
595 // Hooks the layout up to the frame (pushes the layout onto the
596 // frame's event handler stack).
598 void HookUpToFrame();
600 // Returns true if the platform allows reparenting. This may not return true
601 // for all platforms. Reparenting allows control bars to be floated.
605 // Reparents pChild to have parent pNewParent.
607 void ReparentWindow( wxWindow
* pChild
, wxWindow
* pNewParent
);
609 // Returns the previous client window rectangle.
611 wxRect
& GetPrevClientRect() { return mPrevClntWndBounds
; }
613 // Handles paint events, calling PaintPane for each pane.
615 void OnPaint( wxPaintEvent
& event
);
617 // Handles background erase events. Currently does nothing.
619 void OnEraseBackground( wxEraseEvent
& event
);
621 // Handles focus kill events. Currently does nothing.
623 void OnKillFocus( wxFocusEvent
& event
);
625 // Handles focus set events. Currently does nothing.
627 void OnSetFocus( wxFocusEvent
& event
);
629 // Handles activation events. Currently does nothing.
631 void OnActivate( wxActivateEvent
& event
);
633 // Handles idle events.
635 void OnIdle( wxIdleEvent
& event
);
637 // Returns a new cbGCUpdatesMgr object.
639 virtual cbUpdatesManagerBase
* CreateUpdatesManager();
643 A structure that is present in each item of layout,
644 used by any particular updates-manager to store
645 auxiliary information to be used by its updating algorithm.
648 class WXDLLIMPEXP_FL cbUpdateMgrData
: public wxObject
650 DECLARE_DYNAMIC_CLASS( cbUpdateMgrData
)
652 wxRect mPrevBounds
; // previous state of layout item (in parent frame's coordinates)
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
657 wxObject
* mpCustomData
; // any custom data stored by specific updates mgr.
659 // Default constructor. Is-dirty flag is set true initially.
663 // Store the item state.
665 void StoreItemState( const wxRect
& boundsInParent
);
667 // Set the dirty flag.
669 void SetDirty( bool isDirty
= true );
673 void SetCustomData( wxObject
* pCustomData
);
675 // Returns the is-dirty flag.
677 inline bool IsDirty() { return mIsDirty
; }
681 Abstract interface for bar-size handler classes.
682 These objects receive notifications whenever the docking
683 state of the bar is changed, thus they provide the possibility
684 to adjust the values in cbDimInfo::mSizes accordingly.
685 Specific handlers can be hooked up to specific types of bar.
688 class WXDLLIMPEXP_FL cbBarDimHandlerBase
: public wxObject
690 DECLARE_ABSTRACT_CLASS( cbBarDimHandlerBase
)
693 int mRefCount
; // since one dim-handler can be assigned
694 // to multiple bars, it's instance is
698 // Default constructor. The initial reference count is 0, since
699 // the handler is not used until the first invocation of AddRef().
701 cbBarDimHandlerBase();
703 // Increments the reference count.
707 // Decrements the reference count, and if the count is at zero,
712 // Responds to "bar-state-changes" notifications.
714 virtual void OnChangeBarState(cbBarInfo
* pBar
, int newState
) = 0;
716 // Responds to bar resize notifications.
718 virtual void OnResizeBar( cbBarInfo
* pBar
, const wxSize
& given
, wxSize
& preferred
) = 0;
722 Helper class used internally by the wxFrameLayout class.
723 Holds and manages information about bar dimensions.
726 class WXDLLIMPEXP_FL cbDimInfo
: public wxObject
728 DECLARE_DYNAMIC_CLASS( cbDimInfo
)
730 wxSize mSizes
[MAX_BAR_STATES
]; // preferred sizes for each possible bar state
732 wxRect mBounds
[MAX_BAR_STATES
]; // saved positions and sizes for each
733 // possible state, values contain (-1)s if
734 // not initialized yet
736 int mLRUPane
; // pane to which this bar was docked before it was floated
737 // (FL_ALIGN_TOP,FL_ALIGN_BOTTOM,..)
739 // top/bottom gap, separates decorations
740 // from the bar's actual window, filled
741 // with frame's beckground color, default: 0
745 // left/right gap, separates decorations
746 // from the bar's actual wndow, filled
747 // with frame's beckground colour, default: 0
749 int mHorizGap
; // NOTE:: gaps are given in frame's coord. orientation
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
757 cbBarDimHandlerBase
* mpHandler
; // NULL, if no handler present
761 // Default 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.
770 cbDimInfo( cbBarDimHandlerBase
* pDimHandler
,
771 bool isFixed
// (see comments on mIsFixed member)
774 // Constructor taking dimenstion information.
776 // dh_x, dh_y are the dimensions when docked horizontally.
778 // dv_x, dv_y are the dimensions when docked vertically.
780 // f_x, f_y are the dimensions when floating.
782 // For information on isFixed, see comments above.
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.
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.
792 cbDimInfo( int dh_x
, int dh_y
,
800 cbBarDimHandlerBase
* pDimHandler
= NULL
805 cbDimInfo( int x
, int y
,
808 cbBarDimHandlerBase
* pDimHandler
= NULL
811 // Destructor. Destroys handler automatically, if present.
815 // Assignment operator.
817 const cbDimInfo
& operator=( const cbDimInfo
& other
);
819 // Returns the handler, if any.
821 inline cbBarDimHandlerBase
* GetDimHandler() { return mpHandler
; }
824 // FIXME: this array definition compiles but probably doesn't do what was intended (GD)
825 WXFL_DEFINE_ARRAY_LONG(float, cbArrayFloat
);
828 Helper class used internally by the wxFrameLayout class.
829 Holds and manages information about bar rows.
832 class cbRowInfo
: public wxObject
834 DECLARE_DYNAMIC_CLASS( cbRowInfo
)
837 BarArrayT mBars
; // row content
839 // row flags (set up according to row-relations)
841 bool mHasUpperHandle
;
842 bool mHasLowerHandle
;
843 bool mHasOnlyFixedBars
;
844 int mNotFixedBarsCnt
;
850 // stores precalculated row's bounds in parent frame's coordinates
851 wxRect mBoundsInParent
;
853 // info stored for updates-manager
854 cbUpdateMgrData mUMgrData
;
859 cbBarInfo
* mpExpandedBar
; // NULL, if non of the bars is currently expanded
861 cbArrayFloat mSavedRatios
; // length-ratios bofore some of the bars was expanded
872 // Returns the first bar.
874 inline cbBarInfo
* GetFirstBar()
876 { return mBars
.GetCount() ? mBars
[0] : NULL
; }
880 Helper class used internally by the wxFrameLayout class.
881 Holds and manages bar information.
884 class cbBarInfo
: public wxObject
886 DECLARE_DYNAMIC_CLASS( cbBarInfo
)
888 // textual name, by which this bar is referred in layout-customization dialogs
891 // stores bar's bounds in pane's coordinates
894 // stores precalculated bar's bounds in parent frame's coordinates
895 wxRect mBoundsInParent
;
897 // back-ref to the row, which contains this bar
900 // are set up according to the types of the surrounding bars in the row
902 bool mHasRightHandle
;
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)
911 cbDimInfo mDimInfo
; // preferred sizes for each, control bar state
913 int mState
; // (see definition of controlbar states)
915 int mAlignment
; // alignment of the pane to which this
916 // bar is currently placed
918 int mRowNo
; // row, into which this bar would be placed,
919 // when in the docking state
921 wxWindow
* mpBarWnd
; // the actual window object, NULL if no window
922 // is attached to the control bar (possible!)
924 double mLenRatio
; // length ratio among not-fixed-size bars
926 wxPoint mPosIfFloated
; // stored last position when bar was in "floated" state
927 // poistion is stored in parent-window's coordinates
929 cbUpdateMgrData mUMgrData
; // info stored for updates-manager
931 cbBarInfo
* mpNext
; // next. bar in the row
932 cbBarInfo
* mpPrev
; // prev. bar in the row
943 // Returns true if this bar is fixed.
945 inline bool IsFixed() const { return mDimInfo
.mIsFixed
; }
947 // Returns true if this bar is expanded.
949 inline bool IsExpanded() const { return this == mpRow
->mpExpandedBar
; }
953 Used for storing the original bar's positions in the row, when the 'non-destructive-friction'
957 class cbBarShapeData
: public wxObject
965 Used for traversing through all bars of all rows in the pane.
975 // Constructor, taking row array.
977 wxBarIterator( RowArrayT
& rows
);
979 // Resets the iterator to the start of the first row.
983 // Advances the iterator and returns true if a bar is available.
987 // Gets the current bar information.
989 cbBarInfo
& BarInfo();
991 // Returns a reference to the currently traversed row.
993 cbRowInfo
& RowInfo();
997 A structure holding configuration options,
998 which are usually the same for all panes in
1002 class WXDLLIMPEXP_FL cbCommonPaneProperties
: public wxObject
1004 DECLARE_DYNAMIC_CLASS( cbCommonPaneProperties
)
1006 // look-and-feel configuration
1008 bool mRealTimeUpdatesOn
; // default: ON
1009 bool mOutOfPaneDragOn
; // default: ON
1010 bool mExactDockPredictionOn
; // default: OFF
1011 bool mNonDestructFrictionOn
; // default: OFF
1013 bool mShow3DPaneBorderOn
; // default: ON
1015 // FOR NOW:: the below properties are reserved for the "future"
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
1023 // minimal dimensions for not-fixed bars in this pane (16x16 default)
1027 // width/height of resizing sash
1029 int mResizeHandleSize
;
1031 // Default constructor.
1033 cbCommonPaneProperties(void);
1037 cbCommonPaneProperties(const cbCommonPaneProperties
&);
1039 // Assignment operator
1041 cbCommonPaneProperties
& operator=(const cbCommonPaneProperties
&);
1045 This class manages containment and control of control bars
1046 along one of the four edges of the parent frame.
1049 class cbDockPane
: public wxObject
1052 DECLARE_DYNAMIC_CLASS( cbDockPane
)
1054 // look-and-feel configuration for this pane
1055 cbCommonPaneProperties mProps
;
1057 // pane margins (in frame's coordinate-syst. orientation)
1059 int mLeftMargin
; // default: 2 pixels
1060 int mRightMargin
; // default: 2 pixels
1061 int mTopMargin
; // default: 2 pixels
1062 int mBottomMargin
; // default: 2 pixels
1065 // position of the pane in frame's coordinates
1066 wxRect mBoundsInParent
;
1068 // pane width and height in pane's coordinates
1074 // info stored for updates-manager
1075 cbUpdateMgrData mUMgrData
;
1077 public: /* protected really */
1080 wxFrameLayout
* mpLayout
; // back-ref
1082 // transient properties
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
1088 friend class wxFrameLayout
;
1090 public: /* protected really (accessed only by plugins) */
1092 // Returns the row info for a row index. Internal function called by plugins.
1094 cbRowInfo
* GetRow( int row
);
1096 // Returns the row index for the given row info. Internal function called by plugins.
1098 int GetRowIndex( cbRowInfo
* pRow
);
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.
1104 int GetRowAt( int paneY
);
1106 // Returns the row between the given vertical positions.
1107 // Returns -1 if the row is not present.
1108 // Internal function called by plugins.
1110 int GetRowAt( int upperY
, int lowerY
);
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.
1116 void SyncRowFlags( cbRowInfo
* pRow
);
1118 // Returns true if the bar's dimension information indicates a fixed size.
1119 // Internal function called by plugins.
1121 bool IsFixedSize( cbBarInfo
* pInfo
);
1123 // Returns the number of bars whose size is not fixed.
1124 // Internal function called by plugins.
1126 int GetNotFixedBarsCount( cbRowInfo
* pRow
);
1128 // Gets the vertical position at the given row.
1129 // Internal function called by plugins.
1131 int GetRowY( cbRowInfo
* pRow
);
1133 // Returns true if there are any variable-sized rows above this one.
1134 // Internal function called by plugins.
1136 bool HasNotFixedRowsAbove( cbRowInfo
* pRow
);
1138 // Returns true if there are any variable-sized rows below this one.
1139 // Internal function called by plugins.
1141 bool HasNotFixedRowsBelow( cbRowInfo
* pRow
);
1143 // Returns true if there are any variable-sized rows to the left of this one.
1144 // Internal function called by plugins.
1146 bool HasNotFixedBarsLeft ( cbBarInfo
* pBar
);
1148 // Returns true if there are any variable-sized rows to the right of this one.
1149 // Internal function called by plugins.
1151 bool HasNotFixedBarsRight( cbBarInfo
* pBar
);
1153 // Calculate lengths.
1154 // Internal function called by plugins.
1156 virtual void CalcLengthRatios( cbRowInfo
* pInRow
);
1158 // Generates a cbLayoutRowEvent event to recalculate row layouts.
1159 // Internal function called by plugins.
1161 virtual void RecalcRowLayout( cbRowInfo
* pRow
);
1164 // Internal function called by plugins.
1166 virtual void ExpandBar( cbBarInfo
* pBar
);
1168 // Contracts the bar.
1169 // Internal function called by plugins.
1171 virtual void ContractBar( cbBarInfo
* pBar
);
1173 // Sets up links between bars.
1174 // Internal function called by plugins.
1176 void InitLinksForRow( cbRowInfo
* pRow
);
1178 // Sets up links between bars.
1179 // Internal function called by plugins.
1181 void InitLinksForRows();
1183 // Coordinate translation between parent's frame and this pane.
1184 // Internal function called by plugins.
1186 void FrameToPane( int* x
, int* y
);
1188 // Coordinate translation between parent's frame and this pane.
1189 // Internal function called by plugins.
1191 void PaneToFrame( int* x
, int* y
);
1193 // Coordinate translation between parent's frame and this pane.
1194 // Internal function called by plugins.
1196 void FrameToPane( wxRect
* pRect
);
1198 // Coordinate translation between parent's frame and this pane.
1199 // Internal function called by plugins.
1201 void PaneToFrame( wxRect
* pRect
);
1203 // Returns true if pos is within the given rectangle.
1204 // Internal function called by plugins.
1206 inline bool HasPoint( const wxPoint
& pos
, int x
, int y
, int width
, int height
);
1208 // Returns the minimal row height for the given row.
1209 // Internal function called by plugins.
1211 int GetMinimalRowHeight( cbRowInfo
* pRow
);
1213 // Sets the row height for the given height. newHeight includes the height of row handles, if present.
1214 // Internal function called by plugins.
1216 void SetRowHeight( cbRowInfo
* pRow
, int newHeight
);
1218 // Inserts the bar at the given row number.
1219 // Internal function called by plugins.
1221 void DoInsertBar( cbBarInfo
* pBar
, int rowNo
);
1223 public: /* protected really (accessed only by plugins) */
1225 // Generates a cbDrawBarDecorEvent and sends it to the layout to paint the bar decorations.
1226 // Internal function called by plugins.
1228 virtual void PaintBarDecorations( cbBarInfo
* pBar
, wxDC
& dc
);
1230 // Generates a cbDrawBarHandlesEvent and sends it to the layout to paint the bar handles.
1231 // Internal function called by plugins.
1233 virtual void PaintBarHandles( cbBarInfo
* pBar
, wxDC
& dc
);
1235 // Calls PaintBarDecorations and PaintBarHandles.
1236 // Internal function called by plugins.
1238 virtual void PaintBar( cbBarInfo
* pBar
, wxDC
& dc
);
1240 // Generates cbDrawRowHandlesEvent and cbDrawRowDecorEvent and sends them to the layout.
1241 // Internal function called by plugins.
1243 virtual void PaintRowHandles( cbRowInfo
* pRow
, wxDC
& dc
);
1245 // Generates cbDrawRowBkGroundEvent and sends it to the layout.
1246 // Internal function called by plugins.
1248 virtual void PaintRowBackground ( cbRowInfo
* pRow
, wxDC
& dc
);
1250 // Calls PaintBarDecorations for each row.
1251 // Internal function called by plugins.
1253 virtual void PaintRowDecorations( cbRowInfo
* pRow
, wxDC
& dc
);
1255 // Calls PaintRowBackground, PaintRowDecorations, PaintRowHandles.
1256 // Internal function called by plugins.
1258 virtual void PaintRow( cbRowInfo
* pRow
, wxDC
& dc
);
1260 // Generates cbDrawPaneBkGroundEvent and sends it to the layout.
1261 // Internal function called by plugins.
1263 virtual void PaintPaneBackground( wxDC
& dc
);
1265 // Generates cbDrawPaneDecorEvent and sends it to the layout.
1266 // Internal function called by plugins.
1268 virtual void PaintPaneDecorations( wxDC
& dc
);
1270 // Paints the pane background, the row background and decorations,
1271 // and finally the pane decorations.
1272 // Internal function called by plugins.
1274 virtual void PaintPane( wxDC
& dc
);
1276 // Generates a cbSizeBarWndEvent and sends it to the layout.
1277 // Internal function called by plugins.
1279 virtual void SizeBar( cbBarInfo
* pBar
);
1281 // Calls SizeBar for each bar in the row.
1282 // Internal function called by plugins.
1284 virtual void SizeRowObjects( cbRowInfo
* pRow
);
1286 // Calls SizeRowObjects for each row.
1287 // Internal function called by plugins.
1289 virtual void SizePaneObjects();
1291 // Generates cbStartDrawInAreaEvent and sends it to the layout.
1292 // Internal function called by plugins.
1294 virtual wxDC
* StartDrawInArea ( const wxRect
& area
);
1296 // Generates cbFinishDrawInAreaEvent and sends it to the layout.
1297 // Internal function called by plugins.
1299 virtual void FinishDrawInArea( const wxRect
& area
);
1301 public: /* public members */
1303 // Default constructor.
1307 // Constructor, taking alignment and layout panel.
1309 cbDockPane( int alignment
, wxFrameLayout
* pPanel
);
1311 // Sets pane's margins in frame's coordinate orientations.
1313 void SetMargins( int top
, int bottom
, int left
, int right
);
1317 virtual ~cbDockPane();
1319 // Removes the bar from this pane. Does not destroy the bar.
1321 virtual void RemoveBar( cbBarInfo
* pBar
);
1323 // Inserts the bar into this pane. rect is given in the parent frame's coordinates.
1325 virtual void InsertBar( cbBarInfo
* pBar
, const wxRect
& rect
);
1327 // Inserts the bar into the given row, with dimensions and position
1328 // stored in pBarInfo->mBounds. Returns the node of inserted bar.
1330 virtual void InsertBar( cbBarInfo
* pBar
, cbRowInfo
* pIntoRow
);
1332 // Inserts bar and sets its position according to the preferred settings
1333 // given in pBarInfo.
1335 virtual void InsertBar( cbBarInfo
* pBarInfo
);
1337 // Removes the row from this pane. Does not destroy the row object.
1339 virtual void RemoveRow( cbRowInfo
* pRow
);
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.
1344 virtual void InsertRow( cbRowInfo
* pRow
, cbRowInfo
* pBeforeRow
);
1346 // Sets pane's width in the pane's coordinates (including margins).
1348 void SetPaneWidth(int width
);
1350 // Set the position and dimensions of the pane in the parent frame's coordinates.
1352 void SetBoundsInParent( const wxRect
& rect
);
1354 // Returns the bounds of the pane, in parent coordinates.
1356 inline wxRect
& GetRealRect() { return mBoundsInParent
; }
1358 // Returns an array of rows. Used by updates-managers.
1360 inline RowArrayT
& GetRowList() { return mRows
; }
1362 // Returns the first row.
1364 inline cbRowInfo
* GetFirstRow()
1366 { return mRows
.GetCount() ? mRows
[0] : NULL
; }
1368 // Returns true if the given bar is present in this pane.
1370 bool BarPresent( cbBarInfo
* pBar
);
1372 // Returns the height in the pane's coordinates.
1374 int GetPaneHeight();
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.
1381 // Returns true if the given mask matches the pane's mask.
1383 bool MatchesMask( int paneMask
);
1385 // Returns true if the pane is aligned to the top or bottom.
1387 inline bool IsHorizontal()
1389 return (mAlignment
== FL_ALIGN_TOP
||
1390 mAlignment
== FL_ALIGN_BOTTOM
);
1393 // Generates events to perform layout calculations.
1395 virtual void RecalcLayout();
1397 // Returns wxCBAR_DOCKED_HORIZONTALLY if the alignment is top or bottom,
1398 // or wxCBAR_DOCKED_VERTICALLY otherwise.
1400 virtual int GetDockingState();
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.
1406 virtual int HitTestPaneItems( const wxPoint
& pos
,
1411 // Returns the bar's resize range.
1413 void GetBarResizeRange( cbBarInfo
* pBar
, int* from
, int *till
, bool forLeftHandle
);
1415 // Returns the row's resize range.
1417 void GetRowResizeRange( cbRowInfo
* pRow
, int* from
, int* till
, bool forUpperHandle
);
1419 // Finds the bar information by corresponding window.
1421 cbBarInfo
* GetBarInfoByWindow( wxWindow
* pBarWnd
);
1423 public: /* protected really (accessed only by plugins) */
1425 // Row/bar resizing related helper-method.
1427 void DrawVertHandle ( wxDC
& dc
, int x
, int y
, int height
);
1429 // Row/bar resizing related helper-method.
1431 void DrawHorizHandle( wxDC
& dc
, int x
, int y
, int width
);
1433 // Row/bar resizing related helper-method.
1435 void ResizeRow( cbRowInfo
* pRow
, int ofs
, bool forUpperHandle
);
1437 // Row/bar resizing related helper-method.
1439 void ResizeBar( cbBarInfo
* pBar
, int ofs
, bool forLeftHandle
);
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.
1446 void GetRowShapeData( cbRowInfo
* pRow
, wxList
* pLst
);
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.
1452 void SetRowShapeData( cbRowInfo
* pRowNode
, wxList
* pLst
);
1456 This class declares an abstract interface for optimized logic that should refresh
1457 areas of frame layout that actually need to be updated. This should be extended in future
1458 to implement a custom updating strategy.
1461 class WXDLLIMPEXP_FL cbUpdatesManagerBase
: public wxObject
1463 DECLARE_ABSTRACT_CLASS( cbUpdatesManagerBase
)
1465 public: /* protected really, accessed by serializer (if any) */
1467 wxFrameLayout
* mpLayout
;
1470 // Default constructor
1472 cbUpdatesManagerBase(void)
1475 // Constructor taking layout panel.
1477 cbUpdatesManagerBase( wxFrameLayout
* pPanel
)
1478 : mpLayout( pPanel
) {}
1482 virtual ~cbUpdatesManagerBase() {}
1484 // Sets the associated layout.
1486 void SetLayout( wxFrameLayout
* pLayout
) { mpLayout
= pLayout
; }
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.
1492 virtual void OnStartChanges() = 0;
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.
1498 virtual void OnRowWillChange( cbRowInfo
* WXUNUSED(pRow
), cbDockPane
* WXUNUSED(pInPane
) ) {}
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.
1504 virtual void OnBarWillChange( cbBarInfo
* WXUNUSED(pBar
), cbRowInfo
* WXUNUSED(pInRow
), cbDockPane
* WXUNUSED(pInPane
) ) {}
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.
1510 virtual void OnPaneMarginsWillChange( cbDockPane
* WXUNUSED(pPane
) ) {}
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.
1516 virtual void OnPaneWillChange( cbDockPane
* WXUNUSED(pPane
) ) {}
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.
1522 virtual void OnFinishChanges() {}
1524 // Refreshes parts of the frame layout that need an update.
1526 virtual void UpdateNow() = 0;
1530 Base class for all control-bar plugin events.
1531 This is not a dynamically-creatable class.
1534 class cbPluginEvent
: public wxEvent
1537 // NULL if event is not addressed to any specific pane.
1541 // Not used, but required.
1543 virtual wxEvent
* Clone() const { return NULL
; }
1545 // Constructor, taking event type and pane.
1547 cbPluginEvent( wxEventType eventType
, cbDockPane
* pPane
)
1550 { m_eventType
= eventType
; }
1553 // event types handled by plugins
1555 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DOWN
;
1556 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_UP
;
1557 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_DOWN
;
1558 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_UP
;
1559 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_MOTION
;
1561 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DCLICK
;
1563 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROW
;
1564 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_ROW
;
1565 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROWS
;
1566 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_INSERT_BAR
;
1567 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_BAR
;
1568 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_REMOVE_BAR
;
1569 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_SIZE_BAR_WND
;
1571 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_DECOR
;
1572 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_DECOR
;
1573 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_DECOR
;
1574 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_HANDLES
;
1575 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_HANDLES
;
1576 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_BKGROUND
;
1577 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_BKGROUND
;
1579 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_BAR_DRAGGING
;
1580 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_HINT_RECT
;
1582 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_DRAW_IN_AREA
;
1583 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA
;
1585 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_BAR
;
1586 extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT
;
1588 extern WXDLLIMPEXP_FL wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT
;
1590 // Forward declarations, separated by categories.
1592 class cbLeftDownEvent
;
1593 class cbLeftUpEvent
;
1594 class cbRightDownEvent
;
1595 class cbRightUpEvent
;
1596 class cbMotionEvent
;
1597 class cbLeftDClickEvent
;
1599 class cbLayoutRowEvent
;
1600 class cbResizeRowEvent
;
1601 class cbLayoutRowsEvent
;
1602 class cbInsertBarEvent
;
1603 class cbResizeBarEvent
;
1604 class cbRemoveBarEvent
;
1605 class cbSizeBarWndEvent
;
1607 class cbDrawBarDecorEvent
;
1608 class cbDrawRowDecorEvent
;
1609 class cbDrawPaneDecorEvent
;
1610 class cbDrawBarHandlesEvent
;
1611 class cbDrawRowHandlesEvent
;
1612 class cbDrawRowBkGroundEvent
;
1613 class cbDrawPaneBkGroundEvent
;
1615 class cbStartBarDraggingEvent
;
1616 class cbDrawHintRectEvent
;
1618 class cbStartDrawInAreaEvent
;
1619 class cbFinishDrawInAreaEvent
;
1621 class cbCustomizeBarEvent
;
1622 class cbCustomizeLayoutEvent
;
1624 // Definitions for for handler-methods.
1626 typedef void (wxEvtHandler::*cbLeftDownHandler
)(cbLeftDownEvent
&);
1627 typedef void (wxEvtHandler::*cbLeftUpHandler
)(cbLeftUpEvent
&);
1628 typedef void (wxEvtHandler::*cbRightDownHandler
)(cbRightDownEvent
&);
1629 typedef void (wxEvtHandler::*cbRightUpHandler
)(cbRightUpEvent
&);
1630 typedef void (wxEvtHandler::*cbMotionHandler
)(cbMotionEvent
&);
1631 typedef void (wxEvtHandler::*cbLeftDClickHandler
)(cbLeftDClickEvent
&);
1633 typedef void (wxEvtHandler::*cbLayoutRowHandler
)(cbLayoutRowEvent
&);
1634 typedef void (wxEvtHandler::*cbResizeRowHandler
)(cbResizeRowEvent
&);
1635 typedef void (wxEvtHandler::*cbLayoutRowsHandler
)(cbLayoutRowsEvent
&);
1636 typedef void (wxEvtHandler::*cbInsertBarHandler
)(cbInsertBarEvent
&);
1637 typedef void (wxEvtHandler::*cbResizeBarHandler
)(cbResizeBarEvent
&);
1638 typedef void (wxEvtHandler::*cbRemoveBarHandler
)(cbRemoveBarEvent
&);
1639 typedef void (wxEvtHandler::*cbSizeBarWndHandler
)(cbSizeBarWndEvent
&);
1641 typedef void (wxEvtHandler::*cbDrawBarDecorHandler
)(cbDrawBarDecorEvent
&);
1642 typedef void (wxEvtHandler::*cbDrawRowDecorHandler
)(cbDrawRowDecorEvent
&);
1643 typedef void (wxEvtHandler::*cbDrawPaneDecorHandler
)(cbDrawPaneDecorEvent
&);
1644 typedef void (wxEvtHandler::*cbDrawBarHandlesHandler
)(cbDrawBarHandlesEvent
&);
1645 typedef void (wxEvtHandler::*cbDrawRowHandlesHandler
)(cbDrawRowHandlesEvent
&);
1646 typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler
)(cbDrawRowBkGroundEvent
&);
1647 typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler
)(cbDrawPaneBkGroundEvent
&);
1649 typedef void (wxEvtHandler::*cbStartBarDraggingHandler
)(cbStartBarDraggingEvent
&);
1650 typedef void (wxEvtHandler::*cbDrawHintRectHandler
)(cbDrawHintRectEvent
&);
1652 typedef void (wxEvtHandler::*cbStartDrawInAreaHandler
)(cbStartDrawInAreaEvent
&);
1653 typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler
)(cbFinishDrawInAreaEvent
&);
1655 typedef void (wxEvtHandler::*cbCustomizeBarHandler
)(cbCustomizeBarEvent
&);
1656 typedef void (wxEvtHandler::*cbCustomizeLayoutHandler
)(cbCustomizeLayoutEvent
&);
1658 // Macros for creating event table entries for plugin-events.
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 ),
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 ),
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 ),
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 ),
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 ),
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 ),
1694 Abstract base class for all control-bar related plugins.
1695 Note: pointer positions of mouse events sent to plugins
1696 are always in the pane's coordinates (the pane to which
1697 this plugin is hooked).
1700 class cbPluginBase
: public wxEvtHandler
1702 DECLARE_ABSTRACT_CLASS( cbPluginBase
)
1704 // Back-reference to the frame layout.
1706 wxFrameLayout
* mpLayout
;
1708 // Specifies panes for which this plugin receives events
1709 // (see pane masks definitions).
1713 // Is true when plugin is ready to handle events.
1718 // Default constructor.
1723 mPaneMask( wxALL_PANES
),
1727 // Constructor taking layout panel and a mask.
1729 cbPluginBase( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
)
1731 : mpLayout ( pPanel
),
1732 mPaneMask( paneMask
),
1736 // Returns the pane mask.
1738 inline int GetPaneMask() { return mPaneMask
; }
1740 // Destructor. Destroys the whole plugin chain of connected plugins.
1742 virtual ~cbPluginBase();
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.
1748 virtual void OnInitPlugin() { mIsReady
= true; }
1750 // Returns true if the plugin is ready to receive events.
1752 bool IsReady() { return mIsReady
; }
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).
1758 virtual bool ProcessEvent(wxEvent
& event
);
1762 Class for mouse left down events.
1765 class cbLeftDownEvent
: public cbPluginEvent
1770 // Constructor, taking mouse position and pane.
1772 cbLeftDownEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1774 : cbPluginEvent( cbEVT_PL_LEFT_DOWN
, pPane
),
1780 Class for mouse left up events.
1783 class cbLeftUpEvent
: public cbPluginEvent
1788 // Constructor, taking mouse position and pane.
1790 cbLeftUpEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1792 : cbPluginEvent( cbEVT_PL_LEFT_UP
, pPane
),
1798 Class for mouse right down events.
1801 class cbRightDownEvent
: public cbPluginEvent
1806 // Constructor, taking mouse position and pane.
1808 cbRightDownEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1810 : cbPluginEvent( cbEVT_PL_RIGHT_DOWN
, pPane
),
1816 Class for mouse right up events.
1819 class cbRightUpEvent
: public cbPluginEvent
1824 // Constructor, taking mouse position and pane.
1826 cbRightUpEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1828 : cbPluginEvent( cbEVT_PL_RIGHT_UP
, pPane
),
1834 Class for mouse motion events.
1837 class cbMotionEvent
: public cbPluginEvent
1842 // Constructor, taking mouse position and pane.
1844 cbMotionEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1846 : cbPluginEvent( cbEVT_PL_MOTION
, pPane
),
1852 Class for mouse left double click events.
1855 class cbLeftDClickEvent
: public cbPluginEvent
1860 // Constructor, taking mouse position and pane.
1862 cbLeftDClickEvent( const wxPoint
& pos
, cbDockPane
* pPane
)
1864 : cbPluginEvent( cbEVT_PL_LEFT_DCLICK
, pPane
),
1870 Class for single row layout events.
1873 class cbLayoutRowEvent
: public cbPluginEvent
1878 // Constructor, taking row information and pane.
1880 cbLayoutRowEvent( cbRowInfo
* pRow
, cbDockPane
* pPane
)
1882 : cbPluginEvent( cbEVT_PL_LAYOUT_ROW
, pPane
),
1888 Class for row resize events.
1891 class cbResizeRowEvent
: public cbPluginEvent
1896 bool mForUpperHandle
;
1898 // Constructor, taking row information, two parameters of currently unknown use, and pane.
1900 cbResizeRowEvent( cbRowInfo
* pRow
, int handleOfs
, bool forUpperHandle
, cbDockPane
* pPane
)
1902 : cbPluginEvent( cbEVT_PL_RESIZE_ROW
, pPane
),
1904 mHandleOfs( handleOfs
),
1905 mForUpperHandle( forUpperHandle
)
1910 Class for multiple rows layout events.
1913 class cbLayoutRowsEvent
: public cbPluginEvent
1917 // Constructor, taking pane.
1919 cbLayoutRowsEvent( cbDockPane
* pPane
)
1921 : cbPluginEvent( cbEVT_PL_LAYOUT_ROWS
, pPane
)
1926 Class for bar insertion events.
1929 class cbInsertBarEvent
: public cbPluginEvent
1935 // Constructor, taking bar information, row information, and pane.
1937 cbInsertBarEvent( cbBarInfo
* pBar
, cbRowInfo
* pIntoRow
, cbDockPane
* pPane
)
1939 : cbPluginEvent( cbEVT_PL_INSERT_BAR
, pPane
),
1947 Class for bar resize events.
1950 class cbResizeBarEvent
: public cbPluginEvent
1956 // Constructor, taking bar information, row information, and pane.
1958 cbResizeBarEvent( cbBarInfo
* pBar
, cbRowInfo
* pRow
, cbDockPane
* pPane
)
1960 : cbPluginEvent( cbEVT_PL_RESIZE_BAR
, pPane
),
1967 Class for bar removal events.
1970 class cbRemoveBarEvent
: public cbPluginEvent
1975 // Constructor, taking bar information and pane.
1977 cbRemoveBarEvent( cbBarInfo
* pBar
, cbDockPane
* pPane
)
1979 : cbPluginEvent( cbEVT_PL_REMOVE_BAR
, pPane
),
1985 Class for bar window resize events.
1988 class cbSizeBarWndEvent
: public cbPluginEvent
1992 wxRect mBoundsInParent
;
1994 // Constructor, taking bar information and pane.
1996 cbSizeBarWndEvent( cbBarInfo
* pBar
, cbDockPane
* pPane
)
1998 : cbPluginEvent( cbEVT_PL_SIZE_BAR_WND
, pPane
),
2000 mBoundsInParent( pBar
->mBoundsInParent
)
2005 Class for bar decoration drawing events.
2008 class cbDrawBarDecorEvent
: public cbPluginEvent
2013 wxRect mBoundsInParent
;
2015 // Constructor, taking bar information, device context, and pane.
2017 cbDrawBarDecorEvent( cbBarInfo
* pBar
, wxDC
& dc
, cbDockPane
* pPane
)
2019 : cbPluginEvent( cbEVT_PL_DRAW_BAR_DECOR
, pPane
),
2022 mBoundsInParent( pBar
->mBoundsInParent
)
2027 Class for row decoration drawing events.
2030 class cbDrawRowDecorEvent
: public cbPluginEvent
2036 // Constructor, taking row information, device context, and pane.
2038 cbDrawRowDecorEvent( cbRowInfo
* pRow
, wxDC
& dc
, cbDockPane
* pPane
)
2040 : cbPluginEvent( cbEVT_PL_DRAW_ROW_DECOR
, pPane
),
2047 Class for pane decoration drawing events.
2050 class cbDrawPaneDecorEvent
: public cbPluginEvent
2055 // Constructor, taking device context and pane.
2057 cbDrawPaneDecorEvent( wxDC
& dc
, cbDockPane
* pPane
)
2059 : cbPluginEvent( cbEVT_PL_DRAW_PANE_DECOR
, pPane
),
2065 Class for bar handles drawing events.
2068 class cbDrawBarHandlesEvent
: public cbPluginEvent
2074 // Constructor, taking bar information, device context, and pane.
2076 cbDrawBarHandlesEvent( cbBarInfo
* pBar
, wxDC
& dc
, cbDockPane
* pPane
)
2078 : cbPluginEvent( cbEVT_PL_DRAW_BAR_HANDLES
, pPane
),
2085 Class for row handles drawing events.
2088 class cbDrawRowHandlesEvent
: public cbPluginEvent
2094 // Constructor, taking row information, device context, and pane.
2096 cbDrawRowHandlesEvent( cbRowInfo
* pRow
, wxDC
& dc
, cbDockPane
* pPane
)
2098 : cbPluginEvent( cbEVT_PL_DRAW_ROW_HANDLES
, pPane
),
2105 Class for row background drawing events.
2108 class cbDrawRowBkGroundEvent
: public cbPluginEvent
2114 // Constructor, taking row information, device context, and pane.
2116 cbDrawRowBkGroundEvent( cbRowInfo
* pRow
, wxDC
& dc
, cbDockPane
* pPane
)
2118 : cbPluginEvent( cbEVT_PL_DRAW_ROW_BKGROUND
, pPane
),
2125 Class for pane background drawing events.
2128 class cbDrawPaneBkGroundEvent
: public cbPluginEvent
2133 // Constructor, taking device context and pane.
2135 cbDrawPaneBkGroundEvent( wxDC
& dc
, cbDockPane
* pPane
)
2137 : cbPluginEvent( cbEVT_PL_DRAW_PANE_BKGROUND
, pPane
),
2143 Class for start-bar-dragging events.
2146 class cbStartBarDraggingEvent
: public cbPluginEvent
2150 wxPoint mPos
; // is given in frame's coordinates
2152 // Constructor, taking bar information, mouse position, and pane.
2154 cbStartBarDraggingEvent( cbBarInfo
* pBar
, const wxPoint
& pos
, cbDockPane
* pPane
)
2156 : cbPluginEvent( cbEVT_PL_START_BAR_DRAGGING
, pPane
),
2163 Class for hint-rectangle drawing events.
2166 class cbDrawHintRectEvent
: public cbPluginEvent
2169 wxRect mRect
; // is given in frame's coordinates
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
2176 bool mIsInClient
;// in cleint area hint could be drawn differently,
2177 // e.g. with fat/hatched border
2180 // Constructor, taking hint rectangle and three flags.
2182 cbDrawHintRectEvent( const wxRect
& rect
, bool isInClient
, bool eraseRect
, bool lastTime
)
2184 : cbPluginEvent( cbEVT_PL_DRAW_HINT_RECT
, 0 ),
2186 mLastTime ( lastTime
),
2187 mEraseRect ( eraseRect
),
2188 mIsInClient( isInClient
)
2193 Class for start drawing in area events.
2196 class cbStartDrawInAreaEvent
: public cbPluginEvent
2200 wxDC
** mppDc
; // points to pointer, where the reference
2201 // to the obtained buffer-context should be placed
2203 // Constructor, taking rectangular area, device context pointer to a pointer, and pane.
2205 cbStartDrawInAreaEvent( const wxRect
& area
, wxDC
** ppDCForArea
, cbDockPane
* pPane
)
2207 : cbPluginEvent( cbEVT_PL_START_DRAW_IN_AREA
, pPane
),
2209 mppDc( ppDCForArea
)
2214 Class for finish drawing in area events.
2217 class cbFinishDrawInAreaEvent
: public cbPluginEvent
2222 // Constructor, taking rectangular area and pane.
2224 cbFinishDrawInAreaEvent( const wxRect
& area
, cbDockPane
* pPane
)
2226 : cbPluginEvent( cbEVT_PL_FINISH_DRAW_IN_AREA
, pPane
),
2232 Class for bar customization events.
2235 class cbCustomizeBarEvent
: public cbPluginEvent
2238 wxPoint mClickPos
; // in parent frame's coordinates
2241 // Constructor, taking bar information, mouse position, and pane.
2243 cbCustomizeBarEvent( cbBarInfo
* pBar
, const wxPoint
& clickPos
, cbDockPane
* pPane
)
2245 : cbPluginEvent( cbEVT_PL_CUSTOMIZE_BAR
, pPane
),
2246 mClickPos( clickPos
),
2252 Class for layout customization events.
2255 class cbCustomizeLayoutEvent
: public cbPluginEvent
2258 wxPoint mClickPos
; // in parent frame's coordinates
2260 // Constructor, taking mouse position.
2262 cbCustomizeLayoutEvent( const wxPoint
& clickPos
)
2264 : cbPluginEvent( cbEVT_PL_CUSTOMIZE_LAYOUT
, 0 ),
2265 mClickPos( clickPos
)
2269 #endif /* __CONTROLBAR_G__ */