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

#include <touchscreeneditor.h>

+ Inheritance diagram for GUITouchscreenLayout:
+ Collaboration diagram for GUITouchscreenLayout:

Public Member Functions

 GUITouchscreenLayout (gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, ISimpleTextureSource *tsrc)
 
 ~GUITouchscreenLayout ()
 
void regenerateGui (v2u32 screensize)
 
void drawMenu ()
 
bool OnEvent (const SEvent &event)
 
- Public Member Functions inherited from GUIModalMenu
 GUIModalMenu (gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, bool remap_dbl_click=true)
 
virtual ~GUIModalMenu ()
 
void allowFocusRemoval (bool allow)
 
bool canTakeFocus (gui::IGUIElement *e)
 
void draw ()
 
void quitMenu ()
 
virtual bool preprocessEvent (const SEvent &event)
 
virtual bool pausesGame ()
 

Protected Member Functions

std::wstring getLabelByID (s32 id)
 
std::string getNameByID (s32 id)
 
- Protected Member Functions inherited from GUIModalMenu
ScalingInfo getScalingInfo (v2u32 screensize, v2u32 base_size)
 

Private Types

enum class  Mode { Default , Dragging , Add }
 

Private Member Functions

void clearGUIImages ()
 
void regenerateGUIImagesRegular (v2u32 screensize)
 
void regenerateGUIImagesAddMode (v2u32 screensize)
 
void interpolateGUIImages ()
 
void updateDragState (v2u32 screensize, v2s32 mouse_movement)
 
void regenerateMenu (v2u32 screensize)
 

Private Attributes

ISimpleTextureSourcem_tsrc
 
ButtonLayout m_layout
 
v2u32 m_last_screensize
 
s32 m_button_size
 
Mode m_mode = Mode::Default
 
std::unordered_map< touch_gui_button_id, std::shared_ptr< gui::IGUIImage > > m_gui_images
 
std::unordered_map< touch_gui_button_id, v2s32m_gui_images_target_pos
 
bool m_mouse_down = false
 
v2s32 m_last_mouse_pos
 
touch_gui_button_id m_selected_btn = touch_gui_button_id_END
 
ButtonLayout m_last_good_layout
 
std::vector< core::recti > m_error_rects
 
ButtonLayout m_add_layout
 
std::vector< std::shared_ptr< gui::IGUIStaticText > > m_add_button_titles
 
std::shared_ptr< gui::IGUIStaticText > m_gui_help_text
 
std::shared_ptr< gui::IGUIButton > m_gui_add_btn
 
std::shared_ptr< gui::IGUIButton > m_gui_reset_btn
 
std::shared_ptr< gui::IGUIButton > m_gui_done_btn
 
std::shared_ptr< gui::IGUIButton > m_gui_remove_btn
 

Additional Inherited Members

- Protected Attributes inherited from GUIModalMenu
v2s32 m_pointer
 
v2s32 m_old_pointer
 
v2u32 m_screensize_old
 
float m_gui_scale
 
bool m_second_touch = false
 

Member Enumeration Documentation

◆ Mode

enum class GUITouchscreenLayout::Mode
strongprivate
Enumerator
Default 
Dragging 
Add 

Constructor & Destructor Documentation

◆ GUITouchscreenLayout()

GUITouchscreenLayout::GUITouchscreenLayout ( gui::IGUIEnvironment * env,
gui::IGUIElement * parent,
s32 id,
IMenuManager * menumgr,
ISimpleTextureSource * tsrc )

References g_touchcontrols, TouchControls::getLayout(), grab_gui_element(), ButtonLayout::loadFromSettings(), m_gui_add_btn, m_gui_done_btn, m_gui_help_text, m_gui_remove_btn, m_gui_reset_btn, m_layout, and wstrgettext().

+ Here is the call graph for this function:

◆ ~GUITouchscreenLayout()

GUITouchscreenLayout::~GUITouchscreenLayout ( )

References ButtonLayout::clearTextureCache().

+ Here is the call graph for this function:

Member Function Documentation

◆ clearGUIImages()

void GUITouchscreenLayout::clearGUIImages ( )
private

References ButtonLayout::layout, m_add_button_titles, m_add_layout, m_gui_images, and m_gui_images_target_pos.

Referenced by regenerateGui(), regenerateGUIImagesAddMode(), and regenerateGUIImagesRegular().

+ Here is the caller graph for this function:

◆ drawMenu()

void GUITouchscreenLayout::drawMenu ( )
virtual

Implements GUIModalMenu.

References Dragging, interpolateGUIImages(), m_error_rects, m_gui_images, m_mode, and m_selected_btn.

+ Here is the call graph for this function:

◆ getLabelByID()

std::wstring GUITouchscreenLayout::getLabelByID ( s32 id)
inlineprotectedvirtual

Implements GUIModalMenu.

◆ getNameByID()

std::string GUITouchscreenLayout::getNameByID ( s32 id)
inlineprotectedvirtual

Implements GUIModalMenu.

◆ interpolateGUIImages()

