2019-08-01 22:20:24 +02:00
|
|
|
/* Copyright (C) 2019 Wildfire Games.
|
2009-04-18 19:00:33 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2003-12-27 07:26:03 +01:00
|
|
|
/*
|
|
|
|
A GUI ScrollBar
|
|
|
|
|
|
|
|
--Overview--
|
|
|
|
|
|
|
|
A GUI Scrollbar, this class doesn't present all functionality
|
|
|
|
to the scrollbar, it just controls the drawing and a wrapper
|
|
|
|
for interaction with it.
|
|
|
|
|
|
|
|
--Usage--
|
|
|
|
|
|
|
|
Used in everywhere scrollbars are needed, like in a combobox for instance.
|
|
|
|
|
|
|
|
--More info--
|
|
|
|
|
|
|
|
Check GUI.h
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_CGUISCROLLBARVERTICAL
|
|
|
|
#define INCLUDED_CGUISCROLLBARVERTICAL
|
2003-12-27 07:26:03 +01:00
|
|
|
|
2009-12-03 21:17:22 +01:00
|
|
|
#include "IGUIScrollBar.h"
|
2003-12-27 07:26:03 +01:00
|
|
|
#include "GUI.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Vertical implementation of IGUIScrollBar
|
|
|
|
*
|
|
|
|
* @see IGUIScrollBar
|
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
class CGUIScrollBarVertical : public IGUIScrollBar
|
2003-12-27 07:26:03 +01:00
|
|
|
{
|
|
|
|
public:
|
2019-08-01 22:20:24 +02:00
|
|
|
CGUIScrollBarVertical(CGUI* pGUI);
|
2004-05-29 06:06:50 +02:00
|
|
|
virtual ~CGUIScrollBarVertical();
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Draw the scroll-bar
|
|
|
|
*/
|
|
|
|
virtual void Draw();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If an object that contains a scrollbar has got messages, send
|
|
|
|
* them to the scroll-bar and it will see if the message regarded
|
|
|
|
* itself.
|
|
|
|
*
|
2011-04-28 22:42:11 +02:00
|
|
|
* @see IGUIObject#HandleMessage()
|
2003-12-27 07:26:03 +01:00
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
virtual void HandleMessage(SGUIMessage& Message);
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
/**
|
2013-08-26 06:17:26 +02:00
|
|
|
* Set m_Pos with g_mouse_x/y input, i.e. when dragging.
|
2003-12-27 07:26:03 +01:00
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
virtual void SetPosFromMousePos(const CPos& mouse);
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see IGUIScrollBar#HoveringButtonMinus
|
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
virtual bool HoveringButtonMinus(const CPos& mouse);
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see IGUIScrollBar#HoveringButtonPlus
|
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
virtual bool HoveringButtonPlus(const CPos& mouse);
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Right Aligned
|
|
|
|
* @param align Alignment
|
|
|
|
*/
|
2015-08-21 19:08:41 +02:00
|
|
|
void SetRightAligned(const bool& align) { m_RightAligned = align; }
|
2003-12-27 07:26:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the rectangle of the actual BAR.
|
|
|
|
* @return Rectangle, CRect
|
|
|
|
*/
|
|
|
|
virtual CRect GetBarRect() const;
|
|
|
|
|
2004-05-29 06:06:50 +02:00
|
|
|
/**
|
|
|
|
* Get the rectangle of the outline of the scrollbar, every component of the
|
|
|
|
* scroll-bar should be inside this area.
|
|
|
|
* @return Rectangle, CRect
|
|
|
|
*/
|
|
|
|
virtual CRect GetOuterRect() const;
|
|
|
|
|
2005-04-07 11:13:10 +02:00
|
|
|
protected:
|
2003-12-27 07:26:03 +01:00
|
|
|
/**
|
|
|
|
* Should the scroll bar proceed to the left or to the right of the m_X value.
|
|
|
|
* Notice, this has nothing to do with where the owner places it.
|
|
|
|
*/
|
|
|
|
bool m_RightAligned;
|
|
|
|
};
|
|
|
|
|
2015-08-21 19:08:41 +02:00
|
|
|
#endif // INCLUDED_CGUISCROLLBARVERTICAL
|