2007-05-20 11:03:49 -07:00
|
|
|
// Copyright (C) 2002-2007 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __C_GUI_TAB_CONTROL_H_INCLUDED__
|
|
|
|
#define __C_GUI_TAB_CONTROL_H_INCLUDED__
|
|
|
|
|
2007-07-25 22:30:19 -07:00
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
#include "IGUITabControl.h"
|
|
|
|
#include "irrArray.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace gui
|
|
|
|
{
|
|
|
|
// A tab, onto which other gui elements could be added.
|
|
|
|
class CGUITab : public IGUITab
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CGUITab(s32 number, IGUIEnvironment* environment,
|
|
|
|
IGUIElement* parent, const core::rect<s32>& rectangle,
|
|
|
|
s32 id);
|
|
|
|
|
|
|
|
//! Returns number of this tab in tabcontrol. Can be accessed
|
|
|
|
//! later IGUITabControl::getTab() by this number.
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual s32 getNumber() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Sets the number
|
|
|
|
virtual void setNumber(s32 n);
|
|
|
|
|
|
|
|
//! draws the element and its children
|
|
|
|
virtual void draw();
|
|
|
|
|
|
|
|
//! sets if the tab should draw its background
|
|
|
|
virtual void setDrawBackground(bool draw=true);
|
|
|
|
|
|
|
|
//! sets the color of the background, if it should be drawn.
|
|
|
|
virtual void setBackgroundColor(video::SColor c);
|
|
|
|
|
2007-05-26 13:44:25 -07:00
|
|
|
//! returns true if the tab is drawing its background, false if not
|
|
|
|
virtual bool isDrawingBackground() const;
|
|
|
|
|
|
|
|
//! returns the color of the background
|
|
|
|
virtual video::SColor getBackgroundColor() const;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Writes attributes of the element.
|
2007-09-14 15:25:59 -07:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Reads attributes of the element
|
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
s32 Number;
|
|
|
|
bool DrawBackground;
|
|
|
|
video::SColor BackColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! A standard tab control
|
|
|
|
class CGUITabControl : public IGUITabControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
CGUITabControl(IGUIEnvironment* environment,
|
|
|
|
IGUIElement* parent, const core::rect<s32>& rectangle,
|
|
|
|
bool fillbackground=true, bool border=true, s32 id=-1);
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
virtual ~CGUITabControl();
|
|
|
|
|
|
|
|
//! Adds a tab
|
|
|
|
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1);
|
|
|
|
|
|
|
|
//! Adds a tab that has already been created
|
|
|
|
virtual void addTab(CGUITab* tab);
|
|
|
|
|
|
|
|
//! Returns amount of tabs in the tabcontrol
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual s32 getTabCount() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns a tab based on zero based index
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual IGUITab* getTab(s32 idx) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Brings a tab to front.
|
|
|
|
virtual bool setActiveTab(s32 idx);
|
|
|
|
|
|
|
|
//! Brings a tab to front.
|
|
|
|
virtual bool setActiveTab(IGUIElement *tab);
|
|
|
|
|
|
|
|
//! Returns which tab is currently active
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual s32 getActiveTab() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! called if an event happened.
|
|
|
|
virtual bool OnEvent(SEvent event);
|
|
|
|
|
|
|
|
//! draws the element and its children
|
|
|
|
virtual void draw();
|
|
|
|
|
|
|
|
//! Removes a child.
|
|
|
|
virtual void removeChild(IGUIElement* child);
|
|
|
|
|
|
|
|
//! Writes attributes of the element.
|
2007-09-14 15:25:59 -07:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Reads attributes of the element
|
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void selectTab(core::position2d<s32> p);
|
|
|
|
|
|
|
|
core::array<CGUITab*> Tabs;
|
|
|
|
s32 ActiveTab;
|
|
|
|
bool Border;
|
|
|
|
bool FillBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace gui
|
|
|
|
} // end namespace irr
|
|
|
|
|
2007-07-25 22:30:19 -07:00
|
|
|
#endif // _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
#endif
|
|
|
|
|