]>
Commit | Line | Data |
---|---|---|
8e08b761 | 1 | ///////////////////////////////////////////////////////////////////////////// |
4cbc57f0 JS |
2 | // Name: panedrawpl.h |
3 | // Purpose: cbPaneDrawPlugin class header. | |
8e08b761 JS |
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 | |
4cbc57f0 | 9 | // Licence: wxWindows licence |
8e08b761 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __PANEDRAWPL_G__ | |
13 | #define __PANEDRAWPL_G__ | |
14 | ||
8e08b761 JS |
15 | #include "wx/fl/controlbar.h" |
16 | ||
17 | /* | |
4cbc57f0 JS |
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 | */ | |
8e08b761 | 25 | |
510b9edb | 26 | class WXDLLIMPEXP_FL cbPaneDrawPlugin : public cbPluginBase |
8e08b761 JS |
27 | { |
28 | public: | |
4cbc57f0 | 29 | DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin ) |
8e08b761 JS |
30 | protected: |
31 | ||
4cbc57f0 JS |
32 | // resizing bars/rows state variables |
33 | bool mResizeStarted; | |
34 | bool mResizeCursorOn; | |
35 | wxPoint mDragOrigin; | |
8e08b761 | 36 | |
4cbc57f0 JS |
37 | cbBarInfo* mpDraggedBar; // also used when in bar-drag action |
38 | cbRowInfo* mpResizedRow; | |
8e08b761 | 39 | |
4cbc57f0 JS |
40 | bool mRowHandleHitted; |
41 | bool mIsUpperHandle; | |
42 | bool mBarHandleHitted; | |
43 | bool mIsLeftHandle; | |
44 | bool mBarContentHitted; | |
8e08b761 | 45 | |
4cbc57f0 JS |
46 | // contstraints for dragging the handle |
47 | wxRect mHandleDragArea; | |
48 | bool mHandleIsVertical; | |
49 | int mHandleOfs; | |
50 | int mDraggedDelta; | |
51 | wxPoint mPrevPos; | |
8e08b761 | 52 | |
4cbc57f0 JS |
53 | // used for handling, start-draw-in-area events |
54 | wxClientDC* mpClntDc; | |
8e08b761 | 55 | |
4cbc57f0 | 56 | cbDockPane* mpPane; // is set up temorary short-cut, while handling event |
8e08b761 JS |
57 | |
58 | protected: | |
4cbc57f0 JS |
59 | // Internal helper: draws the dragged handle. |
60 | void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane ); | |
8e08b761 | 61 | |
4cbc57f0 JS |
62 | // Internal helper: draws the pane shading. |
63 | virtual void DrawPaneShade( wxDC& dc, int alignment ); | |
8e08b761 | 64 | |
4cbc57f0 JS |
65 | // Internal helper: draws the pane shading for a row. |
66 | virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc ); | |
8e08b761 | 67 | |
4cbc57f0 JS |
68 | // Internal helper: draws the upper row handle. |
69 | virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc ); | |
8e08b761 | 70 | |
4cbc57f0 JS |
71 | // Internal helper: draws the lower row handle. |
72 | virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc ); | |
8e08b761 | 73 | |
4cbc57f0 JS |
74 | // Internal helper: draws the upper row shading. |
75 | virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level ); | |
8e08b761 | 76 | |
4cbc57f0 JS |
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 ); | |
8e08b761 JS |
94 | |
95 | public: | |
4cbc57f0 JS |
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 ); | |
8e08b761 | 128 | |
4cbc57f0 JS |
129 | // Handler for draw row decoration events. |
130 | void OnDrawRowDecorations ( cbDrawRowDecorEvent& event ); | |
8e08b761 | 131 | |
4cbc57f0 JS |
132 | // Handler for draw row handles events. |
133 | void OnDrawRowHandles ( cbDrawRowHandlesEvent& event ); | |
8e08b761 | 134 | |
4cbc57f0 JS |
135 | // Handler for draw row background events. |
136 | void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event ); | |
8e08b761 | 137 | |
4cbc57f0 JS |
138 | // Handler for bar size events. |
139 | void OnSizeBarWindow ( cbSizeBarWndEvent& event ); | |
8e08b761 | 140 | |
4cbc57f0 JS |
141 | // Handler for draw bar decorations events. |
142 | void OnDrawBarDecorations ( cbDrawBarDecorEvent& event ); | |
8e08b761 | 143 | |
4cbc57f0 JS |
144 | // Handler for draw bar handles events. |
145 | void OnDrawBarHandles ( cbDrawBarHandlesEvent& event ); | |
8e08b761 | 146 | |
4cbc57f0 JS |
147 | // Handler for start draw in area events. |
148 | void OnStartDrawInArea ( cbStartDrawInAreaEvent& event ); | |
8e08b761 | 149 | |
4cbc57f0 JS |
150 | // Handler for finish draw in area events. |
151 | void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event ); | |
8e08b761 | 152 | |
4cbc57f0 | 153 | DECLARE_EVENT_TABLE() |
8e08b761 JS |
154 | }; |
155 | ||
156 | #endif /* __PANEDRAWPL_G__ */ | |
157 |