The Battle for Wesnoth  1.15.0-dev
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gui2::dialogs::lua_interpreter::controller Class Reference

The controller is responsible to hold all the input widgets, and a pointer to the model and view. More...

Public Member Functions

 controller (lua_kernel_base &lk)
 
void bind (window &window)
 Bind my pointers to the widgets found in the window. More...
 
void handle_copy_button_clicked (window &window)
 Copy text to the clipboard. More...
 
void handle_clear_button_clicked (window &window)
 Clear the text. More...
 
void input_keypress_callback (bool &handled, bool &halt, const SDL_Keycode key)
 Handle return key (execute) or tab key (tab completion) More...
 
void update_view ()
 Update the view based on the model. More...
 

Private Member Functions

void execute ()
 
void tab ()
 
void search (int direction)
 

Private Attributes

buttoncopy_button
 
buttonclear_button
 
text_boxtext_entry
 
std::string text_entry_
 
const std::unique_ptr< lua_interpreter::lua_modellua_model_
 
const std::unique_ptr< lua_interpreter::input_modelinput_model_
 
const std::unique_ptr< lua_interpreter::viewview_
 

Friends

class lua_interpreter
 

Detailed Description

The controller is responsible to hold all the input widgets, and a pointer to the model and view.

It is responsible to bind the input signals to appropriate handler methods, which it holds. It is also responsible to ask the view to update based on the output of the model, typically in response to some input.

Definition at line 370 of file lua_interpreter.cpp.

Constructor & Destructor Documentation

◆ controller()

gui2::dialogs::lua_interpreter::controller::controller ( lua_kernel_base lk)
inline

Definition at line 386 of file lua_interpreter.cpp.

Member Function Documentation

◆ bind()

void gui2::dialogs::lua_interpreter::controller::bind ( window window)

Bind my pointers to the widgets found in the window.

Find all the widgets managed by the controller and connect them to handler methods.

Definition at line 450 of file lua_interpreter.cpp.

References _(), desktop::clipboard::available(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_pre_key_press(), handle_clear_button_clicked(), handle_copy_button_clicked(), input_keypress_callback(), and LOG_LUA.

◆ execute()

void gui2::dialogs::lua_interpreter::controller::execute ( )
private

Definition at line 548 of file lua_interpreter.cpp.

References LOG_LUA.

◆ handle_clear_button_clicked()

void gui2::dialogs::lua_interpreter::controller::handle_clear_button_clicked ( window window)

Clear the text.

Definition at line 501 of file lua_interpreter.cpp.

Referenced by bind().

◆ handle_copy_button_clicked()

void gui2::dialogs::lua_interpreter::controller::handle_copy_button_clicked ( window window)

Copy text to the clipboard.

Definition at line 494 of file lua_interpreter.cpp.

References desktop::clipboard::copy_to_clipboard().

Referenced by bind().

◆ input_keypress_callback()

void gui2::dialogs::lua_interpreter::controller::input_keypress_callback ( bool &  handled,
bool &  halt,
const SDL_Keycode  key 
)

Handle return key (execute) or tab key (tab completion)

Definition at line 510 of file lua_interpreter.cpp.

References gui2::dialogs::lua_interpreter::lua_model::execute(), and LOG_LUA.

Referenced by bind().

◆ search()

void gui2::dialogs::lua_interpreter::controller::search ( int  direction)
private

Definition at line 661 of file lua_interpreter.cpp.

◆ tab()

void gui2::dialogs::lua_interpreter::controller::tab ( )
private

Definition at line 584 of file lua_interpreter.cpp.

References utils::word_completion().

◆ update_view()

void gui2::dialogs::lua_interpreter::controller::update_view ( )

Update the view based on the model.

Definition at line 438 of file lua_interpreter.cpp.

References LOG_LUA.

Friends And Related Function Documentation

◆ lua_interpreter

friend class lua_interpreter
friend

Definition at line 408 of file lua_interpreter.cpp.

Member Data Documentation

◆ clear_button

button* gui2::dialogs::lua_interpreter::controller::clear_button
private

Definition at line 373 of file lua_interpreter.cpp.

◆ copy_button

button* gui2::dialogs::lua_interpreter::controller::copy_button
private

Definition at line 372 of file lua_interpreter.cpp.

◆ input_model_

const std::unique_ptr<lua_interpreter::input_model> gui2::dialogs::lua_interpreter::controller::input_model_
private

Definition at line 379 of file lua_interpreter.cpp.

◆ lua_model_

const std::unique_ptr<lua_interpreter::lua_model> gui2::dialogs::lua_interpreter::controller::lua_model_
private

Definition at line 378 of file lua_interpreter.cpp.

◆ text_entry

text_box* gui2::dialogs::lua_interpreter::controller::text_entry
private

Definition at line 375 of file lua_interpreter.cpp.

◆ text_entry_

std::string gui2::dialogs::lua_interpreter::controller::text_entry_
private

Definition at line 376 of file lua_interpreter.cpp.

◆ view_

const std::unique_ptr<lua_interpreter::view> gui2::dialogs::lua_interpreter::controller::view_
private

Definition at line 380 of file lua_interpreter.cpp.


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