]> git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/barhintspl.h
Cleaned up paint DC cache in ~wxPaintDC to avoid spurious memory warning
[wxWidgets.git] / utils / framelayout / src / barhintspl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 30/11/98 (my 22th birthday :-)
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __DRAGHINTSPL_G__
13 #define __DRAGHINTSPL_G__
14
15 #include "controlbar.h"
16 #include "toolwnd.h"
17
18 /*
19 * Intercepts bar-decoration and sizing events, draws 3d-hints
20 * around fixed and flexible bars, similar to those in Microsoft DevStudio 6.x
21 */
22
23 class cbBarHintsPlugin : public cbPluginBase
24 {
25 DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin )
26
27 protected:
28 cbDockPane* mpPane; // is set up temorarely, while handling event
29
30 cbMiniButton* mBoxes[2];
31
32 bool mBtnPressed;
33 bool mClosePressed;
34 cbBarInfo* mpClickedBar;
35 bool mDepressed;
36
37 protected:
38 // drawing helpers
39
40 void Draw3DBox ( wxDC& dc, const wxPoint& pos, bool pressed );
41 void DrawCloseBox ( wxDC& dc, const wxPoint& pos, bool pressed );
42 void DrawCollapseBox( wxDC& dc, const wxPoint& pos,
43 bool atLeft, bool disabled, bool pressed );
44
45 void DrawGrooves ( wxDC& dc, const wxPoint& pos, int length );
46
47 void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed );
48
49 void GetHintsLayout( wxRect& rect, cbBarInfo& info,
50 int& boxOfs, int& grooveOfs, int& pos );
51
52 int HitTestHints( cbBarInfo& info, const wxPoint& pos );
53
54 void ExcludeHints( wxRect& rect, cbBarInfo& info );
55
56 void CreateBoxes();
57
58 public:
59 /* public properties */
60
61 bool mCloseBoxOn; // default: ON
62 bool mCollapseBoxOn; // default: ON
63 int mGrooveCount; // default: 2 (two shaded bars)
64 int mHintGap; // default: 5 (pixels from above, below, right and left)
65 int mXWeight; // default: 2 (width in pixels of lines which used for drawing cross)
66
67 public:
68
69 cbBarHintsPlugin(void);
70
71 cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
72
73 void SetGrooveCount( int nGrooves );
74
75 void OnInitPlugin();
76
77 // handlers of plugin-events
78
79 void OnSizeBarWindow( cbSizeBarWndEvent& event );
80 void OnDrawBarDecorations( cbDrawBarDecorEvent& event );
81
82 void OnLeftDown( cbLeftDownEvent& event );
83 void OnLeftUp ( cbLeftUpEvent& event );
84 void OnMotion ( cbMotionEvent& event );
85
86 DECLARE_EVENT_TABLE()
87 };
88
89 #endif