1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: cbBarDragPlugin class
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __BARDRAGPL_G__
13 #define __BARDRAGPL_G__
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "bardragpl.h"
19 #include "wx/fl/controlbar.h"
20 #include "wx/fl/toolwnd.h"
23 Plugin class implementing bar dragging.
26 class WXFL_DECLSPEC cbBarDragPlugin
: public cbPluginBase
28 DECLARE_DYNAMIC_CLASS( cbBarDragPlugin
)
31 // plugin is active only in bar-dragging state
33 bool mCanStick
; // flag used to prevent "bouncing" of hint-rectangle
34 wxScreenDC
* mpScrDc
; // created while tracking hint-rect
35 wxCursor
* mpCurCursor
;
37 // rectangle shows the position/dimensions of the bar,
38 // if it would be docked now
47 cbDockPane
* mpSrcPane
; // pane, from which the bar was originally taken
48 int mBarWidthInSrcPane
;
50 cbDockPane
* mpCurPane
;
52 cbBarInfo
* mpDraggedBar
; // bar, which is being dragged
54 wxRect mFloatedBarBounds
;
56 public: /*** public properties ***/
58 int mInClientHintBorder
; // when hint-rect moves within client window area,
59 // the thicker rectangle is drawn using hatched brush,
60 // the default border width for this rectangle is 8 pix.
64 // Internal implementation function.
65 void AdjustHintRect( wxPoint
& mousePos
);
67 // Internal implementation function.
68 void ClipRectInFrame( wxRect
& rect
);
70 // Internal implementation function.
71 void ClipPosInFrame( wxPoint
& pos
);
73 // Internal implementation function. Finds the pane
74 // under the specified rectangle.
75 cbDockPane
* HitTestPanes( wxRect
& rect
);
77 // Internal implementation function. Finds the pane
78 // under the specified point.
79 cbDockPane
* HitTestPanes( wxPoint
& pos
);
81 // Internal implementation function.
82 bool HitsPane( cbDockPane
* pPane
, wxRect
& rect
);
84 // Internal implementation function.
85 void CalcOnScreenDims( wxRect
& rect
);
87 // Internal implementation function.
88 int GetDistanceToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
90 // Internal implementation function.
91 bool IsInOtherPane ( wxPoint
& mousePos
);
93 // Internal implementation function.
94 bool IsInClientArea( wxPoint
& mousePos
);
96 // Internal implementation function.
97 bool IsInClientArea( wxRect
& rect
);
99 // Internal implementation function.
100 void StickToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
102 // Internal implementation function.
103 void UnstickFromPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
105 // Internal implementation function.
106 int GetBarWidthInPane( cbDockPane
* pPane
);
108 // Internal implementation function.
109 int GetBarHeightInPane( cbDockPane
* pPane
);
111 // on-screen hint-tracking related methods
113 // Internal implementation function.
114 // Start showing a visual hint while dragging.
115 void StartTracking();
117 // Internal implementation function.
118 // Draw the visual hint while dragging.
119 void DrawHintRect ( wxRect
& rect
, bool isInClientRect
);
121 // Internal implementation function.
122 // Erase the visual hint while dragging.
123 void EraseHintRect( wxRect
& rect
, bool isInClientRect
);
125 // Internal implementation function.
126 // Stop showing the visual hint while dragging.
127 void FinishTracking();
129 // Internal implementation function.
130 // Draw the hint rectangle.
131 void DoDrawHintRect( wxRect
& rect
, bool isInClientRect
);
133 // Internal implementation function.
134 // Converts the given rectangle from window to screen coordinates.
135 void RectToScr( wxRect
& frameRect
, wxRect
& scrRect
);
137 // Internal implementation function.
138 // Show the hint; called within OnMouseMove.
139 void ShowHint( bool prevWasInClient
);
142 // Default constructor.
143 cbBarDragPlugin(void);
145 // Constructor taking a parent frame, and flag. See cbPluginBase.
146 cbBarDragPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
149 virtual ~cbBarDragPlugin();
151 // Handler for plugin event.
152 void OnMouseMove( cbMotionEvent
& event
);
154 // Handler for plugin event.
155 void OnLButtonUp( cbLeftUpEvent
& event
);
157 // Handler for plugin event.
158 void OnLButtonDown( cbLeftDownEvent
& event
);
160 // Handler for plugin event.
161 void OnLDblClick( cbLeftDClickEvent
& event
);
163 // Handles event, which originates from itself.
164 void OnDrawHintRect( cbDrawHintRectEvent
& event
);
166 // Handler for plugin event.
167 void OnStartBarDragging( cbStartBarDraggingEvent
& event
);
169 DECLARE_EVENT_TABLE()
172 #endif /* __BARDRAGPL_G__ */