]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/scrarrow.h
explained how the signature works
[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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
a3870b2f 16 #pragma interface "univscrarrow.h"
1e6feb95
VZ
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
30class WXDLLEXPORT wxControlWithArrows;
31class WXDLLEXPORT wxDC;
32class WXDLLEXPORT wxMouseEvent;
33class WXDLLEXPORT wxRect;
34class WXDLLEXPORT wxRenderer;
35
36// ----------------------------------------------------------------------------
37// wxScrollArrows: an abstraction of scrollbar arrow
38// ----------------------------------------------------------------------------
39
40class WXDLLEXPORT wxScrollArrows
41{
42public:
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,
a290fa5a 57 bool scrollbarLike = false) const;
1e6feb95
VZ
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
70private:
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
85class WXDLLEXPORT wxControlWithArrows
86{
87public:
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,
a290fa5a 103 int flag, bool set = true) = 0;
1e6feb95
VZ
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
a290fa5a
WS
108 // called when the arrow is pressed, return true to continue scrolling and
109 // false to stop it
1e6feb95
VZ
110 virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
111};
112
113#endif // _WX_UNIV_SCRARROW_H_