#ifndef __C_GUI_SCROLL_BAR_H_INCLUDED__
#define __C_GUI_SCROLL_BAR_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIScrollBar.h"
#include "IGUIButton.h"
namespace irr
{
namespace gui
{
class CGUIScrollBar : public IGUIScrollBar
{
public:
CGUIScrollBar(bool horizontal, IGUIEnvironment* environment,
IGUIElement* parent, s32 id, core::rect<s32> rectangle,
bool noclip=false);
virtual ~CGUIScrollBar();
virtual bool OnEvent(const SEvent& event);
virtual void draw();
virtual void OnPostRender(u32 timeMs);
virtual s32 getMax() const;
virtual void setMax(s32 max);
virtual s32 getMin() const;
virtual void setMin(s32 min);
virtual s32 getSmallStep() const;
virtual void setSmallStep(s32 step);
virtual s32 getLargeStep() const;
virtual void setLargeStep(s32 step);
virtual s32 getPos() const;
virtual void setPos(s32 pos);
virtual void updateAbsolutePosition();
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
void refreshControls();
s32 getPosFromMousePos(const core::position2di &p) const;
IGUIButton* UpButton;
IGUIButton* DownButton;
core::rect<s32> SliderRect;
bool Dragging;
bool Horizontal;
bool DraggedBySlider;
bool TrayClick;
s32 Pos;
s32 DrawPos;
s32 DrawHeight;
s32 Min;
s32 Max;
s32 SmallStep;
s32 LargeStep;
s32 DesiredPos;
u32 LastChange;
video::SColor CurrentIconColor;
f32 range () const { return (f32) ( Max - Min ); }
};
}
}
#endif
#endif