void GUITouchscreenLayout::interpolateGUIImages ( )
private

References Add, Dragging, interpolate(), m_gui_images, m_gui_images_target_pos, m_mode, and m_selected_btn.

Referenced by drawMenu().

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

◆ OnEvent()

bool GUITouchscreenLayout::OnEvent ( const SEvent & event)
virtual

◆ regenerateGui()

void GUITouchscreenLayout::regenerateGui ( v2u32 screensize)
virtual

Implements GUIModalMenu.

References Add, clearGUIImages(), ButtonLayout::getButtonSize(), ButtonLayout::layout, m_button_size, m_last_screensize, m_layout, m_mode, m_selected_btn, regenerateGUIImagesAddMode(), regenerateGUIImagesRegular(), regenerateMenu(), and touch_gui_button_id_END.

Referenced by OnEvent().

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

◆ regenerateGUIImagesAddMode()

void GUITouchscreenLayout::regenerateGUIImagesAddMode ( v2u32 screensize)
private

References Add, clearGUIImages(), ButtonLayout::getMissingButtons(), ButtonLayout::getTexture(), grab_gui_element(), ButtonLayout::layout, layout_button_grid(), m_add_button_titles, m_add_layout, m_button_size, m_gui_images, m_layout, m_mode, m_tsrc, make_button_grid_title(), and ButtonMeta::setPos().

Referenced by regenerateGui().

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

◆ regenerateGUIImagesRegular()

void GUITouchscreenLayout::regenerateGUIImagesRegular ( v2u32 screensize)
private

References Add, clearGUIImages(), ButtonLayout::getRect(), ButtonLayout::getTexture(), grab_gui_element(), ButtonLayout::layout, m_button_size, m_gui_images, m_gui_images_target_pos, m_layout, m_mode, and m_tsrc.

Referenced by regenerateGui().

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

◆ regenerateMenu()

void GUITouchscreenLayout::regenerateMenu ( v2u32 screensize)
private

References Add, ButtonLayout::getMissingButtons(), ButtonLayout::isButtonRequired(), layout_menu_row(), m_gui_add_btn, m_gui_done_btn, m_gui_help_text, m_gui_remove_btn, m_gui_reset_btn, m_layout, m_mode, m_selected_btn, touch_gui_button_id_END, and wstrgettext().

Referenced by regenerateGui().

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

◆ updateDragState()

void GUITouchscreenLayout::updateDragState ( v2u32 screensize,
v2s32 mouse_movement )
private

References Dragging, ButtonLayout::getRect(), ButtonLayout::layout, m_button_size, m_error_rects, m_last_good_layout, m_layout, m_mode, m_selected_btn, m_tsrc, and ButtonMeta::setPos().

Referenced by OnEvent().

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

Member Data Documentation

◆ m_add_button_titles

std::vector<std::shared_ptr<gui::IGUIStaticText> > GUITouchscreenLayout::m_add_button_titles
private

◆ m_add_layout

ButtonLayout GUITouchscreenLayout::m_add_layout
private

◆ m_button_size

s32 GUITouchscreenLayout::m_button_size
private

◆ m_error_rects

std::vector<core::recti> GUITouchscreenLayout::m_error_rects
private

Referenced by drawMenu(), OnEvent(), and updateDragState().

◆ m_gui_add_btn

std::shared_ptr<gui::IGUIButton> GUITouchscreenLayout::m_gui_add_btn
private

◆ m_gui_done_btn

std::shared_ptr<gui::IGUIButton> GUITouchscreenLayout::m_gui_done_btn
private

◆ m_gui_help_text

std::shared_ptr<gui::IGUIStaticText> GUITouchscreenLayout::m_gui_help_text
private

◆ m_gui_images

std::unordered_map<touch_gui_button_id, std::shared_ptr<gui::IGUIImage> > GUITouchscreenLayout::m_gui_images
private

◆ m_gui_images_target_pos

std::unordered_map<touch_gui_button_id, v2s32> GUITouchscreenLayout::m_gui_images_target_pos
private

◆ m_gui_remove_btn

std::shared_ptr<gui::IGUIButton> GUITouchscreenLayout::m_gui_remove_btn
private

◆ m_gui_reset_btn

std::shared_ptr<gui::IGUIButton> GUITouchscreenLayout::m_gui_reset_btn
private

◆ m_last_good_layout

ButtonLayout GUITouchscreenLayout::m_last_good_layout
private

Referenced by OnEvent(), and updateDragState().

◆ m_last_mouse_pos

v2s32 GUITouchscreenLayout::m_last_mouse_pos
private

Referenced by OnEvent().

◆ m_last_screensize

v2u32 GUITouchscreenLayout::m_last_screensize
private

Referenced by regenerateGui().

◆ m_layout

◆ m_mode

◆ m_mouse_down

bool GUITouchscreenLayout::m_mouse_down = false
private

Referenced by OnEvent().

◆ m_selected_btn

◆ m_tsrc

ISimpleTextureSource* GUITouchscreenLayout::m_tsrc
private

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