The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
editor_toolkit.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2016 by Fabian Mueller <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef EDITOR_TOOLKIT_H_INCLUDED
16 #define EDITOR_TOOLKIT_H_INCLUDED
17 
18 
21 #include "editor/toolkit/brush.hpp"
23 
24 #include <boost/scoped_ptr.hpp>
25 
26 class config;
27 
28 namespace editor {
29 
30 
32 
33 public:
35  const config& game_config, context_manager& c_manager);
36 
38 
39  void adjust_size();
40 
42 
43 private:
44  /** init the sidebar objects */
45  void init_sidebar(const config& game_config);
46 
47  /** init the brushes */
48  void init_brushes(const config& game_config);
49 
50  /** init the mouse actions (tools) */
51  void init_mouse_actions(context_manager& c_manager);
52 
53 public:
54  void set_mouseover_overlay();
56 
57  /**
58  * Set the current mouse action based on a hotkey id
59  */
61 
62  /**
63  * @return true if the mouse action identified by the hotkey is active
64  */
65  bool is_mouse_action_set(hotkey::HOTKEY_COMMAND command) const;
66 
67 
68  /** Get the current mouse action */
70 
71 // Brush related methods
72 
73  /** Cycle to the next brush. */
74  void cycle_brush();
75 
76  /** TODO */
77  void set_brush(std::string id);
78 
79  /** TODO */
80  bool is_active_brush(std::string id) const { return brush_->id() == id; }
81 
83 
84 private:
85 
87 
88  const CKey& key_;
89 
90  boost::scoped_ptr<palette_manager> palette_manager_;
91 
92 //Tools
93 
94  /** The current mouse action */
96 
97  /** The mouse actions */
98  typedef std::map<hotkey::HOTKEY_COMMAND, mouse_action*> mouse_action_map;
99  mouse_action_map mouse_actions_;
100 
101 //Brush members
102 
103  /** The current brush */
105 
106  /** All available brushes */
107  std::vector<brush> brushes_;
108 
109 };
110 
111 }
112 
113 #endif
editor_display & gui_
void hotkey_set_mouse_action(hotkey::HOTKEY_COMMAND command)
Set the current mouse action based on a hotkey id.
mouse_action_map mouse_actions_
bool is_mouse_action_set(hotkey::HOTKEY_COMMAND command) const
void cycle_brush()
Cycle to the next brush.
void init_sidebar(const config &game_config)
init the sidebar objects
General purpose widgets.
brush * brush_
The current brush.
void set_brush(std::string id)
TODO.
editor_toolkit(editor_display &gui, const CKey &key, const config &game_config, context_manager &c_manager)
bool is_active_brush(std::string id) const
TODO.
const std::string id() const
Definition: brush.hpp:58
GLuint id
Definition: glew.h:1647
std::vector< brush > brushes_
All available brushes.
The brush class represents a single brush – a set of relative locations around a "hotspot"...
Definition: brush.hpp:26
boost::scoped_ptr< palette_manager > palette_manager_
Manage the empty-palette in the editor.
Definition: action.cpp:28
mouse_action * get_mouse_action()
Get the current mouse action.
void init_mouse_actions(context_manager &c_manager)
init the mouse actions (tools)
void init_brushes(const config &game_config)
init the brushes
mouse_action * mouse_action_
The current mouse action.
Game configuration data as global variables.
Definition: build_info.cpp:38
std::map< hotkey::HOTKEY_COMMAND, mouse_action * > mouse_action_map
The mouse actions.
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
Class that keeps track of all the keys on the keyboard.
Definition: key.hpp:27
GLsizei const GLcharARB ** string
Definition: glew.h:4503
palette_manager * get_palette_manager()