]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: barhintspl.h | |
3 | // Purpose: cbBarHintsPlugin class declaration | |
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 licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __DRAGHINTSPL_G__ | |
13 | #define __DRAGHINTSPL_G__ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(__APPLE__) | |
16 | #pragma interface "barhintspl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | #include "wx/fl/toolwnd.h" | |
21 | ||
22 | /* | |
23 | This class intercepts bar-decoration and sizing events, and draws 3D hints | |
24 | around fixed and flexible bars, similar to those in Microsoft DevStudio 6.x | |
25 | */ | |
26 | ||
27 | class WXDLLIMPEXP_FL cbBarHintsPlugin : public cbPluginBase | |
28 | { | |
29 | DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin ) | |
30 | ||
31 | protected: | |
32 | cbDockPane* mpPane; // is set up temorarely, while handling event | |
33 | ||
34 | cbMiniButton* mBoxes[2]; | |
35 | ||
36 | bool mBtnPressed; | |
37 | bool mClosePressed; | |
38 | cbBarInfo* mpClickedBar; | |
39 | bool mDepressed; | |
40 | ||
41 | protected: | |
42 | // Helper function: draws a 3D box. | |
43 | void Draw3DBox ( wxDC& dc, const wxPoint& pos, bool pressed ); | |
44 | ||
45 | // Helper function: draws a close box. | |
46 | void DrawCloseBox ( wxDC& dc, const wxPoint& pos, bool pressed ); | |
47 | ||
48 | // Helper function: draws a collapse box. | |
49 | void DrawCollapseBox( wxDC& dc, const wxPoint& pos, | |
50 | bool atLeft, bool disabled, bool pressed ); | |
51 | ||
52 | // Helper function: draws grooves. | |
53 | void DrawGrooves ( wxDC& dc, const wxPoint& pos, int length ); | |
54 | ||
55 | // Helper function: draws a hint. | |
56 | void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed ); | |
57 | ||
58 | // Helper function: gets the layout of a hint. | |
59 | void GetHintsLayout( wxRect& rect, cbBarInfo& info, | |
60 | int& boxOfs, int& grooveOfs, int& pos ); | |
61 | ||
62 | // Helper function: returns information about the hint under the given position. | |
63 | int HitTestHints( cbBarInfo& info, const wxPoint& pos ); | |
64 | ||
65 | // Helper function. | |
66 | void ExcludeHints( wxRect& rect, cbBarInfo& info ); | |
67 | ||
68 | // Helper function: creates close and collapse boxes. | |
69 | void CreateBoxes(); | |
70 | ||
71 | public: | |
72 | /* public properties */ | |
73 | ||
74 | bool mCloseBoxOn; // default: ON | |
75 | bool mCollapseBoxOn; // default: ON | |
76 | int mGrooveCount; // default: 2 (two shaded bars) | |
77 | int mHintGap; // default: 5 (pixels from above, below, right and left) | |
78 | int mXWeight; // default: 2 (width in pixels of lines which used for drawing cross) | |
79 | ||
80 | public: | |
81 | // Default constructor. | |
82 | cbBarHintsPlugin(void); | |
83 | ||
84 | // Constructor, taking parent frame and pane mask flag. | |
85 | cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES ); | |
86 | ||
87 | // Destructor. | |
88 | ~cbBarHintsPlugin(); | |
89 | ||
90 | // Set the number of grooves to be shown in the pane. | |
91 | void SetGrooveCount( int nGrooves ); | |
92 | ||
93 | // Called to initialize this plugin. | |
94 | void OnInitPlugin(); | |
95 | ||
96 | // Handles a plugin event. | |
97 | void OnSizeBarWindow( cbSizeBarWndEvent& event ); | |
98 | ||
99 | // Handles a plugin event. | |
100 | void OnDrawBarDecorations( cbDrawBarDecorEvent& event ); | |
101 | ||
102 | // Handles a plugin event. | |
103 | void OnLeftDown( cbLeftDownEvent& event ); | |
104 | ||
105 | // Handles a plugin event. | |
106 | void OnLeftUp ( cbLeftUpEvent& event ); | |
107 | ||
108 | // Handles a plugin event. | |
109 | void OnMotion ( cbMotionEvent& event ); | |
110 | ||
111 | DECLARE_EVENT_TABLE() | |
112 | }; | |
113 | ||
114 | #endif /* __DRAGHINTSPL_G__ */ | |
115 |