1
/////////////////////////////////////////////////////////////////////////////
3
// Purpose: Central header file for control-bar related classes
5
// Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
8
// RCS-ID: $Id: controlbar.h,v 1.23 2005/06/15 02:08:12 MR Exp $
9
// Copyright: (c) Aleksandras Gluchovas
10
// Licence: wxWindows licence
11
/////////////////////////////////////////////////////////////////////////////
13
#ifndef __CONTROLBAR_G__
14
#define __CONTROLBAR_G__
16
#if defined(__GNUG__) && !defined(__APPLE__)
17
#pragma interface "controlbar.h"
21
#include "wx/string.h"
23
#include "wx/window.h"
24
#include "wx/dynarray.h"
25
#include "wx/fl/fldefs.h"
27
#define WXCONTROLBAR_VERSION 1.3
29
// forward declarations
31
class WXDLLIMPEXP_FL wxFrameLayout;
33
class WXDLLIMPEXP_FL cbDockPane;
34
class WXDLLIMPEXP_FL cbUpdatesManagerBase;
35
class WXDLLIMPEXP_FL cbBarDimHandlerBase;
36
class WXDLLIMPEXP_FL cbPluginBase;
37
class WXDLLIMPEXP_FL cbPluginEvent;
38
class WXDLLIMPEXP_FL cbPaneDrawPlugin;
40
class WXDLLIMPEXP_FL cbBarInfo;
41
class WXDLLIMPEXP_FL cbRowInfo;
42
class WXDLLIMPEXP_FL cbDimInfo;
43
class WXDLLIMPEXP_FL cbCommonPaneProperties;
45
typedef cbBarInfo* BarInfoPtrT;
46
typedef cbRowInfo* RowInfoPtrT;
48
WXFL_DEFINE_ARRAY_PTR( BarInfoPtrT, BarArrayT );
49
WXFL_DEFINE_ARRAY_PTR( RowInfoPtrT, RowArrayT );
53
#define wxCBAR_DOCKED_HORIZONTALLY 0
54
#define wxCBAR_DOCKED_VERTICALLY 1
55
#define wxCBAR_FLOATING 2
56
#define wxCBAR_HIDDEN 3
58
// the states are enumerated above
59
#define MAX_BAR_STATES 4
61
// control bar alignments
63
#if !defined(FL_ALIGN_TOP)
65
#define FL_ALIGN_TOP 0
66
#define FL_ALIGN_BOTTOM 1
67
#define FL_ALIGN_LEFT 2
68
#define FL_ALIGN_RIGHT 3
72
// one pane for each alignment
75
// masks for each pane
77
#define FL_ALIGN_TOP_PANE 0x0001
78
#define FL_ALIGN_BOTTOM_PANE 0x0002
79
#define FL_ALIGN_LEFT_PANE 0x0004
80
#define FL_ALIGN_RIGHT_PANE 0x0008
82
#define wxALL_PANES 0x000F
84
// enumeration of hittest results, see cbDockPane::HitTestPaneItems(..)
86
enum CB_HITTEST_RESULT
90
CB_UPPER_ROW_HANDLE_HITTED,
91
CB_LOWER_ROW_HANDLE_HITTED,
92
CB_LEFT_BAR_HANDLE_HITTED,
93
CB_RIGHT_BAR_HANDLE_HITTED,
98
Helper class, used for spying for unhandled mouse events on control bars
99
and forwarding them to the frame layout.
102
class WXDLLIMPEXP_FL cbBarSpy : public wxEvtHandler
105
DECLARE_DYNAMIC_CLASS( cbBarSpy )
107
wxFrameLayout* mpLayout;
111
// Default constructor.
115
// Constructor, taking a parent pane.
117
cbBarSpy( wxFrameLayout* pPanel );
119
// Sets the bar window.
121
void SetBarWindow( wxWindow* pWnd );
123
// Performs special event processing.
125
virtual bool ProcessEvent(wxEvent& event);
129
wxFrameLayout manages containment and docking of control bars,
130
which can be docked along the top, bottom, right, or left side of the
134
class WXDLLIMPEXP_FL wxFrameLayout : public wxEvtHandler
137
// Default constructor, used only for serialization.
141
// Constructor, taking parent window, the (MDI) client of the parent if there
142
// is one, and flag specifying whether to activate the layout.
144
wxFrameLayout( wxWindow* pParentFrame,
145
wxWindow* pFrameClient = NULL,
146
bool activateNow = true );
148
// Destructor. It does not destroy the bar windows.
150
virtual ~wxFrameLayout();
152
// Enables floating behaviour. By default floating of control bars is on.
154
virtual void EnableFloating( bool enable = true );
156
// Activate can be called after some other layout has been deactivated,
157
// and this one must take over the current contents of the frame window.
159
// Effectively hooks itself to the frame window, re-displays all non-hidden
160
// bar windows and repaints the decorations.
162
virtual void Activate();
164
// Deactivate unhooks itself from frame window, and hides all non-hidden windows.
166
// Note: two frame layouts should not be active at the same time in the
167
// same frame window, since it would cause messy overlapping of bar windows
168
// from both layouts.
170
virtual void Deactivate();
172
// Hides the bar windows, and also the client window if present.
174
void HideBarWindows();
176
// Destroys the bar windows.
178
virtual void DestroyBarWindows();
180
// Passes the client window (e.g. MDI client window) to be controlled by
181
// frame layout, the size and position of which should be adjusted to be
182
// surrounded by controlbar panes, whenever the frame is resized or the dimensions
183
// of control panes change.
185
void SetFrameClient( wxWindow* pFrameClient );
187
// Returns the frame client, or NULL if not present.
189
wxWindow* GetFrameClient();
191
// Returns the parent frame.
193
wxWindow& GetParentFrame() { return *mpFrame; }
195
// Returns an array of panes. Used by update managers.
197
cbDockPane** GetPanesArray() { return mPanes; }
199
// Returns a pane for the given alignment. See pane alignment types.
201
cbDockPane* GetPane( int alignment )
203
{ return mPanes[alignment]; }
205
// Adds bar information to the frame layout. The appearance of the layout is not refreshed
206
// immediately; RefreshNow() can be called if necessary.
208
// Notes: the argument pBarWnd can by NULL, resulting in bar decorations to be drawn
209
// around the empty rectangle (filled with default background colour).
210
// Argument dimInfo can be reused for adding any number of bars, since
211
// it is not used directly - instead its members are copied. If the dimensions
212
// handler is present, its instance is shared (reference counted). The dimension
213
// handler should always be allocated on the heap.
215
// pBarWnd is the window to be managed.
217
// dimInfo contains dimension information.
219
// alignment is a value such as FL_ALIGN_TOP.
221
// rowNo is the vertical position or row in the pane (if in docked state).
223
// columnPos is the horizontal position within the row in pixels (if in docked state).
225
// name is a name by which the bar can be referred in layout customization dialogs.
227
// If spyEvents is true, input events for the bar should be "spyed" in order
228
// to forward unhandled mouse clicks to the frame layout, for example to enable
229
// easy draggablity of toolbars just by clicking on their interior regions.
230
// For widgets like text/tree control this value should be false,
231
// since there's no certain way to detect whether the event was actually handled.
233
// state is the initial state, such as wxCBAR_DOCKED_HORIZONTALLY,
234
// wxCBAR_FLOATING, wxCBAR_HIDDEN.
236
virtual void AddBar( wxWindow* pBarWnd,
237
const cbDimInfo& dimInfo,
240
int alignment = FL_ALIGN_TOP,
243
const wxString& name = wxT("bar"),
244
bool spyEvents = false,
245
int state = wxCBAR_DOCKED_HORIZONTALLY
248
// ReddockBar can be used for repositioning existing bars. The given bar is first removed
249
// from the pane it currently belongs to, and inserted into the pane, which "matches"
250
// the given rectangular area. If pToPane is not NULL, the bar is docked to this given pane.
251
// To dock a bar which is floating, use the wxFrameLayout::DockBar method.
253
virtual bool RedockBar( cbBarInfo* pBar, const wxRect& shapeInParent,
254
cbDockPane* pToPane = NULL, bool updateNow = true );
256
// Finds the bar in the framelayout, by name.
258
cbBarInfo* FindBarByName( const wxString& name );
260
// Finds the bar in the framelayout, by window.
262
cbBarInfo* FindBarByWindow( const wxWindow* pWnd );
264
// Gets an array of bars.
266
BarArrayT& GetBars();
268
// Changes the bar's docking state (see possible control bar states).
270
void SetBarState( cbBarInfo* pBar, int newStatem, bool updateNow );
272
// Toggles the bar between visible and hidden.
274
void InverseVisibility( cbBarInfo* pBar );
276
// Reflects changes in bar information structure visually.
277
// For example, moves the bar, changes its dimension information,
278
// or changes the pane to which it is docked.
280
void ApplyBarProperties( cbBarInfo* pBar );
282
// Removes the bar from the layout permanently, and hides its corresponding window if present.
284
void RemoveBar( cbBarInfo* pBar );
286
// Recalculates the layout of panes, and all bars/rows in each pane.
288
virtual void RecalcLayout( bool repositionBarsNow = false );
290
// Returns the client height.
292
int GetClientHeight();
294
// Returns the client width.
296
int GetClientWidth();
298
// Returns the client's rectangle.
300
wxRect& GetClientRect() { return mClntWndBounds; }
302
// Returns a reference to the updates manager.
303
// Note: in future, the updates manager will become a normal plugin.
305
cbUpdatesManagerBase& GetUpdatesManager();
307
// Destroys the previous manager if any, and sets the new one.
309
void SetUpdatesManager( cbUpdatesManagerBase* pUMgr );
311
// Gets the pane properties for the given alignment.
313
virtual void GetPaneProperties( cbCommonPaneProperties& props, int alignment = FL_ALIGN_TOP );
315
// Sets the pane properties for the given alignment.
316
// Note: changing properties of panes does not result immediate on-screen update.
318
virtual void SetPaneProperties( const cbCommonPaneProperties& props,
319
int paneMask = wxALL_PANES );
321
// Sets the margins for the given panes.
322
// The margins should go into cbCommonPaneProperties in the future.
324
// Note: this method should be called before any custom plugins are attached.
326
virtual void SetMargins( int top, int bottom, int left, int right,
327
int paneMask = wxALL_PANES );
329
// Sets the pane background colour.
331
virtual void SetPaneBackground( const wxColour& colour );
333
// Recalculates layout and performs on-screen update of all panes.
335
void RefreshNow( bool recalcLayout = true );
337
// Event handler for a size event.
339
void OnSize ( wxSizeEvent& event );
341
// Event handler for a left down button event.
343
void OnLButtonDown( wxMouseEvent& event );
345
// Event handler for a left doubleclick button event.
347
void OnLDblClick ( wxMouseEvent& event );
349
// Event handler for a left button up event.
351
void OnLButtonUp ( wxMouseEvent& event );
353
// Event handler for a right button down event.
355
void OnRButtonDown( wxMouseEvent& event );
357
// Event handler for a right button up event.
359
void OnRButtonUp ( wxMouseEvent& event );
361
// Event handler for a mouse move event.
363
void OnMouseMove ( wxMouseEvent& event );
365
// This function should be used instead of passing the event to the ProcessEvent method
366
// of the top-level plugin directly. This method checks if events are currently
367
// captured and ensures that plugin-event is routed correctly.
369
virtual void FirePluginEvent( cbPluginEvent& event );
371
// Captures user input events for the given plugin.
372
// Input events are: mouse movement, mouse clicks, keyboard input.
374
virtual void CaptureEventsForPlugin ( cbPluginBase* pPlugin );
376
// Releases user input events for the given plugin.
377
// Input events are: mouse movement, mouse clicks, keyboard input
379
virtual void ReleaseEventsFromPlugin( cbPluginBase* pPlugin );
381
// Called by plugins; also captures the mouse in the parent frame.
383
void CaptureEventsForPane( cbDockPane* toPane );
385
// Called by plugins; also releases mouse in the parent frame.
387
void ReleaseEventsFromPane( cbDockPane* fromPane );
389
// Returns the current top-level plugin (the one that receives events first,
390
// except if input events are currently captured by some other plugin).
392
virtual cbPluginBase& GetTopPlugin();
394
// Hooking custom plugins to frame layout.
396
// Note: when hooking one plugin on top of the other,
397
// use SetNextHandler or similar methods
398
// of wxEvtHandler class to compose the chain of plugins,
399
// than pass the left-most handler in this chain to
400
// the above methods (assuming that events are delegated
401
// from left-most towards right-most handler).
403
// This secenario is very inconvenient and "low-level",
404
// so use the Add/Push/PopPlugin methods instead.
406
virtual void SetTopPlugin( cbPluginBase* pPlugin );
408
// Similar to wxWindow's "push/pop-event-handler" methods, execept
409
// that the plugin is deleted upon "popping".
411
virtual void PushPlugin( cbPluginBase* pPugin );
413
// Similar to wxWindow's "push/pop-event-handler" methods, execept
414
// that the plugin is deleted upon "popping".
416
virtual void PopPlugin();
419
virtual void PopAllPlugins();
421
// Adds the default plugins. These are cbPaneDrawPlugin, cbRowLayoutPlugin, cbBarDragPlugin,
422
// cbAntiflickerPlugin, cbSimpleCustomizePlugin.
424
// This method is automatically invoked if no plugins were found upon
425
// firing of the first plugin-event, i.e. when wxFrameLayout configures itself.
427
virtual void PushDefaultPlugins();
429
// An advanced methods for plugin configuration using their
430
// dynamic class information, for example CLASSINFO(pluginClass).
432
// First checks if the plugin of the given class is already "hooked up".
433
// If not, adds it to the top of the plugins chain.
435
virtual void AddPlugin( wxClassInfo* pPlInfo, int paneMask = wxALL_PANES );
437
// First checks if the plugin of the given class is already hooked.
438
// If so, removes it, and then inserts it into the chain
439
// before the plugin of the class given by pNextPlInfo.
441
// Note: this method is handy in some cases where the order
442
// of the plugin-chain could be important, for example when one plugin overrides
443
// some functionality of another already-hooked plugin,
444
// so that the former plugin should be hooked before the one
445
// whose functionality is being overridden.
447
virtual void AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
448
int paneMask = wxALL_PANES );
450
// Checks if the plugin of the given class is hooked, and removes
453
virtual void RemovePlugin( wxClassInfo* pPlInfo );
455
// Finds a plugin with the given class, or returns NULL if a plugin of the given
456
// class is not hooked.
458
virtual cbPluginBase* FindPlugin( wxClassInfo* pPlInfo );
460
// Returns true if there is a top plugin.
464
DECLARE_EVENT_TABLE()
465
DECLARE_DYNAMIC_CLASS( wxFrameLayout )
467
public: /* protected really, acessed only by plugins and serializers */
469
friend class cbDockPane;
470
friend class wxBarHandler;
472
wxWindow* mpFrame; // parent frame
473
wxWindow* mpFrameClient; // client window
474
cbDockPane* mPanes[MAX_PANES]; // panes in the panel
477
wxCursor* mpHorizCursor;
478
wxCursor* mpVertCursor;
479
wxCursor* mpNormalCursor;
480
wxCursor* mpDragCursor;
481
wxCursor* mpNECursor; // no-entry cursor
483
// pens for decoration and shades
485
wxPen mDarkPen; // default wxSYS_COLOUR_3DSHADOW
486
wxPen mLightPen; // default wxSYS_COLOUR_3DHILIGHT
487
wxPen mGrayPen; // default wxSYS_COLOUR_3DFACE
488
wxPen mBlackPen; // default wxColour( 0, 0, 0)
489
wxPen mBorderPen; // default wxSYS_COLOUR_3DFACE
491
wxPen mNullPen; // transparent pen
493
// pane to which the all mouse input is currently directed (caputred)
495
cbDockPane* mpPaneInFocus;
497
// pane, from which mouse pointer had just left
499
cbDockPane* mpLRUPane;
501
// bounds of client window in parent frame's coordinates
503
wxRect mClntWndBounds;
504
wxRect mPrevClntWndBounds;
507
wxPoint mNextFloatedWndPos;
508
wxSize mFloatingPosStep;
510
// current plugin (right-most) plugin which receives events first
512
cbPluginBase* mpTopPlugin;
514
// plugin, which currently has captured all input events, otherwise NULL
516
cbPluginBase* mpCaputesInput;
518
// list of event handlers which are "pushed" onto each bar, to catch
519
// mouse events which are not handled by bars, and froward them to the ,
520
// frome-layout and further to plugins
524
// list of top-most frames which contain floated bars
526
wxList mFloatedFrames;
528
// linked list of references to all bars (docked/floated/hidden)
532
// FOR NOW:: dirty stuff...
533
bool mClientWndRefreshPending;
535
bool mCheckFocusWhenIdle;
537
public: /* protected really (accessed only by plugins) */
539
// refrence to custom updates manager
540
cbUpdatesManagerBase* mpUpdatesMgr;
542
// Called to apply the calculated layout to window objects.
544
void PositionClientWindow();
546
// Called to apply the calculated layout to window objects.
548
void PositionPanes();
550
// Creates the cursors.
552
void CreateCursors();
554
// Applies the calculated layout to a floating bar.
556
void RepositionFloatedBar( cbBarInfo* pBar );
558
// Applies the state to the window objects.
560
void DoSetBarState( cbBarInfo* pBar );
562
// The purpose of this function is unknown.
564
bool LocateBar( cbBarInfo* pBarInfo,
566
cbDockPane** ppPane );
569
// Returns true if the position is within the given pane.
571
bool HitTestPane( cbDockPane* pPane, int x, int y );
573
// Returns the pane for which the rectangle hit test succeeds, giving
574
// preference to the given pane if supplied.
576
cbDockPane* HitTestPanes( const wxRect& rect, cbDockPane* pCurPane );
578
// Returns the pane to which the given bar belongs.
580
cbDockPane* GetBarPane( cbBarInfo* pBar );
582
// Delegated from "bar-spy".
583
void ForwardMouseEvent( wxMouseEvent& event,
587
// Routes the mouse event to the appropriate pane.
589
void RouteMouseEvent( wxMouseEvent& event, int pluginEvtType );
591
// Shows all floated windows.
593
void ShowFloatedWindows( bool show );
595
// Unhooks the layout from the frame.
597
void UnhookFromFrame();
599
// Hooks the layout up to the frame (pushes the layout onto the
600
// frame's event handler stack).
602
void HookUpToFrame();
604
// Returns true if the platform allows reparenting. This may not return true
605
// for all platforms. Reparenting allows control bars to be floated.
609
// Reparents pChild to have parent pNewParent.
611
void ReparentWindow( wxWindow* pChild, wxWindow* pNewParent );
613
// Returns the previous client window rectangle.
615
wxRect& GetPrevClientRect() { return mPrevClntWndBounds; }
617
// Handles paint events, calling PaintPane for each pane.
619
void OnPaint( wxPaintEvent& event );
621
// Handles background erase events. Currently does nothing.
623
void OnEraseBackground( wxEraseEvent& event );
625
// Handles focus kill events. Currently does nothing.
627
void OnKillFocus( wxFocusEvent& event );
629
// Handles focus set events. Currently does nothing.
631
void OnSetFocus( wxFocusEvent& event );
633
// Handles activation events. Currently does nothing.
635
void OnActivate( wxActivateEvent& event );
637
// Handles idle events.
639
void OnIdle( wxIdleEvent& event );
641
// Returns a new cbGCUpdatesMgr object.
643
virtual cbUpdatesManagerBase* CreateUpdatesManager();
647
A structure that is present in each item of layout,
648
used by any particular updates-manager to store
649
auxiliary information to be used by its updating algorithm.
652
class WXDLLIMPEXP_FL cbUpdateMgrData : public wxObject
654
DECLARE_DYNAMIC_CLASS( cbUpdateMgrData )
656
wxRect mPrevBounds; // previous state of layout item (in parent frame's coordinates)
658
bool mIsDirty; // overrides result of current-against-previous bounds comparison,
659
// i.e. requires item to be updated, regardless of it's current area
661
wxObject* mpCustomData; // any custom data stored by specific updates mgr.
663
// Default constructor. Is-dirty flag is set true initially.
667
// Store the item state.
669
void StoreItemState( const wxRect& boundsInParent );
671
// Set the dirty flag.
673
void SetDirty( bool isDirty = true );
677
void SetCustomData( wxObject* pCustomData );
679
// Returns the is-dirty flag.
681
inline bool IsDirty() { return mIsDirty; }
685
Abstract interface for bar-size handler classes.
686
These objects receive notifications whenever the docking
687
state of the bar is changed, thus they provide the possibility
688
to adjust the values in cbDimInfo::mSizes accordingly.
689
Specific handlers can be hooked up to specific types of bar.
692
class WXDLLIMPEXP_FL cbBarDimHandlerBase : public wxObject
694
DECLARE_ABSTRACT_CLASS( cbBarDimHandlerBase )
697
int mRefCount; // since one dim-handler can be assigned
698
// to multiple bars, it's instance is
702
// Default constructor. The initial reference count is 0, since
703
// the handler is not used until the first invocation of AddRef().
705
cbBarDimHandlerBase();
707
// Increments the reference count.
711
// Decrements the reference count, and if the count is at zero,
716
// Responds to "bar-state-changes" notifications.
718
virtual void OnChangeBarState(cbBarInfo* pBar, int newState ) = 0;
720
// Responds to bar resize notifications.
722
virtual void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred ) = 0;
726
Helper class used internally by the wxFrameLayout class.
727
Holds and manages information about bar dimensions.
730
class WXDLLIMPEXP_FL cbDimInfo : public wxObject
732
DECLARE_DYNAMIC_CLASS( cbDimInfo )
734
wxSize mSizes[MAX_BAR_STATES]; // preferred sizes for each possible bar state
736
wxRect mBounds[MAX_BAR_STATES]; // saved positions and sizes for each
737
// possible state, values contain (-1)s if
738
// not initialized yet
740
int mLRUPane; // pane to which this bar was docked before it was floated
741
// (FL_ALIGN_TOP,FL_ALIGN_BOTTOM,..)
743
// top/bottom gap, separates decorations
744
// from the bar's actual window, filled
745
// with frame's beckground color, default: 0
749
// left/right gap, separates decorations
750
// from the bar's actual wndow, filled
751
// with frame's beckground colour, default: 0
753
int mHorizGap; // NOTE:: gaps are given in frame's coord. orientation
755
// true, if vertical/horizontal dimensions cannot be mannualy adjusted
756
// by user using resizing handles. If false, the frame-layout
757
// *automatically* places resizing handles among not-fixed bars
761
cbBarDimHandlerBase* mpHandler; // NULL, if no handler present
765
// Default constructor.
770
// isFixed is true if vertical/horizontal dimensions cannot be manually adjusted
771
// by the user using resizing handles. If false, the frame-layout
772
// automatically places resizing handles among bars that do are not fixed.
774
cbDimInfo( cbBarDimHandlerBase* pDimHandler,
775
bool isFixed // (see comments on mIsFixed member)
778
// Constructor taking dimenstion information.
780
// dh_x, dh_y are the dimensions when docked horizontally.
782
// dv_x, dv_y are the dimensions when docked vertically.
784
// f_x, f_y are the dimensions when floating.
786
// For information on isFixed, see comments above.
788
// horizGap is the left/right 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
// vertGap is the top/bottom gap, separating decorations
793
// from the bar's actual wndow, filled with the frame's background colour.
794
// The dimension is given in the frame's coordinates.
796
cbDimInfo( int dh_x, int dh_y,
804
cbBarDimHandlerBase* pDimHandler = NULL
809
cbDimInfo( int x, int y,
812
cbBarDimHandlerBase* pDimHandler = NULL
815
// Destructor. Destroys handler automatically, if present.
819
// Assignment operator.
821
const cbDimInfo& operator=( const cbDimInfo& other );
823
// Returns the handler, if any.
825
inline cbBarDimHandlerBase* GetDimHandler() { return mpHandler; }
828
// FIXME: this array definition compiles but probably doesn't do what was intended (GD)
829
WXFL_DEFINE_ARRAY_LONG(float, cbArrayFloat);
832
Helper class used internally by the wxFrameLayout class.
833
Holds and manages information about bar rows.
836
class cbRowInfo : public wxObject
838
DECLARE_DYNAMIC_CLASS( cbRowInfo )
841
BarArrayT mBars; // row content
843
// row flags (set up according to row-relations)
845
bool mHasUpperHandle;
846
bool mHasLowerHandle;
847
bool mHasOnlyFixedBars;
848
int mNotFixedBarsCnt;
854
// stores precalculated row's bounds in parent frame's coordinates
855
wxRect mBoundsInParent;
857
// info stored for updates-manager
858
cbUpdateMgrData mUMgrData;
863
cbBarInfo* mpExpandedBar; // NULL, if non of the bars is currently expanded
865
cbArrayFloat mSavedRatios; // length-ratios bofore some of the bars was expanded
876
// Returns the first bar.
878
inline cbBarInfo* GetFirstBar()
880
{ return mBars.GetCount() ? mBars[0] : NULL; }
884
Helper class used internally by the wxFrameLayout class.
885
Holds and manages bar information.
888
class cbBarInfo : public wxObject
890
DECLARE_DYNAMIC_CLASS( cbBarInfo )
892
// textual name, by which this bar is referred in layout-customization dialogs
895
// stores bar's bounds in pane's coordinates
898
// stores precalculated bar's bounds in parent frame's coordinates
899
wxRect mBoundsInParent;
901
// back-ref to the row, which contains this bar
904
// are set up according to the types of the surrounding bars in the row
906
bool mHasRightHandle;
908
// determines if this bar can float. The layout's setting as priority. For
909
// example, if the layout's mFloatingOn is false, this setting is irrelevant
910
// since nothing will float at all. If the layout's floating is on, use this
911
// setting to prevent specific bars from floating. In other words, all bars
912
// float by default and floating can be turned off on individual bars.
913
bool mFloatingOn; // default: ON (which is also the layout's mFloatingOn default setting)
915
cbDimInfo mDimInfo; // preferred sizes for each, control bar state
917
int mState; // (see definition of controlbar states)
919
int mAlignment; // alignment of the pane to which this
920
// bar is currently placed
922
int mRowNo; // row, into which this bar would be placed,
923
// when in the docking state
925
wxWindow* mpBarWnd; // the actual window object, NULL if no window
926
// is attached to the control bar (possible!)
928
double mLenRatio; // length ratio among not-fixed-size bars
930
wxPoint mPosIfFloated; // stored last position when bar was in "floated" state
931
// poistion is stored in parent-window's coordinates
933
cbUpdateMgrData mUMgrData; // info stored for updates-manager
935
cbBarInfo* mpNext; // next. bar in the row
936
cbBarInfo* mpPrev; // prev. bar in the row
947
// Returns true if this bar is fixed.
949
inline bool IsFixed() const { return mDimInfo.mIsFixed; }
951
// Returns true if this bar is expanded.
953
inline bool IsExpanded() const { return this == mpRow->mpExpandedBar; }
957
Used for storing the original bar's positions in the row, when the 'non-destructive-friction'
961
class cbBarShapeData : public wxObject
969
Used for traversing through all bars of all rows in the pane.
979
// Constructor, taking row array.
981
wxBarIterator( RowArrayT& rows );
983
// Resets the iterator to the start of the first row.
987
// Advances the iterator and returns true if a bar is available.
991
// Gets the current bar information.
993
cbBarInfo& BarInfo();
995
// Returns a reference to the currently traversed row.
997
cbRowInfo& RowInfo();
1001
A structure holding configuration options,
1002
which are usually the same for all panes in
1006
class WXDLLIMPEXP_FL cbCommonPaneProperties : public wxObject
1008
DECLARE_DYNAMIC_CLASS( cbCommonPaneProperties )
1010
// look-and-feel configuration
1012
bool mRealTimeUpdatesOn; // default: ON
1013
bool mOutOfPaneDragOn; // default: ON
1014
bool mExactDockPredictionOn; // default: OFF
1015
bool mNonDestructFrictionOn; // default: OFF
1017
bool mShow3DPaneBorderOn; // default: ON
1019
// FOR NOW:: the below properties are reserved for the "future"
1021
bool mBarFloatingOn; // default: OFF
1022
bool mRowProportionsOn; // default: OFF
1023
bool mColProportionsOn; // default: ON
1024
bool mBarCollapseIconsOn; // default: OFF
1025
bool mBarDragHintsOn; // default: OFF
1027
// minimal dimensions for not-fixed bars in this pane (16x16 default)
1031
// width/height of resizing sash
1033
int mResizeHandleSize;
1035
// Default constructor.
1037
cbCommonPaneProperties(void);
1041
cbCommonPaneProperties(const cbCommonPaneProperties&);
1043
// Assignment operator
1045
cbCommonPaneProperties& operator=(const cbCommonPaneProperties&);
1049
This class manages containment and control of control bars
1050
along one of the four edges of the parent frame.
1053
class cbDockPane : public wxObject
1056
DECLARE_DYNAMIC_CLASS( cbDockPane )
1058
// look-and-feel configuration for this pane
1059
cbCommonPaneProperties mProps;
1061
// pane margins (in frame's coordinate-syst. orientation)
1063
int mLeftMargin; // default: 2 pixels
1064
int mRightMargin; // default: 2 pixels
1065
int mTopMargin; // default: 2 pixels
1066
int mBottomMargin; // default: 2 pixels
1069
// position of the pane in frame's coordinates
1070
wxRect mBoundsInParent;
1072
// pane width and height in pane's coordinates
1078
// info stored for updates-manager
1079
cbUpdateMgrData mUMgrData;
1081
public: /* protected really */
1084
wxFrameLayout* mpLayout; // back-ref
1086
// transient properties
1088
wxList mRowShapeData; // shapes of bars of recently modified row,
1089
// stored when in "non-destructive-friction" mode
1090
cbRowInfo* mpStoredRow; // row-info for which the shapes are stored
1092
friend class wxFrameLayout;
1094
public: /* protected really (accessed only by plugins) */
1096
// Returns the row info for a row index. Internal function called by plugins.
1098
cbRowInfo* GetRow( int row );
1100
// Returns the row index for the given row info. Internal function called by plugins.
1102
int GetRowIndex( cbRowInfo* pRow );
1104
// Returns the row at the given vertical position.
1105
// Returns -1 if the row is not present at given vertical position.
1106
// Internal function called by plugins.
1108
int GetRowAt( int paneY );
1110
// Returns the row between the given vertical positions.
1111
// Returns -1 if the row is not present.
1112
// Internal function called by plugins.
1114
int GetRowAt( int upperY, int lowerY );
1116
// Sets up flags in the row information structure, so that
1117
// they match the changed state of row items correctly.
1118
// Internal function called by plugins.
1120
void SyncRowFlags( cbRowInfo* pRow );
1122
// Returns true if the bar's dimension information indicates a fixed size.
1123
// Internal function called by plugins.
1125
bool IsFixedSize( cbBarInfo* pInfo );
1127
// Returns the number of bars whose size is not fixed.
1128
// Internal function called by plugins.
1130
int GetNotFixedBarsCount( cbRowInfo* pRow );
1132
// Gets the vertical position at the given row.
1133
// Internal function called by plugins.
1135
int GetRowY( cbRowInfo* pRow );
1137
// Returns true if there are any variable-sized rows above this one.
1138
// Internal function called by plugins.
1140
bool HasNotFixedRowsAbove( cbRowInfo* pRow );
1142
// Returns true if there are any variable-sized rows below this one.
1143
// Internal function called by plugins.
1145
bool HasNotFixedRowsBelow( cbRowInfo* pRow );
1147
// Returns true if there are any variable-sized rows to the left of this one.
1148
// Internal function called by plugins.
1150
bool HasNotFixedBarsLeft ( cbBarInfo* pBar );
1152
// Returns true if there are any variable-sized rows to the right of this one.
1153
// Internal function called by plugins.
1155
bool HasNotFixedBarsRight( cbBarInfo* pBar );
1157
// Calculate lengths.
1158
// Internal function called by plugins.
1160
virtual void CalcLengthRatios( cbRowInfo* pInRow );
1162
// Generates a cbLayoutRowEvent event to recalculate row layouts.
1163
// Internal function called by plugins.
1165
virtual void RecalcRowLayout( cbRowInfo* pRow );
1168
// Internal function called by plugins.
1170
virtual void ExpandBar( cbBarInfo* pBar );
1172
// Contracts the bar.
1173
// Internal function called by plugins.
1175
virtual void ContractBar( cbBarInfo* pBar );
1177
// Sets up links between bars.
1178
// Internal function called by plugins.
1180
void InitLinksForRow( cbRowInfo* pRow );
1182
// Sets up links between bars.
1183
// Internal function called by plugins.
1185
void InitLinksForRows();
1187
// Coordinate translation between parent's frame and this pane.
1188
// Internal function called by plugins.
1190
void FrameToPane( int* x, int* y );
1192
// Coordinate translation between parent's frame and this pane.
1193
// Internal function called by plugins.
1195
void PaneToFrame( int* x, int* y );
1197
// Coordinate translation between parent's frame and this pane.
1198
// Internal function called by plugins.
1200
void FrameToPane( wxRect* pRect );
1202
// Coordinate translation between parent's frame and this pane.
1203
// Internal function called by plugins.
1205
void PaneToFrame( wxRect* pRect );
1207
// Returns true if pos is within the given rectangle.
1208
// Internal function called by plugins.
1210
inline bool HasPoint( const wxPoint& pos, int x, int y, int width, int height );
1212
// Returns the minimal row height for the given row.
1213
// Internal function called by plugins.
1215
int GetMinimalRowHeight( cbRowInfo* pRow );
1217
// Sets the row height for the given height. newHeight includes the height of row handles, if present.
1218
// Internal function called by plugins.
1220
void SetRowHeight( cbRowInfo* pRow, int newHeight );
1222
// Inserts the bar at the given row number.
1223
// Internal function called by plugins.
1225
void DoInsertBar( cbBarInfo* pBar, int rowNo );
1227
public: /* protected really (accessed only by plugins) */
1229
// Generates a cbDrawBarDecorEvent and sends it to the layout to paint the bar decorations.
1230
// Internal function called by plugins.
1232
virtual void PaintBarDecorations( cbBarInfo* pBar, wxDC& dc );
1234
// Generates a cbDrawBarHandlesEvent and sends it to the layout to paint the bar handles.
1235
// Internal function called by plugins.
1237
virtual void PaintBarHandles( cbBarInfo* pBar, wxDC& dc );
1239
// Calls PaintBarDecorations and PaintBarHandles.
1240
// Internal function called by plugins.
1242
virtual void PaintBar( cbBarInfo* pBar, wxDC& dc );
1244
// Generates cbDrawRowHandlesEvent and cbDrawRowDecorEvent and sends them to the layout.
1245
// Internal function called by plugins.
1247
virtual void PaintRowHandles( cbRowInfo* pRow, wxDC& dc );
1249
// Generates cbDrawRowBkGroundEvent and sends it to the layout.
1250
// Internal function called by plugins.
1252
virtual void PaintRowBackground ( cbRowInfo* pRow, wxDC& dc );
1254
// Calls PaintBarDecorations for each row.
1255
// Internal function called by plugins.
1257
virtual void PaintRowDecorations( cbRowInfo* pRow, wxDC& dc );
1259
// Calls PaintRowBackground, PaintRowDecorations, PaintRowHandles.
1260
// Internal function called by plugins.
1262
virtual void PaintRow( cbRowInfo* pRow, wxDC& dc );
1264
// Generates cbDrawPaneBkGroundEvent and sends it to the layout.
1265
// Internal function called by plugins.
1267
virtual void PaintPaneBackground( wxDC& dc );
1269
// Generates cbDrawPaneDecorEvent and sends it to the layout.
1270
// Internal function called by plugins.
1272
virtual void PaintPaneDecorations( wxDC& dc );
1274
// Paints the pane background, the row background and decorations,
1275
// and finally the pane decorations.
1276
// Internal function called by plugins.
1278
virtual void PaintPane( wxDC& dc );
1280
// Generates a cbSizeBarWndEvent and sends it to the layout.
1281
// Internal function called by plugins.
1283
virtual void SizeBar( cbBarInfo* pBar );
1285
// Calls SizeBar for each bar in the row.
1286
// Internal function called by plugins.
1288
virtual void SizeRowObjects( cbRowInfo* pRow );
1290
// Calls SizeRowObjects for each row.
1291
// Internal function called by plugins.
1293
virtual void SizePaneObjects();
1295
// Generates cbStartDrawInAreaEvent and sends it to the layout.
1296
// Internal function called by plugins.
1298
virtual wxDC* StartDrawInArea ( const wxRect& area );
1300
// Generates cbFinishDrawInAreaEvent and sends it to the layout.
1301
// Internal function called by plugins.
1303
virtual void FinishDrawInArea( const wxRect& area );
1305
public: /* public members */
1307
// Default constructor.
1311
// Constructor, taking alignment and layout panel.
1313
cbDockPane( int alignment, wxFrameLayout* pPanel );
1315
// Sets pane's margins in frame's coordinate orientations.
1317
void SetMargins( int top, int bottom, int left, int right );
1321
virtual ~cbDockPane();
1323
// Removes the bar from this pane. Does not destroy the bar.
1325
virtual void RemoveBar( cbBarInfo* pBar );
1327
// Inserts the bar into this pane. rect is given in the parent frame's coordinates.
1329
virtual void InsertBar( cbBarInfo* pBar, const wxRect& rect );
1331
// Inserts the bar into the given row, with dimensions and position
1332
// stored in pBarInfo->mBounds. Returns the node of inserted bar.
1334
virtual void InsertBar( cbBarInfo* pBar, cbRowInfo* pIntoRow );
1336
// Inserts bar and sets its position according to the preferred settings
1337
// given in pBarInfo.
1339
virtual void InsertBar( cbBarInfo* pBarInfo );
1341
// Removes the row from this pane. Does not destroy the row object.
1343
virtual void RemoveRow( cbRowInfo* pRow );
1345
// Inserts a row. Does not refresh the inserted row immediately.
1346
// If pBeforeRowNode is NULL, the row is appended to the end of pane's row list.
1348
virtual void InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow );
1350
// Sets pane's width in the pane's coordinates (including margins).
1352
void SetPaneWidth(int width);
1354
// Set the position and dimensions of the pane in the parent frame's coordinates.
1356
void SetBoundsInParent( const wxRect& rect );
1358
// Returns the bounds of the pane, in parent coordinates.
1360
inline wxRect& GetRealRect() { return mBoundsInParent; }
1362
// Returns an array of rows. Used by updates-managers.
1364
inline RowArrayT& GetRowList() { return mRows; }
1366
// Returns the first row.
1368
inline cbRowInfo* GetFirstRow()
1370
{ return mRows.GetCount() ? mRows[0] : NULL; }
1372
// Returns true if the given bar is present in this pane.
1374
bool BarPresent( cbBarInfo* pBar );
1376
// Returns the height in the pane's coordinates.
1378
int GetPaneHeight();
1380
// Returns the alignment for this pane. The value is one of
1381
// FL_ALIGN_TOP, FL_ALIGN_BOTTOM, FL_ALIGN_LEFT, FL_ALIGN_RIGHT.
1385
// Returns true if the given mask matches the pane's mask.
1387
bool MatchesMask( int paneMask );
1389
// Returns true if the pane is aligned to the top or bottom.
1391
inline bool IsHorizontal()
1393
return (mAlignment == FL_ALIGN_TOP ||
1394
mAlignment == FL_ALIGN_BOTTOM );
1397
// Generates events to perform layout calculations.
1399
virtual void RecalcLayout();
1401
// Returns wxCBAR_DOCKED_HORIZONTALLY if the alignment is top or bottom,
1402
// or wxCBAR_DOCKED_VERTICALLY otherwise.
1404
virtual int GetDockingState();
1406
// Returns the result of hit-testing items in the pane.
1407
// See CB_HITTEST_RESULT enumerated type.
1408
// pos is the position in this pane's coordinates.
1410
virtual int HitTestPaneItems( const wxPoint& pos,
1415
// Returns the bar's resize range.
1417
void GetBarResizeRange( cbBarInfo* pBar, int* from, int *till, bool forLeftHandle );
1419
// Returns the row's resize range.
1421
void GetRowResizeRange( cbRowInfo* pRow, int* from, int* till, bool forUpperHandle );
1423
// Finds the bar information by corresponding window.
1425
cbBarInfo* GetBarInfoByWindow( wxWindow* pBarWnd );
1427
public: /* protected really (accessed only by plugins) */
1429
// Row/bar resizing related helper-method.
1431
void DrawVertHandle ( wxDC& dc, int x, int y, int height );
1433
// Row/bar resizing related helper-method.
1435
void DrawHorizHandle( wxDC& dc, int x, int y, int width );
1437
// Row/bar resizing related helper-method.
1439
void ResizeRow( cbRowInfo* pRow, int ofs, bool forUpperHandle );
1441
// Row/bar resizing related helper-method.
1443
void ResizeBar( cbBarInfo* pBar, int ofs, bool forLeftHandle );
1445
// Returns row shape data.
1446
// cbBarShapeData objects will be added to the given pLst.
1447
// cbBarShapeData is used for storing the original bar's positions in the row,
1448
// when the 'non-destructive-friction' option is turned on.
1450
void GetRowShapeData( cbRowInfo* pRow, wxList* pLst );
1452
// Sets the shape data for the given row, using the data provided in pLst.
1453
// cbBarShapeData is used for storing the original bar's positions in the row,
1454
// when the 'non-destructive-friction' option is turned on.
1456
void SetRowShapeData( cbRowInfo* pRowNode, wxList* pLst );
1460
This class declares an abstract interface for optimized logic that should refresh
1461
areas of frame layout that actually need to be updated. This should be extended in future
1462
to implement a custom updating strategy.
1465
class WXDLLIMPEXP_FL cbUpdatesManagerBase : public wxObject
1467
DECLARE_ABSTRACT_CLASS( cbUpdatesManagerBase )
1469
public: /* protected really, accessed by serializer (if any) */
1471
wxFrameLayout* mpLayout;
1474
// Default constructor
1476
cbUpdatesManagerBase(void)
1479
// Constructor taking layout panel.
1481
cbUpdatesManagerBase( wxFrameLayout* pPanel )
1482
: mpLayout( pPanel ) {}
1486
virtual ~cbUpdatesManagerBase() {}
1488
// Sets the associated layout.
1490
void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; }
1492
// This function receives a notification from the frame layout (in the order in which
1493
// they would usually be invoked). Custom updates-managers may utilize
1494
// these notifications to implement a more fine-grained updating strategy.
1496
virtual void OnStartChanges() = 0;
1498
// This function receives a notification from the frame layout (in the order in which
1499
// they would usually be invoked). Custom updates-managers may utilize
1500
// these notifications to implement a more fine-grained updating strategy.
1502
virtual void OnRowWillChange( cbRowInfo* WXUNUSED(pRow), cbDockPane* WXUNUSED(pInPane) ) {}
1504
// This function receives a notification from the frame layout (in the order in which
1505
// they would usually be invoked). Custom updates-managers may utilize
1506
// these notifications to implement a more fine-grained updating strategy.
1508
virtual void OnBarWillChange( cbBarInfo* WXUNUSED(pBar), cbRowInfo* WXUNUSED(pInRow), cbDockPane* WXUNUSED(pInPane) ) {}
1510
// This function receives a notification from the frame layout (in the order in which
1511
// they would usually be invoked). Custom updates-managers may utilize
1512
// these notifications to implement a more fine-grained updating strategy.
1514
virtual void OnPaneMarginsWillChange( cbDockPane* WXUNUSED(pPane) ) {}
1516
// This function receives a notification from the frame layout (in the order in which
1517
// they would usually be invoked). Custom updates-managers may utilize
1518
// these notifications to implement a more fine-grained updating strategy.
1520
virtual void OnPaneWillChange( cbDockPane* WXUNUSED(pPane) ) {}
1522
// This function receives a notification from the frame layout (in the order in which
1523
// they would usually be invoked). Custom updates-managers may utilize
1524
// these notifications to implement a more fine-grained updating strategy.
1526
virtual void OnFinishChanges() {}
1528
// Refreshes parts of the frame layout that need an update.
1530
virtual void UpdateNow() = 0;
1534
Base class for all control-bar plugin events.
1535
This is not a dynamically-creatable class.
1538
class cbPluginEvent : public wxEvent
1541
// NULL if event is not addressed to any specific pane.
1545
// Not used, but required.
1547
virtual wxEvent* Clone() const { return NULL; }
1549
// Constructor, taking event type and pane.
1551
cbPluginEvent( wxEventType eventType, cbDockPane* pPane )
1554
{ m_eventType = eventType; }
1557
// event types handled by plugins
1559
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DOWN;
1560
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_UP;
1561
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_DOWN;
1562
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_UP;
1563
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_MOTION;
1565
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DCLICK;
1567
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROW;
1568
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_ROW;
1569
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROWS;
1570
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_INSERT_BAR;
1571
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_BAR;
1572
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_REMOVE_BAR;
1573
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_SIZE_BAR_WND;
1575
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_DECOR;
1576
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_DECOR;
1577
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_DECOR;
1578
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_HANDLES;
1579
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_HANDLES;
1580
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_BKGROUND;
1581
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_BKGROUND;
1583
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_BAR_DRAGGING;
1584
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_HINT_RECT;
1586
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_DRAW_IN_AREA;
1587
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA;
1589
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_BAR;
1590
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT;
1592
extern WXDLLIMPEXP_FL wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT;
1594
// Forward declarations, separated by categories.
1596
class cbLeftDownEvent;
1597
class cbLeftUpEvent;
1598
class cbRightDownEvent;
1599
class cbRightUpEvent;
1600
class cbMotionEvent;
1601
class cbLeftDClickEvent;
1603
class cbLayoutRowEvent;
1604
class cbResizeRowEvent;
1605
class cbLayoutRowsEvent;
1606
class cbInsertBarEvent;
1607
class cbResizeBarEvent;
1608
class cbRemoveBarEvent;
1609
class cbSizeBarWndEvent;
1611
class cbDrawBarDecorEvent;
1612
class cbDrawRowDecorEvent;
1613
class cbDrawPaneDecorEvent;
1614
class cbDrawBarHandlesEvent;
1615
class cbDrawRowHandlesEvent;
1616
class cbDrawRowBkGroundEvent;
1617
class cbDrawPaneBkGroundEvent;
1619
class cbStartBarDraggingEvent;
1620
class cbDrawHintRectEvent;
1622
class cbStartDrawInAreaEvent;
1623
class cbFinishDrawInAreaEvent;
1625
class cbCustomizeBarEvent;
1626
class cbCustomizeLayoutEvent;
1628
// Definitions for for handler-methods.
1630
typedef void (wxEvtHandler::*cbLeftDownHandler )(cbLeftDownEvent&);
1631
typedef void (wxEvtHandler::*cbLeftUpHandler )(cbLeftUpEvent&);
1632
typedef void (wxEvtHandler::*cbRightDownHandler )(cbRightDownEvent&);
1633
typedef void (wxEvtHandler::*cbRightUpHandler )(cbRightUpEvent&);
1634
typedef void (wxEvtHandler::*cbMotionHandler )(cbMotionEvent&);
1635
typedef void (wxEvtHandler::*cbLeftDClickHandler )(cbLeftDClickEvent&);
1637
typedef void (wxEvtHandler::*cbLayoutRowHandler )(cbLayoutRowEvent&);
1638
typedef void (wxEvtHandler::*cbResizeRowHandler )(cbResizeRowEvent&);
1639
typedef void (wxEvtHandler::*cbLayoutRowsHandler )(cbLayoutRowsEvent&);
1640
typedef void (wxEvtHandler::*cbInsertBarHandler )(cbInsertBarEvent&);
1641
typedef void (wxEvtHandler::*cbResizeBarHandler )(cbResizeBarEvent&);
1642
typedef void (wxEvtHandler::*cbRemoveBarHandler )(cbRemoveBarEvent&);
1643
typedef void (wxEvtHandler::*cbSizeBarWndHandler )(cbSizeBarWndEvent&);
1645
typedef void (wxEvtHandler::*cbDrawBarDecorHandler )(cbDrawBarDecorEvent&);
1646
typedef void (wxEvtHandler::*cbDrawRowDecorHandler )(cbDrawRowDecorEvent&);
1647
typedef void (wxEvtHandler::*cbDrawPaneDecorHandler )(cbDrawPaneDecorEvent&);
1648
typedef void (wxEvtHandler::*cbDrawBarHandlesHandler )(cbDrawBarHandlesEvent&);
1649
typedef void (wxEvtHandler::*cbDrawRowHandlesHandler )(cbDrawRowHandlesEvent&);
1650
typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler )(cbDrawRowBkGroundEvent&);
1651
typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler)(cbDrawPaneBkGroundEvent&);
1653
typedef void (wxEvtHandler::*cbStartBarDraggingHandler )(cbStartBarDraggingEvent&);
1654
typedef void (wxEvtHandler::*cbDrawHintRectHandler )(cbDrawHintRectEvent&);
1656
typedef void (wxEvtHandler::*cbStartDrawInAreaHandler )(cbStartDrawInAreaEvent&);
1657
typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler)(cbFinishDrawInAreaEvent&);
1659
typedef void (wxEvtHandler::*cbCustomizeBarHandler )(cbCustomizeBarEvent&);
1660
typedef void (wxEvtHandler::*cbCustomizeLayoutHandler )(cbCustomizeLayoutEvent&);
1662
// Macros for creating event table entries for plugin-events.
1664
#define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ),
1665
#define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ),
1666
#define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ),
1667
#define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ),
1668
#define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ),
1669
#define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ),
1671
#define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ),
1672
#define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ),
1673
#define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ),
1674
#define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ),
1675
#define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ),
1676
#define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ),
1677
#define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ),
1679
#define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ),
1680
#define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ),
1681
#define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ),
1682
#define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ),
1683
#define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ),
1684
#define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ),
1685
#define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ),
1687
#define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ),
1688
#define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ),
1691
#define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ),
1692
#define EVT_PL_FINISH_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func, (wxObject *) NULL ),
1694
#define EVT_PL_CUSTOMIZE_BAR(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func, (wxObject *) NULL ),
1695
#define EVT_PL_CUSTOMIZE_LAYOUT(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func, (wxObject *) NULL ),
1698
Abstract base class for all control-bar related plugins.
1699
Note: pointer positions of mouse events sent to plugins
1700
are always in the pane's coordinates (the pane to which
1701
this plugin is hooked).
1704
class cbPluginBase : public wxEvtHandler
1706
DECLARE_ABSTRACT_CLASS( cbPluginBase )
1708
// Back-reference to the frame layout.
1710
wxFrameLayout* mpLayout;
1712
// Specifies panes for which this plugin receives events
1713
// (see pane masks definitions).
1717
// Is true when plugin is ready to handle events.
1722
// Default constructor.
1727
mPaneMask( wxALL_PANES ),
1731
// Constructor taking layout panel and a mask.
1733
cbPluginBase( wxFrameLayout* pPanel, int paneMask = wxALL_PANES )
1735
: mpLayout ( pPanel ),
1736
mPaneMask( paneMask ),
1740
// Returns the pane mask.
1742
inline int GetPaneMask() { return mPaneMask; }
1744
// Destructor. Destroys the whole plugin chain of connected plugins.
1746
virtual ~cbPluginBase();
1748
// Override this method to do plugin-specific initialization.
1749
// At this point plugin is already attached to the frame layout,
1750
// and pane masks are set.
1752
virtual void OnInitPlugin() { mIsReady = true; }
1754
// Returns true if the plugin is ready to receive events.
1756
bool IsReady() { return mIsReady; }
1758
// Overridden to determine whether the target pane specified in the
1759
// event matches the pane mask of this plugin (specific plugins
1760
// do not override this method).
1762
virtual bool ProcessEvent(wxEvent& event);
1766
Class for mouse left down events.
1769
class cbLeftDownEvent : public cbPluginEvent
1774
// Constructor, taking mouse position and pane.
1776
cbLeftDownEvent( const wxPoint& pos, cbDockPane* pPane )
1778
: cbPluginEvent( cbEVT_PL_LEFT_DOWN, pPane ),
1784
Class for mouse left up events.
1787
class cbLeftUpEvent : public cbPluginEvent
1792
// Constructor, taking mouse position and pane.
1794
cbLeftUpEvent( const wxPoint& pos, cbDockPane* pPane )
1796
: cbPluginEvent( cbEVT_PL_LEFT_UP, pPane ),
1802
Class for mouse right down events.
1805
class cbRightDownEvent : public cbPluginEvent
1810
// Constructor, taking mouse position and pane.
1812
cbRightDownEvent( const wxPoint& pos, cbDockPane* pPane )
1814
: cbPluginEvent( cbEVT_PL_RIGHT_DOWN, pPane ),
1820
Class for mouse right up events.
1823
class cbRightUpEvent : public cbPluginEvent
1828
// Constructor, taking mouse position and pane.
1830
cbRightUpEvent( const wxPoint& pos, cbDockPane* pPane )
1832
: cbPluginEvent( cbEVT_PL_RIGHT_UP, pPane ),
1838
Class for mouse motion events.
1841
class cbMotionEvent : public cbPluginEvent
1846
// Constructor, taking mouse position and pane.
1848
cbMotionEvent( const wxPoint& pos, cbDockPane* pPane )
1850
: cbPluginEvent( cbEVT_PL_MOTION, pPane ),
1856
Class for mouse left double click events.
1859
class cbLeftDClickEvent : public cbPluginEvent
1864
// Constructor, taking mouse position and pane.
1866
cbLeftDClickEvent( const wxPoint& pos, cbDockPane* pPane )
1868
: cbPluginEvent( cbEVT_PL_LEFT_DCLICK, pPane ),
1874
Class for single row layout events.
1877
class cbLayoutRowEvent : public cbPluginEvent
1882
// Constructor, taking row information and pane.
1884
cbLayoutRowEvent( cbRowInfo* pRow, cbDockPane* pPane )
1886
: cbPluginEvent( cbEVT_PL_LAYOUT_ROW, pPane ),
1892
Class for row resize events.
1895
class cbResizeRowEvent : public cbPluginEvent
1900
bool mForUpperHandle;
1902
// Constructor, taking row information, two parameters of currently unknown use, and pane.
1904
cbResizeRowEvent( cbRowInfo* pRow, int handleOfs, bool forUpperHandle, cbDockPane* pPane )
1906
: cbPluginEvent( cbEVT_PL_RESIZE_ROW, pPane ),
1908
mHandleOfs( handleOfs ),
1909
mForUpperHandle( forUpperHandle )
1914
Class for multiple rows layout events.
1917
class cbLayoutRowsEvent : public cbPluginEvent
1921
// Constructor, taking pane.
1923
cbLayoutRowsEvent( cbDockPane* pPane )
1925
: cbPluginEvent( cbEVT_PL_LAYOUT_ROWS, pPane )
1930
Class for bar insertion events.
1933
class cbInsertBarEvent : public cbPluginEvent
1939
// Constructor, taking bar information, row information, and pane.
1941
cbInsertBarEvent( cbBarInfo* pBar, cbRowInfo* pIntoRow, cbDockPane* pPane )
1943
: cbPluginEvent( cbEVT_PL_INSERT_BAR, pPane ),
1951
Class for bar resize events.
1954
class cbResizeBarEvent : public cbPluginEvent
1960
// Constructor, taking bar information, row information, and pane.
1962
cbResizeBarEvent( cbBarInfo* pBar, cbRowInfo* pRow, cbDockPane* pPane )
1964
: cbPluginEvent( cbEVT_PL_RESIZE_BAR, pPane ),
1971
Class for bar removal events.
1974
class cbRemoveBarEvent : public cbPluginEvent
1979
// Constructor, taking bar information and pane.
1981
cbRemoveBarEvent( cbBarInfo* pBar, cbDockPane* pPane )
1983
: cbPluginEvent( cbEVT_PL_REMOVE_BAR, pPane ),
1989
Class for bar window resize events.
1992
class cbSizeBarWndEvent : public cbPluginEvent
1996
wxRect mBoundsInParent;
1998
// Constructor, taking bar information and pane.
2000
cbSizeBarWndEvent( cbBarInfo* pBar, cbDockPane* pPane )
2002
: cbPluginEvent( cbEVT_PL_SIZE_BAR_WND, pPane ),
2004
mBoundsInParent( pBar->mBoundsInParent )
2009
Class for bar decoration drawing events.
2012
class cbDrawBarDecorEvent : public cbPluginEvent
2017
wxRect mBoundsInParent;
2019
// Constructor, taking bar information, device context, and pane.
2021
cbDrawBarDecorEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane )
2023
: cbPluginEvent( cbEVT_PL_DRAW_BAR_DECOR, pPane ),
2026
mBoundsInParent( pBar->mBoundsInParent )
2031
Class for row decoration drawing events.
2034
class cbDrawRowDecorEvent : public cbPluginEvent
2040
// Constructor, taking row information, device context, and pane.
2042
cbDrawRowDecorEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2044
: cbPluginEvent( cbEVT_PL_DRAW_ROW_DECOR, pPane ),
2051
Class for pane decoration drawing events.
2054
class cbDrawPaneDecorEvent : public cbPluginEvent
2059
// Constructor, taking device context and pane.
2061
cbDrawPaneDecorEvent( wxDC& dc, cbDockPane* pPane )
2063
: cbPluginEvent( cbEVT_PL_DRAW_PANE_DECOR, pPane ),
2069
Class for bar handles drawing events.
2072
class cbDrawBarHandlesEvent : public cbPluginEvent
2078
// Constructor, taking bar information, device context, and pane.
2080
cbDrawBarHandlesEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane )
2082
: cbPluginEvent( cbEVT_PL_DRAW_BAR_HANDLES, pPane ),
2089
Class for row handles drawing events.
2092
class cbDrawRowHandlesEvent : public cbPluginEvent
2098
// Constructor, taking row information, device context, and pane.
2100
cbDrawRowHandlesEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2102
: cbPluginEvent( cbEVT_PL_DRAW_ROW_HANDLES, pPane ),
2109
Class for row background drawing events.
2112
class cbDrawRowBkGroundEvent : public cbPluginEvent
2118
// Constructor, taking row information, device context, and pane.
2120
cbDrawRowBkGroundEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane )
2122
: cbPluginEvent( cbEVT_PL_DRAW_ROW_BKGROUND, pPane ),
2129
Class for pane background drawing events.
2132
class cbDrawPaneBkGroundEvent : public cbPluginEvent
2137
// Constructor, taking device context and pane.
2139
cbDrawPaneBkGroundEvent( wxDC& dc, cbDockPane* pPane )
2141
: cbPluginEvent( cbEVT_PL_DRAW_PANE_BKGROUND, pPane ),
2147
Class for start-bar-dragging events.
2150
class cbStartBarDraggingEvent : public cbPluginEvent
2154
wxPoint mPos; // is given in frame's coordinates
2156
// Constructor, taking bar information, mouse position, and pane.
2158
cbStartBarDraggingEvent( cbBarInfo* pBar, const wxPoint& pos, cbDockPane* pPane )
2160
: cbPluginEvent( cbEVT_PL_START_BAR_DRAGGING, pPane ),
2167
Class for hint-rectangle drawing events.
2170
class cbDrawHintRectEvent : public cbPluginEvent
2173
wxRect mRect; // is given in frame's coordinates
2176
bool mLastTime; // indicates that this event finishes "session" of on-screen drawing,
2177
// thus associated resources can be freed now
2178
bool mEraseRect; // does not have any impact, if recangle is drawn using XOR-mask
2180
bool mIsInClient;// in cleint area hint could be drawn differently,
2181
// e.g. with fat/hatched border
2184
// Constructor, taking hint rectangle and three flags.
2186
cbDrawHintRectEvent( const wxRect& rect, bool isInClient, bool eraseRect, bool lastTime )
2188
: cbPluginEvent( cbEVT_PL_DRAW_HINT_RECT, 0 ),
2190
mLastTime ( lastTime ),
2191
mEraseRect ( eraseRect ),
2192
mIsInClient( isInClient )
2197
Class for start drawing in area events.
2200
class cbStartDrawInAreaEvent : public cbPluginEvent
2204
wxDC** mppDc; // points to pointer, where the reference
2205
// to the obtained buffer-context should be placed
2207
// Constructor, taking rectangular area, device context pointer to a pointer, and pane.
2209
cbStartDrawInAreaEvent( const wxRect& area, wxDC** ppDCForArea, cbDockPane* pPane )
2211
: cbPluginEvent( cbEVT_PL_START_DRAW_IN_AREA, pPane ),
2213
mppDc( ppDCForArea )
2218
Class for finish drawing in area events.
2221
class cbFinishDrawInAreaEvent : public cbPluginEvent
2226
// Constructor, taking rectangular area and pane.
2228
cbFinishDrawInAreaEvent( const wxRect& area, cbDockPane* pPane )
2230
: cbPluginEvent( cbEVT_PL_FINISH_DRAW_IN_AREA, pPane ),
2236
Class for bar customization events.
2239
class cbCustomizeBarEvent : public cbPluginEvent
2242
wxPoint mClickPos; // in parent frame's coordinates
2245
// Constructor, taking bar information, mouse position, and pane.
2247
cbCustomizeBarEvent( cbBarInfo* pBar, const wxPoint& clickPos, cbDockPane* pPane )
2249
: cbPluginEvent( cbEVT_PL_CUSTOMIZE_BAR, pPane ),
2250
mClickPos( clickPos ),
2256
Class for layout customization events.
2259
class cbCustomizeLayoutEvent : public cbPluginEvent
2262
wxPoint mClickPos; // in parent frame's coordinates
2264
// Constructor, taking mouse position.
2266
cbCustomizeLayoutEvent( const wxPoint& clickPos )
2268
: cbPluginEvent( cbEVT_PL_CUSTOMIZE_LAYOUT, 0 ),
2269
mClickPos( clickPos )
2273
#endif /* __CONTROLBAR_G__ */