16 #define GETTEXT_DOMAIN "wesnoth-lib"
39 hour_percentage_ = find_widget<progress_bar>(
"hour_percentage",
false,
false);
40 minute_percentage_ = find_widget<progress_bar>(
"minute_percentage",
false,
false);
41 second_percentage_ = find_widget<progress_bar>(
"second_percentage",
false,
false);
43 hour_ = find_widget<integer_selector>(
"hour",
false,
false);
45 hour->set_active(
false);
47 minute_ = find_widget<integer_selector>(
"minute",
false,
false);
49 minute->set_active(
false);
51 second_ = find_widget<integer_selector>(
"second",
false,
false);
53 second->set_active(
false);
56 pane_ = find_widget<pane>(
"pane",
false,
false);
58 clock_ = find_widget<styled_widget>(
"clock",
false,
false);
60 time_.set_current_time();
110 const std::map<std::string, std::string> tags;
114 item[
"label"] = std::to_string(second_stamp);
115 item_data.emplace(
"time", item);
128 std::time_t now = ::std::time(
nullptr);
129 std::tm* stamp = std::localtime(&now);
131 hour = stamp->tm_hour;
132 minute = stamp->tm_min;
133 second = stamp->tm_sec;
139 millisecond += milliseconds;
141 if(millisecond < 1000)
A simple canvas which can be drawn upon.
void set_variable(const std::string &key, wfl::variant &&value)
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.
REGISTER_DIALOG(editor_edit_unit)
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
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.