bullet3/examples/ThirdPartyLibs/Gwen/Controls/ScrollBarBar.cpp
erwincoumans ab8f16961e Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
2018-09-23 14:17:31 -07:00

56 lines
1.0 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "Gwen/Controls/ScrollBar.h"
#include "Gwen/Controls/ScrollBarBar.h"
using namespace Gwen;
using namespace Gwen::Controls;
using namespace Gwen::ControlsInternal;
//Actual bar representing height of parent
GWEN_CONTROL_CONSTRUCTOR(ScrollBarBar)
{
RestrictToParent(true);
SetTarget(this);
}
void ScrollBarBar::Render(Skin::Base* skin)
{
skin->DrawScrollBarBar(this, m_bDepressed, IsHovered(), m_bHorizontal);
BaseClass::Render(skin);
}
void ScrollBarBar::OnMouseMoved(int x, int y, int deltaX, int deltaY)
{
BaseClass::OnMouseMoved(x, y, deltaX, deltaY);
if (!m_bDepressed)
return;
InvalidateParent();
}
void ScrollBarBar::OnMouseClickLeft(int x, int y, bool bDown)
{
BaseClass::OnMouseClickLeft(x, y, bDown);
InvalidateParent();
}
void ScrollBarBar::Layout(Skin::Base* /*skin*/)
{
if (!GetParent())
return;
//Move to our current position to force clamping - is this a hack?
MoveTo(X(), Y());
}
void ScrollBarBar::MoveTo(int x, int y)
{
BaseClass::MoveTo(x, y);
}