]>
Commit | Line | Data |
---|---|---|
8e08b761 | 1 | ///////////////////////////////////////////////////////////////////////////// |
e598303a JS |
2 | // Name: bardragpl.h |
3 | // Purpose: cbBarDragPlugin class | |
8e08b761 JS |
4 | // Author: Aleksandras Gluchovas |
5 | // Modified by: | |
6 | // Created: 23/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
4cbc57f0 | 9 | // Licence: wxWindows licence |
8e08b761 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __BARDRAGPL_G__ | |
13 | #define __BARDRAGPL_G__ | |
14 | ||
8e08b761 JS |
15 | #include "wx/fl/controlbar.h" |
16 | #include "wx/fl/toolwnd.h" | |
17 | ||
4cbc57f0 JS |
18 | /* |
19 | Plugin class implementing bar dragging. | |
20 | */ | |
21 | ||
510b9edb | 22 | class WXDLLIMPEXP_FL cbBarDragPlugin : public cbPluginBase |
8e08b761 | 23 | { |
4cbc57f0 | 24 | DECLARE_DYNAMIC_CLASS( cbBarDragPlugin ) |
8e08b761 JS |
25 | protected: |
26 | ||
4cbc57f0 JS |
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; | |
8e08b761 | 32 | |
4cbc57f0 JS |
33 | // rectangle shows the position/dimensions of the bar, |
34 | // if it would be docked now | |
8e08b761 | 35 | |
4cbc57f0 JS |
36 | wxRect mPrevHintRect; |
37 | wxRect mHintRect; | |
8e08b761 JS |
38 | |
39 | ||
4cbc57f0 JS |
40 | int mMouseInRectX; |
41 | int mMouseInRectY; | |
8e08b761 | 42 | |
4cbc57f0 JS |
43 | cbDockPane* mpSrcPane; // pane, from which the bar was originally taken |
44 | int mBarWidthInSrcPane; | |
8e08b761 | 45 | |
4cbc57f0 | 46 | cbDockPane* mpCurPane; |
8e08b761 | 47 | |
4cbc57f0 JS |
48 | cbBarInfo* mpDraggedBar; // bar, which is being dragged |
49 | bool mBarWasFloating; | |
50 | wxRect mFloatedBarBounds; | |
8e08b761 JS |
51 | |
52 | public: /*** public properties ***/ | |
53 | ||
4cbc57f0 | 54 | int mInClientHintBorder; // when hint-rect moves within client window area, |
8e08b761 | 55 | // the thicker rectangle is drawn using hatched brush, |
4cbc57f0 | 56 | // the default border width for this rectangle is 8 pix. |
8e08b761 JS |
57 | |
58 | protected: | |
59 | ||
4cbc57f0 JS |
60 | // Internal implementation function. |
61 | void AdjustHintRect( wxPoint& mousePos ); | |
62 | ||
63 | // Internal implementation function. | |
64 | void ClipRectInFrame( wxRect& rect ); | |
8e08b761 | 65 | |
4cbc57f0 JS |
66 | // Internal implementation function. |
67 | void ClipPosInFrame( wxPoint& pos ); | |
e598303a | 68 | |
4cbc57f0 JS |
69 | // Internal implementation function. Finds the pane |
70 | // under the specified rectangle. | |
71 | cbDockPane* HitTestPanes( wxRect& rect ); | |
8e08b761 | 72 | |
4cbc57f0 JS |
73 | // Internal implementation function. Finds the pane |
74 | // under the specified point. | |
75 | cbDockPane* HitTestPanes( wxPoint& pos ); | |
e598303a | 76 | |
4cbc57f0 JS |
77 | // Internal implementation function. |
78 | bool HitsPane( cbDockPane* pPane, wxRect& rect ); | |
e598303a | 79 | |
4cbc57f0 JS |
80 | // Internal implementation function. |
81 | void CalcOnScreenDims( wxRect& rect ); | |
8e08b761 | 82 | |
4cbc57f0 JS |
83 | // Internal implementation function. |
84 | int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos ); | |
8e08b761 | 85 | |
4cbc57f0 JS |
86 | // Internal implementation function. |
87 | bool IsInOtherPane ( wxPoint& mousePos ); | |
8e08b761 | 88 | |
4cbc57f0 JS |
89 | // Internal implementation function. |
90 | bool IsInClientArea( wxPoint& mousePos ); | |
e598303a | 91 | |
4cbc57f0 JS |
92 | // Internal implementation function. |
93 | bool IsInClientArea( wxRect& rect ); | |
e598303a | 94 | |
4cbc57f0 JS |
95 | // Internal implementation function. |
96 | void StickToPane( cbDockPane* pPane, wxPoint& mousePos ); | |
8e08b761 | 97 | |
4cbc57f0 JS |
98 | // Internal implementation function. |
99 | void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos ); | |
e598303a | 100 | |
4cbc57f0 JS |
101 | // Internal implementation function. |
102 | int GetBarWidthInPane( cbDockPane* pPane ); | |
8e08b761 | 103 | |
4cbc57f0 JS |
104 | // Internal implementation function. |
105 | int GetBarHeightInPane( cbDockPane* pPane ); | |
e598303a | 106 | |
4cbc57f0 | 107 | // on-screen hint-tracking related methods |
8e08b761 | 108 | |
4cbc57f0 JS |
109 | // Internal implementation function. |
110 | // Start showing a visual hint while dragging. | |
111 | void StartTracking(); | |
8e08b761 | 112 | |
4cbc57f0 JS |
113 | // Internal implementation function. |
114 | // Draw the visual hint while dragging. | |
115 | void DrawHintRect ( wxRect& rect, bool isInClientRect); | |
8e08b761 | 116 | |
4cbc57f0 JS |
117 | // Internal implementation function. |
118 | // Erase the visual hint while dragging. | |
119 | void EraseHintRect( wxRect& rect, bool isInClientRect); | |
8e08b761 | 120 | |
4cbc57f0 JS |
121 | // Internal implementation function. |
122 | // Stop showing the visual hint while dragging. | |
123 | void FinishTracking(); | |
8e08b761 | 124 | |
4cbc57f0 JS |
125 | // Internal implementation function. |
126 | // Draw the hint rectangle. | |
127 | void DoDrawHintRect( wxRect& rect, bool isInClientRect); | |
8e08b761 | 128 | |
4cbc57f0 JS |
129 | // Internal implementation function. |
130 | // Converts the given rectangle from window to screen coordinates. | |
131 | void RectToScr( wxRect& frameRect, wxRect& scrRect ); | |
8e08b761 | 132 | |
4cbc57f0 JS |
133 | // Internal implementation function. |
134 | // Show the hint; called within OnMouseMove. | |
135 | void ShowHint( bool prevWasInClient ); | |
8e08b761 JS |
136 | |
137 | public: | |
4cbc57f0 JS |
138 | // Default constructor. |
139 | cbBarDragPlugin(void); | |
8e08b761 | 140 | |
4cbc57f0 JS |
141 | // Constructor taking a parent frame, and flag. See cbPluginBase. |
142 | cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
8e08b761 | 143 | |
4cbc57f0 JS |
144 | // Destructor. |
145 | virtual ~cbBarDragPlugin(); | |
8e08b761 | 146 | |
4cbc57f0 JS |
147 | // Handler for plugin event. |
148 | void OnMouseMove( cbMotionEvent& event ); | |
e598303a | 149 | |
4cbc57f0 JS |
150 | // Handler for plugin event. |
151 | void OnLButtonUp( cbLeftUpEvent& event ); | |
e598303a | 152 | |
4cbc57f0 JS |
153 | // Handler for plugin event. |
154 | void OnLButtonDown( cbLeftDownEvent& event ); | |
e598303a | 155 | |
4cbc57f0 JS |
156 | // Handler for plugin event. |
157 | void OnLDblClick( cbLeftDClickEvent& event ); | |
8e08b761 | 158 | |
4cbc57f0 JS |
159 | // Handles event, which originates from itself. |
160 | void OnDrawHintRect( cbDrawHintRectEvent& event ); | |
8e08b761 | 161 | |
4cbc57f0 JS |
162 | // Handler for plugin event. |
163 | void OnStartBarDragging( cbStartBarDraggingEvent& event ); | |
8e08b761 | 164 | |
4cbc57f0 | 165 | DECLARE_EVENT_TABLE() |
8e08b761 JS |
166 | }; |
167 | ||
168 | #endif /* __BARDRAGPL_G__ */ | |
169 |