]>
Commit | Line | Data |
---|---|---|
8e08b761 JS |
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 | ||
0ad0dc57 GD |
1055 | virtual ~cbUpdatesManagerBase() {} |
1056 | ||
8e08b761 JS |
1057 | void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; } |
1058 | ||
1059 | // notificiactions received from frame-layout (in the order, in which | |
1060 | // they usually would be invoked). Custom updates-managers may utilize | |
1061 | // these notifications to implement more "fine-grained" updating strategy | |
1062 | ||
1063 | virtual void OnStartChanges() = 0; | |
1064 | ||
1065 | virtual void OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane ) {} | |
1066 | virtual void OnBarWillChange( cbBarInfo* pBar, cbRowInfo* pInRow, cbDockPane* pInPane ) {} | |
1067 | virtual void OnPaneMarginsWillChange( cbDockPane* pPane ) {} | |
1068 | virtual void OnPaneWillChange( cbDockPane* pPane ) {} | |
1069 | ||
1070 | virtual void OnFinishChanges() {} | |
1071 | ||
1072 | // refreshes parts of the frame layout, which need an update | |
1073 | virtual void UpdateNow() = 0; | |
1074 | }; | |
1075 | ||
1076 | /*------------------------------------------------------------ | |
1077 | * "API" for developing custom plugins of Frame Layout Engine | |
1078 | * TODO:: documentation | |
1079 | *------------------------------------------------------------ | |
1080 | */ | |
1081 | ||
1082 | // base class for all control-bar plugin events | |
1083 | ||
1084 | class cbPluginEvent : public wxEvent | |
1085 | { | |
1086 | // NOTE:: plugin-event does not need to be a dynamic class | |
1087 | ||
1088 | public: | |
1089 | cbDockPane* mpPane; // NULL, if event is not addressed to any specific pane | |
1090 | ||
1091 | /* OLD STUFF:: | |
1092 | // FOR NOW FOR NOW:: all-in-one plugin event structure | |
1093 | wxNode* mpObjNode; | |
1094 | wxNode* mpObjNodeAux; | |
1095 | wxPoint mPos; | |
1096 | wxSize mSize; | |
1097 | wxDC* mpDC; | |
1098 | bool mAuxBoolVal; | |
1099 | */ | |
1100 | ||
1101 | #if wxCHECK_VERSION(2,3,0) | |
1102 | cbPluginEvent( wxEventType eventType, cbDockPane* pPane ) | |
1103 | : mpPane( pPane ) | |
1104 | ||
1105 | { m_eventType = eventType; } | |
1106 | #else | |
1107 | cbPluginEvent( int eventType, cbDockPane* pPane ) | |
1108 | : mpPane( pPane ) | |
1109 | ||
1110 | { m_eventType = eventType; } | |
1111 | #endif | |
1112 | }; | |
1113 | ||
1114 | // event types handled by plugins | |
1115 | ||
1116 | #if wxCHECK_VERSION(2,3,0) | |
1117 | ||
1118 | extern wxEventType cbEVT_PL_LEFT_DOWN; | |
1119 | extern wxEventType cbEVT_PL_LEFT_UP; | |
1120 | extern wxEventType cbEVT_PL_RIGHT_DOWN; | |
1121 | extern wxEventType cbEVT_PL_RIGHT_UP; | |
1122 | extern wxEventType cbEVT_PL_MOTION; | |
1123 | ||
1124 | extern wxEventType cbEVT_PL_LEFT_DCLICK; | |
1125 | ||
1126 | extern wxEventType cbEVT_PL_LAYOUT_ROW; | |
1127 | extern wxEventType cbEVT_PL_RESIZE_ROW; | |
1128 | extern wxEventType cbEVT_PL_LAYOUT_ROWS; | |
1129 | extern wxEventType cbEVT_PL_INSERT_BAR; | |
1130 | extern wxEventType cbEVT_PL_RESIZE_BAR; | |
1131 | extern wxEventType cbEVT_PL_REMOVE_BAR; | |
1132 | extern wxEventType cbEVT_PL_SIZE_BAR_WND; | |
1133 | ||
1134 | extern wxEventType cbEVT_PL_DRAW_BAR_DECOR; | |
1135 | extern wxEventType cbEVT_PL_DRAW_ROW_DECOR; | |
1136 | extern wxEventType cbEVT_PL_DRAW_PANE_DECOR; | |
1137 | extern wxEventType cbEVT_PL_DRAW_BAR_HANDLES; | |
1138 | extern wxEventType cbEVT_PL_DRAW_ROW_HANDLES; | |
1139 | extern wxEventType cbEVT_PL_DRAW_ROW_BKGROUND; | |
1140 | extern wxEventType cbEVT_PL_DRAW_PANE_BKGROUND; | |
1141 | ||
1142 | extern wxEventType cbEVT_PL_START_BAR_DRAGGING; | |
1143 | extern wxEventType cbEVT_PL_DRAW_HINT_RECT; | |
1144 | ||
1145 | extern wxEventType cbEVT_PL_START_DRAW_IN_AREA; | |
1146 | extern wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA; | |
1147 | ||
1148 | extern wxEventType cbEVT_PL_CUSTOMIZE_BAR; | |
1149 | extern wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT; | |
1150 | ||
1151 | extern wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT; | |
1152 | ||
1153 | #else | |
1154 | ||
1155 | #define cbEVT_PL_LEFT_DOWN 0 | |
1156 | #define cbEVT_PL_LEFT_UP 1 | |
1157 | #define cbEVT_PL_RIGHT_DOWN 2 | |
1158 | #define cbEVT_PL_RIGHT_UP 3 | |
1159 | #define cbEVT_PL_MOTION 4 | |
1160 | ||
1161 | #define cbEVT_PL_LEFT_DCLICK 5 | |
1162 | ||
1163 | #define cbEVT_PL_LAYOUT_ROW 6 | |
1164 | #define cbEVT_PL_RESIZE_ROW 7 | |
1165 | #define cbEVT_PL_LAYOUT_ROWS 8 | |
1166 | #define cbEVT_PL_INSERT_BAR 9 | |
1167 | #define cbEVT_PL_RESIZE_BAR 10 | |
1168 | #define cbEVT_PL_REMOVE_BAR 11 | |
1169 | #define cbEVT_PL_SIZE_BAR_WND 12 | |
1170 | ||
1171 | #define cbEVT_PL_DRAW_BAR_DECOR 13 | |
1172 | #define cbEVT_PL_DRAW_ROW_DECOR 14 | |
1173 | #define cbEVT_PL_DRAW_PANE_DECOR 15 | |
1174 | #define cbEVT_PL_DRAW_BAR_HANDLES 16 | |
1175 | #define cbEVT_PL_DRAW_ROW_HANDLES 17 | |
1176 | #define cbEVT_PL_DRAW_ROW_BKGROUND 18 | |
1177 | #define cbEVT_PL_DRAW_PANE_BKGROUND 19 | |
1178 | ||
1179 | #define cbEVT_PL_START_BAR_DRAGGING 20 | |
1180 | #define cbEVT_PL_DRAW_HINT_RECT 21 | |
1181 | ||
1182 | #define cbEVT_PL_START_DRAW_IN_AREA 22 | |
1183 | #define cbEVT_PL_FINISH_DRAW_IN_AREA 23 | |
1184 | ||
1185 | #define cbEVT_PL_CUSTOMIZE_BAR 24 | |
1186 | #define cbEVT_PL_CUSTOMIZE_LAYOUT 25 | |
1187 | ||
1188 | #define wxCUSTOM_CB_PLUGIN_EVENTS_START_AT 100 | |
1189 | ||
1190 | #endif // wxCHECK_VERSION(2,3,0) else | |
1191 | ||
1192 | // forward decls, separated by categories | |
1193 | ||
1194 | class cbLeftDownEvent; | |
1195 | class cbLeftUpEvent; | |
1196 | class cbRightDownEvent; | |
1197 | class cbRightUpEvent; | |
1198 | class cbMotionEvent; | |
1199 | class cbLeftDClickEvent; | |
1200 | ||
1201 | class cbLayoutRowEvent; | |
1202 | class cbResizeRowEvent; | |
1203 | class cbLayoutRowsEvent; | |
1204 | class cbInsertBarEvent; | |
1205 | class cbResizeBarEvent; | |
1206 | class cbRemoveBarEvent; | |
1207 | class cbSizeBarWndEvent; | |
1208 | ||
1209 | class cbDrawBarDecorEvent; | |
1210 | class cbDrawRowDecorEvent; | |
1211 | class cbDrawPaneDecorEvent; | |
1212 | class cbDrawBarHandlesEvent; | |
1213 | class cbDrawRowHandlesEvent; | |
1214 | class cbDrawRowBkGroundEvent; | |
1215 | class cbDrawPaneBkGroundEvent; | |
1216 | ||
1217 | class cbStartBarDraggingEvent; | |
1218 | class cbDrawHintRectEvent; | |
1219 | ||
1220 | class cbStartDrawInAreaEvent; | |
1221 | class cbFinishDrawInAreaEvent; | |
1222 | ||
1223 | class cbCustomizeBarEvent; | |
1224 | class cbCustomizeLayoutEvent; | |
1225 | ||
1226 | // defs. for handler-methods | |
1227 | ||
1228 | typedef void (wxEvtHandler::*cbLeftDownHandler )(cbLeftDownEvent&); | |
1229 | typedef void (wxEvtHandler::*cbLeftUpHandler )(cbLeftUpEvent&); | |
1230 | typedef void (wxEvtHandler::*cbRightDownHandler )(cbRightDownEvent&); | |
1231 | typedef void (wxEvtHandler::*cbRightUpHandler )(cbRightUpEvent&); | |
1232 | typedef void (wxEvtHandler::*cbMotionHandler )(cbMotionEvent&); | |
1233 | typedef void (wxEvtHandler::*cbLeftDClickHandler )(cbLeftDClickEvent&); | |
1234 | ||
1235 | typedef void (wxEvtHandler::*cbLayoutRowHandler )(cbLayoutRowEvent&); | |
1236 | typedef void (wxEvtHandler::*cbResizeRowHandler )(cbResizeRowEvent&); | |
1237 | typedef void (wxEvtHandler::*cbLayoutRowsHandler )(cbLayoutRowsEvent&); | |
1238 | typedef void (wxEvtHandler::*cbInsertBarHandler )(cbInsertBarEvent&); | |
1239 | typedef void (wxEvtHandler::*cbResizeBarHandler )(cbResizeBarEvent&); | |
1240 | typedef void (wxEvtHandler::*cbRemoveBarHandler )(cbRemoveBarEvent&); | |
1241 | typedef void (wxEvtHandler::*cbSizeBarWndHandler )(cbSizeBarWndEvent&); | |
1242 | ||
1243 | typedef void (wxEvtHandler::*cbDrawBarDecorHandler )(cbDrawBarDecorEvent&); | |
1244 | typedef void (wxEvtHandler::*cbDrawRowDecorHandler )(cbDrawRowDecorEvent&); | |
1245 | typedef void (wxEvtHandler::*cbDrawPaneDecorHandler )(cbDrawPaneDecorEvent&); | |
1246 | typedef void (wxEvtHandler::*cbDrawBarHandlesHandler )(cbDrawBarHandlesEvent&); | |
1247 | typedef void (wxEvtHandler::*cbDrawRowHandlesHandler )(cbDrawRowHandlesEvent&); | |
1248 | typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler )(cbDrawRowBkGroundEvent&); | |
1249 | typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler)(cbDrawPaneBkGroundEvent&); | |
1250 | ||
1251 | typedef void (wxEvtHandler::*cbStartBarDraggingHandler )(cbStartBarDraggingEvent&); | |
1252 | typedef void (wxEvtHandler::*cbDrawHintRectHandler )(cbDrawHintRectEvent&); | |
1253 | ||
1254 | typedef void (wxEvtHandler::*cbStartDrawInAreaHandler )(cbStartDrawInAreaEvent&); | |
1255 | typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler)(cbFinishDrawInAreaEvent&); | |
1256 | ||
1257 | typedef void (wxEvtHandler::*cbCustomizeBarHandler )(cbCustomizeBarEvent&); | |
1258 | typedef void (wxEvtHandler::*cbCustomizeLayoutHandler )(cbCustomizeLayoutEvent&); | |
1259 | ||
1260 | // macros for creating event table entries for plugin-events | |
1261 | ||
1262 | #if wxCHECK_VERSION(2,3,0) | |
1263 | #define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ), | |
1264 | #define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ), | |
1265 | #define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ), | |
1266 | #define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ), | |
1267 | #define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ), | |
1268 | #define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ), | |
1269 | ||
1270 | #define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ), | |
1271 | #define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ), | |
1272 | #define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ), | |
1273 | #define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ), | |
1274 | #define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ), | |
1275 | #define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ), | |
1276 | #define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ), | |
1277 | ||
1278 | #define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ), | |
1279 | #define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ), | |
1280 | #define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ), | |
1281 | #define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ), | |
1282 | #define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ), | |
1283 | #define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ), | |
1284 | #define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ), | |
1285 | ||
1286 | #define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ), | |
1287 | #define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ), | |
1288 | ||
1289 | ||
1290 | #define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ), | |
1291 | #define EVT_PL_FINISH_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func, (wxObject *) NULL ), | |
1292 | ||
1293 | #define EVT_PL_CUSTOMIZE_BAR(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func, (wxObject *) NULL ), | |
1294 | #define EVT_PL_CUSTOMIZE_LAYOUT(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func, (wxObject *) NULL ), | |
1295 | #else | |
1296 | #define EVT_PL_LEFT_DOWN(func) { cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func }, | |
1297 | #define EVT_PL_LEFT_UP(func) { cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func }, | |
1298 | #define EVT_PL_RIGHT_DOWN(func) { cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func }, | |
1299 | #define EVT_PL_RIGHT_UP(func) { cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func }, | |
1300 | #define EVT_PL_MOTION(func) { cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func }, | |
1301 | #define EVT_PL_LEFT_DCLICK(func) { cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func }, | |
1302 | ||
1303 | #define EVT_PL_LAYOUT_ROW(func) { cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func }, | |
1304 | #define EVT_PL_RESIZE_ROW(func) { cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func }, | |
1305 | #define EVT_PL_LAYOUT_ROWS(func) { cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func }, | |
1306 | #define EVT_PL_INSERT_BAR(func) { cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func }, | |
1307 | #define EVT_PL_RESIZE_BAR(func) { cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func }, | |
1308 | #define EVT_PL_REMOVE_BAR(func) { cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func }, | |
1309 | #define EVT_PL_SIZE_BAR_WND(func) { cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func }, | |
1310 | ||
1311 | #define EVT_PL_DRAW_BAR_DECOR(func) { cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func }, | |
1312 | #define EVT_PL_DRAW_ROW_DECOR(func) { cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func }, | |
1313 | #define EVT_PL_DRAW_PANE_DECOR(func) { cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func }, | |
1314 | #define EVT_PL_DRAW_BAR_HANDLES(func) { cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func }, | |
1315 | #define EVT_PL_DRAW_ROW_HANDLES(func) { cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func }, | |
1316 | #define EVT_PL_DRAW_ROW_BKGROUND(func) { cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func }, | |
1317 | #define EVT_PL_DRAW_PANE_BKGROUND(func) { cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func }, | |
1318 | ||
1319 | #define EVT_PL_START_BAR_DRAGGING(func) { cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func }, | |
1320 | #define EVT_PL_DRAW_HINT_RECT(func) { cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func }, | |
1321 | ||
1322 | #define EVT_PL_START_DRAW_IN_AREA(func) { cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func }, | |
1323 | #define EVT_PL_FINISH_DRAW_IN_AREA(func) { cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func }, | |
1324 | ||
1325 | #define EVT_PL_CUSTOMIZE_BAR(func) { cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func }, | |
1326 | #define EVT_PL_CUSTOMIZE_LAYOUT(func) { cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func }, | |
1327 | #endif | |
1328 | /* | |
1329 | * abstract base class for all control-bar related plugins | |
1330 | */ | |
1331 | ||
1332 | class cbPluginBase : public wxEvtHandler | |
1333 | { | |
1334 | DECLARE_ABSTRACT_CLASS( cbPluginBase ) | |
1335 | public: | |
1336 | ||
1337 | wxFrameLayout* mpLayout; // back-reference to the frame layout | |
1338 | ||
1339 | // specifies panes, for which this plugin receives events | |
1340 | // (see pane masks definitions) | |
1341 | int mPaneMask; | |
1342 | ||
1343 | bool mIsReady; // is TRUE, when plugin is ready to handle events | |
1344 | ||
1345 | public: | |
1346 | cbPluginBase(void) | |
1347 | ||
1348 | : mpLayout ( 0 ), | |
1349 | mPaneMask( wxALL_PANES ), | |
1350 | mIsReady ( FALSE ) | |
1351 | {} | |
1352 | ||
1353 | cbPluginBase( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ) | |
1354 | ||
1355 | : mpLayout ( pPanel ), | |
1356 | mPaneMask( paneMask ), | |
1357 | mIsReady ( FALSE ) | |
1358 | {} | |
1359 | ||
1360 | inline int GetPaneMask() { return mPaneMask; } | |
1361 | ||
1362 | // NOTE:: pointer positions of mouse-events sent to plugins | |
1363 | // are always in pane's coordinates (pane's to which | |
1364 | // this plugin is hooked) | |
1365 | ||
1366 | // destroys the whole plugin chain of connected plagins | |
1367 | virtual ~cbPluginBase(); | |
1368 | ||
1369 | // override this method to do plugin-specific initialization | |
1370 | // (at this point plugin is already attached to the frame layout, | |
1371 | // and pane masks are set) | |
1372 | virtual void OnInitPlugin() { mIsReady = TRUE; } | |
1373 | ||
1374 | bool IsReady() { return mIsReady; } | |
1375 | ||
1376 | // overriden, to determine whether the target pane specified in the | |
1377 | // event, matches the pane mask of this plugin (specific plugins | |
1378 | // do not override this method) | |
1379 | ||
1380 | virtual bool ProcessEvent(wxEvent& event); | |
1381 | }; | |
1382 | ||
1383 | /*** event classes, for each corresponding event type (24 currnetly...uhh) ***/ | |
1384 | ||
1385 | // mouse-events category | |
1386 | ||
1387 | class cbLeftDownEvent : public cbPluginEvent | |
1388 | { | |
1389 | public: | |
1390 | wxPoint mPos; | |
1391 | ||
1392 | cbLeftDownEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1393 | ||
1394 | : cbPluginEvent( cbEVT_PL_LEFT_DOWN, pPane ), | |
1395 | mPos( pos ) | |
1396 | {} | |
1397 | }; | |
1398 | ||
1399 | class cbLeftUpEvent : public cbPluginEvent | |
1400 | { | |
1401 | public: | |
1402 | wxPoint mPos; | |
1403 | ||
1404 | cbLeftUpEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1405 | ||
1406 | : cbPluginEvent( cbEVT_PL_LEFT_UP, pPane ), | |
1407 | mPos( pos ) | |
1408 | {} | |
1409 | }; | |
1410 | ||
1411 | class cbRightDownEvent : public cbPluginEvent | |
1412 | { | |
1413 | public: | |
1414 | wxPoint mPos; | |
1415 | ||
1416 | cbRightDownEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1417 | ||
1418 | : cbPluginEvent( cbEVT_PL_RIGHT_DOWN, pPane ), | |
1419 | mPos( pos ) | |
1420 | {} | |
1421 | }; | |
1422 | ||
1423 | class cbRightUpEvent : public cbPluginEvent | |
1424 | { | |
1425 | public: | |
1426 | wxPoint mPos; | |
1427 | ||
1428 | cbRightUpEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1429 | ||
1430 | : cbPluginEvent( cbEVT_PL_RIGHT_UP, pPane ), | |
1431 | mPos( pos ) | |
1432 | {} | |
1433 | }; | |
1434 | ||
1435 | class cbMotionEvent : public cbPluginEvent | |
1436 | { | |
1437 | public: | |
1438 | wxPoint mPos; | |
1439 | ||
1440 | cbMotionEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1441 | ||
1442 | : cbPluginEvent( cbEVT_PL_MOTION, pPane ), | |
1443 | mPos( pos ) | |
1444 | {} | |
1445 | }; | |
1446 | ||
1447 | class cbLeftDClickEvent : public cbPluginEvent | |
1448 | { | |
1449 | public: | |
1450 | wxPoint mPos; | |
1451 | ||
1452 | cbLeftDClickEvent( const wxPoint& pos, cbDockPane* pPane ) | |
1453 | ||
1454 | : cbPluginEvent( cbEVT_PL_LEFT_DCLICK, pPane ), | |
1455 | mPos( pos ) | |
1456 | {} | |
1457 | }; | |
1458 | ||
1459 | // bar/row events category | |
1460 | ||
1461 | class cbLayoutRowEvent : public cbPluginEvent | |
1462 | { | |
1463 | public: | |
1464 | cbRowInfo* mpRow; | |
1465 | ||
1466 | cbLayoutRowEvent( cbRowInfo* pRow, cbDockPane* pPane ) | |
1467 | ||
1468 | : cbPluginEvent( cbEVT_PL_LAYOUT_ROW, pPane ), | |
1469 | mpRow( pRow ) | |
1470 | {} | |
1471 | }; | |
1472 | ||
1473 | class cbResizeRowEvent : public cbPluginEvent | |
1474 | { | |
1475 | public: | |
1476 | cbRowInfo* mpRow; | |
1477 | int mHandleOfs; | |
1478 | bool mForUpperHandle; | |
1479 | ||
1480 | cbResizeRowEvent( cbRowInfo* pRow, int handleOfs, bool forUpperHandle, cbDockPane* pPane ) | |
1481 | ||
1482 | : cbPluginEvent( cbEVT_PL_RESIZE_ROW, pPane ), | |
1483 | mpRow( pRow ), | |
1484 | mHandleOfs( handleOfs ), | |
1485 | mForUpperHandle( forUpperHandle ) | |
1486 | {} | |
1487 | }; | |
1488 | ||
1489 | class cbLayoutRowsEvent : public cbPluginEvent | |
1490 | { | |
1491 | public: | |
1492 | ||
1493 | cbLayoutRowsEvent( cbDockPane* pPane ) | |
1494 | ||
1495 | : cbPluginEvent( cbEVT_PL_LAYOUT_ROWS, pPane ) | |
1496 | {} | |
1497 | }; | |
1498 | ||
1499 | class cbInsertBarEvent : public cbPluginEvent | |
1500 | { | |
1501 | public: | |
1502 | cbBarInfo* mpBar; | |
1503 | cbRowInfo* mpRow; | |
1504 | ||
1505 | cbInsertBarEvent( cbBarInfo* pBar, cbRowInfo* pIntoRow, cbDockPane* pPane ) | |
1506 | ||
1507 | : cbPluginEvent( cbEVT_PL_INSERT_BAR, pPane ), | |
1508 | ||
1509 | mpBar( pBar ), | |
1510 | mpRow( pIntoRow ) | |
1511 | {} | |
1512 | }; | |
1513 | ||
1514 | class cbResizeBarEvent : public cbPluginEvent | |
1515 | { | |
1516 | public: | |
1517 | cbBarInfo* mpBar; | |
1518 | cbRowInfo* mpRow; | |
1519 | ||
1520 | cbResizeBarEvent( cbBarInfo* pBar, cbRowInfo* pRow, cbDockPane* pPane ) | |
1521 | ||
1522 | : cbPluginEvent( cbEVT_PL_RESIZE_BAR, pPane ), | |
1523 | mpBar( pBar ), | |
1524 | mpRow( pRow ) | |
1525 | {} | |
1526 | }; | |
1527 | ||
1528 | class cbRemoveBarEvent : public cbPluginEvent | |
1529 | { | |
1530 | public: | |
1531 | cbBarInfo* mpBar; | |
1532 | ||
1533 | cbRemoveBarEvent( cbBarInfo* pBar, cbDockPane* pPane ) | |
1534 | ||
1535 | : cbPluginEvent( cbEVT_PL_REMOVE_BAR, pPane ), | |
1536 | mpBar( pBar ) | |
1537 | {} | |
1538 | }; | |
1539 | ||
1540 | class cbSizeBarWndEvent : public cbPluginEvent | |
1541 | { | |
1542 | public: | |
1543 | cbBarInfo* mpBar; | |
1544 | wxRect mBoundsInParent; | |
1545 | ||
1546 | cbSizeBarWndEvent( cbBarInfo* pBar, cbDockPane* pPane ) | |
1547 | ||
1548 | : cbPluginEvent( cbEVT_PL_SIZE_BAR_WND, pPane ), | |
1549 | mpBar( pBar ), | |
1550 | mBoundsInParent( pBar->mBoundsInParent ) | |
1551 | {} | |
1552 | }; | |
1553 | ||
1554 | class cbDrawBarDecorEvent : public cbPluginEvent | |
1555 | { | |
1556 | public: | |
1557 | cbBarInfo* mpBar; | |
1558 | wxDC* mpDc; | |
1559 | wxRect mBoundsInParent; | |
1560 | ||
1561 | cbDrawBarDecorEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane ) | |
1562 | ||
1563 | : cbPluginEvent( cbEVT_PL_DRAW_BAR_DECOR, pPane ), | |
1564 | mpBar( pBar ), | |
1565 | mpDc( &dc ), | |
1566 | mBoundsInParent( pBar->mBoundsInParent ) | |
1567 | {} | |
1568 | }; | |
1569 | ||
1570 | class cbDrawRowDecorEvent : public cbPluginEvent | |
1571 | { | |
1572 | public: | |
1573 | cbRowInfo* mpRow; | |
1574 | wxDC* mpDc; | |
1575 | ||
1576 | cbDrawRowDecorEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1577 | ||
1578 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_DECOR, pPane ), | |
1579 | mpRow( pRow ), | |
1580 | mpDc( &dc ) | |
1581 | {} | |
1582 | }; | |
1583 | ||
1584 | class cbDrawPaneDecorEvent : public cbPluginEvent | |
1585 | { | |
1586 | public: | |
1587 | wxDC* mpDc; | |
1588 | ||
1589 | cbDrawPaneDecorEvent( wxDC& dc, cbDockPane* pPane ) | |
1590 | ||
1591 | : cbPluginEvent( cbEVT_PL_DRAW_PANE_DECOR, pPane ), | |
1592 | mpDc( &dc ) | |
1593 | {} | |
1594 | }; | |
1595 | ||
1596 | class cbDrawBarHandlesEvent : public cbPluginEvent | |
1597 | { | |
1598 | public: | |
1599 | cbBarInfo* mpBar; | |
1600 | wxDC* mpDc; | |
1601 | ||
1602 | cbDrawBarHandlesEvent( cbBarInfo* pBar, wxDC& dc, cbDockPane* pPane ) | |
1603 | ||
1604 | : cbPluginEvent( cbEVT_PL_DRAW_BAR_HANDLES, pPane ), | |
1605 | mpBar( pBar ), | |
1606 | mpDc( &dc ) | |
1607 | {} | |
1608 | }; | |
1609 | ||
1610 | class cbDrawRowHandlesEvent : public cbPluginEvent | |
1611 | { | |
1612 | public: | |
1613 | cbRowInfo* mpRow; | |
1614 | wxDC* mpDc; | |
1615 | ||
1616 | cbDrawRowHandlesEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1617 | ||
1618 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_HANDLES, pPane ), | |
1619 | mpRow( pRow ), | |
1620 | mpDc( &dc ) | |
1621 | {} | |
1622 | }; | |
1623 | ||
1624 | class cbDrawRowBkGroundEvent : public cbPluginEvent | |
1625 | { | |
1626 | public: | |
1627 | cbRowInfo* mpRow; | |
1628 | wxDC* mpDc; | |
1629 | ||
1630 | cbDrawRowBkGroundEvent( cbRowInfo* pRow, wxDC& dc, cbDockPane* pPane ) | |
1631 | ||
1632 | : cbPluginEvent( cbEVT_PL_DRAW_ROW_BKGROUND, pPane ), | |
1633 | mpRow( pRow ), | |
1634 | mpDc( &dc ) | |
1635 | {} | |
1636 | }; | |
1637 | ||
1638 | class cbDrawPaneBkGroundEvent : public cbPluginEvent | |
1639 | { | |
1640 | public: | |
1641 | wxDC* mpDc; | |
1642 | ||
1643 | cbDrawPaneBkGroundEvent( wxDC& dc, cbDockPane* pPane ) | |
1644 | ||
1645 | : cbPluginEvent( cbEVT_PL_DRAW_PANE_BKGROUND, pPane ), | |
1646 | mpDc( &dc ) | |
1647 | {} | |
1648 | }; | |
1649 | ||
1650 | class cbStartBarDraggingEvent : public cbPluginEvent | |
1651 | { | |
1652 | public: | |
1653 | cbBarInfo* mpBar; | |
1654 | wxPoint mPos; // is given in frame's coordinates | |
1655 | ||
1656 | cbStartBarDraggingEvent( cbBarInfo* pBar, const wxPoint& pos, cbDockPane* pPane ) | |
1657 | ||
1658 | : cbPluginEvent( cbEVT_PL_START_BAR_DRAGGING, pPane ), | |
1659 | mpBar( pBar ), | |
1660 | mPos( pos ) | |
1661 | {} | |
1662 | }; | |
1663 | ||
1664 | class cbDrawHintRectEvent : public cbPluginEvent | |
1665 | { | |
1666 | public: | |
1667 | wxRect mRect; // is given in frame's coordinates | |
1668 | ||
1669 | ||
1670 | bool mLastTime; // indicates that this event finishes "session" of on-screen drawing, | |
1671 | // thus associated resources can be freed now | |
1672 | bool mEraseRect; // does not have any impact, if recangle is drawn using XOR-mask | |
1673 | ||
1674 | bool mIsInClient;// in cleint area hint could be drawn differently, | |
1675 | // e.g. with fat/hatched border | |
1676 | ||
1677 | ||
1678 | cbDrawHintRectEvent( const wxRect& rect, bool isInClient, bool eraseRect, bool lastTime ) | |
1679 | ||
1680 | : cbPluginEvent( cbEVT_PL_DRAW_HINT_RECT, 0 ), | |
1681 | mRect ( rect ), | |
1682 | mLastTime ( lastTime ), | |
1683 | mEraseRect ( eraseRect ), | |
1684 | mIsInClient( isInClient ) | |
1685 | {} | |
1686 | }; | |
1687 | ||
1688 | class cbStartDrawInAreaEvent : public cbPluginEvent | |
1689 | { | |
1690 | public: | |
1691 | wxRect mArea; | |
1692 | wxDC** mppDc; // points to pointer, where the reference | |
1693 | // to the obtained buffer-context should be placed | |
1694 | ||
1695 | cbStartDrawInAreaEvent( const wxRect& area, wxDC** ppDCForArea, cbDockPane* pPane ) | |
1696 | ||
1697 | : cbPluginEvent( cbEVT_PL_START_DRAW_IN_AREA, pPane ), | |
1698 | mArea( area ), | |
1699 | mppDc( ppDCForArea ) | |
1700 | {} | |
1701 | }; | |
1702 | ||
1703 | class cbFinishDrawInAreaEvent : public cbPluginEvent | |
1704 | { | |
1705 | public: | |
1706 | wxRect mArea; | |
1707 | ||
1708 | cbFinishDrawInAreaEvent( const wxRect& area, cbDockPane* pPane ) | |
1709 | ||
1710 | : cbPluginEvent( cbEVT_PL_FINISH_DRAW_IN_AREA, pPane ), | |
1711 | mArea( area ) | |
1712 | {} | |
1713 | }; | |
1714 | ||
1715 | class cbCustomizeBarEvent : public cbPluginEvent | |
1716 | { | |
1717 | public: | |
1718 | wxPoint mClickPos; // in parent frame's coordinates | |
1719 | cbBarInfo* mpBar; | |
1720 | ||
1721 | cbCustomizeBarEvent( cbBarInfo* pBar, const wxPoint& clickPos, cbDockPane* pPane ) | |
1722 | ||
1723 | : cbPluginEvent( cbEVT_PL_CUSTOMIZE_BAR, pPane ), | |
1724 | mClickPos( clickPos ), | |
1725 | mpBar( pBar ) | |
1726 | {} | |
1727 | }; | |
1728 | ||
1729 | class cbCustomizeLayoutEvent : public cbPluginEvent | |
1730 | { | |
1731 | public: | |
1732 | wxPoint mClickPos; // in parent frame's coordinates | |
1733 | ||
1734 | cbCustomizeLayoutEvent( const wxPoint& clickPos ) | |
1735 | ||
1736 | : cbPluginEvent( cbEVT_PL_CUSTOMIZE_LAYOUT, 0 ), | |
1737 | mClickPos( clickPos ) | |
1738 | {} | |
1739 | }; | |
1740 | ||
1741 | #endif /* __CONTROLBAR_G__ */ | |
1742 |