]>
git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/bardragpl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __BARDRAGPL_G__
13 #define __BARDRAGPL_G__
15 #include "controlbar.h"
18 class cbBarDragPlugin
: public cbPluginBase
20 DECLARE_DYNAMIC_CLASS( cbBarDragPlugin
)
23 // plugin is active only in bar-dragging state
25 bool mCanStick
; // flag used to prevent "bouncing" of hint-rectangle
26 wxScreenDC
* mpScrDc
; // created while tracking hint-rect
27 wxCursor
* mpCurCursor
;
29 // rectnagle shows the position/dimensions of the bar,
30 // if it would be docked now
39 cbDockPane
* mpSrcPane
; // pane, from which the bar was originally taken
40 int mBarWidthInSrcPane
;
42 cbDockPane
* mpCurPane
;
44 cbBarInfo
* mpDraggedBar
; // bar, which is being dragged
46 wxRect mFloatedBarBounds
;
48 public: /*** public properties ***/
50 int mInClientHintBorder
; // when hint-rect moves within client window area,
51 // the thicker rectangle is drawn using hatched brush,
52 // the default border width for this rectangle is 8 pix.
57 void AdjustHintRect( wxPoint
& mousePos
);
59 void ClipRectInFrame( wxRect
& rect
);
60 void ClipPosInFrame( wxPoint
& pos
);
62 cbDockPane
* HitTestPanes( wxRect
& rect
);
63 cbDockPane
* HitTestPanes( wxPoint
& pos
);
64 bool HitsPane( cbDockPane
* pPane
, wxRect
& rect
);
66 void CalcOnScreenDims( wxRect
& rect
);
68 int GetDistanceToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
70 bool IsInOtherPane ( wxPoint
& mousePos
);
71 bool IsInClientArea( wxPoint
& mousePos
);
72 bool IsInClientArea( wxRect
& rect
);
74 void StickToPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
75 void UnstickFromPane( cbDockPane
* pPane
, wxPoint
& mousePos
);
77 int GetBarWidthInPane( cbDockPane
* pPane
);
78 int GetBarHeightInPane( cbDockPane
* pPane
);
80 // on-screen hint-tracking related methods
84 void DrawHintRect ( wxRect
& rect
, bool isInClientRect
);
85 void EraseHintRect( wxRect
& rect
, bool isInClientRect
);
87 void FinishTracking();
89 void DoDrawHintRect( wxRect
& rect
, bool isInClientRect
);
91 void RectToScr( wxRect
& frameRect
, wxRect
& scrRect
);
93 void ShowHint( bool prevWasInClient
);
96 cbBarDragPlugin(void);
98 cbBarDragPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
100 virtual ~cbBarDragPlugin();
102 // handlers for plugin events
104 void OnMouseMove( cbMotionEvent
& event
);
105 void OnLButtonUp( cbLeftUpEvent
& event
);
106 void OnLButtonDown( cbLeftDownEvent
& event
);
107 void OnLDblClick( cbLeftDClickEvent
& event
);
109 // handles event, which oriniates from itself
110 void OnDrawHintRect( cbDrawHintRectEvent
& event
);
112 void OnStartBarDragging( cbStartBarDraggingEvent
& event
);
114 DECLARE_EVENT_TABLE()