The Battle for Wesnoth  1.19.5+dev
plugin_executor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2024
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include "gui/core/timer.hpp"
18 #include "gui/widgets/window.hpp"
21 #include "game_config.hpp"
22 #include <memory>
23 
24 namespace gui2::dialogs
25 {
26 
28 {
29  std::size_t timer_id;
30 
31  void play_slice() {
32  if(plugins_context_) {
33  plugins_context_->play_slice();
34  }
35  }
36 protected:
37  std::unique_ptr<plugins_context> plugins_context_;
38 
39 protected:
41  : timer_id(0u)
42  {
43  if(plugins_manager::get()) {
45  }
46  }
47 
49  {
50  if(plugins_manager::get()) {
52  }
53  }
54 };
55 
56 } // namespace dialogs
std::unique_ptr< plugins_context > plugins_context_
static plugins_manager * get()
Definition: manager.cpp:58
This file contains the window object, this object is a top level container which has the event manage...
std::chrono::milliseconds lobby_network_timer
Definition: game_config.cpp:71
std::size_t add_timer(const std::chrono::milliseconds &interval, const std::function< void(std::size_t id)> &callback, const bool repeat)
Adds a new timer.
Definition: timer.cpp:123
bool remove_timer(const std::size_t id)
Removes a timer.
Definition: timer.cpp:164
Contains the gui2 timer routines.