The Battle for Wesnoth  1.15.0-dev
empty_palette.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2018 by Fabian Mueller <fabianmueller5@gmx.de>
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  * Manage the empty-palette in the editor.
17  */
18 
19 #pragma once
20 
22 
23 namespace editor {
24 
25 /** Empty palette */
26 class empty_palette : public common_palette {
27 
28 public:
29 
31  : common_palette(gui.video())
32  //, gui_(gui)
33  {}
34 
35  //event handling
36  virtual bool mouse_click() { return false;}
37 
38  virtual bool scroll_up() override { return false;}
39  virtual bool can_scroll_up() override { return false;}
40  virtual bool scroll_down() override { return false;}
41  virtual bool can_scroll_down() override { return false;}
42 
43  //drawing
44  virtual void adjust_size(const SDL_Rect& /*target*/) override {}
45  virtual void draw() override {}
46 
47  void hide(bool /*hidden*/) override
48  {
49 #if 0
50  std::shared_ptr<gui::button> upscroll_button = gui_.find_action_button("upscroll-button-editor");
51  upscroll_button->enable(false);
52  std::shared_ptr<gui::button> downscroll_button = gui_.find_action_button("downscroll-button-editor");
53  downscroll_button->enable(false);
54  std::shared_ptr<gui::button> palette_menu_button = gui_.find_menu_button("menu-editor-terrain");
55  palette_menu_button->set_overlay("");
56  palette_menu_button->enable(false);
57 #endif
58  }
59 
60  std::vector<gui::widget>* get_widgets() { return nullptr; }
61 
62  //group
63  virtual void set_group(std::size_t /*index*/) override {}
64  virtual void next_group() override {}
65  virtual void prev_group() override {}
66  virtual const std::vector<item_group>& get_groups() const override { static const std::vector<item_group> empty; return empty; }
67 
68  /** Menu expanding for palette group list */
69  virtual void expand_palette_groups_menu(std::vector<config>& items, int i) override
70  {
71  items.erase(items.begin() + i);
72  }
73 
74  //item
75  virtual int num_items() override {return 0;}
76  virtual std::size_t start_num() override {return 0;}
77  virtual void set_start_item(std::size_t /*index*/) override {}
78  virtual bool supports_swap() override { return false; }
79  virtual void swap() override {}
80 
81 private:
82  //display& gui_;
83 };
84 
85 }
virtual bool scroll_down() override
Scroll the editor-palette down one step if possible.
std::vector< gui::widget > * get_widgets()
virtual const std::vector< item_group > & get_groups() const override
virtual void expand_palette_groups_menu(std::vector< config > &items, int i) override
Menu expanding for palette group list.
General purpose widgets.
virtual void next_group() override
const std::vector< std::string > items
virtual void swap() override
virtual bool mouse_click()
Manage the empty-palette in the editor.
Definition: action.cpp:29
virtual bool supports_swap() override
virtual int num_items() override
std::size_t i
Definition: function.cpp:933
void hide(bool) override
virtual void draw() override
virtual void set_start_item(std::size_t) override
virtual bool can_scroll_down() override
CVideo & video() const
Definition: widget.hpp:84
virtual void prev_group() override
empty_palette(display &gui)
virtual std::size_t start_num() override
virtual void set_group(std::size_t) override
virtual bool can_scroll_up() override
virtual void adjust_size(const SDL_Rect &) override
virtual bool scroll_up() override
Scroll the editor-palette up one step if possible.