TGUI
v0.6.10
|
Public Types | |
Public Types inherited from tgui::Widget |
Public Member Functions | |
ListBox () | |
Default constructor. More... | |
ListBox (const ListBox ©) | |
Copy constructor. More... | |
virtual | ~ListBox () |
Destructor. More... | |
ListBox & | operator= (const ListBox &right) |
Overload of assignment operator. More... | |
bool | load (const std::string &configFileFilename, const std::string §ionName="ListBox") |
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 list box. More... | |
virtual sf::Vector2f | getSize () const |
Returns the size of the list box. More... | |
virtual sf::Vector2f | getFullSize () const |
Returns the full size of the list box. 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 used in the list box. More... | |
void | setBackgroundColor (const sf::Color &backgroundColor) |
Set the background color that will be used inside the list box. More... | |
void | setTextColor (const sf::Color &textColor) |
Set the text color that will be used inside the list box. More... | |
void | setSelectedBackgroundColor (const sf::Color &selectedBackgroundColor) |
Set the background color of the selected text that will be used inside the list box. More... | |
void | setSelectedTextColor (const sf::Color &selectedTextColor) |
Set the text color of the selected text that will be used inside the list box. More... | |
void | setBorderColor (const sf::Color &borderColor) |
Set the border color text that will be used inside the list box. More... | |
const sf::Color & | getBackgroundColor () const |
Get the background color that is currently being used inside the list box. More... | |
const sf::Color & | getTextColor () const |
Get the text color that is currently being used inside the list box. More... | |
const sf::Color & | getSelectedBackgroundColor () const |
Get the background color of the selected text that is currently being used inside the list box. More... | |
const sf::Color & | getSelectedTextColor () const |
Get the text color of the selected text that is currently being used inside the list box. More... | |
const sf::Color & | getBorderColor () const |
Get the border color that is currently being used inside the list box. More... | |
void | setTextFont (const sf::Font &font) |
Changes the font of the items. More... | |
const sf::Font * | getTextFont () const |
Returns the font of the items. More... | |
int | addItem (const sf::String &itemName, int id=0) |
Adds an item to the list. More... | |
bool | setSelectedItem (const sf::String &itemName) |
Selects an item in the list box. More... | |
bool | setSelectedItem (int index) |
Selects an item in the list box. 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 the 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 () |
Returns the list of 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 of the list box. More... | |
void | removeScrollbar () |
Removes the scrollbar from the list box. More... | |
void | setItemHeight (unsigned int itemHeight) |
Changes the height of the items in the list box. More... | |
unsigned int | getItemHeight () const |
Returns the height of the items in the list box. More... | |
void | setMaximumItems (unsigned int maximumItems=0) |
Changes the maximum items that the list box can contain. More... | |
unsigned int | getMaximumItems () const |
Returns the maximum items that the list box can contain. 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... | |
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::ListBox::ListBox | ( | ) |
Default constructor.
tgui::ListBox::ListBox | ( | const ListBox & | copy | ) |
Copy constructor.
copy | Instance to copy |
|
virtual |
Destructor.
int tgui::ListBox::addItem | ( | const sf::String & | itemName, |
int | id = 0 |
||
) |
Adds an item to the list.
itemName | The name of the item you want to add (this is the text that will be displayed inside the list box) |
id | Optional id given to this item for the purpose to later identifying this item. |
void tgui::ListBox::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 used in the list box.
backgroundColor | The color of the background of the list box |
textColor | The color of the text |
selectedBackgroundColor | The color of the background of the selected item |
selectedTextColor | The color of the text when it is selected |
borderColor | The color of the borders |
bool tgui::ListBox::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::ListBox::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::ListBox::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::ListBox::deselectItem | ( | ) |
Deselects the selected item.
const sf::Color& tgui::ListBox::getBackgroundColor | ( | ) | const |
Get the background color that is currently being used inside the list box.
const sf::Color& tgui::ListBox::getBorderColor | ( | ) | const |
Get the border color that is currently being used inside the list box.
|
virtual |
Returns the full size of the list box.
The size returned by this function includes the borders.
Reimplemented from tgui::Transformable.
sf::String tgui::ListBox::getItem | ( | unsigned int | index | ) | const |
Returns the item name of the item with the given index.
index | The index of the item |
unsigned int tgui::ListBox::getItemHeight | ( | ) | const |
Returns the height of the items in the list box.
int tgui::ListBox::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::ListBox::getItems | ( | ) |
Returns the list of all the items.
const std::string& tgui::ListBox::getLoadedConfigFile | ( | ) | const |
Returns the filename of the config file that was used to load the widget.
unsigned int tgui::ListBox::getMaximumItems | ( | ) | const |
Returns the maximum items that the list box can contain.
const sf::Color& tgui::ListBox::getSelectedBackgroundColor | ( | ) | const |
Get the background color of the selected text that is currently being used inside the list box.
sf::String tgui::ListBox::getSelectedItem | ( | ) | const |
Returns the currently selected item.
int tgui::ListBox::getSelectedItemId | ( | ) | const |
Get the id of the selected item.
int tgui::ListBox::getSelectedItemIndex | ( | ) | const |
Get the index of the selected item.
const sf::Color& tgui::ListBox::getSelectedTextColor | ( | ) | const |
Get the text color of the selected text that is currently being used inside the list box.
|
virtual |
Returns the size of the list box.
The size returned by this function does not include the borders.
Implements tgui::Transformable.
const sf::Color& tgui::ListBox::getTextColor | ( | ) | const |
Get the text color that is currently being used inside the list box.
const sf::Font* tgui::ListBox::getTextFont | ( | ) | const |
Returns the font of the items.
bool tgui::ListBox::load | ( | const std::string & | configFileFilename, |
const std::string & | sectionName = "ListBox" |
||
) |
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 ListBox section with the needed information.
Overload of assignment operator.
right | Instance to assign |
void tgui::ListBox::removeAllItems | ( | ) |
Removes all items from the list.
bool tgui::ListBox::removeItem | ( | unsigned int | index | ) |
Removes an item from the list with a given index.
index | The index of the item to remove |
bool tgui::ListBox::removeItem | ( | const sf::String & | itemName | ) |
Removes the first item from the list with the given name.
itemName | The item to remove |
unsigned int tgui::ListBox::removeItemsById | ( | int | id | ) |
Removes all items that were added with the given id.
id | Id that was given to the addItem function. |
void tgui::ListBox::removeScrollbar | ( | ) |
Removes the scrollbar from the list box.
When there are too many items to fit in the list box then the items will be removed.
void tgui::ListBox::setBackgroundColor | ( | const sf::Color & | backgroundColor | ) |
Set the background color that will be used inside the list box.
backgroundColor | The color of the background of the list box |
void tgui::ListBox::setBorderColor | ( | const sf::Color & | borderColor | ) |
Set the border color text that will be used inside the list 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::ListBox::setItemHeight | ( | unsigned int | itemHeight | ) |
Changes the height of the items in the list box.
itemHeight | The size of a single item in the list |
void tgui::ListBox::setMaximumItems | ( | unsigned int | maximumItems = 0 | ) |
Changes the maximum items that the list box can contain.
maximumItems | The maximum items inside the list 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::ListBox::setScrollbar | ( | const std::string & | scrollbarConfigFileFilename | ) |
Changes the scrollbar of the list box.
scrollbarConfigFileFilename | Filename of the config file. The config file must contain a Scrollbar section with the needed information. |
void tgui::ListBox::setSelectedBackgroundColor | ( | const sf::Color & | selectedBackgroundColor | ) |
Set the background color of the selected text that will be used inside the list box.
selectedBackgroundColor | The color of the background of the selected item |
bool tgui::ListBox::setSelectedItem | ( | const sf::String & | itemName | ) |
Selects an item in the list box.
When adding items to the list box with the addItem function, none of them will be selected. If you want a default item selected then you can use this function to select it. The first item that matches the name will be selected.
itemName | The item you want to select |
bool tgui::ListBox::setSelectedItem | ( | int | index | ) |
Selects an item in the list box.
When adding items to the list box with the addItem function, none of them will be selected. If you want a default item selected then you can use this function to select it. If the index is -1 then the deselectItem function will be called.
index | The index of the item |
void tgui::ListBox::setSelectedTextColor | ( | const sf::Color & | selectedTextColor | ) |
Set the text color of the selected text that will be used inside the list box.
selectedTextColor | The color of the text when it is selected |
|
virtual |
Changes the size of the list box.
width | The new width of the list box |
height | The new height of the list box |
Implements tgui::Transformable.
void tgui::ListBox::setTextColor | ( | const sf::Color & | textColor | ) |
Set the text color that will be used inside the list box.
textColor | The color of the text |
void tgui::ListBox::setTextFont | ( | const sf::Font & | font | ) |
Changes the font of the items.
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.