2019-03-18 15:15:40 -07:00
|
|
|
/* Copyright (C) 2019 Wildfire Games.
|
2009-04-18 10:00:33 -07: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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2004-06-03 11:38:14 -07:00
|
|
|
#include "precompiled.h"
|
2003-12-26 22:26:03 -08:00
|
|
|
|
2019-09-20 06:11:18 -07:00
|
|
|
#include "IGUIScrollBarOwner.h"
|
|
|
|
|
|
2019-09-18 13:51:45 -07:00
|
|
|
#include "gui/CGUI.h"
|
2019-09-20 06:11:18 -07:00
|
|
|
#include "gui/IGUIScrollBar.h"
|
2003-12-26 22:26:03 -08:00
|
|
|
|
2019-09-30 07:08:14 -07:00
|
|
|
IGUIScrollBarOwner::IGUIScrollBarOwner(IGUIObject& pObject)
|
|
|
|
|
: m_pObject(pObject)
|
2003-12-26 22:26:03 -08:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IGUIScrollBarOwner::~IGUIScrollBarOwner()
|
|
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
for (IGUIScrollBar* const& sb : m_ScrollBars)
|
|
|
|
|
delete sb;
|
2003-12-26 22:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IGUIScrollBarOwner::ResetStates()
|
|
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
for (IGUIScrollBar* const& sb : m_ScrollBars)
|
|
|
|
|
sb->SetBarPressed(false);
|
2003-12-26 22:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
void IGUIScrollBarOwner::AddScrollBar(IGUIScrollBar* scrollbar)
|
2003-12-26 22:26:03 -08:00
|
|
|
{
|
|
|
|
|
scrollbar->SetHostObject(this);
|
|
|
|
|
m_ScrollBars.push_back(scrollbar);
|
|
|
|
|
}
|
2004-08-30 19:09:58 -07:00
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
const SGUIScrollBarStyle* IGUIScrollBarOwner::GetScrollBarStyle(const CStr& style) const
|
2003-12-26 22:26:03 -08:00
|
|
|
{
|
2019-09-30 07:08:14 -07:00
|
|
|
return m_pObject.GetGUI().GetScrollBarStyle(style);
|
2003-12-26 22:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
void IGUIScrollBarOwner::HandleMessage(SGUIMessage& msg)
|
2003-12-26 22:26:03 -08:00
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
for (IGUIScrollBar* const& sb : m_ScrollBars)
|
|
|
|
|
sb->HandleMessage(msg);
|
2003-12-26 22:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
void IGUIScrollBarOwner::Draw()
|
2003-12-26 22:26:03 -08:00
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
for (IGUIScrollBar* const& sb : m_ScrollBars)
|
|
|
|
|
sb->Draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float IGUIScrollBarOwner::GetScrollBarPos(const int index) const
|
|
|
|
|
{
|
|
|
|
|
return m_ScrollBars[index]->GetPos();
|
2004-06-10 19:14:18 -07:00
|
|
|
}
|