Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
GUITable Class Reference

#include <guiTable.h>

+ Inheritance diagram for GUITable:
+ Collaboration diagram for GUITable:

Classes

struct  Cell
 
struct  DynamicData
 
struct  Option
 
struct  Row
 
struct  TableColumn
 

Public Types

typedef std::vector< OptionTableOptions
 
typedef std::vector< TableColumnTableColumns
 

Public Member Functions

 GUITable (gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, core::rect< s32 > rectangle, ISimpleTextureSource *tsrc)
 
virtual ~GUITable ()
 
void setTextList (const std::vector< std::string > &content, bool transparent)
 
void setTable (const TableOptions &options, const TableColumns &columns, std::vector< std::string > &content)
 
void clear ()
 
std::string checkEvent ()
 
s32 getSelected () const
 
void setSelected (s32 index)
 
virtual void setOverrideFont (gui::IGUIFont *font=nullptr)
 Sets another skin independent font. If this is set to zero, the button uses the font of the skin.
 
virtual gui::IGUIFont * getOverrideFont () const
 Gets the override font (if any)
 
DynamicData getDynamicData () const
 
void setDynamicData (const DynamicData &dyndata)
 
virtual const c8 * getTypeName () const
 
virtual void updateAbsolutePosition ()
 
virtual void draw ()
 
virtual bool OnEvent (const SEvent &event)
 

Static Public Member Functions

static Option splitOption (const std::string &str)
 

Protected Types

enum  ColumnType {
  COLUMN_TYPE_TEXT , COLUMN_TYPE_IMAGE , COLUMN_TYPE_COLOR , COLUMN_TYPE_INDENT ,
  COLUMN_TYPE_TREE
}
 

Protected Member Functions

s32 allocString (const std::string &text)
 
s32 allocImage (const std::string &imagename)
 
void allocationComplete ()
 
void drawCell (const Cell *cell, video::SColor color, const core::rect< s32 > &rowrect, const core::rect< s32 > &client_clip)
 
const RowgetRow (s32 i) const
 
bool doesRowStartWith (const Row *row, const core::stringw &str) const
 
s32 getRowAt (s32 y, bool &really_hovering) const
 
s32 getCellAt (s32 x, s32 row_i) const
 
void autoScroll ()
 
void updateScrollBar ()
 
void sendTableEvent (s32 column, bool doubleclick)
 
void getOpenedTrees (std::set< s32 > &opened_trees) const
 
void setOpenedTrees (const std::set< s32 > &opened_trees)
 
void openTree (s32 to_open)
 
void closeTree (s32 to_close)
 
void toggleVisibleTree (s32 row_i, int dir, bool move_selection)
 

Static Protected Member Functions

static void alignContent (Cell *cell, s32 xmax, s32 content_width, s32 align)
 

Protected Attributes

ISimpleTextureSourcem_tsrc
 
std::vector< Rowm_rows
 
std::vector< s32 > m_visible_rows
 
bool m_is_textlist = false
 
bool m_has_tree_column = false
 
s32 m_selected = -1
 
s32 m_sel_column = 0
 
bool m_sel_doubleclick = false
 
u64 m_keynav_time = 0
 
core::stringw m_keynav_buffer = L""
 
bool m_border = true
 
video::SColor m_color = video::SColor(255, 255, 255, 255)
 
video::SColor m_background = video::SColor(255, 0, 0, 0)
 
video::SColor m_highlight = video::SColor(255, 70, 100, 50)
 
video::SColor m_highlight_text = video::SColor(255, 255, 255, 255)
 
s32 m_rowheight = 1
 
gui::IGUIFont * m_font = nullptr
 
GUIScrollBarm_scrollbar = nullptr
 
std::vector< core::stringw > m_strings
 
std::vector< video::ITexture * > m_images
 
std::map< std::string, s32 > m_alloc_strings
 
std::map< std::string, s32 > m_alloc_images
 

Member Typedef Documentation

◆ TableColumns

typedef std::vector<TableColumn> GUITable::TableColumns

◆ TableOptions

typedef std::vector<Option> GUITable::TableOptions

Member Enumeration Documentation

◆ ColumnType

