1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __I_GUI_TAB_CONTROL_H_INCLUDED__
6
#define __I_GUI_TAB_CONTROL_H_INCLUDED__
8
#include "IGUIElement.h"
16
//! A tab-page, onto which other gui elements could be added.
17
/** IGUITab refers to the page itself, not to the tab in the tabbar of an IGUITabControl. */
18
class IGUITab : public IGUIElement
23
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
24
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
26
//! Returns zero based index of tab if in tabcontrol.
27
/** Can be accessed later IGUITabControl::getTab() by this number.
28
Note that this number can change when other tabs are inserted or removed .
30
virtual s32 getNumber() const = 0;
32
//! sets if the tab should draw its background
33
virtual void setDrawBackground(bool draw=true) = 0;
35
//! sets the color of the background, if it should be drawn.
36
virtual void setBackgroundColor(video::SColor c) = 0;
38
//! returns true if the tab is drawing its background, false if not
39
virtual bool isDrawingBackground() const = 0;
41
//! returns the color of the background
42
virtual video::SColor getBackgroundColor() const = 0;
44
//! sets the color of the text
45
virtual void setTextColor(video::SColor c) = 0;
47
//! gets the color of the text
48
virtual video::SColor getTextColor() const = 0;
51
//! A standard tab control
52
class IGUITabControl : public IGUIElement
57
IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
58
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
61
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
63
//! Insert the tab at the given index
64
/** \return The tab on success or NULL on failure. */
65
virtual IGUITab* insertTab(s32 idx, const wchar_t* caption, s32 id=-1) = 0;
67
//! Removes a tab from the tabcontrol
68
virtual void removeTab(s32 idx) = 0;
70
//! Clears the tabcontrol removing all tabs
71
virtual void clear() = 0;
73
//! Returns amount of tabs in the tabcontrol
74
virtual s32 getTabCount() const = 0;
76
//! Returns a tab based on zero based index
77
/** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
78
\return Returns pointer to the Tab. Returns 0 if no tab
79
is corresponding to this tab. */
80
virtual IGUITab* getTab(s32 idx) const = 0;
82
//! Brings a tab to front.
83
/** \param idx: number of the tab.
84
\return Returns true if successful. */
85
virtual bool setActiveTab(s32 idx) = 0;
87
//! Brings a tab to front.
88
/** \param tab: pointer to the tab.
89
\return Returns true if successful. */
90
virtual bool setActiveTab(IGUITab *tab) = 0;
92
//! Returns which tab is currently active
93
virtual s32 getActiveTab() const = 0;
95
//! get the the id of the tab at the given absolute coordinates
96
/** \return The id of the tab or -1 when no tab is at those coordinates*/
97
virtual s32 getTabAt(s32 xpos, s32 ypos) const = 0;
99
//! Set the height of the tabs
100
virtual void setTabHeight( s32 height ) = 0;
102
//! Get the height of the tabs
103
/** return Returns the height of the tabs */
104
virtual s32 getTabHeight() const = 0;
106
//! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
107
virtual void setTabMaxWidth(s32 width ) = 0;
109
//! get the maximal width of a tab
110
virtual s32 getTabMaxWidth() const = 0;
112
//! Set the alignment of the tabs
113
/** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
114
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
116
//! Get the alignment of the tabs
117
/** return Returns the alignment of the tabs */
118
virtual gui::EGUI_ALIGNMENT getTabVerticalAlignment() const = 0;
120
//! Set the extra width added to tabs on each side of the text
121
virtual void setTabExtraWidth( s32 extraWidth ) = 0;
123
//! Get the extra width added to tabs on each side of the text
124
/** return Returns the extra width of the tabs */
125
virtual s32 getTabExtraWidth() const = 0;
129
} // end namespace gui
130
} // end namespace irr