]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: No names yet. | |
3 | // Purpose: Central header file for control-bar related classes | |
4 | // | |
5 | // Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt> | |
6 | // Modified by: | |
7 | // Created: 06/09/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Aleksandras Gluchovas | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef __CONTROLBAR_G__ | |
14 | #define __CONTROLBAR_G__ | |
15 | ||
16 | #ifdef __GNUG__ | |
17 | #pragma interface "controlbar.h" | |
18 | #endif | |
19 | ||
20 | #include "wx/defs.h" | |
21 | #include "wx/string.h" | |
22 | #include "wx/window.h" | |
23 | #include "wx/dynarray.h" | |
24 | ||
25 | #define WXCONTROLBAR_VERSION 1.3 | |
26 | ||
27 | // forward declarations | |
28 | ||
29 | class wxFrameLayout; | |
30 | ||
31 | class cbDockPane; | |
32 | class cbUpdatesManagerBase; | |
33 | class cbBarDimHandlerBase; | |
34 | class cbPluginBase; | |
35 | class cbPluginEvent; | |
36 | class cbPaneDrawPlugin; | |
37 | ||
38 | class cbBarInfo; | |
39 | class cbRowInfo; | |
40 | class cbDimInfo; | |
41 | class cbCommonPaneProperties; | |
42 | ||
43 | typedef cbBarInfo* BarInfoPtrT; | |
44 | typedef cbRowInfo* RowInfoPtrT; | |
45 | ||
46 | WX_DEFINE_ARRAY( BarInfoPtrT, BarArrayT ); | |
47 | WX_DEFINE_ARRAY( RowInfoPtrT, RowArrayT ); | |
48 | ||
49 | // control bar states | |
50 | ||
51 | #define wxCBAR_DOCKED_HORIZONTALLY 0 | |
52 | #define wxCBAR_DOCKED_VERTICALLY 1 | |
53 | #define wxCBAR_FLOATING 2 | |
54 | #define wxCBAR_HIDDEN 3 | |
55 | ||
56 | // the states are enumerated above | |
57 | #define MAX_BAR_STATES 4 | |
58 | ||
59 | // control bar alignments | |
60 | ||
61 | #if !defined(FL_ALIGN_TOP) | |
62 | ||
63 | #define FL_ALIGN_TOP 0 | |
64 | #define FL_ALIGN_BOTTOM 1 | |
65 | #define FL_ALIGN_LEFT 2 | |
66 | #define FL_ALIGN_RIGHT 3 | |
67 | ||
68 | #endif | |
69 | ||
70 | // one pane for each alignment | |
71 | #define MAX_PANES 4 | |
72 | ||
73 | // masks for each pane | |
74 | ||
75 | #define FL_ALIGN_TOP_PANE 0x0001 | |
76 | #define FL_ALIGN_BOTTOM_PANE 0x0002 | |
77 | #define FL_ALIGN_LEFT_PANE 0x0004 | |
78 | #define FL_ALIGN_RIGHT_PANE 0x0008 | |
79 | ||
80 | #define wxALL_PANES 0x000F | |
81 | ||
82 | // enumeration of hittest results, see cbDockPane::HitTestPaneItems(..) | |
83 | ||
84 | enum CB_HITTEST_RESULT | |
85 | { | |
86 | CB_NO_ITEMS_HITTED, | |
87 | ||
88 | CB_UPPER_ROW_HANDLE_HITTED, | |
89 | CB_LOWER_ROW_HANDLE_HITTED, | |
90 | CB_LEFT_BAR_HANDLE_HITTED, | |
91 | CB_RIGHT_BAR_HANDLE_HITTED, | |
92 | CB_BAR_CONTENT_HITTED | |
93 | }; | |
94 | ||
95 | // FIXME:: somehow in debug v. originall wxASSERT's are not compiled in... | |
96 | ||
97 | //#undef wxASSERT | |
98 | //#define wxASSERT(x) if ( !(x) ) throw; | |
99 | ||
100 | // helper class, used for spying for not-handled mouse events on control-bars | |
101 | // and forwarding them to the frame layout | |
102 | ||
103 | class cbBarSpy : public wxEvtHandler | |
104 | { | |
105 | public: | |
106 | DECLARE_DYNAMIC_CLASS( cbBarSpy ) | |
107 | ||
108 | wxFrameLayout* mpLayout; | |
109 | wxWindow* mpBarWnd; | |
110 | ||
111 | public: | |
112 | cbBarSpy(void); | |
113 | ||
114 | cbBarSpy( wxFrameLayout* pPanel ); | |
115 | ||
116 | void SetBarWindow( wxWindow* pWnd ); | |
117 | ||
118 | // overriden | |
119 | ||
120 | virtual bool ProcessEvent(wxEvent& event); | |
121 | }; | |
122 | ||
123 | /* wxFrameLayout manages containment and docking of control bars. | |
124 | * which can be docked along top, bottom, righ, or left side of the | |
125 | * parent frame | |
126 | */ | |
127 | ||
128 | class wxFrameLayout : public wxEvtHandler | |
129 | { | |
130 | public: | |
131 | wxFrameLayout(void); // used only while serializing | |
132 | ||
133 | wxFrameLayout( wxWindow* pParentFrame, | |
134 | wxWindow* pFrameClient = NULL, | |
135 | bool activateNow = TRUE ); | |
136 | ||
137 | // (doesn't destroy bar windows) | |
138 | virtual ~wxFrameLayout(); | |
139 | ||
140 | // (by default floating of control-bars is ON) | |
141 | virtual void EnableFloating( bool enable = TRUE ); | |
142 | ||
143 | // Can be called after some other layout has been deactivated, | |
144 | // and this one must "take over" the current contents of frame window. | |
145 | // | |
146 | // Effectively hooks itself to the frame window, re-displays all not-hidden | |
147 | // bar-windows and repaints decorations | |
148 | ||
149 | virtual void Activate(); | |
150 | ||
151 | // unhooks itself from frame window, and hides all not-hidden windows | |
152 | // | |
153 | // NOTE:: two frame-layouts should not be active at the same time in the | |
154 | // same frame window, it would cause messy overlapping of bar windows | |
155 | // from both layouts | |
156 | ||
157 | virtual void Deactivate(); | |
158 | ||
159 | // also hides the client window if presents | |
160 | ||
161 | void HideBarWindows(); | |
162 | ||
163 | virtual void DestroyBarWindows(); | |
164 | ||
165 | // passes the client window (e.g. MDI-client frame) to be controled by | |
166 | // frame layout, the size and position of which should be adjusted to be | |
167 | // surrounded by controlbar panes, whenever frame is resized, or dimensions | |
168 | // of control panes change | |
169 | ||
170 | void SetFrameClient( wxWindow* pFrameClient ); | |
171 | ||
172 | wxWindow* GetFrameClient(); | |
173 | ||
174 | wxWindow& GetParentFrame() { return *mpFrame; } | |
175 | ||
176 | // used by updates-managers | |
177 | cbDockPane** GetPanesArray() { return mPanes; } | |
178 | ||
179 | // see pane alignment types | |
180 | cbDockPane* GetPane( int alignment ) | |
181 | ||
182 | { return mPanes[alignment]; } | |
183 | ||
184 | // Adds bar information to frame-layout, appearence of layout is not refreshed | |
185 | // immediately, RefreshNow() can be called if necessary. | |
186 | // | |
187 | // NOTES:: argument pBarWnd can by NULL, resulting bar decorations to be drawn | |
188 | // around the empty rectangle (filled with default background colour). | |
189 | // Argument dimInfo, can be re-used for adding any number of bars, since | |
190 | // it is not used directly, instead it's members are copied. If dimensions- | |
191 | // handler is present, it's instance shared (reference counted). Dimension | |
192 | // handler should always be allocated on the heap!) | |
193 | ||
194 | virtual void AddBar( wxWindow* pBarWnd, | |
195 | const cbDimInfo& dimInfo, | |
196 | ||
197 | // defaults: | |
198 | int alignment = FL_ALIGN_TOP, | |
199 | int rowNo = 0, // vert. position - row in the pane (if docked state) | |
200 | int columnPos = 0, // horiz. position in the row in pixels (if docked state) | |
201 | const wxString& name="bar",// name, by which the bar could be referred | |
202 | // in layout customization dialogs | |
203 | ||
204 | bool spyEvents = FALSE, // if TRUE - input events for the bar should | |
205 | // be "spyed" in order to forward not-handled | |
206 | // mouse clicks to frame layout (e.g. to enable | |
207 | // easy-draggablity of toolbars just by clicking | |
208 | // on their interior regions). For widgets like | |
209 | // text/tree control this value should be FALSE | |
210 | // (since there's _no_ certain way to detect | |
211 | // whether the event was actually handled...) | |
212 | ||
213 | int state = wxCBAR_DOCKED_HORIZONTALLY // e.g. wxCBAR_FLOATING | |
214 | // or wxCBAR_HIDDEN | |
215 | ); | |
216 | ||
217 | // can be used for repositioning already existing bars. The given bar is first removed | |
218 | // from the pane it currently belongs to, and inserted into the pane, which "matches" | |
219 | // the given recantular area. If pToPane is not NULL, bar is docked to this given pane | |
220 | ||
221 | // to dock the bar which is floated, use wxFrameLayout::DockBar(..) method | |
222 | ||
223 | virtual bool RedockBar( cbBarInfo* pBar, const wxRect& shapeInParent, | |
224 | cbDockPane* pToPane = NULL, bool updateNow = TRUE ); | |
225 | ||
226 | // methods for access and modification of bars in frame layout | |
227 | ||
228 | cbBarInfo* FindBarByName( const wxString& name ); | |
229 | ||
230 | cbBarInfo* FindBarByWindow( const wxWindow* pWnd ); | |
231 | ||
232 | BarArrayT& GetBars(); | |
233 | ||
234 | // changes bar's docking state (see possible control bar states) | |
235 | ||
236 | void SetBarState( cbBarInfo* pBar, int newStatem, bool updateNow ); | |
237 | ||
238 | void InverseVisibility( cbBarInfo* pBar ); | |
239 | ||
240 | // reflects changes in bar information structure visually | |
241 | // (e.g. moves bar, changes it's dimension info, pane to which it is docked) | |
242 | ||
243 | void ApplyBarProperties( cbBarInfo* pBar ); | |
244 | ||
245 | // removes bar from layout permanently, hides it's corresponding window if present | |
246 | ||
247 | void RemoveBar( cbBarInfo* pBar ); | |
248 | ||
249 | // recalcualtes layout of panes, and all bars/rows in each pane | |
250 | ||
251 | virtual void RecalcLayout( bool repositionBarsNow = FALSE ); | |
252 | ||
253 | int GetClientHeight(); | |
254 | int GetClientWidth(); | |
255 | wxRect& GetClientRect() { return mClntWndBounds; } | |
256 | ||
257 | // NOTE:: in future ubdates-manager will become a normal plugin | |
258 | ||
259 | cbUpdatesManagerBase& GetUpdatesManager(); | |
260 | ||
261 | // destroys the previous manager if any, set the new one | |
262 | ||
263 | void SetUpdatesManager( cbUpdatesManagerBase* pUMgr ); | |
264 | ||
265 | // NOTE:: changing properties of panes, does not result immediate on-screen update | |
266 | ||
267 | virtual void GetPaneProperties( cbCommonPaneProperties& props, int alignment = FL_ALIGN_TOP ); | |
268 | ||
269 | virtual void SetPaneProperties( const cbCommonPaneProperties& props, | |
270 | int paneMask = wxALL_PANES ); | |
271 | ||
272 | // TODO:: margins should go into cbCommonPaneProperties in the future | |
273 | // | |
274 | // NOTE:: this method should be called before any custom plugins are attached | |
275 | ||
276 | virtual void SetMargins( int top, int bottom, int left, int right, | |
277 | int paneMask = wxALL_PANES ); | |
278 | ||
279 | virtual void SetPaneBackground( const wxColour& colour ); | |
280 | ||
281 | // recalculates layoute and performs on-screen update of all panes | |
282 | ||
283 | void RefreshNow( bool recalcLayout = TRUE ); | |
284 | ||
285 | // event handlers | |
286 | ||
287 | void OnSize ( wxSizeEvent& event ); | |
288 | void OnLButtonDown( wxMouseEvent& event ); | |
289 | void OnLDblClick ( wxMouseEvent& event ); | |
290 | void OnLButtonUp ( wxMouseEvent& event ); | |
291 | void OnRButtonDown( wxMouseEvent& event ); | |
292 | void OnRButtonUp ( wxMouseEvent& event ); | |
293 | void OnMouseMove ( wxMouseEvent& event ); | |
294 | ||
295 | /*** plugin-related methods ***/ | |
296 | ||
297 | // should be used, instead of passing the event to ProcessEvent(..) method | |
298 | // of the top-plugin directly. This method checks if events are currently | |
299 | // captured and ensures that plugin-event is routed correctly. | |
300 | ||
301 | virtual void FirePluginEvent( cbPluginEvent& event ); | |
302 | ||
303 | // captures/releases user-input event's for the given plugin | |
304 | // Input events are: mouse movement, mouse clicks, keyboard input | |
305 | ||
306 | virtual void CaptureEventsForPlugin ( cbPluginBase* pPlugin ); | |
307 | virtual void ReleaseEventsFromPlugin( cbPluginBase* pPlugin ); | |
308 | ||
309 | // called by plugins ( also captures/releases mouse in parent frame) | |
310 | void CaptureEventsForPane( cbDockPane* toPane ); | |
311 | void ReleaseEventsFromPane( cbDockPane* fromPane ); | |
312 | ||
313 | // returns current top-level plugin (the one which receives events first, | |
314 | // with an exception if input-events are currently captured by some other plugin) | |
315 | ||
316 | virtual cbPluginBase& GetTopPlugin(); | |
317 | ||
318 | // hooking custom plugins to frame layout | |
319 | // | |
320 | // NOTE:: when hooking one plugin on top of the other - | |
321 | // use SetNextHandler(..) or similar methods | |
322 | // of wxEvtHandler class to compose the chain of plugins, | |
323 | // than pass the left-most handler in this chain to | |
324 | // the above methods (assuming that events are delegated | |
325 | // from left-most towards right-most handler) | |
326 | // | |
327 | // NOTE2:: this secenario is very inconvenient and "low-level", | |
328 | // use Add/Push/PopPlugin methods instead | |
329 | ||
330 | virtual void SetTopPlugin( cbPluginBase* pPlugin ); | |
331 | ||
332 | // similar to wxWindow's "push/pop-event-handler" methods, execept | |
333 | // that plugin is *deleted* upon "popping" | |
334 | ||
335 | virtual void PushPlugin( cbPluginBase* pPugin ); | |
336 | virtual void PopPlugin(); | |
337 | ||
338 | virtual void PopAllPlugins(); | |
339 | ||
340 | // default plugins are : cbPaneDrawPlugin, cbRowLayoutPlugin, cbBarDragPlugin, | |
341 | // cbAntiflickerPlugin, cbSimpleCustomizePlugin | |
342 | // | |
343 | // this method is automatically invoked, if no plugins were found upon | |
344 | // fireing of the first plugin-event, i.e. wxFrameLayout *CONFIGURES* itself | |
345 | ||
346 | virtual void PushDefaultPlugins(); | |
347 | ||
348 | /* "Advanced" methods for plugin-configuration using their */ | |
349 | /* dynamic class information (e.g. CLASSINFO(pluginClass) ) */ | |
350 | ||
351 | // first checks if plugin of the given class is already "hooked up", | |
352 | // if not, adds it to the top of plugins chain | |
353 | ||
354 | virtual void AddPlugin( wxClassInfo* pPlInfo, int paneMask = wxALL_PANES ); | |
355 | ||
356 | // first checks if plugin of the givne class already hooked, | |
357 | // if so, removes it, and then inserts it to the chain | |
358 | // before plugin of the class given by "pNextPlInfo" | |
359 | // | |
360 | // NOTE:: this method is "handy" in some cases, where the order | |
361 | // of plugin-chain could be important, e.g. one plugin overrides | |
362 | // some functionallity of the other already hooked plugin, | |
363 | // thefore the former should be hooked before the one | |
364 | // who's functionality is being overriden | |
365 | ||
366 | virtual void AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo, | |
367 | int paneMask = wxALL_PANES ); | |
368 | ||
369 | // checks if plugin of the given class is hooked, removes | |
370 | // it if found | |
371 | // | |
372 | // @param pPlInfo class information structure for the plugin | |
373 | // @note | |
374 | // @see wxFrameLayout::Method | |
375 | ||
376 | ||
377 | virtual void RemovePlugin( wxClassInfo* pPlInfo ); | |
378 | ||
379 | // returns NULL, if plugin of the given class is not hooked | |
380 | ||
381 | virtual cbPluginBase* FindPlugin( wxClassInfo* pPlInfo ); | |
382 | ||
383 | bool HasTopPlugin(); | |
384 | ||
385 | DECLARE_EVENT_TABLE() | |
386 | DECLARE_DYNAMIC_CLASS( wxFrameLayout ) | |
387 | ||
388 | public: /* protected really, acessed only by plugins and serializers */ | |
389 | ||
390 | friend class cbDockPane; | |
391 | friend class wxBarHandler; | |
392 | ||
393 | wxWindow* mpFrame; // parent frame | |
394 | wxWindow* mpFrameClient; // client window | |
395 | cbDockPane* mPanes[MAX_PANES]; // panes in the panel | |
396 | ||
397 | // misc. cursors | |
398 | wxCursor* mpHorizCursor; | |
399 | wxCursor* mpVertCursor; | |
400 | wxCursor* mpNormalCursor; | |
401 | wxCursor* mpDragCursor; | |
402 | wxCursor* mpNECursor; // no-entry cursor | |
403 | ||
404 | // pens for decoration and shades | |
405 | ||
406 | wxPen mDarkPen; // default wxSYS_COLOUR_3DSHADOW | |
407 | wxPen mLightPen; // default wxSYS_COLOUR_3DHILIGHT | |
408 | wxPen mGrayPen; // default wxSYS_COLOUR_3DFACE | |
409 | wxPen mBlackPen; // default wxColour( 0, 0, 0) | |
410 | wxPen mBorderPen; // default wxSYS_COLOUR_3DFACE | |
411 | ||
412 | wxPen mNullPen; // transparent pen | |
413 | ||
414 | // pane to which the all mouse input is currently directed (caputred) | |
415 | ||
416 | cbDockPane* mpPaneInFocus; | |
417 | ||
418 | // pane, from which mouse pointer had just left | |
419 | ||
420 | cbDockPane* mpLRUPane; | |
421 | ||
422 | // bounds of client window in parent frame's coordinates | |
423 | ||
424 | wxRect mClntWndBounds; | |
425 | wxRect mPrevClntWndBounds; | |
426 | ||
427 | bool mFloatingOn; | |
428 | wxPoint mNextFloatedWndPos; | |
429 | wxSize mFloatingPosStep; | |
430 | ||
431 | // current plugin (right-most) plugin which receives events first | |
432 | ||
433 | cbPluginBase* mpTopPlugin; | |
434 | ||
435 | // plugin, which currently has captured all input events, otherwise NULL | |
436 | ||
437 | cbPluginBase* mpCaputesInput; | |
438 | ||
439 | // list of event handlers which are "pushed" onto each bar, to catch | |
440 | // mouse events which are not handled by bars, and froward them to the , | |
441 | // frome-layout and further to plugins | |
442 | ||
443 | wxList mBarSpyList; | |
444 | ||
445 | // list of top-most frames which contain floated bars | |
446 | ||
447 | wxList mFloatedFrames; | |
448 | ||
449 | // linked list of references to all bars (docked/floated/hidden) | |
450 | ||
451 | BarArrayT mAllBars; | |
452 | ||
453 | // FOR NOW:: dirty stuff... | |
454 | bool mClientWndRefreshPending; | |
455 | bool mRecalcPending; | |
456 | bool mCheckFocusWhenIdle; | |
457 | ||
458 | public: /* protected really (accessed only by plugins) */ | |
459 | ||
460 | // refrence to custom updates manager | |
461 | cbUpdatesManagerBase* mpUpdatesMgr; | |
462 | ||
463 | // called to set calculated layout to window objects | |
464 | void PositionClientWindow(); | |
465 | void PositionPanes(); | |
466 | void CreateCursors(); | |
467 | ||
468 | void RepositionFloatedBar( cbBarInfo* pBar ); | |
469 | void DoSetBarState( cbBarInfo* pBar ); | |
470 | ||
471 | bool LocateBar( cbBarInfo* pBarInfo, | |
472 | cbRowInfo** ppRow, | |
473 | cbDockPane** ppPane ); | |
474 | ||
475 | ||
476 | bool HitTestPane( cbDockPane* pPane, int x, int y ); | |
477 | cbDockPane* HitTestPanes( const wxRect& rect, cbDockPane* pCurPane ); | |
478 | ||
479 | // returns panes, to which the given bar belongs | |
480 | ||
481 | cbDockPane* GetBarPane( cbBarInfo* pBar ); | |
482 | ||
483 | // delegated from "bar-spy" | |
484 | void ForwardMouseEvent( wxMouseEvent& event, | |
485 | cbDockPane* pToPane, | |
486 | int eventType ); | |
487 | ||
488 | void RouteMouseEvent( wxMouseEvent& event, int pluginEvtType ); | |
489 | ||
490 | void ShowFloatedWindows( bool show ); | |
491 | ||
492 | void UnhookFromFrame(); | |
493 | void HookUpToFrame(); | |
494 | ||
495 | // NOTE:: reparenting of windows may NOT work on all platforms | |
496 | // (reparenting allows control-bars to be floated) | |
497 | ||
498 | bool CanReparent(); | |
499 | void ReparentWindow( wxWindow* pChild, wxWindow* pNewParent ); | |
500 | ||
501 | wxRect& GetPrevClientRect() { return mPrevClntWndBounds; } | |
502 | ||
503 | void OnPaint( wxPaintEvent& event ); | |
504 | void OnEraseBackground( wxEraseEvent& event ); | |
505 | void OnKillFocus( wxFocusEvent& event ); | |
506 | void OnSetFocus( wxFocusEvent& event ); | |
507 | void OnActivate( wxActivateEvent& event ); | |
508 | void OnIdle( wxIdleEvent& event ); | |
509 | ||
510 | // factory method | |
511 | virtual cbUpdatesManagerBase* CreateUpdatesManager(); | |
512 | }; | |
513 | ||
514 | /* structure, which is present in each item of layout, | |
515 | * it used by any specific updates-manager to store | |
516 | * auxilary information to be used by it's specific | |
517 | * updating algorithm | |
518 | */ | |
519 | ||
520 | class cbUpdateMgrData : public wxObject | |
521 | { | |
522 | DECLARE_DYNAMIC_CLASS( cbUpdateMgrData ) | |
523 | public: | |
524 | wxRect mPrevBounds; // previous state of layout item (in parent frame's coordinates) | |
525 | ||
526 | bool mIsDirty; // overrides result of current-against-previous bounds comparison, | |
527 | // i.e. requires item to be updated, regardless of it's current area | |
528 | ||
529 | wxObject* mpCustomData; // any custom data stored by specific updates mgr. | |
530 | ||
531 | cbUpdateMgrData(); // is-dirty flag is set TRUE initially | |
532 | ||
533 | void StoreItemState( const wxRect& boundsInParent ); | |
534 | ||
535 | void SetDirty( bool isDirty = TRUE ); | |
536 | ||
537 | void SetCustomData( wxObject* pCustomData ); | |
538 | ||
539 | inline bool IsDirty() { return mIsDirty; } | |
540 | }; | |
541 | ||
542 | /* Abstract interface for bar-size handler classes. | |
543 | * These objects receive notifications, whenever the docking | |
544 | * state of the bar is changed, thus they have a possibility | |
545 | * to adjust the values in cbDimInfo::mSizes accordingly. | |
546 | * Specific handlers can be hooked to specific types of bars. | |
547 | */ | |
548 | ||
549 | class cbBarDimHandlerBase : public wxObject | |
550 | { | |
551 | DECLARE_ABSTRACT_CLASS( cbBarDimHandlerBase ) | |
552 | ||
553 | public: | |
554 | int mRefCount; // since one dim-handler can be assigned | |
555 | // to multiple bars, it's instance is | |
556 | // reference-counted | |
557 | public: | |
558 | ||
559 | // initial reference count is 0, since handler is not used, until the | |
560 | // first invocation of AddRef() | |
561 | ||
562 | cbBarDimHandlerBase(); | |
563 | ||
564 | void AddRef(); | |
565 | void RemoveRef(); | |
566 | ||
567 | // "bar-state-changes" notification | |
568 | virtual void OnChangeBarState(cbBarInfo* pBar, int newState ) = 0; | |
569 | virtual void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred ) = 0; | |
570 | }; | |
571 | ||
572 | /* helper classes (used internally by wxFrameLayout class) */ | |
573 | ||
574 | // holds and manages information about bar dimensions | |
575 | ||
576 | class cbDimInfo : public wxObject | |
577 | { | |
578 | DECLARE_DYNAMIC_CLASS( cbDimInfo ) | |
579 | public: | |
580 | wxSize mSizes[MAX_BAR_STATES]; // preferred sizes for each possible bar state | |
581 | ||
582 | wxRect mBounds[MAX_BAR_STATES]; // saved positions and sizes for each | |
583 | // possible state, values contain (-1)s if | |
584 | // not initialized yet | |
585 | ||
586 | int mLRUPane; // pane to which this bar was docked before it was floated | |
587 | // (FL_ALIGN_TOP,FL_ALIGN_BOTTOM,..) | |
588 | ||
589 | // top/bottom gap, separates decorations | |
590 | // from the bar's actual window, filled | |
591 | // with frame's beckground color, default: 0 | |
592 | ||
593 | int mVertGap; | |
594 | ||
595 | // left/right gap, separates decorations | |
596 | // from the bar's actual window, filled | |
597 | // with frame's beckground colour, default: 0 | |
598 | ||
599 | int mHorizGap; // NOTE:: gaps are given in frame's coord. orientation | |
600 | ||
601 | // TRUE, if vertical/horizotal dimensions cannot be mannualy adjusted | |
602 | // by user using resizing handles. If FALSE, the frame-layout | |
603 | // *automatically* places resizing handles among not-fixed bars | |
604 | ||
605 | bool mIsFixed; | |
606 | ||
607 | cbBarDimHandlerBase* mpHandler; // NULL, if no handler present | |
608 | ||
609 | public: | |
610 | ||
611 | cbDimInfo(void); | |
612 | ||
613 | cbDimInfo( cbBarDimHandlerBase* pDimHandler, | |
614 | bool isFixed // (see comments on mIsFixed member) | |
615 | ); | |
616 | ||
617 | cbDimInfo( int dh_x, int dh_y, // dims when docked horizontally | |
618 | int dv_x, int dv_y, // dims when docked vertically | |
619 | int f_x, int f_y, // dims when floating | |
620 | ||
621 | bool isFixed = TRUE,// (see comments on mIsFixed member) | |
622 | int horizGap = 6, // (see comments on mHorizGap member) | |
623 | int vertGap = 6, // -/- | |
624 | ||
625 | cbBarDimHandlerBase* pDimHandler = NULL | |
626 | ); | |
627 | ||
628 | cbDimInfo( int x, int y, | |
629 | bool isFixed = TRUE, | |
630 | int gap = 6, | |
631 | cbBarDimHandlerBase* pDimHandler = NULL | |
632 | ); | |
633 | ||
634 | const cbDimInfo& operator=( const cbDimInfo& other ); | |
635 | ||
636 | // destroys handler automatically, if present | |
637 | ~cbDimInfo(); | |
638 | ||
639 | inline cbBarDimHandlerBase* GetDimHandler() { return mpHandler; } | |
640 | }; | |
641 | ||
642 | WX_DEFINE_ARRAY(float, cbArrayFloat); | |
643 | ||
644 | class cbRowInfo : public wxObject | |
645 | { | |
646 | DECLARE_DYNAMIC_CLASS( cbRowInfo ) | |
647 | public: | |
648 | ||
649 | BarArrayT mBars; // row content | |
650 | ||
651 | // row flags (set up according to row-relations) | |
652 | ||
653 | bool mHasUpperHandle; | |
654 | bool mHasLowerHandle; | |
655 | bool mHasOnlyFixedBars; | |
656 | int mNotFixedBarsCnt; | |
657 | ||
658 | int mRowWidth; | |
659 | int mRowHeight; | |
660 | int mRowY; | |
661 | ||
662 | // stores precalculated row's bounds in parent frame's coordinates | |
663 | wxRect mBoundsInParent; | |
664 | ||
665 | // info stored for updates-manager | |
666 | cbUpdateMgrData mUMgrData; | |
667 | ||
668 | cbRowInfo* mpNext; | |
669 | cbRowInfo* mpPrev; | |
670 | ||
671 | cbBarInfo* mpExpandedBar; // NULL, if non of the bars is currently expanded | |
672 | ||
673 | cbArrayFloat mSavedRatios; // length-ratios bofore some of the bars was expanded | |
674 | ||
675 | public: | |
676 | cbRowInfo(void); | |
677 | ||
678 | ~cbRowInfo(); | |
679 | ||
680 | // convenience method | |
681 | ||
682 | inline cbBarInfo* GetFirstBar() | |
683 | ||
684 | { return mBars.GetCount() ? mBars[0] : NULL; } | |
685 | }; | |
686 | ||
687 | class cbBarInfo : public wxObject | |
688 | { | |
689 | DECLARE_DYNAMIC_CLASS( cbBarInfo ) | |
690 | public: | |
691 | // textual name, by which this bar is refered in layout-customization dialogs | |
692 | wxString mName; | |
693 | ||
694 | // stores bar's bounds in pane's coordinates | |
695 | wxRect mBounds; | |
696 | ||
697 | // stores precalculated bar's bounds in parent frame's coordinates | |
698 | wxRect mBoundsInParent; | |
699 | ||
700 | // back-ref to the row, which contains this bar | |
701 | cbRowInfo* mpRow; | |
702 | ||
703 | // are set up according to the types of the surrounding bars in the row | |
704 | bool mHasLeftHandle; | |
705 | bool mHasRightHandle; | |
706 | ||
707 | cbDimInfo mDimInfo; // preferred sizes for each, control bar state | |
708 | ||
709 | int mState; // (see definition of controlbar states) | |
710 | ||
711 | int mAlignment; // alignment of the pane to which this | |
712 | // bar is currently placed | |
713 | ||
714 | int mRowNo; // row, into which this bar would be placed, | |
715 | // when in the docking state | |
716 | ||
717 | wxWindow* mpBarWnd; // the actual window object, NULL if no window | |
718 | // is attached to the control bar (possible!) | |
719 | ||
720 | double mLenRatio; // length ratio among not-fixed-size bars | |
721 | ||
722 | wxPoint mPosIfFloated; // stored last position when bar was in "floated" state | |
723 | // poistion is stored in parent-window's coordinates | |
724 | ||
725 | cbUpdateMgrData mUMgrData; // info stored for updates-manager | |
726 | ||
727 | cbBarInfo* mpNext; // next. bar in the row | |
728 | cbBarInfo* mpPrev; // prev. bar in the row | |
729 | ||
730 | public: | |
731 | cbBarInfo(void); | |
732 | ||
733 | ~cbBarInfo(); | |
734 | ||
735 | inline bool IsFixed() const { return mDimInfo.mIsFixed; } | |
736 | ||
737 | inline bool IsExpanded() const { return this == mpRow->mpExpandedBar; } | |
738 | }; | |
739 | ||
740 | // used for storing original bar's postions in the row, when the "non-destructive-friction" | |
741 | // option is turned ON | |
742 | ||
743 | class cbBarShapeData : public wxObject | |
744 | { | |
745 | public: | |
746 | wxRect mBounds; | |
747 | double mLenRatio; | |
748 | }; | |
749 | ||
750 | // used for traversing through all bars of all rows in the pane | |
751 | ||
752 | class wxBarIterator | |
753 | { | |
754 | RowArrayT* mpRows; | |
755 | cbRowInfo* mpRow; | |
756 | cbBarInfo* mpBar; | |
757 | ||
758 | public: | |
759 | wxBarIterator( RowArrayT& rows ); | |
760 | ||
761 | void Reset(); | |
762 | bool Next(); // TRUE, if next bar is available | |
763 | ||
764 | cbBarInfo& BarInfo(); | |
765 | ||
766 | // returns reference to currently traversed row | |
767 | cbRowInfo& RowInfo(); | |
768 | }; | |
769 | ||
770 | /* structure holds configuration options, | |
771 | * which are usually the same for all panes in | |
772 | * frame layout | |
773 | */ | |
774 | ||
775 | class cbCommonPaneProperties : public wxObject | |
776 | { | |
777 | DECLARE_DYNAMIC_CLASS( cbCommonPaneProperties ) | |
778 | ||
779 | // look-and-feel configuration | |
780 | ||
781 | bool mRealTimeUpdatesOn; // default: ON | |
782 | bool mOutOfPaneDragOn; // default: ON | |
783 | bool mExactDockPredictionOn; // default: OFF | |
784 | bool mNonDestructFirctionOn; // default: OFF | |
785 | ||
786 | bool mShow3DPaneBorderOn; // default: ON | |
787 | ||
788 | // FOR NOW:: the below properties are reserved for the "future" | |
789 | ||
790 | bool mBarFloatingOn; // default: OFF | |
791 | bool mRowProportionsOn; // default: OFF | |
792 | bool mColProportionsOn; // default: ON | |
793 | bool mBarCollapseIconsOn; // default: OFF | |
794 | bool mBarDragHintsOn; // default: OFF | |
795 | ||
796 | // minimal dimensions for not-fixed bars in this pane (16x16 default) | |
797 | ||
798 | wxSize mMinCBarDim; | |
799 | ||
800 | // width/height of resizing sash | |
801 | ||
802 | int mResizeHandleSize; | |
803 | ||
804 | cbCommonPaneProperties(void); | |
805 | }; | |
806 | ||
807 | /* class manages containment and control of control-bars | |
808 | * along one of the four edges of the parent frame | |
809 | */ | |
810 | ||
811 | class cbDockPane : public wxObject | |
812 | { | |
813 | public: | |
814 | DECLARE_DYNAMIC_CLASS( cbDockPane ) | |
815 | ||
816 | // look-and-feel configuration for this pane | |
817 | cbCommonPaneProperties mProps; | |
818 | ||
819 | // pane margins (in frame's coordinate-syst. orientation) | |
820 | ||
821 | int mLeftMargin; // default: 2 pixels | |
822 | int mRightMargin; // default: 2 pixels | |
823 | int mTopMargin; // default: 2 pixels | |
824 | int mBottomMargin; // default: 2 pixels | |
825 | ||
826 | public: | |
827 | // position of the pane in frame's coordinates | |
828 | wxRect mBoundsInParent; | |
829 | ||
830 | // pane width and height in pane's coordinates | |
831 | int mPaneWidth; | |
832 | int mPaneHeight; | |
833 | ||
834 | int mAlignment; | |
835 | ||
836 | // info stored for updates-manager | |
837 | cbUpdateMgrData mUMgrData; | |
838 | ||
839 | public: /* protected really */ | |
840 | ||
841 | RowArrayT mRows; | |
842 | wxFrameLayout* mpLayout; // back-ref | |
843 | ||
844 | // transient properties | |
845 | ||
846 | wxList mRowShapeData; // shapes of bars of recently modified row, | |
847 | // stored when in "non-destructive-firction" mode | |
848 | cbRowInfo* mpStoredRow; // row-info for which the shapes are stored | |
849 | ||
850 | friend class wxFrameLayout; | |
851 | ||
852 | public: /* protected really (accessed only by plugins) */ | |
853 | ||
854 | cbRowInfo* GetRow( int row ); | |
855 | ||
856 | int GetRowIndex( cbRowInfo* pRow ); | |
857 | ||
858 | // return -1, if row is not present at given vertical position | |
859 | int GetRowAt( int paneY ); | |
860 | int GetRowAt( int upperY, int lowerY ); | |
861 | ||
862 | // re-setups flags in the row-information structure, so that | |
863 | // the would match the changed state of row-items correctly | |
864 | void SyncRowFlags( cbRowInfo* pRow ); | |
865 | ||
866 | // layout "AI" helpers: | |
867 | ||
868 | bool IsFixedSize( cbBarInfo* pInfo ); | |
869 | int GetNotFixedBarsCount( cbRowInfo* pRow ); | |
870 | ||
871 | int GetRowWidth( wxList* pRow ); | |
872 | ||
873 | int GetRowY( cbRowInfo* pRow ); | |
874 | ||
875 | bool HasNotFixedRowsAbove( cbRowInfo* pRow ); | |
876 | bool HasNotFixedRowsBelow( cbRowInfo* pRow ); | |
877 | bool HasNotFixedBarsLeft ( cbBarInfo* pBar ); | |
878 | bool HasNotFixedBarsRight( cbBarInfo* pBar ); | |
879 | ||
880 | virtual void CalcLengthRatios( cbRowInfo* pInRow ); | |
881 | virtual void RecalcRowLayout( cbRowInfo* pRow ); | |
882 | ||
883 | virtual void ExpandBar( cbBarInfo* pBar ); | |
884 | virtual void ContractBar( cbBarInfo* pBar ); | |
885 | ||
886 | void InitLinksForRow( cbRowInfo* pRow ); | |
887 | void InitLinksForRows(); | |
888 | ||
889 | // coordinate translation between parent's frame and this pane | |
890 | ||
891 | void FrameToPane( int* x, int* y ); | |
892 | void PaneToFrame( int* x, int* y ); | |
893 | void FrameToPane( wxRect* pRect ); | |
894 | void PaneToFrame( wxRect* pRect ); | |
895 | ||
896 | inline bool HasPoint( const wxPoint& pos, int x, int y, int width, int height ); | |
897 | ||
898 | int GetMinimalRowHeight( cbRowInfo* pRow ); | |
899 | ||
900 | // given row height includes height of row handles, if present | |
901 | void SetRowHeight( cbRowInfo* pRow, int newHeight ); | |
902 | ||
903 | void DoInsertBar( cbBarInfo* pBar, int rowNo ); | |
904 | ||
905 | public: /* protected really (accessed only by plugins) */ | |
906 | ||
907 | // methods for incramental on-screen refreshing of the pane | |
908 | // (simply, they are wrappers around corresponding plugin-events) | |
909 | ||
910 | virtual void PaintBarDecorations( cbBarInfo* pBar, wxDC& dc ); | |
911 | virtual void PaintBarHandles( cbBarInfo* pBar, wxDC& dc ); | |
912 | virtual void PaintBar( cbBarInfo* pBar, wxDC& dc ); | |
913 | virtual void PaintRowHandles( cbRowInfo* pRow, wxDC& dc ); | |
914 | virtual void PaintRowBackground ( cbRowInfo* pRow, wxDC& dc ); | |
915 | virtual void PaintRowDecorations( cbRowInfo* pRow, wxDC& dc ); | |
916 | virtual void PaintRow( cbRowInfo* pRow, wxDC& dc ); | |
917 | virtual void PaintPaneBackground( wxDC& dc ); | |
918 | virtual void PaintPaneDecorations( wxDC& dc ); | |
919 | virtual void PaintPane( wxDC& dc ); | |
920 | virtual void SizeBar( cbBarInfo* pBar ); | |
921 | virtual void SizeRowObjects( cbRowInfo* pRow ); | |
922 | virtual void SizePaneObjects(); | |
923 | ||
924 | virtual wxDC* StartDrawInArea ( const wxRect& area ); | |
925 | virtual void FinishDrawInArea( const wxRect& area ); | |
926 | ||
927 | public: /* public members */ | |
928 | ||
929 | cbDockPane(void); | |
930 | ||
931 | cbDockPane( int alignment, wxFrameLayout* pPanel ); | |
932 | ||
933 | // sets pane's margins in frame's coordinate orientations | |
934 | void SetMargins( int top, int bottom, int left, int right ); | |
935 | ||
936 | virtual ~cbDockPane(); | |
937 | ||
938 | // does not destroys the info bar , only removes it's reference | |
939 | // from this pane | |
940 | ||
941 | virtual void RemoveBar( cbBarInfo* pBar ); | |
942 | ||
943 | // rect given in the parent frame's coordinates | |
944 | ||
945 | virtual void InsertBar( cbBarInfo* pBar, const wxRect& atRect ); | |
946 | ||
947 | // inserts bar into the given row, with dimensions and position | |
948 | // stored in pBarInfo->mBounds. Returns the node of inserted bar | |
949 | ||
950 | virtual void InsertBar( cbBarInfo* pBar, cbRowInfo* pIntoRow ); | |
951 | ||
952 | // inserts bar, sets its position according to the preferred settings | |
953 | // given in (*pBarInfo) structure | |
954 | ||
955 | virtual void InsertBar( cbBarInfo* pBarInfo ); | |
956 | ||
957 | // does not destroy the row object, only removes the corresponding | |
958 | // node from this pane | |
959 | virtual void RemoveRow( cbRowInfo* pRow ); | |
960 | ||
961 | // does not refresh the inserted row immediately, | |
962 | // if pBeforeRowNode arg. is NULL, row is appended to the end of pane's row list | |
963 | virtual void InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow ); | |
964 | ||
965 | // sets pane's width in pane's coordinates (including margins) | |
966 | void SetPaneWidth(int width); | |
967 | ||
968 | // set the position and dims. of the pane in parent frame's coordinates | |
969 | void SetBoundsInParent( const wxRect& rect ); | |
970 | ||
971 | inline wxRect& GetRealRect() { return mBoundsInParent; } | |
972 | ||
973 | // used by updates-managers | |
974 | inline RowArrayT& GetRowList() { return mRows; } | |
975 | ||
976 | // convenience method | |
977 | ||
978 | inline cbRowInfo* GetFirstRow() | |
979 | ||
980 | { return mRows.GetCount() ? mRows[0] : NULL; } | |
981 | ||
982 | // TRUE, if the given bar node presents in this pane | |
983 | ||
984 | bool BarPresent( cbBarInfo* pBar ); | |
985 | ||
986 | // retuns height, in pane's coordinates | |
987 | int GetPaneHeight(); | |
988 | ||
989 | int GetAlignment(); | |
990 | ||
991 | bool MatchesMask( int paneMask ); | |
992 | ||
993 | inline bool IsHorizontal() | |
994 | { | |
995 | return (mAlignment == FL_ALIGN_TOP || | |
996 | mAlignment == FL_ALIGN_BOTTOM ); | |
997 | } | |
998 | ||
999 | virtual void RecalcLayout(); | |
1000 | ||
1001 | virtual int GetDockingState(); | |
1002 | ||
1003 | // returns result of hit-testing items in the pane, | |
1004 | // see CB_HITTEST_RESULTS enumeration | |
1005 | ||
1006 | virtual int HitTestPaneItems( const wxPoint& pos, // position in pane's coordinates | |
1007 | cbRowInfo** ppRow, | |
1008 | cbBarInfo** ppBar | |
1009 | ); | |
1010 | ||
1011 | void GetBarResizeRange( cbBarInfo* pBar, int* from, int *till, bool forLeftHandle ); | |
1012 | void GetRowResizeRange( cbRowInfo* pRow, int* from, int* till, bool forUpperHandle ); | |
1013 | ||
1014 | cbBarInfo* GetBarInfoByWindow( wxWindow* pBarWnd ); | |
1015 | ||
1016 | public: /* protected really (accessed only by plugins) */ | |
1017 | ||
1018 | // row/bar resizing related helper-methods | |
1019 | ||
1020 | void DrawVertHandle ( wxDC& dc, int x, int y, int height ); | |
1021 | void DrawHorizHandle( wxDC& dc, int x, int y, int width ); | |
1022 | ||
1023 | void ResizeRow( cbRowInfo* pRow, int ofs, bool forUpperHandle ); | |
1024 | void ResizeBar( cbBarInfo* pBar, int ofs, bool forLeftHandle ); | |
1025 | ||
1026 | // cbBarShapeData objects will be placed to given pLst (see comments on cbBarShapeData) | |
1027 | ||
1028 | void GetRowShapeData( cbRowInfo* pRow, wxList* pLst ); | |
1029 | ||
1030 | // sets the shape to the given row, using the data provided in pLst | |
1031 | void SetRowShapeData( cbRowInfo* pRowNode, wxList* pLst ); | |
1032 | }; | |
1033 | ||
1034 | /* | |
1035 | * class declares abstract interface for optimized logic, which should refresh | |
1036 | * areas of frame layout - that actually need to be updated. Should be extended, | |
1037 | * to implement custom updating strategy | |
1038 | */ | |
1039 | ||
1040 | class cbUpdatesManagerBase : public wxObject | |
1041 | { | |
1042 | DECLARE_ABSTRACT_CLASS( cbUpdatesManagerBase ) | |
1043 | ||
1044 | public: /* protected really, accessed by serializer (if any) */ | |
1045 | ||
1046 | wxFrameLayout* mpLayout; | |
1047 | ||
1048 | public: | |
1049 | cbUpdatesManagerBase(void) | |
1050 | : mpLayout( 0 ) {} | |
1051 | ||
1052 | cbUpdatesManagerBase( wxFrameLayout* pPanel ) | |
1053 | : mpLayout( pPanel ) {} | |
1054 | ||
1055 | void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; } | |
1056 | ||
1057 | // notificiactions received from frame-layout (in the order, in which | |
1058 | // they usually would be invoked). Custom updates-managers may utilize | |
1059 | // these notifications to implement more "fine-grained" updating strategy | |
1060 | ||
1061 | virtual void OnStartChanges() = 0; | |
1062 | ||
1063 | virtual void OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane ) {} | |
1064 | virtual void OnBarWillChange( cbBarInfo* pBar, cbRowInfo* pInRow, cbDockPane* pInPane ) {} | |
1065 | virtual void OnPaneMarginsWillChange( cbDockPane* pPane ) {} | |
1066 | virtual void OnPaneWillChange( cbDockPane* pPane ) {} | |
1067 | ||
1068 | virtual void OnFinishChanges() {} | |
1069 | ||
1070 | // refreshes parts of the frame layout, which need an update | |
1071 | virtual void UpdateNow() = 0; | |
1072 | }; | |
1073 | ||
1074 | /*------------------------------------------------------------ | |
1075 | * "API" for developing custom plugins of Frame Layout Engine | |
1076 | * TODO:: documentation | |
1077 | *------------------------------------------------------------ | |
1078 | */ | |
1079 | ||
1080 | // base class for all control-bar plugin events | |
1081 | ||
1082 | class cbPluginEvent : public wxEvent | |
1083 | { | |
1084 | // NOTE:: plugin-event does not need to be a dynamic class | |
1085 | ||
1086 | public: | |
1087 | cbDockPane* mpPane; // NULL, if event is not addressed to any specific pane | |
1088 | ||
1089 | /* OLD STUFF:: | |
1090 | // FOR NOW FOR NOW:: all-in-one plugin event structure | |
1091 | wxNode* mpObjNode; | |
1092 | wxNode* mpObjNodeAux; | |
1093 | wxPoint mPos; | |
1094 | wxSize mSize; | |
1095 | wxDC* mpDC; | |
1096 | bool mAuxBoolVal; | |
1097 | */ | |
1098 | ||
1099 | #if wxCHECK_VERSION(2,3,0) | |
1100 | cbPluginEvent( wxEventType eventType, cbDockPane* pPane ) | |
1101 | : mpPane( pPane ) | |
1102 | ||
1103 | { m_eventType = eventType; } | |
1104 | #else | |
1105 | cbPluginEvent( int eventType, cbDockPane* pPane ) | |
1106 | : mpPane( pPane ) | |
1107 | ||
1108 | { m_eventType = eventType; } | |
1109 | #endif | |
1110 | }; | |
1111 | ||
1112 | // event types handled by plugins | |
1113 | ||
1114 | #if wxCHECK_VERSION(2,3,0) | |
1115 | ||
1116 | extern wxEventType cbEVT_PL_LEFT_DOWN; | |
1117 | extern wxEventType cbEVT_PL_LEFT_UP; | |
1118 | extern wxEventType cbEVT_PL_RIGHT_DOWN; | |
1119 | extern wxEventType cbEVT_PL_RIGHT_UP; | |
1120 | extern wxEventType cbEVT_PL_MOTION; | |
1121 | ||
1122 | extern wxEventType cbEVT_PL_LEFT_DCLICK; | |
1123 | ||
1124 | extern wxEventType cbEVT_PL_LAYOUT_ROW; | |
1125 | extern wxEventType cbEVT_PL_RESIZE_ROW; | |
1126 | extern wxEventType cbEVT_PL_LAYOUT_ROWS; | |
1127 | extern wxEventType cbEVT_PL_INSERT_BAR; | |
1128 | extern wxEventType cbEVT_PL_RESIZE_BAR; | |
1129 | extern wxEventType cbEVT_PL_REMOVE_BAR; | |
1130 | extern wxEventType cbEVT_PL_SIZE_BAR_WND; | |
1131 | ||
1132 | extern wxEventType cbEVT_PL_DRAW_BAR_DECOR; | |
1133 | extern wxEventType cbEVT_PL_DRAW_ROW_DECOR; | |
1134 | extern wxEventType cbEVT_PL_DRAW_PANE_DECOR; | |
1135 | extern wxEventType cbEVT_PL_DRAW_BAR_HANDLES; | |
1136 | extern wxEventType cbEVT_PL_DRAW_ROW_HANDLES; | |
1137 | extern wxEventType cbEVT_PL_DRAW_ROW_BKGROUND; | |
1138 | extern wxEventType cbEVT_PL_DRAW_PANE_BKGROUND; | |
1139 | ||
1140 | extern wxEventType cbEVT_PL_START_BAR_DRAGGING; | |
1141 | extern wxEventType cbEVT_PL_DRAW_HINT_RECT; | |
1142 | ||
1143 | extern wxEventType cbEVT_PL_START_DRAW_IN_AREA; | |
1144 | extern wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA; | |
1145 | ||
1146 | extern wxEventType cbEVT_PL_CUSTOMIZE_BAR; | |
1147 | extern wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT; | |
1148 | ||
1149 | extern wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT; | |
1150 | ||
1151 | #else | |
1152 | ||
1153 | #define cbEVT_PL_LEFT_DOWN 0 | |
1154 | #define cbEVT_PL_LEFT_UP 1 | |
1155 | #define cbEVT_PL_RIGHT_DOWN 2 | |
1156 | #define cbEVT_PL_RIGHT_UP 3 | |
1157 | #define cbEVT_PL_MOTION 4 | |
1158 | ||
1159 | #define cbEVT_PL_LEFT_DCLICK 5 | |
1160 | ||
1161 | #define cbEVT_PL_LAYOUT_ROW 6 | |
1162 | #define cbEVT_PL_RESIZE_ROW 7 | |
1163 | #define cbEVT_PL_LAYOUT_ROWS 8 | |
1164 | #define cbEVT_PL_INSERT_BAR 9 | |
1165 | #define cbEVT_PL_RESIZE_BAR 10 | |
1166 | #define cbEVT_PL_REMOVE_BAR 11 | |
1167 | #define cbEVT_PL_SIZE_BAR_WND 12 | |
1168 | ||
1169 | #define cbEVT_PL_DRAW_BAR_DECOR 13 | |
1170 | #define cbEVT_PL_DRAW_ROW_DECOR 14 | |
1171 | #define cbEVT_PL_DRAW_PANE_DECOR 15 | |
1172 | #define cbEVT_PL_DRAW_BAR_HANDLES 16 | |
1173 | #define cbEVT_PL_DRAW_ROW_HANDLES 17 | |
1174 | #define cbEVT_PL_DRAW_ROW_BKGROUND 18 | |
1175 | #define cbEVT_PL_DRAW_PANE_BKGROUND 19 | |
1176 | ||
1177 | #define cbEVT_PL_START_BAR_DRAGGING 20 | |
1178 | #define cbEVT_PL_DRAW_HINT_RECT 21 | |
1179 | ||
1180 | #define cbEVT_PL_START_DRAW_IN_AREA 22 | |
1181 | #define cbEVT_PL_FINISH_DRAW_IN_AREA 23 | |
1182 | ||
1183 | #define cbEVT_PL_CUSTOMIZE_BAR 24 | |
1184 | #define cbEVT_PL_CUSTOMIZE_LAYOUT 25 | |
1185 | ||
1186 | #define wxCUSTOM_CB_PLUGIN_EVENTS_START_AT 100 | |
1187 | ||
1188 | #endif // wxCHECK_VERSION(2,3,0) else | |
1189 | ||
1190 | // forward decls, separated by categories | |
1191 | ||
1192 | class cbLeftDownEvent; | |
1193 | class cbLeftUpEvent; | |
1194 | class cbRightDownEvent; | |
1195 | class cbRightUpEvent; | |
1196 | class cbMotionEvent; | |
1197 | class cbLeftDClickEvent; | |
1198 | ||
1199 | class cbLayoutRowEvent; | |
1200 | class cbResizeRowEvent; | |
1201 | class cbLayoutRowsEvent; | |
1202 | class cbInsertBarEvent; | |
1203 | class cbResizeBarEvent; | |
1204 | class cbRemoveBarEvent; | |
1205 | class cbSizeBarWndEvent; | |
1206 | ||
1207 | class cbDrawBarDecorEvent; | |
1208 | class cbDrawRowDecorEvent; | |
1209 | class cbDrawPaneDecorEvent; | |
1210 | class cbDrawBarHandlesEvent; | |
1211 | class cbDrawRowHandlesEvent; | |
1212 | class cbDrawRowBkGroundEvent; | |
1213 | class cbDrawPaneBkGroundEvent; | |
1214 | ||
1215 | class cbStartBarDraggingEvent; | |
1216 | class cbDrawHintRectEvent; | |
1217 | ||
1218 | class cbStartDrawInAreaEvent; | |
1219 | class cbFinishDrawInAreaEvent; | |
1220 | ||
1221 | class cbCustomizeBarEvent; | |
1222 | class cbCustomizeLayoutEvent; | |
1223 | ||
1224 | // defs. for handler-methods | |
1225 | ||
1226 | typedef void (wxEvtHandler::*cbLeftDownHandler )(cbLeftDownEvent&); | |
1227 | typedef void (wxEvtHandler::*cbLeftUpHandler )(cbLeftUpEvent&); | |
1228 | typedef void (wxEvtHandler::*cbRightDownHandler )(cbRightDownEvent&); | |
1229 | typedef void (wxEvtHandler::*cbRightUpHandler )(cbRightUpEvent&); | |
1230 | typedef void (wxEvtHandler::*cbMotionHandler )(cbMotionEvent&); | |
1231 | typedef void (wxEvtHandler::*cbLeftDClickHandler )(cbLeftDClickEvent&); | |
1232 | ||
1233 | typedef void (wxEvtHandler::*cbLayoutRowHandler )(cbLayoutRowEvent&); | |
1234 | typedef void (wxEvtHandler::*cbResizeRowHandler )(cbResizeRowEvent&); | |
1235 | typedef void (wxEvtHandler::*cbLayoutRowsHandler )(cbLayoutRowsEvent&); | |
1236 | typedef void (wxEvtHandler::*cbInsertBarHandler )(cbInsertBarEvent&); | |
1237 | typedef void (wxEvtHandler::*cbResizeBarHandler )(cbResizeBarEvent&); | |
1238 | typedef void (wxEvtHandler::*cbRemoveBarHandler )(cbRemoveBarEvent&); | |
1239 | typedef void (wxEvtHandler::*cbSizeBarWndHandler )(cbSizeBarWndEvent&); | |
1240 | ||
1241 | typedef void (wxEvtHandler::*cbDrawBarDecorHandler )(cbDrawBarDecorEvent&); | |
1242 | typedef void (wxEvtHandler::*cbDrawRowDecorHandler )(cbDrawRowDecorEvent&); | |
1243 | typedef void (wxEvtHandler::*cbDrawPaneDecorHandler )(cbDrawPaneDecorEvent&); | |
1244 | typedef void (wxEvtHandler::*cbDrawBarHandlesHandler )(cbDrawBarHandlesEvent&); | |
1245 | typedef void (wxEvtHandler::*cbDrawRowHandlesHandler )(cbDrawRowHandlesEvent&); | |
1246 | typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler )(cbDrawRowBkGroundEvent&); | |
1247 | typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler)(cbDrawPaneBkGroundEvent&); | |
1248 | ||
1249 | typedef void (wxEvtHandler::*cbStartBarDraggingHandler )(cbStartBarDraggingEvent&); | |
1250 | typedef void (wxEvtHandler::*cbDrawHintRectHandler )(cbDrawHintRectEvent&); | |
1251 | ||
1252 | typedef void (wxEvtHandler::*cbStartDrawInAreaHandler )(cbStartDrawInAreaEvent&); | |
1253 | typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler)(cbFinishDrawInAreaEvent&); | |
1254 | ||
1255 | typedef void (wxEvtHandler::*cbCustomizeBarHandler )(cbCustomizeBarEvent&); | |
1256 | typedef void (wxEvtHandler::*cbCustomizeLayoutHandler )(cbCustomizeLayoutEvent&); | |
1257 | ||
1258 | // macros for creating event table entries for plugin-events | |
1259 | ||
1260 | #if wxCHECK_VERSION(2,3,0) | |
1261 | #define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ), | |
1262 | #define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ), | |
1263 | #define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ), | |
1264 | #define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ), | |
1265 | #define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ), | |
1266 | #define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ), | |
1267 | ||
1268 | #define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ), | |
1269 | #define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ), | |
1270 | #define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ), | |
1271 | #define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ), | |
1272 | #define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ), | |
1273 | #define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ), | |
1274 | #define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ), | |
1275 | ||
1276 | #define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ), | |
1277 | #define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ), | |
1278 | #define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ), | |
1279 | #define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ), | |
1280 | #define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ), | |
1281 | #define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ), | |
1282 | #define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ), | |
1283 | ||
1284 | #define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ), | |
1285 | #define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ), | |
1286 | ||
1287 | ||
1288 | #define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ), | |
1289 | #define EVT_PL_FINISH_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func, (wxObject *) NULL ), | |
1290 | ||
1291 | #define EVT_PL_CUSTOMIZE_BAR(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func, (wxObject *) NULL ), | |
1292 | #define EVT_PL_CUSTOMIZE_LAYOUT(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func, (wxObject *) NULL ), | |
1293 | #else | |
1294 | #define EVT_PL_LEFT_DOWN(func) { cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func }, | |
1295 | #define EVT_PL_LEFT_UP(func) { cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func }, | |
1296 | #define EVT_PL_RIGHT_DOWN(func) { cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func }, | |
1297 | #define EVT_PL_RIGHT_UP(func) { cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func }, | |
1298 | #define EVT_PL_MOTION(func) { cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func }, | |
1299 | #define EVT_PL_LEFT_DCLICK(func) { cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func }, | |
1300 | ||
1301 | #define EVT_PL_LAYOUT_ROW(func) { cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func }, | |
1302 | #define EVT_PL_RESIZE_ROW(func) { cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func }, | |
1303 | #define EVT_PL_LAYOUT_ROWS(func) { cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func }, | |
1304 | #define EVT_PL_INSERT_BAR(func) { cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func }, | |
1305 | #define EVT_PL_RESIZE_BAR(func) { cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func }, | |
1306 | #define EVT_PL_REMOVE_BAR(func) { cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func }, | |
1307 | #define EVT_PL_SIZE_BAR_WND(func) { cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func }, | |
1308 | ||
1309 | #define EVT_PL_DRAW_BAR_DECOR(func) { cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func }, | |
1310 | #define EVT_PL_DRAW_ROW_DECOR(func) { cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func }, | |
1311 | #define EVT_PL_DRAW_PANE_DECOR(func) { cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func }, | |
1312 | #define EVT_PL_DRAW_BAR_HANDLES(func) { cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func }, | |
1313 | #define EVT_PL_DRAW_ROW_HANDLES(func) { cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func }, | |
1314 | #define EVT_PL_DRAW_ROW_BKGROUND(func) { cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func }, | |
1315 | #define EVT_PL_DRAW_PANE_BKGROUND(func) { cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func }, | |
1316 | ||
1317 | #define EVT_PL_START_BAR_DRAGGING(func) { cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func }, | |
1318 | #define EVT_PL_DRAW_HINT_RECT(func) { cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func }, | |
1319 | ||
1320 | #define EVT_PL_START_DRAW_IN_AREA(func) { cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func }, | |
1321 | #define EVT_PL_FINISH_DRAW_IN_AREA(func) { cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func }, | |
1322 | ||
1323 | #define EVT_PL_CUSTOMIZE_BAR(func) { cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func }, | |
1324 | #define EVT_PL_CUSTOMIZE_LAYOUT(func) { cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func }, | |
1325 | #endif | |
1326 | /* | |
1327 | * abstract base class for all control-bar related plugins | |
1328 | */ | |
1329 | ||
1330 | class cbPluginBase : public wxEvtHandler | |
1331 | { | |
1332 | DECLARE_ABSTRACT_CLASS( cbPluginBase ) | |
1333 | public: | |
1334 | ||
1335 | wxFrameLayout* mpLayout; // back-reference to the frame layout | |
1336 | ||
1337 | // specifies panes, for which this plugin receives events | |
1338 | // (see pane masks definitions) | |
1339 | int mPaneMask; | |
1340 | ||
1341 | bool mIsReady; // is TRUE, when plugin is ready to handle events | |
1342 | ||
1343 | public: | |
1344 | cbPluginBase(void) | |
1345 | ||
1346 | : mpLayout ( 0 ), | |
1347 | mPaneMask( wxALL_PANES ), | |
1348 | mIsReady ( FALSE ) | |
1349 | {} | |
1350 | ||
1351 | cbPluginBase( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ) | |
1352 | ||
1353 | : mpLayout ( pPanel ), | |
1354 | mPaneMask( paneMask ), | |
1355 | mIsReady ( FALSE ) | |
1356 | {} | |
1357 | ||
1358 | inline int GetPaneMask() { return mPaneMask; } | |
1359 | ||
1360 | // NOTE:: pointer positions of mouse-events sent to plugins | |
1361 | // are always in pane's coordinates (pane's to which | |
1362 | // this plugin is hooked) | |
1363 | ||
1364 | // destroys the whole plugin chain of connected plagins | |
1365 | virtual ~cbPluginBase(); | |
1366 | ||
1367 | // override this method to do plugin-specific initialization | |
1368 | // (at this point plugin is already attached to the frame layout, | |
1369 | // and pane masks are set) | |
1370 | virtual void OnInitPlugin() { mIsReady = TRUE; } | |
1371 | ||
1372 | bool IsReady() { return mIsReady; } | |
1373 | ||
1374 | // overriden, to determine whether the target pane specified in the | |
1375 | // event, matches the pane mask of this plugin (specific plugins | |
1376 | // do not override this method) | |
1377 | ||
1378 | virtual bool ProcessEvent(wxEvent& event); | |
1379 | }; | |
1380 | ||
1381 | /*** event classes, for each corresponding event type (24 currnetly...uhh) ***/ | |
1382 | ||
1383 | // mouse-events category | |
1384 | ||
1385 | class cbLeftDownEvent : public cbPluginEvent | |
1386 | { | |
1387 | public: | |
1388 | wxPoint mPos; | |
1389 | ||
1390 | cbLeftDownEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1391 | ||
1392 | : cbPluginEvent( cbEVT_PL_LEFT_DOWN, pPane ), | |
1393 | mPos( pos ) | |
1394 | {} | |
1395 | }; | |
1396 | ||
1397 | class cbLeftUpEvent : public cbPluginEvent | |
1398 | { | |
1399 | public: | |
1400 | wxPoint mPos; | |
1401 | ||
1402 | cbLeftUpEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1403 | ||
1404 | : cbPluginEvent( cbEVT_PL_LEFT_UP, pPane ), | |
1405 | mPos( pos ) | |
1406 | {} | |
1407 | }; | |
1408 | ||
1409 | class cbRightDownEvent : public cbPluginEvent | |
1410 | { | |
1411 | public: | |
1412 | wxPoint mPos; | |
1413 | ||
1414 | cbRightDownEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1415 | ||
1416 | : cbPluginEvent( cbEVT_PL_RIGHT_DOWN, pPane ), | |
1417 | mPos( pos ) | |
1418 | {} | |
1419 | }; | |
1420 | ||
1421 | class cbRightUpEvent : public cbPluginEvent | |
1422 | { | |
1423 | public: | |
1424 | wxPoint mPos; | |
1425 | ||
1426 | cbRightUpEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1427 | ||
1428 | : cbPluginEvent( cbEVT_PL_RIGHT_UP, pPane ), | |
1429 | mPos( pos ) | |
1430 | {} | |
1431 | }; | |
1432 | ||
1433 | class cbMotionEvent : public cbPluginEvent | |
1434 | { | |
1435 | public: | |
1436 | wxPoint mPos; | |
1437 | ||
1438 | cbMotionEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1439 | ||
1440 | : cbPluginEvent( cbEVT_PL_MOTION, pPane ), | |
1441 | mPos( pos ) | |
1442 | {} | |
1443 | }; | |
1444 | ||
1445 | class cbLeftDClickEvent : public cbPluginEvent | |
1446 | { | |
1447 | public: | |
1448 | wxPoint mPos; | |
1449 | ||
1450 | cbLeftDClickEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1451 | ||
1452 | : cbPluginEvent( cbEVT_PL_LEFT_DCLICK, pPane ), | |
1453 | mPos( pos ) | |
1454 | {} | |
1455 | }; | |
1456 | ||
1457 | // bar/row events category | |
1458 | ||
1459 | class cbLayoutRowEvent : public cbPluginEvent | |
1460 | { | |
1461 | public: | |
1462 | cbRowInfo* mpRow; | |
1463 | ||
1464 | cbLayoutRowEvent( cbRowInfo* pRow, cbDockPane* pPane ) | |
1465 | ||
1466 | : cbPluginEvent( cbEVT_PL_LAYOUT_ROW, pPane ), | |
1467 | mpRow( pRow ) | |
1468 | {} | |
1469 | }; | |
1470 | ||
1471 | class cbResizeRowEvent : public cbPluginEvent | |
1472 | { | |
1473 | public: | |
1474 | cbRowInfo* mpRow; | |
1475 | int mHandleOfs; | |
1476 | bool mForUpperHandle; | |
1477 | ||
1478 | cbResizeRowEvent( cbRowInfo* pRow, int handleOfs, bool forUpperHandle, cbDockPane* pPane ) | |
1479 | ||
1480 | : cbPluginEvent( cbEVT_PL_RESIZE_ROW, pPane ), | |
1481 | mpRow( pRow ), | |
1482 | mHandleOfs( handleOfs ), | |
1483 | mForUpperHandle( forUpperHandle ) | |
1484 | {} | |
1485 | }; | |
1486 | ||
1487 | class cbLayoutRowsEvent : public cbPluginEvent | |
1488 | { | |
1489 | public: | |
1490 | ||
1491 | cbLayoutRowsEvent( cbDockPane* pPane ) | |
1492 | ||
1493 | : cbPluginEvent( cbEVT_PL_LAYOUT_ROWS, pPane ) | |
1494 | {} | |
1495 | }; | |
1496 | ||
1497 | class cbInsertBarEvent : public cbPluginEvent | |
1498 | { | |
1499 | public: | |
1500 | cbBarInfo* mpBar; | |
1501 | cbRowInfo* mpRow; | |
1502 | ||
1503 | cbInsertBarEvent( cbBarInfo* pBar, cbRowInfo* pIntoRow, cbDockPane* pPane ) | |
1504 | ||
1505 | : cbPluginEvent( cbEVT_PL_INSERT_BAR, pPane ), | |
1506 | ||
1507 | mpBar( pBar ), | |
1508 | mpRow( pIntoRow ) | |
1509 | {} | |
1510 | }; | |
1511 | ||
1512 | class cbResizeBarEvent : public cbPluginEvent | |
1513 | { | |
1514 | public: | |
1515 | cbBarInfo* mpBar; | |
1516 | cbRowInfo* mpRow; | |
1517 | ||
1518 | cbResizeBarEvent( cbBarInfo* pBar, cbRowInfo* pRow, cbDockPane* pPane ) | |
1519 | ||
1520 | : cbPluginEvent( cbEVT_PL_RESIZE_BAR, pPane ), | |
1521 | mpBar( pBar ), | |
1522 | mpRow( pRow ) | |
1523 | {} | |
1524 | }; | |
1525 | ||
1526 | class cbRemoveBarEvent : public cbPluginEvent | |
1527 | { | |
1528 | public: | |
1529 | cbBarInfo* mpBar; | |
1530 | ||
1531 | cbRemoveBarEvent( cbBarInfo* pBar, cbDockPane* pPane ) | |
1532 | ||
1533 | : cbPluginEvent( cbEVT_PL_REMOVE_BAR, pPane ), | |
1534 | mpBar( pBar ) | |
1535 | {} | |
1536 | }; | |
1537 | ||
1538 | class cbSizeBarWndEvent : public cbPluginEvent | |
1539 | { | |
1540 | public: | |
1541 | cbBarInfo* mpBar; | |
1542 | wxRect mBoundsInParent; | |
1543 | ||
1544 | cbSizeBarWndEvent( cbBarInfo* pBar, cbDockPane* pPane ) | |
1545 | ||
1546 | : cbPluginEvent( cbEVT_PL_SIZE_BAR_WND, pPane ), | |
1547 | mpBar( pBar ), | |
1548 | mBoundsInParent( pBar->mBoundsInParent ) | |
1549 | {} | |
1550 | }; | |
1551 | ||
1552 | class cbDrawBarDecorEvent : public cbPluginEvent | |
1553 | { | |
1554 | public: | |
1555 | cbBarInfo* mpBar; | |
1556 | wxDC* mpDc; | |
1557 | wxRect mBoundsInParent; | |
1558 | ||
1559 | cbDrawBarDecorEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane ) | |
1560 | ||
1561 | : cbPluginEvent( cbEVT_PL_DRAW_BAR_DECOR, pPane ), | |
1562 | mpBar( pBar ), | |
1563 | mpDc( &dc ), | |
1564 | mBoundsInParent( pBar->mBoundsInParent ) | |
1565 | {} | |
1566 | }; | |
1567 | ||
1568 | class cbDrawRowDecorEvent : public cbPluginEvent | |
1569 | { | |
1570 | public: | |
1571 | cbRowInfo* mpRow; | |
1572 | wxDC* mpDc; | |
1573 | ||
1574 | cbDrawRowDecorEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1575 | ||
1576 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_DECOR, pPane ), | |
1577 | mpRow( pRow ), | |
1578 | mpDc( &dc ) | |
1579 | {} | |
1580 | }; | |
1581 | ||
1582 | class cbDrawPaneDecorEvent : public cbPluginEvent | |
1583 | { | |
1584 | public: | |
1585 | wxDC* mpDc; | |
1586 | ||
1587 | cbDrawPaneDecorEvent( wxDC& dc, cbDockPane* pPane ) | |
1588 | ||
1589 | : cbPluginEvent( cbEVT_PL_DRAW_PANE_DECOR, pPane ), | |
1590 | mpDc( &dc ) | |
1591 | {} | |
1592 | }; | |
1593 | ||
1594 | class cbDrawBarHandlesEvent : public cbPluginEvent | |
1595 | { | |
1596 | public: | |
1597 | cbBarInfo* mpBar; | |
1598 | wxDC* mpDc; | |
1599 | ||
1600 | cbDrawBarHandlesEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane ) | |
1601 | ||
1602 | : cbPluginEvent( cbEVT_PL_DRAW_BAR_HANDLES, pPane ), | |
1603 | mpBar( pBar ), | |
1604 | mpDc( &dc ) | |
1605 | {} | |
1606 | }; | |
1607 | ||
1608 | class cbDrawRowHandlesEvent : public cbPluginEvent | |
1609 | { | |
1610 | public: | |
1611 | cbRowInfo* mpRow; | |
1612 | wxDC* mpDc; | |
1613 | ||
1614 | cbDrawRowHandlesEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1615 | ||
1616 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_HANDLES, pPane ), | |
1617 | mpRow( pRow ), | |
1618 | mpDc( &dc ) | |
1619 | {} | |
1620 | }; | |
1621 | ||
1622 | class cbDrawRowBkGroundEvent : public cbPluginEvent | |
1623 | { | |
1624 | public: | |
1625 | cbRowInfo* mpRow; | |
1626 | wxDC* mpDc; | |
1627 | ||
1628 | cbDrawRowBkGroundEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1629 | ||
1630 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_BKGROUND, pPane ), | |
1631 | mpRow( pRow ), | |
1632 | mpDc( &dc ) | |
1633 | {} | |
1634 | }; | |
1635 | ||
1636 | class cbDrawPaneBkGroundEvent : public cbPluginEvent | |
1637 | { | |
1638 | public: | |
1639 | wxDC* mpDc; | |
1640 | ||
1641 | cbDrawPaneBkGroundEvent( wxDC& dc, cbDockPane* pPane ) | |
1642 | ||
1643 | : cbPluginEvent( cbEVT_PL_DRAW_PANE_BKGROUND, pPane ), | |
1644 | mpDc( &dc ) | |
1645 | {} | |
1646 | }; | |
1647 | ||
1648 | class cbStartBarDraggingEvent : public cbPluginEvent | |
1649 | { | |
1650 | public: | |
1651 | cbBarInfo* mpBar; | |
1652 | wxPoint mPos; // is given in frame's coordinates | |
1653 | ||
1654 | cbStartBarDraggingEvent( cbBarInfo* pBar, const wxPoint& pos, cbDockPane* pPane ) | |
1655 | ||
1656 | : cbPluginEvent( cbEVT_PL_START_BAR_DRAGGING, pPane ), | |
1657 | mpBar( pBar ), | |
1658 | mPos( pos ) | |
1659 | {} | |
1660 | }; | |
1661 | ||
1662 | class cbDrawHintRectEvent : public cbPluginEvent | |
1663 | { | |
1664 | public: | |
1665 | wxRect mRect; // is given in frame's coordinates | |
1666 | ||
1667 | ||
1668 | bool mLastTime; // indicates that this event finishes "session" of on-screen drawing, | |
1669 | // thus associated resources can be freed now | |
1670 | bool mEraseRect; // does not have any impact, if recangle is drawn using XOR-mask | |
1671 | ||
1672 | bool mIsInClient;// in cleint area hint could be drawn differently, | |
1673 | // e.g. with fat/hatched border | |
1674 | ||
1675 | ||
1676 | cbDrawHintRectEvent( const wxRect& rect, bool isInClient, bool eraseRect, bool lastTime ) | |
1677 | ||
1678 | : cbPluginEvent( cbEVT_PL_DRAW_HINT_RECT, 0 ), | |
1679 | mRect ( rect ), | |
1680 | mLastTime ( lastTime ), | |
1681 | mEraseRect ( eraseRect ), | |
1682 | mIsInClient( isInClient ) | |
1683 | {} | |
1684 | }; | |
1685 | ||
1686 | class cbStartDrawInAreaEvent : public cbPluginEvent | |
1687 | { | |
1688 | public: | |
1689 | wxRect mArea; | |
1690 | wxDC** mppDc; // points to pointer, where the reference | |
1691 | // to the obtained buffer-context should be placed | |
1692 | ||
1693 | cbStartDrawInAreaEvent( const wxRect& area, wxDC** ppDCForArea, cbDockPane* pPane ) | |
1694 | ||
1695 | : cbPluginEvent( cbEVT_PL_START_DRAW_IN_AREA, pPane ), | |
1696 | mArea( area ), | |
1697 | mppDc( ppDCForArea ) | |
1698 | {} | |
1699 | }; | |
1700 | ||
1701 | class cbFinishDrawInAreaEvent : public cbPluginEvent | |
1702 | { | |
1703 | public: | |
1704 | wxRect mArea; | |
1705 | ||
1706 | cbFinishDrawInAreaEvent( const wxRect& area, cbDockPane* pPane ) | |
1707 | ||
1708 | : cbPluginEvent( cbEVT_PL_FINISH_DRAW_IN_AREA, pPane ), | |
1709 | mArea( area ) | |
1710 | {} | |
1711 | }; | |
1712 | ||
1713 | class cbCustomizeBarEvent : public cbPluginEvent | |
1714 | { | |
1715 | public: | |
1716 | wxPoint mClickPos; // in parent frame's coordinates | |
1717 | cbBarInfo* mpBar; | |
1718 | ||
1719 | cbCustomizeBarEvent( cbBarInfo* pBar, const wxPoint& clickPos, cbDockPane* pPane ) | |
1720 | ||
1721 | : cbPluginEvent( cbEVT_PL_CUSTOMIZE_BAR, pPane ), | |
1722 | mClickPos( clickPos ), | |
1723 | mpBar( pBar ) | |
1724 | {} | |
1725 | }; | |
1726 | ||
1727 | class cbCustomizeLayoutEvent : public cbPluginEvent | |
1728 | { | |
1729 | public: | |
1730 | wxPoint mClickPos; // in parent frame's coordinates | |
1731 | ||
1732 | cbCustomizeLayoutEvent( const wxPoint& clickPos ) | |
1733 | ||
1734 | : cbPluginEvent( cbEVT_PL_CUSTOMIZE_LAYOUT, 0 ), | |
1735 | mClickPos( clickPos ) | |
1736 | {} | |
1737 | }; | |
1738 | ||
1739 | #endif /* __CONTROLBAR_G__ */ | |
1740 |