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