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: barhintspl.h 35650 2005-09-23 12:56:45Z MR $
8// Copyright:   (c) Aleksandras Gluchovas
9// Licence:     wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __DRAGHINTSPL_G__
13#define __DRAGHINTSPL_G__
14
15#include "wx/fl/controlbar.h"
16#include "wx/fl/toolwnd.h"
17
18/*
19This class intercepts bar-decoration and sizing events, and draws 3D hints
20around fixed and flexible bars, similar to those in Microsoft DevStudio 6.x
21*/
22
23class WXDLLIMPEXP_FL cbBarHintsPlugin : public cbPluginBase
24{
25    DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin )
26
27protected:
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
37protected:
38        // Helper function: draws a 3D box.
39    void Draw3DBox      ( wxDC& dc, const wxPoint& pos, bool pressed );
40
41        // Helper function: draws a close box.
42    void DrawCloseBox   ( wxDC& dc, const wxPoint& pos, bool pressed );
43
44        // Helper function: draws a collapse box.
45    void DrawCollapseBox( wxDC& dc, const wxPoint& pos,
46                          bool atLeft, bool disabled, bool pressed );
47
48        // Helper function: draws grooves.
49    void DrawGrooves    ( wxDC& dc, const wxPoint& pos, int length );
50
51        // Helper function: draws a hint.
52    void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed );
53
54        // Helper function: gets the layout of a hint.
55    void GetHintsLayout( wxRect& rect, cbBarInfo& info,
56                         int& boxOfs, int& grooveOfs, int& pos );
57
58        // Helper function: returns information about the hint under the given position.
59    int HitTestHints( cbBarInfo& info, const wxPoint& pos );
60
61        // Helper function.
62    void ExcludeHints( wxRect& rect, cbBarInfo& info );
63
64        // Helper function: creates close and collapse boxes.
65    void CreateBoxes();
66
67public:
68    /* public properties */
69
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)
75
76public:
77        // Default constructor.
78    cbBarHintsPlugin(void);
79
80        // Constructor, taking parent frame and pane mask flag.
81    cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
82
83        // Destructor.
84    ~cbBarHintsPlugin();
85
86        // Set the number of grooves to be shown in the pane.
87    void SetGrooveCount( int nGrooves );
88
89        // Called to initialize this plugin.
90    void OnInitPlugin();
91
92        // Handles a plugin event.
93    void OnSizeBarWindow( cbSizeBarWndEvent& event );
94
95        // Handles a plugin event.
96    void OnDrawBarDecorations( cbDrawBarDecorEvent& event );
97
98        // Handles a plugin event.
99    void OnLeftDown( cbLeftDownEvent& event );
100
101        // Handles a plugin event.
102    void OnLeftUp  ( cbLeftUpEvent&   event );
103
104        // Handles a plugin event.
105    void OnMotion  ( cbMotionEvent&   event );
106
107    DECLARE_EVENT_TABLE()
108};
109
110#endif /* __DRAGHINTSPL_G__ */
111
112