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