The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
palette_manager.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 /**
16  * Manages all the palettes in the editor.
17  */
18 
19 #ifndef PALETTE_MANAGER_H_INCLUDED
20 #define PALETTE_MANAGER_H_INCLUDED
21 
22 #include "common_palette.hpp"
23 
24 #include "empty_palette.hpp"
25 #include "terrain_palettes.hpp"
26 #include "unit_palette.hpp"
27 #include "item_palette.hpp"
28 #include "location_palette.hpp"
29 
30 namespace editor {
31 
32 /** Empty palette */
33 class palette_manager : public gui::widget {
34 
35 public:
36 
38  , mouse_action** active_mouse_action);
39 
40  void set_group(size_t index);
41 
42  /** Scroll the editor-palette up one step if possible. */
43  void scroll_up();
44  /** Scroll the editor-palette down one step if possible. */
45  void scroll_down();
46 
47  bool can_scroll_up();
48  bool can_scroll_down();
49 
50  void scroll_top();
51  void resrote_palete_bg(bool scroll_top);
52  void scroll_bottom();
53 
54 //TODO
55 // void swap();
56 
57  void adjust_size();
58 
60  virtual void handle_event(const SDL_Event& event);
61 
62  /**
63  * Draw the palette.
64  *
65  * If force is true everything will be redrawn,
66  * even though it is not invalidated.
67  */
68  //void draw(bool force=false);
69  void draw_contents(); // { draw(false); };
70 
71 public:
72 
74 
75 private:
76 
80 
81 public:
82 
83  boost::scoped_ptr<terrain_palette> terrain_palette_;
84  boost::scoped_ptr<unit_palette> unit_palette_;
85  boost::scoped_ptr<empty_palette> empty_palette_;
86  boost::scoped_ptr<item_palette> item_palette_;
87  boost::scoped_ptr<location_palette> location_palette_;
88 };
89 
90 }
91 
92 #endif
void set_group(size_t index)
boost::scoped_ptr< unit_palette > unit_palette_
std::vector< events::sdl_handler * > sdl_handler_vector
Definition: events.hpp:163
common_palette & active_palette()
void resrote_palete_bg(bool scroll_top)
virtual void handle_event(const SDL_Event &event)
General purpose widgets.
boost::scoped_ptr< item_palette > item_palette_
mouse_action ** mouse_action_
void draw_contents()
Draw the palette.
boost::scoped_ptr< location_palette > location_palette_
palette_manager(editor_display &gui, const config &cfg, mouse_action **active_mouse_action)
boost::scoped_ptr< empty_palette > empty_palette_
sdl_handler_vector handler_members()
Manage the empty-palette in the editor.
Definition: action.cpp:28
void scroll_down()
Scroll the editor-palette down one step if possible.
void scroll_up()
Scroll the editor-palette up one step if possible.
GLuint index
Definition: glew.h:1782
cl_event event
Definition: glew.h:3070
boost::scoped_ptr< terrain_palette > terrain_palette_
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