enum GUITable::ColumnType
protected
Enumerator
COLUMN_TYPE_TEXT 
COLUMN_TYPE_IMAGE 
COLUMN_TYPE_COLOR 
COLUMN_TYPE_INDENT 
COLUMN_TYPE_TREE 

Constructor & Destructor Documentation

◆ GUITable()

GUITable::GUITable ( gui::IGUIEnvironment * env,
gui::IGUIElement * parent,
s32 id,
core::rect< s32 > rectangle,
ISimpleTextureSource * tsrc )

References m_font, m_rowheight, m_scrollbar, MYMAX, GUIScrollBar::setPos(), and updateAbsolutePosition().

+ Here is the call graph for this function:

◆ ~GUITable()

GUITable::~GUITable ( )
virtual

References m_font, m_rows, and m_scrollbar.

Member Function Documentation

◆ alignContent()

void GUITable::alignContent ( Cell * cell,
s32 xmax,
s32 content_width,
s32 align )
staticprotected

References GUITable::Cell::xmax, GUITable::Cell::xmin, and GUITable::Cell::xpos.

Referenced by setTable().

+ Here is the caller graph for this function:

◆ allocationComplete()

void GUITable::allocationComplete ( )
protected

References m_alloc_images, and m_alloc_strings.

Referenced by setTable(), and setTextList().

+ Here is the caller graph for this function:

◆ allocImage()

s32 GUITable::allocImage ( const std::string & imagename)
protected

References ISimpleTextureSource::getTexture(), m_alloc_images, m_images, and m_tsrc.

Referenced by setTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allocString()

s32 GUITable::allocString ( const std::string & text)
protected

References m_alloc_strings, m_strings, and utf8_to_wide().

Referenced by setTable(), and setTextList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoScroll()

void GUITable::autoScroll ( )
protected

References GUIScrollBar::getPos(), m_rowheight, m_scrollbar, m_selected, and GUIScrollBar::setPos().

Referenced by OnEvent(), setSelected(), and toggleVisibleTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkEvent()

std::string GUITable::checkEvent ( )

References getSelected(), m_is_textlist, m_sel_column, and m_sel_doubleclick.

+ Here is the call graph for this function:

◆ clear()

void GUITable::clear ( )

References m_alloc_images, m_alloc_strings, m_background, m_border, m_color, m_has_tree_column, m_highlight, m_highlight_text, m_images, m_is_textlist, m_keynav_buffer, m_keynav_time, m_rows, m_sel_column, m_sel_doubleclick, m_selected, m_strings, and m_visible_rows.

Referenced by setTable(), and setTextList().

+ Here is the caller graph for this function:

◆ closeTree()

void GUITable::closeTree ( s32 to_close)
protected

References getOpenedTrees(), and setOpenedTrees().

Referenced by toggleVisibleTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesRowStartWith()

bool GUITable::doesRowStartWith ( const Row * row,
const core::stringw & str ) const
protected

References GUITable::Row::cellcount, GUITable::Row::cells, COLUMN_TYPE_TEXT, GUITable::Cell::content_index, GUITable::Cell::content_type, and m_strings.

Referenced by OnEvent().

+ Here is the caller graph for this function:

◆ draw()

void GUITable::draw ( )
virtual

References GUITable::Row::cellcount, GUITable::Row::cells, drawCell(), GUIScrollBar::getPos(), m_background, m_border, m_color, m_highlight, m_highlight_text, m_rowheight, m_rows, m_scrollbar, m_selected, m_visible_rows, and MYMIN.

+ Here is the call graph for this function:

◆ drawCell()

void GUITable::drawCell ( const Cell * cell,
video::SColor color,
const core::rect< s32 > & rowrect,
const core::rect< s32 > & client_clip )
protected

References GUITable::Cell::color, GUITable::Cell::color_defined, COLUMN_TYPE_IMAGE, COLUMN_TYPE_TEXT, COLUMN_TYPE_TREE, GUITable::Cell::content_index, GUITable::Cell::content_type, GUITable::Cell::image_scale, m_font, m_images, m_strings, GUITable::Cell::xmax, and GUITable::Cell::xpos.

