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