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