The Battle for Wesnoth  1.19.7+dev
minimap.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
21 
22 class config;
23 class gamemap;
24 
25 namespace gui2
26 {
27 namespace implementation
28 {
29 struct builder_minimap;
30 }
31 
32 // ------------ WIDGET -----------{
33 
34 class minimap : public styled_widget
35 {
36 public:
37  explicit minimap(const implementation::builder_minimap& builder);
38 
39  /***** ***** ***** ***** Inherited ***** ***** ***** *****/
40 
41  /** See @ref styled_widget::set_active. */
42  virtual void set_active(const bool active) override;
43 
44  /** See @ref styled_widget::get_active. */
45  virtual bool get_active() const override;
46 
47  /** See @ref styled_widget::get_state. */
48  virtual unsigned get_state() const override;
49 
50  /** See @ref widget::disable_click_dismiss. */
51  bool disable_click_dismiss() const override;
52 
53  /***** ***** ***** setters / getters for members ***** ****** *****/
54 
55  void set_map_data(const std::string& map_data);
56 
57 private:
58  /** Game map generated from the provided data. */
59  std::unique_ptr<gamemap> map_;
60 
61  /** See @ref widget::impl_draw_background. */
62  virtual bool impl_draw_background() override;
63 
64 public:
65  /** Static type getter that does not rely on the widget being constructed. */
66  static const std::string& type();
67 
68 private:
69  /** Inherited from styled_widget, implemented by REGISTER_WIDGET. */
70  virtual const std::string& get_control_type() const override;
71 };
72 
73 // }---------- DEFINITION ---------{
74 
76 {
77  explicit minimap_definition(const config& cfg);
78 
80  {
81  explicit resolution(const config& cfg);
82  };
83 };
84 
85 // }---------- BUILDER -----------{
86 
87 namespace implementation
88 {
89 
91 {
92  explicit builder_minimap(const config& cfg);
93 
95 
96  virtual std::unique_ptr<widget> build() const override;
97 };
98 
99 } // namespace implementation
100 
101 // }------------ END --------------
102 
103 } // namespace gui2
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
Encapsulates the map of the game.
Definition: map.hpp:172
virtual bool impl_draw_background() override
See widget::impl_draw_background.
Definition: minimap.cpp:86
void set_map_data(const std::string &map_data)
Definition: minimap.cpp:74
std::unique_ptr< gamemap > map_
Game map generated from the provided data.
Definition: minimap.hpp:59
virtual bool get_active() const override
See styled_widget::get_active.
Definition: minimap.cpp:59
virtual const std::string & get_control_type() const override
Inherited from styled_widget, implemented by REGISTER_WIDGET.
virtual unsigned get_state() const override
See styled_widget::get_state.
Definition: minimap.cpp:64
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
bool disable_click_dismiss() const override
See widget::disable_click_dismiss.
Definition: minimap.cpp:69
virtual void set_active(const bool active) override
See styled_widget::set_active.
Definition: minimap.cpp:54
minimap(const implementation::builder_minimap &builder)
Definition: minimap.cpp:49
Generic file dialog.
Contains the implementation details for lexical_cast and shouldn't be used directly.
virtual std::unique_ptr< widget > build() const override
Definition: minimap.cpp:123
builder_minimap(const config &cfg)
Definition: minimap.cpp:119
virtual std::unique_ptr< widget > build() const=0
minimap_definition(const config &cfg)
Definition: minimap.cpp:99