1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: cbPaneDrawPlugin class header.
4 // Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __PANEDRAWPL_G__
13 #define __PANEDRAWPL_G__
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "panedrawpl.h"
19 #include "wx/fl/controlbar.h"
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).
30 class WXDLLIMPEXP_FL cbPaneDrawPlugin
: public cbPluginBase
33 DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin
)
36 // resizing bars/rows state variables
41 cbBarInfo
* mpDraggedBar
; // also used when in bar-drag action
42 cbRowInfo
* mpResizedRow
;
44 bool mRowHandleHitted
;
46 bool mBarHandleHitted
;
48 bool mBarContentHitted
;
50 // contstraints for dragging the handle
51 wxRect mHandleDragArea
;
52 bool mHandleIsVertical
;
57 // used for handling, start-draw-in-area events
60 cbDockPane
* mpPane
; // is set up temorary short-cut, while handling event
63 // Internal helper: draws the dragged handle.
64 void DrawDraggedHandle( const wxPoint
& pos
, cbDockPane
& pane
);
66 // Internal helper: draws the pane shading.
67 virtual void DrawPaneShade( wxDC
& dc
, int alignment
);
69 // Internal helper: draws the pane shading for a row.
70 virtual void DrawPaneShadeForRow( cbRowInfo
* pRow
, wxDC
& dc
);
72 // Internal helper: draws the upper row handle.
73 virtual void DrawUpperRowHandle( cbRowInfo
* pRow
, wxDC
& dc
);
75 // Internal helper: draws the lower row handle.
76 virtual void DrawLowerRowHandle( cbRowInfo
* pRow
, wxDC
& dc
);
78 // Internal helper: draws the upper row shading.
79 virtual void DrawUpperRowShades( cbRowInfo
* pRow
, wxDC
& dc
, int level
);
81 // Internal helper: draws the lower row shading.
82 virtual void DrawLowerRowShades( cbRowInfo
* pRow
, wxDC
& dc
, int level
);
84 // Internal helper: draws the inner bar shading.
85 virtual void DrawBarInnerShadeRect( cbBarInfo
* pBar
, wxDC
& dc
);
87 // Internal helper: draws shading.
88 virtual void DrawShade( int level
, wxRect
& rect
, int alignment
, wxDC
& dc
);
90 // Internal helper: draws shading.
91 virtual void DrawShade1( int level
, wxRect
& rect
, int alignment
, wxDC
& dc
);
93 // Internal helper: sets a light pixel at the given location.
94 inline void SetLightPixel( int x
, int y
, wxDC
& dc
);
96 // Internal helper: sets a dark pixel at the given location.
97 inline void SetDarkPixel ( int x
, int y
, wxDC
& dc
);
100 // Default constructor.
103 // Constructor taking frame layout pane and a pane mask.
104 cbPaneDrawPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
107 virtual ~cbPaneDrawPlugin();
109 // Clone function, returning a new instance of this class.
110 virtual cbPluginBase
* Clone() { return new cbPaneDrawPlugin(0,0); }
112 // Handler for left mouse button down events.
113 void OnLButtonDown( cbLeftDownEvent
& event
);
115 // Handler for left double-click mouse button down events.
116 void OnLDblClick ( cbLeftDClickEvent
& event
);
118 // Handler for left mouse button up events.
119 void OnLButtonUp ( cbLeftUpEvent
& event
);
121 // Handler for right mouse button up events.
122 void OnRButtonUp ( cbRightUpEvent
& event
);
124 // Handler for mouse move events.
125 void OnMouseMove ( cbMotionEvent
& event
);
127 // Handler for draw pane background events.
128 void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent
& event
);
130 // Handler for draw pane decoration events.
131 void OnDrawPaneDecorations( cbDrawPaneDecorEvent
& event
);
133 // Handler for draw row decoration events.
134 void OnDrawRowDecorations ( cbDrawRowDecorEvent
& event
);
136 // Handler for draw row handles events.
137 void OnDrawRowHandles ( cbDrawRowHandlesEvent
& event
);
139 // Handler for draw row background events.
140 void OnDrawRowBackground ( cbDrawRowBkGroundEvent
& event
);
142 // Handler for bar size events.
143 void OnSizeBarWindow ( cbSizeBarWndEvent
& event
);
145 // Handler for draw bar decorations events.
146 void OnDrawBarDecorations ( cbDrawBarDecorEvent
& event
);
148 // Handler for draw bar handles events.
149 void OnDrawBarHandles ( cbDrawBarHandlesEvent
& event
);
151 // Handler for start draw in area events.
152 void OnStartDrawInArea ( cbStartDrawInAreaEvent
& event
);
154 // Handler for finish draw in area events.
155 void OnFinishDrawInArea ( cbFinishDrawInAreaEvent
& event
);
157 DECLARE_EVENT_TABLE()
160 #endif /* __PANEDRAWPL_G__ */