]>
Commit | Line | Data |
---|---|---|
8e08b761 | 1 | ///////////////////////////////////////////////////////////////////////////// |
4cbc57f0 JS |
2 | // Name: rowdragpl.h |
3 | // Purpose: cbRowDragPlugin class header. | |
8e08b761 JS |
4 | // Author: Aleksandras Gluchovas |
5 | // Modified by: | |
6 | // Created: 06/10/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
4cbc57f0 | 9 | // Licence: wxWindows licence |
8e08b761 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __ROWDRAGPL_G__ | |
13 | #define __ROWDRAGPL_G__ | |
14 | ||
ab7ce33c | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
8e08b761 JS |
16 | #pragma interface "rowdragpl.h" |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | ||
21 | /* | |
4cbc57f0 JS |
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 | */ | |
8e08b761 | 27 | |
510b9edb | 28 | class WXDLLIMPEXP_FL cbRowDragPlugin : public cbPluginBase |
8e08b761 | 29 | { |
4cbc57f0 | 30 | DECLARE_DYNAMIC_CLASS( cbRowDragPlugin ) |
8e08b761 | 31 | public: |
4cbc57f0 | 32 | // background colours for the highlighted/unhighlighted icons |
8e08b761 | 33 | |
4cbc57f0 JS |
34 | wxColour mHightColor; // light-blue for NC-look |
35 | wxColour mLowColor; // light-gray -/- | |
36 | wxColour mTrianInnerColor; // blue -/- | |
37 | wxPen mTrianInnerPen; // black -/- | |
8e08b761 JS |
38 | |
39 | protected: | |
4cbc57f0 | 40 | friend class cbRowDragPluginSerializer; |
8e08b761 | 41 | |
4cbc57f0 JS |
42 | // drag & drop state variables |
43 | bool mDragStarted; | |
44 | bool mDecisionMode; | |
45 | wxPoint mDragOrigin; | |
46 | int mCurDragOfs; | |
47 | bool mCaptureIsOn; | |
8e08b761 | 48 | |
4cbc57f0 JS |
49 | // saved margins of the pane |
50 | int mSvTopMargin; | |
51 | int mSvBottomMargin; | |
52 | int mSvLeftMargin; | |
53 | int mSvRightMargin; | |
8e08b761 | 54 | |
4cbc57f0 JS |
55 | // on-screen drawing state variables |
56 | wxBitmap* mpPaneImage; | |
57 | wxBitmap* mpRowImage; | |
58 | wxBitmap* mpCombinedImage; | |
8e08b761 | 59 | |
4cbc57f0 JS |
60 | wxScreenDC* mpScrDc; |
61 | wxRect mCombRect; | |
62 | wxSize mRowImgDim; | |
63 | int mInitialRowOfs; | |
8e08b761 | 64 | |
4cbc57f0 JS |
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) | |
8e08b761 | 67 | |
4cbc57f0 JS |
68 | cbRowInfo* mpRowInFocus; |
69 | int mCollapsedIconInFocus; | |
8e08b761 | 70 | |
4cbc57f0 | 71 | cbDockPane* mpPane; // is set up temorarely, while handling event |
8e08b761 | 72 | |
4cbc57f0 | 73 | wxList mHiddenBars; |
8e08b761 | 74 | |
4cbc57f0 JS |
75 | // Helper for drag and drop. |
76 | wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area ); | |
8e08b761 | 77 | |
4cbc57f0 JS |
78 | // Helper for drag and drop. |
79 | int GetHRowsCountForPane( cbDockPane* pPane ); | |
8e08b761 | 80 | |
4cbc57f0 JS |
81 | // Helper for drag and drop. |
82 | void SetMouseCapture( bool captureOn ); | |
8e08b761 | 83 | |
4cbc57f0 JS |
84 | // Helper for drag and drop. |
85 | void PrepareForRowDrag(); | |
8e08b761 | 86 | |
4cbc57f0 JS |
87 | // Helper for drag and drop. |
88 | void ShowDraggedRow( int offset ); | |
8e08b761 | 89 | |
4cbc57f0 JS |
90 | // Helper for drag and drop. |
91 | void ShowPaneImage(); | |
8e08b761 | 92 | |
4cbc57f0 JS |
93 | // Helper for drag and drop. |
94 | void FinishOnScreenDraw(); | |
8e08b761 | 95 | |
4cbc57f0 JS |
96 | // Helper for drag and drop. |
97 | void CollapseRow( cbRowInfo* pRow ); | |
8e08b761 | 98 | |
4cbc57f0 JS |
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(); | |
8e08b761 JS |
153 | |
154 | public: | |
155 | ||
4cbc57f0 JS |
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(); | |
8e08b761 | 164 | |
4cbc57f0 JS |
165 | // Clone function, returning a new instance of this class. |
166 | virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); } | |
8e08b761 | 167 | |
4cbc57f0 JS |
168 | // Called to initialize this plugin. |
169 | virtual void OnInitPlugin(); | |
8e08b761 | 170 | |
4cbc57f0 JS |
171 | // Handles mouse move plugin events (appearance-independent logic). |
172 | void OnMouseMove ( cbMotionEvent& event ); | |
8e08b761 | 173 | |
4cbc57f0 JS |
174 | // Handles left button down plugin events (appearance-independent logic). |
175 | void OnLButtonDown( cbLeftDownEvent& event ); | |
8e08b761 | 176 | |
4cbc57f0 JS |
177 | // Handles left button up plugin events (appearance-independent logic). |
178 | void OnLButtonUp ( cbLeftUpEvent& event ); | |
8e08b761 | 179 | |
4cbc57f0 JS |
180 | // Handles pane drawing plugin events (appearance-independent logic). |
181 | void OnDrawPaneBackground( cbDrawPaneDecorEvent& event ); | |
8e08b761 | 182 | |
4cbc57f0 JS |
183 | // Draws collapsed row icon (appearance-dependent). |
184 | virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted ); | |
8e08b761 | 185 | |
4cbc57f0 JS |
186 | // Draws collapsed rows border (appearance-dependent). |
187 | virtual void DrawCollapsedRowsBorder( wxDC& dc ); | |
8e08b761 | 188 | |
4cbc57f0 JS |
189 | // Draws rows drag hints border (appearance-dependent). |
190 | virtual void DrawRowsDragHintsBorder( wxDC& dc ); | |
8e08b761 | 191 | |
4cbc57f0 JS |
192 | // Draws row drag hint (appearance-dependent). |
193 | virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted ); | |
8e08b761 | 194 | |
4cbc57f0 JS |
195 | // Draws empty row (appearance-dependent). |
196 | virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds ); | |
8e08b761 | 197 | |
4cbc57f0 JS |
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() | |
8e08b761 JS |
214 | }; |
215 | ||
4cbc57f0 JS |
216 | /* |
217 | Internal helper class. | |
218 | */ | |
8e08b761 | 219 | |
510b9edb | 220 | class WXDLLIMPEXP_FL cbHiddenBarInfo : public wxObject |
8e08b761 | 221 | { |
4cbc57f0 | 222 | DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo ) |
8e08b761 | 223 | public: |
4cbc57f0 JS |
224 | cbBarInfo* mpBar; |
225 | int mRowNo; | |
226 | int mIconNo; | |
227 | int mAlignment; | |
8e08b761 JS |
228 | }; |
229 | ||
230 | #endif /* __ROWDRAGPL_G__ */ | |
231 |