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);
50 if(
styled_widget *hour = dynamic_cast<styled_widget*>(hour_)) {
53 minute_ = find_widget<integer_selector>(
this,
"minute",
false,
false);
54 if(
styled_widget *minute = dynamic_cast<styled_widget*>(minute_)) {
55 minute->set_active(
false);
57 second_ = find_widget<integer_selector>(
this,
"second",
false,
false);
58 if(
styled_widget *second = dynamic_cast<styled_widget*>(second_)) {
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;
integer_selector * minute_
An integer selector to display the total seconds this hour.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
progress_bar * second_percentage_
Progress bar for displaying the seconds as a percentage.
integer_selector * hour_
An integer selector to display the total seconds.
void set_variable(const std::string &key, wfl::variant &&value)
void set_percentage(unsigned percentage)
progress_bar * minute_percentage_
Progress bar for displaying the minutes as a percentage.
integer_selector * second_
An integer selector to display the seconds this minute.
unsigned second
The number of seconds.
virtual void update() override
Update state and any parameters that may effect layout, or any of the later stages.
void update_time(const bool force)
The callback for the drawing routine.
std::map< std::string, t_string > widget_item
This file contains the settings handling of the widget library.
progress_bar * hour_percentage_
Progress bar for displaying the hours as a percentage.
A simple canvas which can be drawn upon.
unsigned minute
The number of minutes.
time time_
The `current' time.
void set_current_time()
Sets the fields to the current time.
Clock to test the draw events.
virtual void update()
Update state and any parameters that may effect layout, or any of the later stages.
virtual void set_active(const bool active) override
See styled_widget::set_active.
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.
The popup class shows windows that are shown non-modal.
std::map< std::string, widget_item > widget_data
unsigned hour
The number of hours.
unsigned millisecond
The number of milliseconds.
bool step(const unsigned milliseconds=30)
Moves the clock x milliseconds forward.
styled_widget * clock_
A widget that can display the time.
std::pair< std::string, unsigned > item