Referenced by draw().

+ Here is the caller graph for this function:

◆ getCellAt()

s32 GUITable::getCellAt ( s32 x,
s32 row_i ) const
protected

References GUITable::Row::cellcount, GUITable::Row::cells, getRow(), and GUITable::Cell::xmin.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDynamicData()

GUITable::DynamicData GUITable::getDynamicData ( ) const

◆ getOpenedTrees()

void GUITable::getOpenedTrees ( std::set< s32 > & opened_trees) const
protected

References m_rows.

Referenced by closeTree(), getDynamicData(), openTree(), and setSelected().

+ Here is the caller graph for this function:

◆ getOverrideFont()

IGUIFont * GUITable::getOverrideFont ( ) const
virtual

Gets the override font (if any)

References m_font.

◆ getRow()

const GUITable::Row * GUITable::getRow ( s32 i) const
protected

References m_rows, and m_visible_rows.

Referenced by getCellAt(), OnEvent(), and toggleVisibleTree().

+ Here is the caller graph for this function:

◆ getRowAt()

s32 GUITable::getRowAt ( s32 y,
bool & really_hovering ) const
protected

References GUIScrollBar::getPos(), m_rowheight, m_scrollbar, and m_visible_rows.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelected()

s32 GUITable::getSelected ( ) const

References m_selected, and m_visible_rows.

Referenced by checkEvent(), and getDynamicData().

+ Here is the caller graph for this function:

◆ getTypeName()

const c8 * GUITable::getTypeName ( ) const
virtual

◆ OnEvent()

◆ openTree()

void GUITable::openTree ( s32 to_open)
protected

References getOpenedTrees(), and setOpenedTrees().

Referenced by toggleVisibleTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendTableEvent()

void GUITable::sendTableEvent ( s32 column,
bool doubleclick )
protected

References m_sel_column, and m_sel_doubleclick.

Referenced by OnEvent(), and toggleVisibleTree().

+ Here is the caller graph for this function:

◆ setDynamicData()

void GUITable::setDynamicData ( const DynamicData & dyndata)

References GUITable::DynamicData::keynav_buffer, GUITable::DynamicData::keynav_time, m_has_tree_column, m_keynav_buffer, m_keynav_time, m_scrollbar, m_sel_column, m_sel_doubleclick, GUITable::DynamicData::opened_trees, GUITable::DynamicData::scrollpos, GUITable::DynamicData::selected, setOpenedTrees(), GUIScrollBar::setPos(), and setSelected().

Referenced by GUIFormSpecMenu::parseTable(), and GUIFormSpecMenu::parseTextList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOpenedTrees()

void GUITable::setOpenedTrees ( const std::set< s32 > & opened_trees)
protected

References GUITable::Row::cellcount, GUITable::Row::cells, COLUMN_TYPE_TREE, GUITable::Cell::content_index, GUITable::Cell::content_type, GUITable::Row::indent, m_rows, m_selected, m_visible_rows, updateScrollBar(), and GUITable::Row::visible_index.

Referenced by closeTree(), openTree(), setDynamicData(), setSelected(), and setTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOverrideFont()

void GUITable::setOverrideFont ( gui::IGUIFont * font = nullptr)
virtual

Sets another skin independent font. If this is set to zero, the button uses the font of the skin.

References m_font, m_rowheight, MYMAX, and updateScrollBar().

Referenced by GUIFormSpecMenu::parseTable(), and GUIFormSpecMenu::parseTextList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelected()

void GUITable::setSelected ( s32 index)

References autoScroll(), getOpenedTrees(), m_rows, m_sel_column, m_sel_doubleclick, m_selected, m_visible_rows, and setOpenedTrees().

Referenced by GUIFormSpecMenu::parseTable(), GUIFormSpecMenu::parseTextList(), and setDynamicData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTable()

◆ setTextList()

void GUITable::setTextList ( const std::vector< std::string > & content,
bool transparent )

