16 #define GETTEXT_DOMAIN "wesnoth-lib"
42 hour_percentage_ = find_widget<progress_bar>(
43 this,
"hour_percentage",
false,
false);
44 minute_percentage_ = find_widget<progress_bar>(
45 this,
"minute_percentage",
false,
false);
46 second_percentage_ = find_widget<progress_bar>(
47 this,
"second_percentage",
false,
false);
49 hour_ = find_widget<integer_selector>(
this,
"hour",
false,
false);
51 hour->set_active(
false);
53 minute_ = find_widget<integer_selector>(
this,
"minute",
false,
false);
55 minute->set_active(
false);
57 second_ = find_widget<integer_selector>(
this,
"second",
false,
false);
59 second->set_active(
false);
62 pane_ = find_widget<pane>(
this,
"pane",
false,
false);
64 clock_ = find_widget<styled_widget>(
this,
"clock",
false,
false);
66 time_.set_current_time();
116 const std::map<std::string, std::string> tags;
120 item[
"label"] = std::to_string(second_stamp);
121 item_data.emplace(
"time",
item);
134 std::time_t now = ::std::time(
nullptr);
135 std::tm* stamp = std::localtime(&now);
137 hour = stamp->tm_hour;
138 minute = stamp->tm_min;
139 second = stamp->tm_sec;
145 millisecond += milliseconds;
147 if(millisecond < 1000)
A simple canvas which can be drawn upon.
void set_variable(const std::string &key, wfl::variant &&value)
Clock to test the draw events.
virtual void update() override
Update state and any parameters that may effect layout, or any of the later stages.
progress_bar * second_percentage_
Progress bar for displaying the seconds as a percentage.
progress_bar * minute_percentage_
Progress bar for displaying the minutes as a percentage.
integer_selector * minute_
An integer selector to display the total seconds this hour.
integer_selector * second_
An integer selector to display the seconds this minute.
void update_time(const bool force)
The callback for the drawing routine.
time time_
The ‘current’ time.
progress_bar * hour_percentage_
Progress bar for displaying the hours as a percentage.
integer_selector * hour_
An integer selector to display the total seconds.
styled_widget * clock_
A widget that can display the time.
The popup class shows windows that are shown non-modal.
virtual void set_value(int value)=0
Sets the selected value.
unsigned create_item(const widget_data &item_data, const std::map< std::string, std::string > &tags)
Creates a new item.
void set_percentage(unsigned percentage)
virtual void update()
Update state and any parameters that may effect layout, or any of the later stages.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
std::pair< std::string, unsigned > item
This file contains the settings handling of the widget library.
unsigned minute
The number of minutes.
unsigned second
The number of seconds.
unsigned hour
The number of hours.
void set_current_time()
Sets the fields to the current time.
bool step(const unsigned milliseconds=30)
Moves the clock x milliseconds forward.