wxWidgets/include/wx/univ/scrarrow.h
Vadim Zeitlin 3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00

112 lines
4.1 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wx/univ/scrarrow.h
// Purpose: wxScrollArrows class
// Author: Vadim Zeitlin
// Modified by:
// Created: 22.01.01
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIV_SCRARROW_H_
#define _WX_UNIV_SCRARROW_H_
// ----------------------------------------------------------------------------
// wxScrollArrows is not a control but just a class containing the common
// functionality of scroll arrows, whether part of scrollbars, spin ctrls or
// anything else.
//
// To customize its behaviour, wxScrollArrows doesn't use any virtual methods
// but instead a callback pointer to a wxControlWithArrows object which is used
// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need
// to derive from the wxControlWithArrows interface and implement its methods.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxControlWithArrows;
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
class WXDLLIMPEXP_FWD_CORE wxRect;
class WXDLLIMPEXP_FWD_CORE wxRenderer;
// ----------------------------------------------------------------------------
// wxScrollArrows: an abstraction of scrollbar arrow
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxScrollArrows
{
public:
enum Arrow
{
Arrow_None = -1,
Arrow_First, // left or top
Arrow_Second, // right or bottom
Arrow_Max
};
// ctor requires a back pointer to wxControlWithArrows
wxScrollArrows(wxControlWithArrows *control);
// draws the arrow on the given DC in the given rectangle, uses
// wxControlWithArrows::GetArrowState() to get its current state
void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect,
bool scrollbarLike = false) const;
// process a mouse move, enter or leave event, possibly calling
// wxControlWithArrows::SetArrowState() if
// wxControlWithArrows::HitTestArrow() says that the mouse has left/entered
// an arrow
bool HandleMouseMove(const wxMouseEvent& event) const;
// process a mouse click event
bool HandleMouse(const wxMouseEvent& event) const;
// dtor
~wxScrollArrows();
private:
// set or clear the wxCONTROL_CURRENT flag for the arrow
void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const;
// the main control
wxControlWithArrows *m_control;
// the data for the mouse capture
struct wxScrollArrowCaptureData *m_captureData;
};
// ----------------------------------------------------------------------------
// wxControlWithArrows: interface implemented by controls using wxScrollArrows
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlWithArrows
{
public:
virtual ~wxControlWithArrows() {}
// get the renderer to use for drawing the arrows
virtual wxRenderer *GetRenderer() const = 0;
// get the controls window (used for mouse capturing)
virtual wxWindow *GetWindow() = 0;
// get the orientation of the arrows (vertical or horizontal)
virtual bool IsVertical() const = 0;
// get the state of this arrow as combination of wxCONTROL_XXX flags
virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0;
// set or clear the specified flag in the arrow state: this function is
// responsible for refreshing the control
virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
int flag, bool set = true) = 0;
// hit testing: return on which arrow the point is (or Arrow_None)
virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0;
// called when the arrow is pressed, return true to continue scrolling and
// false to stop it
virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
};
#endif // _WX_UNIV_SCRARROW_H_