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