]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/bardragpl.h
c314c169fa8beadee0a93f5f0c5d3cbd4723e689
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: cbBarDragPlugin class
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __BARDRAGPL_G__
13 #define __BARDRAGPL_G__
16 #pragma interface "bardragpl.h"
19 #include "wx/fl/controlbar.h"
20 #include "wx/fl/toolwnd.h"
22 class cbBarDragPlugin
: public cbPluginBase
24 DECLARE_DYNAMIC_CLASS( cbBarDragPlugin
)
27 // plugin is active only in bar-dragging state
29 bool mCanStick
; // flag used to prevent "bouncing" of hint-rectangle
30 wxScreenDC
* mpScrDc
; // created while tracking hint-rect
31 wxCursor
* mpCurCursor
;
33 // rectangle shows the position/dimensions of the bar,
34 // if it would be docked now
43 cbDockPane
* mpSrcPane
; // pane, from which the bar was originally taken
44 int mBarWidthInSrcPane
;
46 cbDockPane
* mpCurPane
;
48 cbBarInfo
* mpDraggedBar
; // bar, which is being dragged
50 wxRect mFloatedBarBounds
;
52 public: /*** public properties ***/
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.
60 // Internal implementation function.
61 void AdjustHintRect( wxPoint
& mousePos
);
63 // Internal implementation function.
64 void ClipRectInFrame( wxRect
& rect
);
66 // Internal implementation function.
67 void ClipPosInFrame( wxPoint
& pos
);
69 // Internal implementation function. Finds the pane
70 // under the specified rectangle.
71 cbDockPane
* HitTestPanes( wxRect
& rect
);
73 // Internal implementation function. Finds the pane
74 // under the specified point.
75 cbDockPane
* HitTestPanes( wxPoint
& pos
);
77 // Internal implementation function.
78 bool HitsPane( cbDockPane
* pPane
, wxRect
& rect
);
80 // Internal implementation function.
81 void CalcOnScreenDims( wxRect
& rect
);
83 // Internal implementation function.
84 int GetDistanceToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
86 // Internal implementation function.
87 bool IsInOtherPane ( wxPoint
& mousePos
);
89 // Internal implementation function.
90 bool IsInClientArea( wxPoint
& mousePos
);
92 // Internal implementation function.
93 bool IsInClientArea( wxRect
& rect
);
95 // Internal implementation function.
96 void StickToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
98 // Internal implementation function.
99 void UnstickFromPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
101 // Internal implementation function.
102 int GetBarWidthInPane( cbDockPane
* pPane
);
104 // Internal implementation function.
105 int GetBarHeightInPane( cbDockPane
* pPane
);
107 // on-screen hint-tracking related methods
109 // Internal implementation function.
110 // Start showing a visual hint while dragging.
111 void StartTracking();
113 // Internal implementation function.
114 // Draw the visual hint while dragging.
115 void DrawHintRect ( wxRect
& rect
, bool isInClientRect
);
116 // Internal implementation function.
117 // Erase the visual hint while dragging.
118 void EraseHintRect( wxRect
& rect
, bool isInClientRect
);
120 // Internal implementation function.
121 // Stop showing the visual hint while dragging.
122 void FinishTracking();
124 // Internal implementation function.
125 // Draw the hint rectangle.
126 void DoDrawHintRect( wxRect
& rect
, bool isInClientRect
);
128 // Internal implementation function.
129 // Converts the given rectangle from window to screen coordinates.
130 void RectToScr( wxRect
& frameRect
, wxRect
& scrRect
);
132 // Internal implementation function.
133 // Show the hint; called within OnMouseMove.
134 void ShowHint( bool prevWasInClient
);
137 // Default constructor.
138 cbBarDragPlugin(void);
140 // Constructor taking a parent frame, and flag. See cbPluginBase.
141 cbBarDragPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
144 virtual ~cbBarDragPlugin();
146 // Handler for plugin event.
147 void OnMouseMove( cbMotionEvent
& event
);
149 // Handler for plugin event.
150 void OnLButtonUp( cbLeftUpEvent
& event
);
152 // Handler for plugin event.
153 void OnLButtonDown( cbLeftDownEvent
& event
);
155 // Handler for plugin event.
156 void OnLDblClick( cbLeftDClickEvent
& event
);
158 // Handles event, which originates from itself.
159 void OnDrawHintRect( cbDrawHintRectEvent
& event
);
161 // Handler for plugin event.
162 void OnStartBarDragging( cbStartBarDraggingEvent
& event
);
164 DECLARE_EVENT_TABLE()
167 #endif /* __BARDRAGPL_G__ */