]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/scrarrow.h
gtk_window_[un]fullscreen only available with GTK >= 2.2
[wxWidgets.git] / include / wx / univ / scrarrow.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/scrarrow.h
3 // Purpose: wxScrollArrows class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 22.01.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_SCRARROW_H_
13 #define _WX_UNIV_SCRARROW_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "univscrarrow.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // wxScrollArrows is not a control but just a class containing the common
21 // functionality of scroll arrows, whether part of scrollbars, spin ctrls or
22 // anything else.
23 //
24 // To customize its behaviour, wxScrollArrows doesn't use any virtual methods
25 // but instead a callback pointer to a wxControlWithArrows object which is used
26 // for all control-dependent stuff. Thus, to use wxScrollArrows, you just need
27 // to derive from the wxControlWithArrows interface and implement its methods.
28 // ----------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxControlWithArrows;
31 class WXDLLEXPORT wxDC;
32 class WXDLLEXPORT wxMouseEvent;
33 class WXDLLEXPORT wxRect;
34 class WXDLLEXPORT wxRenderer;
35
36 // ----------------------------------------------------------------------------
37 // wxScrollArrows: an abstraction of scrollbar arrow
38 // ----------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxScrollArrows
41 {
42 public:
43 enum Arrow
44 {
45 Arrow_None = -1,
46 Arrow_First, // left or top
47 Arrow_Second, // right or bottom
48 Arrow_Max
49 };
50
51 // ctor requires a back pointer to wxControlWithArrows
52 wxScrollArrows(wxControlWithArrows *control);
53
54 // draws the arrow on the given DC in the given rectangle, uses
55 // wxControlWithArrows::GetArrowState() to get its current state
56 void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect,
57 bool scrollbarLike = false) const;
58
59 // process a mouse move, enter or leave event, possibly calling
60 // wxControlWithArrows::SetArrowState() if wxControlWithArrows::HitTest()
61 // says that the mosue has left/entered an arrow
62 bool HandleMouseMove(const wxMouseEvent& event) const;
63
64 // process a mouse click event
65 bool HandleMouse(const wxMouseEvent& event) const;
66
67 // dtor
68 ~wxScrollArrows();
69
70 private:
71 // set or clear the wxCONTROL_CURRENT flag for the arrow
72 void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const;
73
74 // the main control
75 wxControlWithArrows *m_control;
76
77 // the data for the mouse capture
78 struct wxScrollArrowCaptureData *m_captureData;
79 };
80
81 // ----------------------------------------------------------------------------
82 // wxControlWithArrows: interface implemented by controls using wxScrollArrows
83 // ----------------------------------------------------------------------------
84
85 class WXDLLEXPORT wxControlWithArrows
86 {
87 public:
88 // get the renderer to use for drawing the arrows
89 virtual wxRenderer *GetRenderer() const = 0;
90
91 // get the controls window (used for mouse capturing)
92 virtual wxWindow *GetWindow() = 0;
93
94 // get the orientation of the arrows (vertical or horizontal)
95 virtual bool IsVertical() const = 0;
96
97 // get the state of this arrow as combination of wxCONTROL_XXX flags
98 virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0;
99
100 // set or clear the specified flag in the arrow state: this function is
101 // responsible for refreshing the control
102 virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
103 int flag, bool set = true) = 0;
104
105 // hit testing: return on which arrow the point is (or Arrow_None)
106 virtual wxScrollArrows::Arrow HitTest(const wxPoint& pt) const = 0;
107
108 // called when the arrow is pressed, return true to continue scrolling and
109 // false to stop it
110 virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
111 };
112
113 #endif // _WX_UNIV_SCRARROW_H_