]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/scrarrow.h
declare file-related APIs missing under Palm (pflib-missing.diff part of patch 1894861)
[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
b5dbe15d
VS
26class WXDLLIMPEXP_FWD_CORE wxControlWithArrows;
27class WXDLLIMPEXP_FWD_CORE wxDC;
28class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
29class WXDLLIMPEXP_FWD_CORE wxRect;
30class WXDLLIMPEXP_FWD_CORE wxRenderer;
1e6feb95
VZ
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
6236b8b4
VS
56 // wxControlWithArrows::SetArrowState() if
57 // wxControlWithArrows::HitTestArrow() says that the mouse has left/entered
58 // an arrow
1e6feb95
VZ
59 bool HandleMouseMove(const wxMouseEvent& event) const;
60
61 // process a mouse click event
62 bool HandleMouse(const wxMouseEvent& event) const;
63
64 // dtor
65 ~wxScrollArrows();
66
67private:
68 // set or clear the wxCONTROL_CURRENT flag for the arrow
69 void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const;
70
71 // the main control
72 wxControlWithArrows *m_control;
73
74 // the data for the mouse capture
75 struct wxScrollArrowCaptureData *m_captureData;
76};
77
78// ----------------------------------------------------------------------------
79// wxControlWithArrows: interface implemented by controls using wxScrollArrows
80// ----------------------------------------------------------------------------
81
82class WXDLLEXPORT wxControlWithArrows
83{
84public:
23ff76d5
WS
85 virtual ~wxControlWithArrows() {}
86
1e6feb95
VZ
87 // get the renderer to use for drawing the arrows
88 virtual wxRenderer *GetRenderer() const = 0;
89
90 // get the controls window (used for mouse capturing)
91 virtual wxWindow *GetWindow() = 0;
92
93 // get the orientation of the arrows (vertical or horizontal)
94 virtual bool IsVertical() const = 0;
95
96 // get the state of this arrow as combination of wxCONTROL_XXX flags
97 virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0;
98
99 // set or clear the specified flag in the arrow state: this function is
100 // responsible for refreshing the control
101 virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
a290fa5a 102 int flag, bool set = true) = 0;
1e6feb95
VZ
103
104 // hit testing: return on which arrow the point is (or Arrow_None)
6236b8b4 105 virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0;
1e6feb95 106
a290fa5a
WS
107 // called when the arrow is pressed, return true to continue scrolling and
108 // false to stop it
1e6feb95
VZ
109 virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
110};
111
112#endif // _WX_UNIV_SCRARROW_H_