This shows the dialog to modify tod schedules. More...
#include <custom_tod.hpp>
Public Types | |
using | string_pair = std::pair< std::string, std::string > |
The execute function. More... | |
using | tod_attribute_getter = std::function< string_pair(const time_of_day &)> |
Public Member Functions | |
custom_tod (const std::vector< time_of_day > ×, int current_time) | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
void | set_allow_plugin_skip (const bool allow_plugin_skip) |
void | set_show_even_without_video (const bool show_even_without_video) |
Private Member Functions | |
virtual const std::string & | window_id () const override |
Inherited from modal_dialog, implemented by REGISTER_DIALOG. More... | |
virtual void | pre_show (window &window) override |
Inherited from modal_dialog. More... | |
virtual void | post_show (window &window) override |
Inherited from modal_dialog. More... | |
void | do_next_tod () |
Callback for the next tod button. More... | |
void | do_prev_tod () |
void | do_new_tod () |
void | do_delete_tod () |
template<custom_tod::string_pair(*)(const time_of_day &) fptr> | |
void | select_file (const std::string &default_dir) |
void | color_slider_callback () |
void | update_tod_display () |
void | update_lawful_bonus () |
void | set_selected_tod (time_of_day tod) |
const time_of_day & | get_selected_tod () const |
void | update_selected_tod_info () |
void | copy_to_clipboard_callback (tod_attribute_getter getter) |
Private Attributes | |
std::vector< time_of_day > | times_ |
Available time_of_days. More... | |
int | current_tod_ |
Current ToD index. More... | |
field_integer * | color_field_r_ |
field_integer * | color_field_g_ |
field_integer * | color_field_b_ |
Additional Inherited Members | |
![]() | |
field_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr) |
Creates a new integer field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false) |
Creates a new text field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
field_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new styled_widget as a label. More... | |
field_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
This shows the dialog to modify tod schedules.
Key | Type | Mandatory | Description |
---|---|---|---|
current_tod_name | text_box | yes | The name of the time of day(ToD). |
current_tod_id | text_box | yes | The id of the time of day(ToD). |
current_tod_image | image | yes | The image for the time of day(ToD). |
current_tod_mask | image | yes | The image mask for the time of day(ToD). |
current_tod_sound | label | yes | The sound for the time of day(ToD). |
next_tod | button | yes | Selects the next ToD. |
prev_tod | button | yes | Selects the previous ToD. |
lawful_bonus | slider | yes | Sets the Lawful Bonus for the current ToD. |
tod_red | slider | yes | Sets the red component of the current ToD. |
tod_green | slider | yes | Sets the green component of the current ToD. |
tod_blue | slider | yes | Sets the blue component of the current ToD. |
Definition at line 47 of file custom_tod.hpp.
using gui2::dialogs::custom_tod::string_pair = std::pair<std::string, std::string> |
The execute function.
See modal_dialog for more information.
Definition at line 55 of file custom_tod.hpp.
using gui2::dialogs::custom_tod::tod_attribute_getter = std::function<string_pair(const time_of_day&)> |
Definition at line 56 of file custom_tod.hpp.
gui2::dialogs::custom_tod::custom_tod | ( | const std::vector< time_of_day > & | times, |
int | current_time | ||
) |
Definition at line 60 of file custom_tod.cpp.
|
private |
Definition at line 222 of file custom_tod.cpp.
References tod_color::b, time_of_day::color, color_field_b_, color_field_g_, color_field_r_, current_tod_, tod_color::g, gui2::field< T, W, CT >::get_widget_value(), gui2::dialogs::modal_dialog::get_window(), tod_color::r, times_, and update_tod_display().
Referenced by pre_show().
|
private |
Definition at line 295 of file custom_tod.cpp.
References desktop::clipboard::copy_to_clipboard(), and get_selected_tod().
Referenced by pre_show().
|
private |
Definition at line 196 of file custom_tod.cpp.
References current_tod_, times_, and update_selected_tod_info().
Referenced by pre_show().
|
private |
Definition at line 190 of file custom_tod.cpp.
References current_tod_, times_, and update_selected_tod_info().
Referenced by pre_show().
|
private |
Callback for the next tod button.
Definition at line 178 of file custom_tod.cpp.
References current_tod_, times_, and update_selected_tod_info().
Referenced by pre_show().
|
private |
Definition at line 184 of file custom_tod.cpp.
References current_tod_, times_, and update_selected_tod_info().
Referenced by pre_show().
|
private |
Definition at line 213 of file custom_tod.cpp.
References current_tod_, and times_.
Referenced by copy_to_clipboard_callback(), select_file(), update_selected_tod_info(), and update_tod_display().
|
overrideprivatevirtual |
Inherited from modal_dialog.
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 300 of file custom_tod.cpp.
References gui2::dialogs::modal_dialog::get_retval(), gui2::OK, and update_tod_display().
|
overrideprivatevirtual |
Inherited from modal_dialog.
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 73 of file custom_tod.cpp.
References _(), gui2::window::add_to_tab_order(), desktop::clipboard::available(), color_field_b_, color_field_g_, color_field_r_, color_slider_callback(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), copy_to_clipboard_callback(), do_delete_tod(), do_new_tod(), do_next_tod(), do_prev_tod(), gui2::field_base::get_widget(), gui2::button::set_active(), gui2::styled_widget::set_tooltip(), gui2::dialogs::tod_getter_image(), gui2::dialogs::tod_getter_mask(), gui2::dialogs::tod_getter_sound(), update_lawful_bonus(), and update_selected_tod_info().
|
private |
Definition at line 146 of file custom_tod.cpp.
References _(), filesystem::base_name(), current_tod_, preferences::editor::default_dir(), filesystem::directory_name(), get_selected_tod(), gui2::dialogs::file_dialog::path(), gui2::dialogs::file_dialog::set_ok_label(), gui2::dialogs::file_dialog::set_path(), gui2::dialogs::file_dialog::set_read_only(), gui2::dialogs::file_dialog::set_title(), gui2::dialogs::modal_dialog::show(), times_, and update_selected_tod_info().
|
private |
|
private |
Definition at line 264 of file custom_tod.cpp.
References current_tod_, gui2::dialogs::modal_dialog::get_window(), and times_.
Referenced by pre_show().
|
private |
Definition at line 269 of file custom_tod.cpp.
References tod_color::b, time_of_day::color, color_field_b_, color_field_g_, color_field_r_, current_tod_, tod_color::g, get_selected_tod(), gui2::dialogs::modal_dialog::get_window(), time_of_day::id, time_of_day::image, time_of_day::image_mask, time_of_day::lawful_bonus, time_of_day::name, tod_color::r, gui2::field< T, W, CT >::set_widget_value(), time_of_day::sounds, times_, and update_tod_display().
Referenced by do_delete_tod(), do_new_tod(), do_next_tod(), do_prev_tod(), pre_show(), and select_file().
|
private |
Definition at line 233 of file custom_tod.cpp.
References display::draw(), get_selected_tod(), display::get_singleton(), gui2::dialogs::modal_dialog::get_window(), display::invalidate_all(), gui2::widget::set_is_dirty(), gui2::window::undraw(), and display::update_tod().
Referenced by color_slider_callback(), post_show(), and update_selected_tod_info().
|
overrideprivatevirtual |
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 99 of file custom_tod.hpp.
Referenced by color_slider_callback(), pre_show(), and update_selected_tod_info().
|
private |
Definition at line 98 of file custom_tod.hpp.
Referenced by color_slider_callback(), pre_show(), and update_selected_tod_info().
|
private |
Definition at line 97 of file custom_tod.hpp.
Referenced by color_slider_callback(), pre_show(), and update_selected_tod_info().
|
private |
Current ToD index.
Definition at line 95 of file custom_tod.hpp.
Referenced by color_slider_callback(), do_delete_tod(), do_new_tod(), do_next_tod(), do_prev_tod(), get_selected_tod(), select_file(), update_lawful_bonus(), and update_selected_tod_info().
|
private |
Available time_of_days.
Definition at line 92 of file custom_tod.hpp.
Referenced by color_slider_callback(), do_delete_tod(), do_new_tod(), do_next_tod(), do_prev_tod(), get_selected_tod(), select_file(), update_lawful_bonus(), and update_selected_tod_info().