]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/rowdragpl.h
Changed how EVT_CHAR and EVT_KEY_DOWN are sent to Scintilla
[wxWidgets.git] / contrib / include / wx / fl / rowdragpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 06/10/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __ROWDRAGPL_G__
13 #define __ROWDRAGPL_G__
14
15 #ifdef __GNUG__
16 #pragma interface "rowdragpl.h"
17 #endif
18
19 #include "wx/fl/controlbar.h"
20
21 /*
22 * Plugin adds row-dragging fuctionality to the pane.
23 * Handles mouse/movement and pane-background erasing plugin-events.
24 * Behaviour and appearence resembles drag & drop posotioning
25 * of the toolbar-rows int Netscape Comunicator 4.xx.
26 */
27
28 class 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 wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
76
77 // helpers for drag&drop
78
79 int GetHRowsCountForPane( cbDockPane* pPane );
80
81 void SetMouseCapture( bool captureOn );
82 void PrepareForRowDrag();
83 void ShowDraggedRow( int offset );
84 void ShowPaneImage();
85 void FinishOnScreenDraw();
86 void CollapseRow( cbRowInfo* pRow );
87 void ExpandRow( int collapsedIconIdx );
88 void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
89 bool ItemIsInFocus();
90 void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
91 void UnhiglightItemInFocus();
92
93 cbRowInfo* GetFirstRow();
94
95 // "hard-coded metafile" for NN-look
96
97 virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
98 virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
99 virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
100 virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
101 virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
102 virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
103 virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
104 virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
105 virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
106 int level, wxPen& upperPen, wxPen& lowerPen );
107
108 virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
109 virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
110
111 virtual int GetCollapsedIconsPos();
112
113 public:
114
115 cbRowDragPlugin(void);
116
117 cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
118 virtual ~cbRowDragPlugin();
119
120 virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
121
122 virtual void OnInitPlugin();
123
124 // handlers for plugin events (appearence-independent logic)
125
126 void OnMouseMove ( cbMotionEvent& event );
127 void OnLButtonDown( cbLeftDownEvent& event );
128 void OnLButtonUp ( cbLeftUpEvent& event );
129 void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
130
131 // overridables (appearence-depedent)
132
133 virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
134 virtual void DrawCollapsedRowsBorder( wxDC& dc );
135 virtual void DrawRowsDragHintsBorder( wxDC& dc );
136 virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
137 virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
138
139 virtual int GetCollapsedRowIconHeight();
140 virtual int GetRowDragHintWidth();
141
142 virtual void SetPaneMargins();
143
144
145 virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
146 virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
147
148 DECLARE_EVENT_TABLE()
149 };
150
151 // internal helper-class
152
153 class cbHiddenBarInfo : public wxObject
154 {
155 DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
156 public:
157 cbBarInfo* mpBar;
158 int mRowNo;
159 int mIconNo;
160 int mAlignment;
161 };
162
163 #endif /* __ROWDRAGPL_G__ */
164