TGUI
v0.6.10
|
Public Types | |
Public Types inherited from tgui::Widget |
Public Member Functions | |
ComboBox () | |
Default constructor. More... | |
ComboBox (const ComboBox ©) | |
Copy constructor. More... | |
virtual | ~ComboBox () |
Destructor. More... | |
ComboBox & | operator= (const ComboBox &right) |
Overload of assignment operator. More... | |
bool | load (const std::string &configFileFilename, const std::string §ionName="ComboBox") |
Loads the widget. More... | |
const std::string & | getLoadedConfigFile () const |
Returns the filename of the config file that was used to load the widget. More... | |
void | setSize (float width, float height) |
Changes the size of the combo box. More... | |
virtual sf::Vector2f | getSize () const |
Returns the size of the combo box. More... | |
virtual sf::Vector2f | getFullSize () const |
Returns the full size of the combo box. More... | |
void | setItemsToDisplay (unsigned int nrOfItemsInListToDisplay) |
Changes the number of items that are displayed in the list. More... | |
unsigned int | getItemsToDisplay () const |
Returns the number of items that are displayed in the list. More... | |
void | changeColors (const sf::Color &backgroundColor=sf::Color::White, const sf::Color &textColor=sf::Color::Black, const sf::Color &selectedBackgroundColor=sf::Color(50, 100, 200), const sf::Color &selectedTextColor=sf::Color::White, const sf::Color &borderColor=sf::Color::Black) |
Changes the colors that are used in the combo box. More... | |
void | setBackgroundColor (const sf::Color &backgroundColor) |
Set the background color that will be used inside the combo box. More... | |
void | setTextColor (const sf::Color &textColor) |
Set the text color that will be used inside the combo box. More... | |
void | setSelectedBackgroundColor (const sf::Color &selectedBackgroundColor) |
Set the background color of the selected text that will be used inside the combo box. More... | |
void | setSelectedTextColor (const sf::Color &selectedTextColor) |
Set the text color of the selected text that will be used inside the combo box. More... | |
void | setBorderColor (const sf::Color &borderColor) |
Set the border color text that will be used inside the combo box. More... | |
const sf::Color & | getBackgroundColor () const |
Get the background color that is currently being used inside the combo box. More... | |
const sf::Color & | getTextColor () const |
Get the text color that is currently being used inside the combo box. More... | |
const sf::Color & | getSelectedBackgroundColor () const |
Get the background color of the selected text that is currently being used inside the combo box. More... | |
const sf::Color & | getSelectedTextColor () const |
Get the text color of the selected text that is currently being used inside the combo box. More... | |
const sf::Color & | getBorderColor () const |
Get the border color that is currently being used inside the combo box. More... | |
void | setTextFont (const sf::Font &font) |
Changes the text font. More... | |
const sf::Font * | getTextFont () const |
Returns the text font. More... | |
virtual void | setBorders (unsigned int leftBorder=0, unsigned int topBorder=0, unsigned int rightBorder=0, unsigned int bottomBorder=0) |
Changes the size of the borders. More... | |
int | addItem (const sf::String &itemName, int id=0) |
Adds an item to the list, so that it can be selected later. More... | |
bool | setSelectedItem (const sf::String &itemName) |
Selects an item from the list. More... | |
bool | setSelectedItem (int index) |
Selects an item from the list. More... | |
void | deselectItem () |
Deselects the selected item. More... | |
bool | removeItem (unsigned int index) |
Removes an item from the list with a given index. More... | |
bool | removeItem (const sf::String &itemName) |
Removes the first item from the list with a given name. More... | |
unsigned int | removeItemsById (int id) |
Removes all items that were added with the given id. More... | |
void | removeAllItems () |
Removes all items from the list. More... | |
sf::String | getItem (unsigned int index) const |
Returns the item name of the item with the given index. More... | |
int | getItemIndex (const sf::String &itemName) const |
Returns the index of the first item with the given name. More... | |
std::vector< sf::String > & | getItems () const |
Returns the list that contains all the items. More... | |
sf::String | getSelectedItem () const |
Returns the currently selected item. More... | |
int | getSelectedItemIndex () const |
Get the index of the selected item. More... | |
int | getSelectedItemId () const |
Get the id of the selected item. More... | |
bool | changeItem (unsigned int index, const sf::String &newValue) |
Changes the value of the item at the given index. More... | |
unsigned int | changeItems (const sf::String &originalValue, const sf::String &newValue) |
Changes all items with originalValue to newValue. More... | |
unsigned int | changeItemsById (int id, const sf::String &newValue) |
Changes all items with the given id to newValue. More... | |
bool | setScrollbar (const std::string &scrollbarConfigFileFilename) |
Changes the scrollbar that is displayed next to the list. More... | |
void | removeScrollbar () |
Removes the scrollbar. More... | |
void | setMaximumItems (unsigned int maximumItems=0) |
Changes the maximum items that the combo box can contain. More... | |
unsigned int | getMaximumItems () const |
Returns the maximum items that the combo box can contain. More... | |
virtual void | setTransparency (unsigned char transparency) |
Changes the transparency of the widget. More... | |
Public Member Functions inherited from tgui::Widget | |
Widget () | |
Default constructor. More... | |
Widget (const Widget ©) | |
Copy constructor. More... | |
virtual | ~Widget () |
Destructor. More... | |
Widget & | operator= (const Widget &right) |
Overload of assignment operator. More... | |
virtual sf::Vector2f | getAbsolutePosition () const |
Get the absolute position of the widget on the screen. More... | |
virtual void | show () |
Shows the widget. More... | |
virtual void | hide () |
Hides the widget. More... | |
bool | isVisible () const |
Returns true when the widget is visible. More... | |
virtual void | enable () |
Enables the widget. More... | |
virtual void | disable () |
Disables the widget. More... | |
bool | isEnabled () const |
Returns true when the widget is enabled. More... | |
bool | isDisabled () const |
Returns true when the widget is disabled. More... | |
bool | isLoaded () const |
Returns true when the widget is loaded successfully. More... | |
virtual void | focus () |
Focus the widget. More... | |
virtual void | unfocus () |
Unfocus the widget. More... | |
bool | isFocused () const |
Returns true when the widget is focused and false otherwise. More... | |
WidgetTypes | getWidgetType () const |
Returns the type of the widget. More... | |
Container * | getParent () const |
Returns a pointer to the parent widget. More... | |
unsigned char | getTransparency () const |
Returns the transparency of the widget. More... | |
virtual void | moveToFront () |
Places the widget before all other widgets. More... | |
virtual void | moveToBack () |
Places the widget behind all other widgets. More... | |
void | setCallbackId (unsigned int callbackId) |
Changes the callback id of the widget. More... | |
unsigned int | getCallbackId () |
Returns the callback id of the widget. More... | |
Public Member Functions inherited from tgui::Transformable | |
Transformable () | |
Default constructor. More... | |
virtual | ~Transformable () |
Destructor. More... | |
virtual void | setPosition (float x, float y) |
Set the position of the widget. More... | |
void | setPosition (const sf::Vector2f &position) |
set the position of the widget More... | |
const sf::Vector2f & | getPosition () const |
get the position of the widget More... | |
void | move (float offsetX, float offsetY) |
Move the widget by a given offset. More... | |
void | move (const sf::Vector2f &offset) |
Move the widget by a given offset. More... | |
void | scale (float factorX, float factorY) |
Scale the widget. More... | |
void | scale (const sf::Vector2f &factors) |
Scale the widget. More... | |
Public Member Functions inherited from tgui::CallbackManager | |
void | bindCallback (std::function< void()> func, unsigned int trigger) |
Bind a function to one or more specific callback trigger(s). More... | |
template<typename T > | |
void | bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger) |
Bind a function to one or more specific callback trigger(s). More... | |
void | bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger) |
Bind a function to one or more specific callback trigger(s). More... | |
template<typename T > | |
void | bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger) |
Bind a function to one or more specific callback trigger(s). More... | |
void | bindCallback (unsigned int trigger) |
Bind one or more specific callback trigger(s) to the parent widget. More... | |
void | unbindCallback (unsigned int trigger) |
Unbind all callback function bound to the given trigger. More... | |
void | unbindAllCallback () |
Unbind all callback functions bound to any callback. More... | |
Public Member Functions inherited from tgui::WidgetBorders | |
WidgetBorders () | |
Default constructor. More... | |
virtual | ~WidgetBorders () |
Destructor. More... | |
virtual Borders | getBorders () const |
Returns the size of the borders as a tgui::Borders. More... | |
tgui::ComboBox::ComboBox | ( | ) |
Default constructor.
tgui::ComboBox::ComboBox | ( | const ComboBox & | copy | ) |
Copy constructor.
copy | Instance to copy |
|
virtual |
Destructor.
int tgui::ComboBox::addItem | ( | const sf::String & | itemName, |
int | id = 0 |
||
) |
Adds an item to the list, so that it can be selected later.
itemName | The name of the item you want to add (this is the text that will be displayed inside the combo box) |
id | Optional id given to this item for the purpose to later identifying this item. |
void tgui::ComboBox::changeColors | ( | const sf::Color & | backgroundColor = sf::Color::White , |
const sf::Color & | textColor = sf::Color::Black , |
||
const sf::Color & | selectedBackgroundColor = sf::Color(50, 100, 200) , |
||
const sf::Color & | selectedTextColor = sf::Color::White , |
||
const sf::Color & | borderColor = sf::Color::Black |
||
) |
Changes the colors that are used in the combo box.
backgroundColor | The color of the background of the combo box |
textColor | The color of the text |
selectedBackgroundColor | The color of the background of the selected item in the list |
selectedTextColor | The color of the text when it is selected in the list |
borderColor | The color of the borders |
bool tgui::ComboBox::changeItem | ( | unsigned int | index, |
const sf::String & | newValue | ||
) |
Changes the value of the item at the given index.
index | The index of the value that should be changed |
newValue | The new name for that item |
unsigned int tgui::ComboBox::changeItems | ( | const sf::String & | originalValue, |
const sf::String & | newValue | ||
) |
Changes all items with originalValue to newValue.
originalValue | The name of the items which will change |
newValue | The new name for these items |
unsigned int tgui::ComboBox::changeItemsById | ( | int | id, |
const sf::String & | newValue | ||
) |
Changes all items with the given id to newValue.
id | The id of the items which will change |
newValue | The new name for these items |
void tgui::ComboBox::deselectItem | ( | ) |
Deselects the selected item.
The combo box will be empty after this function is called.
const sf::Color& tgui::ComboBox::getBackgroundColor | ( | ) | const |
Get the background color that is currently being used inside the combo box.
const sf::Color& tgui::ComboBox::getBorderColor | ( | ) | const |
Get the border color that is currently being used inside the combo box.
|
virtual |
Returns the full size of the combo box.
The size returned by this function includes the borders.
Reimplemented from tgui::Transformable.
sf::String tgui::ComboBox::getItem | ( | unsigned int | index | ) | const |
Returns the item name of the item with the given index.
index | The index of the item |
int tgui::ComboBox::getItemIndex | ( | const sf::String & | itemName | ) | const |
Returns the index of the first item with the given name.
itemName | The name of the item |
std::vector<sf::String>& tgui::ComboBox::getItems | ( | ) | const |
Returns the list that contains all the items.
unsigned int tgui::ComboBox::getItemsToDisplay | ( | ) | const |
Returns the number of items that are displayed in the list.
When there is no scrollbar then this is the maximum number of items. If there is one, then it will only become visible when there are more items than this number.
When set to zero then all items are shown (then there will never be a scrollbar).
const std::string& tgui::ComboBox::getLoadedConfigFile | ( | ) | const |
Returns the filename of the config file that was used to load the widget.
unsigned int tgui::ComboBox::getMaximumItems | ( | ) | const |
Returns the maximum items that the combo box can contain.
const sf::Color& tgui::ComboBox::getSelectedBackgroundColor | ( | ) | const |
Get the background color of the selected text that is currently being used inside the combo box.
sf::String tgui::ComboBox::getSelectedItem | ( | ) | const |
Returns the currently selected item.
int tgui::ComboBox::getSelectedItemId | ( | ) | const |
Get the id of the selected item.
int tgui::ComboBox::getSelectedItemIndex | ( | ) | const |
Get the index of the selected item.
const sf::Color& tgui::ComboBox::getSelectedTextColor | ( | ) | const |
Get the text color of the selected text that is currently being used inside the combo box.
|
virtual |
Returns the size of the combo box.
The size returned by this function does not include the borders.
Implements tgui::Transformable.
const sf::Color& tgui::ComboBox::getTextColor | ( | ) | const |
Get the text color that is currently being used inside the combo box.
const sf::Font* tgui::ComboBox::getTextFont | ( | ) | const |
Returns the text font.
bool tgui::ComboBox::load | ( | const std::string & | configFileFilename, |
const std::string & | sectionName = "ComboBox" |
||
) |
Loads the widget.
configFileFilename | Filename of the config file. |
sectionName | Name of the section in the file to load |
The config file must contain a ComboBox section with the needed information.
Overload of assignment operator.
right | Instance to assign |
void tgui::ComboBox::removeAllItems | ( | ) |
Removes all items from the list.
bool tgui::ComboBox::removeItem | ( | unsigned int | index | ) |
Removes an item from the list with a given index.
index | The index of the item to remove |
bool tgui::ComboBox::removeItem | ( | const sf::String & | itemName | ) |
Removes the first item from the list with a given name.
itemName | The item to remove |
unsigned int tgui::ComboBox::removeItemsById | ( | int | id | ) |
Removes all items that were added with the given id.
id | Id that was given to the addItem function. |
void tgui::ComboBox::removeScrollbar | ( | ) |
Removes the scrollbar.
When there are too many items to fit in the list then the items will be removed.
void tgui::ComboBox::setBackgroundColor | ( | const sf::Color & | backgroundColor | ) |
Set the background color that will be used inside the combo box.
backgroundColor | The color of the background of the combo box |
void tgui::ComboBox::setBorderColor | ( | const sf::Color & | borderColor | ) |
Set the border color text that will be used inside the combo box.
borderColor | The color of the borders |
|
virtual |
Changes the size of the borders.
leftBorder | The width of the left border |
topBorder | The height of the top border |
rightBorder | The width of the right border |
bottomBorder | The height of the bottom border |
Implements tgui::WidgetBorders.
void tgui::ComboBox::setItemsToDisplay | ( | unsigned int | nrOfItemsInListToDisplay | ) |
Changes the number of items that are displayed in the list.
nrOfItemsInListToDisplay | The maximum number of items to display when the list of items is shown. |
When there is no scrollbar then this is the maximum number of items. If there is one, then it will only become visible when there are more items than this number.
When set to zero then all items are shown (then there will never be a scrollbar).
void tgui::ComboBox::setMaximumItems | ( | unsigned int | maximumItems = 0 | ) |
Changes the maximum items that the combo box can contain.
maximumItems | The maximum items inside the combo box. When the maximum is set to 0 then the limit will be disabled. |
If no scrollbar was loaded then there is always a limitation because there will be a limited space for the items.
bool tgui::ComboBox::setScrollbar | ( | const std::string & | scrollbarConfigFileFilename | ) |
Changes the scrollbar that is displayed next to the list.
scrollbarConfigFileFilename | Filename of the config file. The config file must contain a Scrollbar section with the needed information. |
void tgui::ComboBox::setSelectedBackgroundColor | ( | const sf::Color & | selectedBackgroundColor | ) |
Set the background color of the selected text that will be used inside the combo box.
selectedBackgroundColor | The color of the background of the selected item in the list |
bool tgui::ComboBox::setSelectedItem | ( | const sf::String & | itemName | ) |
Selects an item from the list.
When adding items to the combo box with the addItem function, none of them will be selected. If you don't want the combo box to stay empty until the user selects something, but you want a default item instead, then you can use this function to select an item. The first item that matches the name will be selected.
itemName | The item you want to select |
bool tgui::ComboBox::setSelectedItem | ( | int | index | ) |
Selects an item from the list.
When adding items to the combo box with the addItem function, none of them will be selected. If you don't want the combo box to stay empty until the user selects something, but you want a default item instead, then you can use this function to select an item. If the index is -1 then the deselectItem function will be called.
index | The index of the item |
void tgui::ComboBox::setSelectedTextColor | ( | const sf::Color & | selectedTextColor | ) |
Set the text color of the selected text that will be used inside the combo box.
selectedTextColor | The color of the text when it is selected in the list |
|
virtual |
Changes the size of the combo box.
This size does not include the borders.
width | The new width of the combo box |
height | The new height of the combo box |
Implements tgui::Transformable.
void tgui::ComboBox::setTextColor | ( | const sf::Color & | textColor | ) |
Set the text color that will be used inside the combo box.
textColor | The color of the text |
void tgui::ComboBox::setTextFont | ( | const sf::Font & | font | ) |
Changes the text font.
When you don't call this function then the global font will be use. This global font can be changed with the setGlobalFont function from the parent.
font | The new font. |
|
virtual |
Changes the transparency of the widget.
transparency | The transparency of the widget. 0 is completely transparent, while 255 (default) means fully opaque. |
Note that this will only change the transparency of the images. The parts of the widgets that use a color will not be changed. You must change them yourself by setting the alpha channel of the color.
Reimplemented from tgui::Widget.