15 #define GETTEXT_DOMAIN "wesnoth-lib"
80 hour_percentage_ = find_widget<tprogress_bar>(
81 &window,
"hour_percentage",
false,
false);
82 minute_percentage_ = find_widget<tprogress_bar>(
83 &window,
"minute_percentage",
false,
false);
84 second_percentage_ = find_widget<tprogress_bar>(
85 &window,
"second_percentage",
false,
false);
87 hour_ = find_widget<tinteger_selector_>(&window,
"hour",
false,
false);
88 if(
tcontrol *hour = dynamic_cast<tcontrol*>(hour_)) {
89 hour->set_active(
false);
91 minute_ = find_widget<tinteger_selector_>(&window,
"minute",
false,
false);
92 if(
tcontrol *minute = dynamic_cast<tcontrol*>(minute_)) {
93 minute->set_active(
false);
95 second_ = find_widget<tinteger_selector_>(&window,
"second",
false,
false);
96 if(
tcontrol *second = dynamic_cast<tcontrol*>(second_)) {
97 second->set_active(
false);
100 pane_ = find_widget<tpane>(&window,
"pane",
false,
false);
102 clock_ = find_widget<tcontrol>(&window,
"clock",
false,
false);
110 time_.set_current_time();
152 canvas.set_variable(
"hour",
variant(hour_stamp));
153 canvas.set_variable(
"minute",
variant(minute_stamp));
154 canvas.set_variable(
"second",
variant(second_stamp));
159 const std::map<std::string, std::string> tags;
160 std::map<std::string, string_map> item_data;
163 item[
"label"] = std::to_string(second_stamp);
164 item_data.insert(std::make_pair(
"time", item));
177 time_t now = time(
nullptr);
178 tm* stamp = localtime(&now);
180 hour = stamp->tm_hour;
181 minute = stamp->tm_min;
182 second = stamp->tm_sec;
188 millisecond += milliseconds;
190 if(millisecond < 1000)
tcontrol * clock_
A widget that can display the time.
void post_show(CVideo &video)
Inherited from tdialog.
tprogress_bar * second_percentage_
Progress bar for displaying the seconds as a percentage.
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
void set_percentage(unsigned percentage)
boost::enable_if< boost::mpl::has_key< tset_event, boost::mpl::int_< E > > >::type disconnect_signal(const tsignal_function &signal, const tposition position=back_child)
Disconnect a signal for callback in tset_event.
REGISTER_DIALOG(label_settings)
Clock to test the draw events.
unsigned create_item(const std::map< std::string, string_map > &item_data, const std::map< std::string, std::string > &tags)
Creates a new item.
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
unsigned minute
The number of minutes.
twindow * window_
The window being shown.
void update_time(const bool force)
The callback for the drawing routine.
void set_current_time()
Sets the fields to the current time.
bool step(const unsigned milliseconds=30)
Moves the clock x milliseconds forward.
virtual void set_value(const int value)=0
Sets the selected value.
tinteger_selector_ * hour_
An integer selector to display the total seconds.
tinteger_selector_ * second_
An integer selector to display the seconds this minute.
tinteger_selector_ * minute_
An integer selector to display the total seconds this hour.
std::map< std::string, t_string > string_map
tprogress_bar * minute_percentage_
Progress bar for displaying the minutes as a percentage.
unsigned hour
The number of hours.
unsigned second
The number of seconds.
ttime time_
The `current' time.
std::vector< tcanvas > & canvas()
Base class for all visible items.
tprogress_bar * hour_percentage_
Progress bar for displaying the hours as a percentage.
event::tsignal_function signal_
The signal patched in the drawing routine.