]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/rowdragpl.h
More details about the internal module name changes
[wxWidgets.git] / contrib / include / wx / fl / rowdragpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: rowdragpl.h
3 // Purpose: cbRowDragPlugin class header.
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 06/10/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __ROWDRAGPL_G__
13 #define __ROWDRAGPL_G__
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "rowdragpl.h"
17 #endif
18
19 #include "wx/fl/controlbar.h"
20
21 /*
22 This plugin adds row-dragging functionality to the pane.
23 It handles mouse movement and pane background-erasing plugin events.
24 The behaviour and appearance resembles drag and drop positioning
25 of the toolbar rows in Netscape Communicator 4.xx.
26 */
27
28 class WXDLLIMPEXP_FL cbRowDragPlugin : public cbPluginBase
29 {
30 DECLARE_DYNAMIC_CLASS( cbRowDragPlugin )
31 public:
32 // background colours for the highlighted/unhighlighted icons
33
34 wxColour mHightColor; // light-blue for NC-look
35 wxColour mLowColor; // light-gray -/-
36 wxColour mTrianInnerColor; // blue -/-
37 wxPen mTrianInnerPen; // black -/-
38
39 protected:
40 friend class cbRowDragPluginSerializer;
41
42 // drag & drop state variables
43 bool mDragStarted;
44 bool mDecisionMode;
45 wxPoint mDragOrigin;
46 int mCurDragOfs;
47 bool mCaptureIsOn;
48
49 // saved margins of the pane
50 int mSvTopMargin;
51 int mSvBottomMargin;
52 int mSvLeftMargin;
53 int mSvRightMargin;
54
55 // on-screen drawing state variables
56 wxBitmap* mpPaneImage;
57 wxBitmap* mpRowImage;
58 wxBitmap* mpCombinedImage;
59
60 wxScreenDC* mpScrDc;
61 wxRect mCombRect;
62 wxSize mRowImgDim;
63 int mInitialRowOfs;
64
65 // NOTE:: if mpRowInFocus is not NULL, then mCollapsedIconInFocus is -1,
66 // and v.v. (two different items cannot be in focus at the same time)
67
68 cbRowInfo* mpRowInFocus;
69 int mCollapsedIconInFocus;
70
71 cbDockPane* mpPane; // is set up temorarely, while handling event
72
73 wxList mHiddenBars;
74
75 // Helper for drag and drop.
76 wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
77
78 // Helper for drag and drop.
79 int GetHRowsCountForPane( cbDockPane* pPane );
80
81 // Helper for drag and drop.
82 void SetMouseCapture( bool captureOn );
83
84 // Helper for drag and drop.
85 void PrepareForRowDrag();
86
87 // Helper for drag and drop.
88 void ShowDraggedRow( int offset );
89
90 // Helper for drag and drop.
91 void ShowPaneImage();
92
93 // Helper for drag and drop.
94 void FinishOnScreenDraw();
95
96 // Helper for drag and drop.
97 void CollapseRow( cbRowInfo* pRow );
98
99 // Helper for drag and drop.
100 void ExpandRow( int collapsedIconIdx );
101
102 // Helper for drag and drop.
103 void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
104
105 // Helper for drag and drop.
106 bool ItemIsInFocus();
107
108 // Helper for drag and drop.
109 void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
110
111 // Helper for drag and drop.
112 void UnhighlightItemInFocus();
113
114 // Helper for drag and drop.
115 cbRowInfo* GetFirstRow();
116
117 // Implements 'hard-coded metafile' for Netscape Navigator look.
118 virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
119
120 // Implements 'hard-coded metafile' for Netscape Navigator look.
121 virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
122
123 // Implements 'hard-coded metafile' for Netscape Navigator look.
124 virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
125
126 // Implements 'hard-coded metafile' for Netscape Navigator look.
127 virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
128
129 // Implements 'hard-coded metafile' for Netscape Navigator look.
130 virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
131
132 // Implements 'hard-coded metafile' for Netscape Navigator look.
133 virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
134
135 // Implements 'hard-coded metafile' for Netscape Navigator look.
136 virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
137
138 // Implements 'hard-coded metafile' for Netscape Navigator look.
139 virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
140
141 // Implements 'hard-coded metafile' for Netscape Navigator look.
142 virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
143 int level, wxPen& upperPen, wxPen& lowerPen );
144
145 // Helper for drag and drop.
146 virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
147
148 // Helper for drag and drop.
149 virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
150
151 // Helper for drag and drop.
152 virtual int GetCollapsedIconsPos();
153
154 public:
155
156 // Default constructor.
157 cbRowDragPlugin();
158
159 // Constructor, taking paren layout frame and pane mask.
160 cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
161
162 // Destructor.
163 virtual ~cbRowDragPlugin();
164
165 // Clone function, returning a new instance of this class.
166 virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
167
168 // Called to initialize this plugin.
169 virtual void OnInitPlugin();
170
171 // Handles mouse move plugin events (appearance-independent logic).
172 void OnMouseMove ( cbMotionEvent& event );
173
174 // Handles left button down plugin events (appearance-independent logic).
175 void OnLButtonDown( cbLeftDownEvent& event );
176
177 // Handles left button up plugin events (appearance-independent logic).
178 void OnLButtonUp ( cbLeftUpEvent& event );
179
180 // Handles pane drawing plugin events (appearance-independent logic).
181 void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
182
183 // Draws collapsed row icon (appearance-dependent).
184 virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
185
186 // Draws collapsed rows border (appearance-dependent).
187 virtual void DrawCollapsedRowsBorder( wxDC& dc );
188
189 // Draws rows drag hints border (appearance-dependent).
190 virtual void DrawRowsDragHintsBorder( wxDC& dc );
191
192 // Draws row drag hint (appearance-dependent).
193 virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
194
195 // Draws empty row (appearance-dependent).
196 virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
197
198 // Gets the collapsed row icon height.
199 virtual int GetCollapsedRowIconHeight();
200
201 // Gets the row drag hint width.
202 virtual int GetRowDragHintWidth();
203
204 // Sets the pane margins.
205 virtual void SetPaneMargins();
206
207 // Test for the collapsed row icon position.
208 virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
209
210 // Test for the row drag hint position.
211 virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
212
213 DECLARE_EVENT_TABLE()
214 };
215
216 /*
217 Internal helper class.
218 */
219
220 class WXDLLIMPEXP_FL cbHiddenBarInfo : public wxObject
221 {
222 DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
223 public:
224 cbBarInfo* mpBar;
225 int mRowNo;
226 int mIconNo;
227 int mAlignment;
228 };
229
230 #endif /* __ROWDRAGPL_G__ */
231