]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: panedrawpl.h | |
3 | // Purpose: cbPaneDrawPlugin class header. | |
4 | // Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt> | |
5 | // Modified by: | |
6 | // Created: 06/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __PANEDRAWPL_G__ | |
13 | #define __PANEDRAWPL_G__ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(__APPLE__) | |
16 | #pragma interface "panedrawpl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | ||
21 | /* | |
22 | Simple but all-in-one plugin implementation. Resembles the look and feel of | |
23 | MFC control-bars. The class handles painting of the pane and the items in it; | |
24 | it generates bar/layout customization events, when the user right-clicks the bar/pane. | |
25 | Hooking an instance of this and row-layout plugins for each pane | |
26 | would be enough for the frame layout to function properly | |
27 | (they are plugged in automatically by the wxFrameLayout class). | |
28 | */ | |
29 | ||
30 | class WXDLLIMPEXP_FL cbPaneDrawPlugin : public cbPluginBase | |
31 | { | |
32 | public: | |
33 | DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin ) | |
34 | protected: | |
35 | ||
36 | // resizing bars/rows state variables | |
37 | bool mResizeStarted; | |
38 | bool mResizeCursorOn; | |
39 | wxPoint mDragOrigin; | |
40 | ||
41 | cbBarInfo* mpDraggedBar; // also used when in bar-drag action | |
42 | cbRowInfo* mpResizedRow; | |
43 | ||
44 | bool mRowHandleHitted; | |
45 | bool mIsUpperHandle; | |
46 | bool mBarHandleHitted; | |
47 | bool mIsLeftHandle; | |
48 | bool mBarContentHitted; | |
49 | ||
50 | // contstraints for dragging the handle | |
51 | wxRect mHandleDragArea; | |
52 | bool mHandleIsVertical; | |
53 | int mHandleOfs; | |
54 | int mDraggedDelta; | |
55 | wxPoint mPrevPos; | |
56 | ||
57 | // used for handling, start-draw-in-area events | |
58 | wxClientDC* mpClntDc; | |
59 | ||
60 | cbDockPane* mpPane; // is set up temorary short-cut, while handling event | |
61 | ||
62 | protected: | |
63 | // Internal helper: draws the dragged handle. | |
64 | void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane ); | |
65 | ||
66 | // Internal helper: draws the pane shading. | |
67 | virtual void DrawPaneShade( wxDC& dc, int alignment ); | |
68 | ||
69 | // Internal helper: draws the pane shading for a row. | |
70 | virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc ); | |
71 | ||
72 | // Internal helper: draws the upper row handle. | |
73 | virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc ); | |
74 | ||
75 | // Internal helper: draws the lower row handle. | |
76 | virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc ); | |
77 | ||
78 | // Internal helper: draws the upper row shading. | |
79 | virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level ); | |
80 | ||
81 | // Internal helper: draws the lower row shading. | |
82 | virtual void DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level ); | |
83 | ||
84 | // Internal helper: draws the inner bar shading. | |
85 | virtual void DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc ); | |
86 | ||
87 | // Internal helper: draws shading. | |
88 | virtual void DrawShade( int level, wxRect& rect, int alignment, wxDC& dc ); | |
89 | ||
90 | // Internal helper: draws shading. | |
91 | virtual void DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc ); | |
92 | ||
93 | // Internal helper: sets a light pixel at the given location. | |
94 | inline void SetLightPixel( int x, int y, wxDC& dc ); | |
95 | ||
96 | // Internal helper: sets a dark pixel at the given location. | |
97 | inline void SetDarkPixel ( int x, int y, wxDC& dc ); | |
98 | ||
99 | public: | |
100 | // Default constructor. | |
101 | cbPaneDrawPlugin(); | |
102 | ||
103 | // Constructor taking frame layout pane and a pane mask. | |
104 | cbPaneDrawPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
105 | ||
106 | // Destructor. | |
107 | virtual ~cbPaneDrawPlugin(); | |
108 | ||
109 | // Clone function, returning a new instance of this class. | |
110 | virtual cbPluginBase* Clone() { return new cbPaneDrawPlugin(0,0); } | |
111 | ||
112 | // Handler for left mouse button down events. | |
113 | void OnLButtonDown( cbLeftDownEvent& event ); | |
114 | ||
115 | // Handler for left double-click mouse button down events. | |
116 | void OnLDblClick ( cbLeftDClickEvent& event ); | |
117 | ||
118 | // Handler for left mouse button up events. | |
119 | void OnLButtonUp ( cbLeftUpEvent& event ); | |
120 | ||
121 | // Handler for right mouse button up events. | |
122 | void OnRButtonUp ( cbRightUpEvent& event ); | |
123 | ||
124 | // Handler for mouse move events. | |
125 | void OnMouseMove ( cbMotionEvent& event ); | |
126 | ||
127 | // Handler for draw pane background events. | |
128 | void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent& event ); | |
129 | ||
130 | // Handler for draw pane decoration events. | |
131 | void OnDrawPaneDecorations( cbDrawPaneDecorEvent& event ); | |
132 | ||
133 | // Handler for draw row decoration events. | |
134 | void OnDrawRowDecorations ( cbDrawRowDecorEvent& event ); | |
135 | ||
136 | // Handler for draw row handles events. | |
137 | void OnDrawRowHandles ( cbDrawRowHandlesEvent& event ); | |
138 | ||
139 | // Handler for draw row background events. | |
140 | void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event ); | |
141 | ||
142 | // Handler for bar size events. | |
143 | void OnSizeBarWindow ( cbSizeBarWndEvent& event ); | |
144 | ||
145 | // Handler for draw bar decorations events. | |
146 | void OnDrawBarDecorations ( cbDrawBarDecorEvent& event ); | |
147 | ||
148 | // Handler for draw bar handles events. | |
149 | void OnDrawBarHandles ( cbDrawBarHandlesEvent& event ); | |
150 | ||
151 | // Handler for start draw in area events. | |
152 | void OnStartDrawInArea ( cbStartDrawInAreaEvent& event ); | |
153 | ||
154 | // Handler for finish draw in area events. | |
155 | void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event ); | |
156 | ||
157 | DECLARE_EVENT_TABLE() | |
158 | }; | |
159 | ||
160 | #endif /* __PANEDRAWPL_G__ */ | |
161 |