]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: No names yet. | |
3 | // Purpose: Contrib. demo | |
4 | // Author: Aleksandras Gluchovas | |
5 | // Modified by: | |
6 | // Created: 23/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __BARDRAGPL_G__ | |
13 | #define __BARDRAGPL_G__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "bardragpl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | #include "wx/fl/toolwnd.h" | |
21 | ||
22 | class cbBarDragPlugin : public cbPluginBase | |
23 | { | |
24 | DECLARE_DYNAMIC_CLASS( cbBarDragPlugin ) | |
25 | protected: | |
26 | ||
27 | // plugin is active only in bar-dragging state | |
28 | bool mBarDragStarted; | |
29 | bool mCanStick; // flag used to prevent "bouncing" of hint-rectangle | |
30 | wxScreenDC* mpScrDc; // created while tracking hint-rect | |
31 | wxCursor* mpCurCursor; | |
32 | ||
33 | // rectnagle shows the position/dimensions of the bar, | |
34 | // if it would be docked now | |
35 | ||
36 | wxRect mPrevHintRect; | |
37 | wxRect mHintRect; | |
38 | ||
39 | ||
40 | int mMouseInRectX; | |
41 | int mMouseInRectY; | |
42 | ||
43 | cbDockPane* mpSrcPane; // pane, from which the bar was originally taken | |
44 | int mBarWidthInSrcPane; | |
45 | ||
46 | cbDockPane* mpCurPane; | |
47 | ||
48 | cbBarInfo* mpDraggedBar; // bar, which is being dragged | |
49 | bool mBarWasFloating; | |
50 | wxRect mFloatedBarBounds; | |
51 | ||
52 | public: /*** public properties ***/ | |
53 | ||
54 | int mInClientHintBorder; // when hint-rect moves within client window area, | |
55 | // the thicker rectangle is drawn using hatched brush, | |
56 | // the default border width for this rectangle is 8 pix. | |
57 | ||
58 | protected: | |
59 | ||
60 | ||
61 | void AdjustHintRect( wxPoint& mousePos ); | |
62 | ||
63 | void ClipRectInFrame( wxRect& rect ); | |
64 | void ClipPosInFrame( wxPoint& pos ); | |
65 | ||
66 | cbDockPane* HitTestPanes( wxRect& rect ); | |
67 | cbDockPane* HitTestPanes( wxPoint& pos ); | |
68 | bool HitsPane( cbDockPane* pPane, wxRect& rect ); | |
69 | ||
70 | void CalcOnScreenDims( wxRect& rect ); | |
71 | ||
72 | int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos ); | |
73 | ||
74 | bool IsInOtherPane ( wxPoint& mousePos ); | |
75 | bool IsInClientArea( wxPoint& mousePos ); | |
76 | bool IsInClientArea( wxRect& rect ); | |
77 | ||
78 | void StickToPane( cbDockPane* pPane, wxPoint& mousePos ); | |
79 | void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos ); | |
80 | ||
81 | int GetBarWidthInPane( cbDockPane* pPane ); | |
82 | int GetBarHeightInPane( cbDockPane* pPane ); | |
83 | ||
84 | // on-screen hint-tracking related methods | |
85 | ||
86 | void StartTracking(); | |
87 | ||
88 | void DrawHintRect ( wxRect& rect, bool isInClientRect); | |
89 | void EraseHintRect( wxRect& rect, bool isInClientRect); | |
90 | ||
91 | void FinishTracking(); | |
92 | ||
93 | void DoDrawHintRect( wxRect& rect, bool isInClientRect); | |
94 | ||
95 | void RectToScr( wxRect& frameRect, wxRect& scrRect ); | |
96 | ||
97 | void ShowHint( bool prevWasInClient ); | |
98 | ||
99 | public: | |
100 | cbBarDragPlugin(void); | |
101 | ||
102 | cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
103 | ||
104 | virtual ~cbBarDragPlugin(); | |
105 | ||
106 | // handlers for plugin events | |
107 | ||
108 | void OnMouseMove( cbMotionEvent& event ); | |
109 | void OnLButtonUp( cbLeftUpEvent& event ); | |
110 | void OnLButtonDown( cbLeftDownEvent& event ); | |
111 | void OnLDblClick( cbLeftDClickEvent& event ); | |
112 | ||
113 | // handles event, which oriniates from itself | |
114 | void OnDrawHintRect( cbDrawHintRectEvent& event ); | |
115 | ||
116 | void OnStartBarDragging( cbStartBarDraggingEvent& event ); | |
117 | ||
118 | DECLARE_EVENT_TABLE() | |
119 | }; | |
120 | ||
121 | #endif /* __BARDRAGPL_G__ */ | |
122 |