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 #include "wx/fl/controlbar.h"
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).
26 class WXDLLIMPEXP_FL cbPaneDrawPlugin
: public cbPluginBase
29 DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin
)
32 // resizing bars/rows state variables
37 cbBarInfo
* mpDraggedBar
; // also used when in bar-drag action
38 cbRowInfo
* mpResizedRow
;
40 bool mRowHandleHitted
;
42 bool mBarHandleHitted
;
44 bool mBarContentHitted
;
46 // contstraints for dragging the handle
47 wxRect mHandleDragArea
;
48 bool mHandleIsVertical
;
53 // used for handling, start-draw-in-area events
56 cbDockPane
* mpPane
; // is set up temorary short-cut, while handling event
59 // Internal helper: draws the dragged handle.
60 void DrawDraggedHandle( const wxPoint
& pos
, cbDockPane
& pane
);
62 // Internal helper: draws the pane shading.
63 virtual void DrawPaneShade( wxDC
& dc
, int alignment
);
65 // Internal helper: draws the pane shading for a row.
66 virtual void DrawPaneShadeForRow( cbRowInfo
* pRow
, wxDC
& dc
);
68 // Internal helper: draws the upper row handle.
69 virtual void DrawUpperRowHandle( cbRowInfo
* pRow
, wxDC
& dc
);
71 // Internal helper: draws the lower row handle.
72 virtual void DrawLowerRowHandle( cbRowInfo
* pRow
, wxDC
& dc
);
74 // Internal helper: draws the upper row shading.
75 virtual void DrawUpperRowShades( cbRowInfo
* pRow
, wxDC
& dc
, int level
);
77 // Internal helper: draws the lower row shading.
78 virtual void DrawLowerRowShades( cbRowInfo
* pRow
, wxDC
& dc
, int level
);
80 // Internal helper: draws the inner bar shading.
81 virtual void DrawBarInnerShadeRect( cbBarInfo
* pBar
, wxDC
& dc
);
83 // Internal helper: draws shading.
84 virtual void DrawShade( int level
, wxRect
& rect
, int alignment
, wxDC
& dc
);
86 // Internal helper: draws shading.
87 virtual void DrawShade1( int level
, wxRect
& rect
, int alignment
, wxDC
& dc
);
89 // Internal helper: sets a light pixel at the given location.
90 inline void SetLightPixel( int x
, int y
, wxDC
& dc
);
92 // Internal helper: sets a dark pixel at the given location.
93 inline void SetDarkPixel ( int x
, int y
, wxDC
& dc
);
96 // Default constructor.
99 // Constructor taking frame layout pane and a pane mask.
100 cbPaneDrawPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
103 virtual ~cbPaneDrawPlugin();
105 // Clone function, returning a new instance of this class.
106 virtual cbPluginBase
* Clone() { return new cbPaneDrawPlugin(0,0); }
108 // Handler for left mouse button down events.
109 void OnLButtonDown( cbLeftDownEvent
& event
);
111 // Handler for left double-click mouse button down events.
112 void OnLDblClick ( cbLeftDClickEvent
& event
);
114 // Handler for left mouse button up events.
115 void OnLButtonUp ( cbLeftUpEvent
& event
);
117 // Handler for right mouse button up events.
118 void OnRButtonUp ( cbRightUpEvent
& event
);
120 // Handler for mouse move events.
121 void OnMouseMove ( cbMotionEvent
& event
);
123 // Handler for draw pane background events.
124 void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent
& event
);
126 // Handler for draw pane decoration events.
127 void OnDrawPaneDecorations( cbDrawPaneDecorEvent
& event
);
129 // Handler for draw row decoration events.
130 void OnDrawRowDecorations ( cbDrawRowDecorEvent
& event
);
132 // Handler for draw row handles events.
133 void OnDrawRowHandles ( cbDrawRowHandlesEvent
& event
);
135 // Handler for draw row background events.
136 void OnDrawRowBackground ( cbDrawRowBkGroundEvent
& event
);
138 // Handler for bar size events.
139 void OnSizeBarWindow ( cbSizeBarWndEvent
& event
);
141 // Handler for draw bar decorations events.
142 void OnDrawBarDecorations ( cbDrawBarDecorEvent
& event
);
144 // Handler for draw bar handles events.
145 void OnDrawBarHandles ( cbDrawBarHandlesEvent
& event
);
147 // Handler for start draw in area events.
148 void OnStartDrawInArea ( cbStartDrawInAreaEvent
& event
);
150 // Handler for finish draw in area events.
151 void OnFinishDrawInArea ( cbFinishDrawInAreaEvent
& event
);
153 DECLARE_EVENT_TABLE()
156 #endif /* __PANEDRAWPL_G__ */