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