The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
empty_palette.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2012 - 2025
3 by Fabian Mueller <fabianmueller5@gmx.de>
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/**
17 * Manage the empty-palette in the editor.
18 */
19
20#pragma once
21
23
24namespace editor {
25
26/** Empty palette */
28
29public:
30
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 rect& /*target*/) override {}
45
46 void hide(bool /*hidden*/) override
47 {
48 std::shared_ptr<gui::button> upscroll_button = gui_.find_action_button("upscroll-button-editor");
49 upscroll_button->enable(false);
50 std::shared_ptr<gui::button> downscroll_button = gui_.find_action_button("downscroll-button-editor");
51 downscroll_button->enable(false);
52 std::shared_ptr<gui::button> palette_menu_button = gui_.find_menu_button("menu-editor-terrain");
53 palette_menu_button->set_overlay("");
54 palette_menu_button->enable(false);
55 }
56
57 std::vector<gui::widget>* get_widgets() { return nullptr; }
58
59 //group
60 virtual void set_group(std::size_t /*index*/) override {}
61 virtual void next_group() override {}
62 virtual void prev_group() override {}
63 virtual const std::vector<item_group>& get_groups() const override { static const std::vector<item_group> empty; return empty; }
64
65 /** Menu expanding for palette group list */
66 virtual void expand_palette_groups_menu(std::vector<config>& /*items*/) override
67 {
68 }
69
70 //item
71 virtual std::size_t num_items() override {return 0;}
72 virtual std::size_t start_num() override {return 0;}
73 virtual void set_start_item(std::size_t /*index*/) override {}
74 virtual bool supports_swap() override { return false; }
75 virtual void swap() override {}
76
77private:
79};
80
81}
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition display.hpp:88
std::shared_ptr< gui::button > find_action_button(const std::string &id)
Retrieves a pointer to a theme UI button.
Definition display.cpp:768
std::shared_ptr< gui::button > find_menu_button(const std::string &id)
Definition display.cpp:778
virtual bool can_scroll_down() override
virtual void next_group() override
virtual void swap() override
For tools which support fg and bg items, exchange the two items.
void hide(bool) override
virtual std::size_t start_num() override
empty_palette(display &gui)
std::vector< gui::widget > * get_widgets()
virtual void expand_palette_groups_menu(std::vector< config > &) override
Menu expanding for palette group list.
virtual void set_start_item(std::size_t) override
virtual bool scroll_down() override
Scroll the editor-palette down one step if possible.
virtual std::size_t num_items() override
virtual bool mouse_click()
virtual bool can_scroll_up() override
virtual void adjust_size(const rect &) override
virtual bool supports_swap() override
Whether the hotkey system should the enable GUI button connected to swap().
virtual void set_group(std::size_t) override
virtual bool scroll_up() override
Scroll the editor-palette up one step if possible.
virtual const std::vector< item_group > & get_groups() const override
virtual void prev_group() override
Manage the empty-palette in the editor.
Definition action.cpp:31
General purpose widgets.
An abstract description of a rectangle with integer coordinates.
Definition rect.hpp:49