References allocationComplete(), allocString(), GUITable::Row::cellcount, GUITable::Row::cells, clear(), GUITable::Cell::color, GUITable::Cell::color_defined, COLUMN_TYPE_TEXT, GUITable::Cell::content_index, GUITable::Cell::content_type, GUITable::Row::indent, m_background, m_border, m_is_textlist, m_rows, m_visible_rows, parseColorString(), GUITable::Cell::reported_column, GUITable::Cell::tooltip_index, updateScrollBar(), GUITable::Row::visible_index, GUITable::Cell::xmax, GUITable::Cell::xmin, and GUITable::Cell::xpos.

Referenced by GUIFormSpecMenu::parseTextList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ splitOption()

GUITable::Option GUITable::splitOption ( const std::string & str)
static

Referenced by GUIFormSpecMenu::parseTableColumns(), and GUIFormSpecMenu::parseTableOptions().

+ Here is the caller graph for this function:

◆ toggleVisibleTree()

void GUITable::toggleVisibleTree ( s32 row_i,
int dir,
bool move_selection )
protected

References autoScroll(), GUITable::Row::cellcount, GUITable::Row::cells, closeTree(), COLUMN_TYPE_TREE, GUITable::Cell::content_index, GUITable::Cell::content_type, dir(), getRow(), GUITable::Row::indent, m_selected, m_visible_rows, openTree(), and sendTableEvent().

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAbsolutePosition()

void GUITable::updateAbsolutePosition ( )
virtual

References updateScrollBar().

Referenced by GUITable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateScrollBar()

void GUITable::updateScrollBar ( )
protected

References m_rowheight, m_scrollbar, m_visible_rows, MYMAX, GUIScrollBar::setLargeStep(), GUIScrollBar::setMax(), GUIScrollBar::setPageSize(), and GUIScrollBar::setSmallStep().

Referenced by setOpenedTrees(), setOverrideFont(), setTable(), setTextList(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_alloc_images

std::map<std::string, s32> GUITable::m_alloc_images
protected

◆ m_alloc_strings

std::map<std::string, s32> GUITable::m_alloc_strings
protected

◆ m_background

video::SColor GUITable::m_background = video::SColor(255, 0, 0, 0)
protected

Referenced by clear(), draw(), setTable(), and setTextList().

◆ m_border

bool GUITable::m_border = true
protected

Referenced by clear(), draw(), setTable(), and setTextList().

◆ m_color

video::SColor GUITable::m_color = video::SColor(255, 255, 255, 255)
protected

Referenced by clear(), draw(), and setTable().

◆ m_font

gui::IGUIFont* GUITable::m_font = nullptr
protected

◆ m_has_tree_column

bool GUITable::m_has_tree_column = false
protected

◆ m_highlight

video::SColor GUITable::m_highlight = video::SColor(255, 70, 100, 50)
protected

Referenced by clear(), draw(), and setTable().

◆ m_highlight_text

video::SColor GUITable::m_highlight_text = video::SColor(255, 255, 255, 255)
protected

Referenced by clear(), draw(), and setTable().

◆ m_images

std::vector<video::ITexture*> GUITable::m_images
protected

Referenced by allocImage(), clear(), drawCell(), and setTable().

◆ m_is_textlist

bool GUITable::m_is_textlist = false
protected

Referenced by checkEvent(), clear(), and setTextList().

◆ m_keynav_buffer

core::stringw GUITable::m_keynav_buffer = L""
protected

◆ m_keynav_time

u64 GUITable::m_keynav_time = 0
protected

◆ m_rowheight

s32 GUITable::m_rowheight = 1
protected

◆ m_rows

std::vector<Row> GUITable::m_rows
protected

◆ m_scrollbar

GUIScrollBar* GUITable::m_scrollbar = nullptr
protected

◆ m_sel_column

s32 GUITable::m_sel_column = 0
protected

◆ m_sel_doubleclick

bool GUITable::m_sel_doubleclick = false
protected

◆ m_selected

s32 GUITable::m_selected = -1
protected

◆ m_strings

std::vector<core::stringw> GUITable::m_strings
protected

◆ m_tsrc

ISimpleTextureSource* GUITable::m_tsrc
protected

Referenced by allocImage().

◆ m_visible_rows

std::vector<s32> GUITable::m_visible_rows
protected

The documentation for this class was generated from the following files: