1 /* 2 Copyright (C) 2009 - 2018 by Mark de Wever <koraq@xs4all.nl> 3 Part of the Battle for Wesnoth Project https://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 #pragma once 16 17 #include "gui/widgets/scrollbar_container.hpp" 18 19 #include "gui/core/widget_definition.hpp" 20 #include "gui/core/window_builder.hpp" 21 22 namespace gui2 23 { 24 25 // ------------ WIDGET -----------{ 26 27 namespace implementation 28 { 29 struct builder_scrollbar_panel; 30 } 31 32 /** 33 * Visible container to hold multiple widgets. 34 * 35 * This widget can draw items beyond the widgets it holds and in front of 36 * them. A panel is always active so these functions return dummy values. 37 */ 38 class scrollbar_panel : public scrollbar_container 39 { 40 friend struct implementation::builder_scrollbar_panel; 41 42 public: 43 /** 44 * Constructor. 45 */ 46 explicit scrollbar_panel(const implementation::builder_scrollbar_panel& builder); 47 48 /** See @ref styled_widget::get_active. */ 49 virtual bool get_active() const override; 50 51 /** See @ref styled_widget::get_state. */ 52 virtual unsigned get_state() const override; 53 54 /** Static type getter that does not rely on the widget being constructed. */ 55 static const std::string& type(); 56 57 private: 58 /** Inherited from styled_widget, implemented by REGISTER_WIDGET. */ 59 virtual const std::string& get_control_type() const override; 60 61 /** See @ref container_base::set_self_active. */ 62 virtual void set_self_active(const bool active) override; 63 }; 64 65 // }---------- DEFINITION ---------{ 66 67 struct scrollbar_panel_definition : public styled_widget_definition 68 { 69 70 explicit scrollbar_panel_definition(const config& cfg); 71 72 struct resolution : public resolution_definition 73 { 74 explicit resolution(const config& cfg); 75 76 builder_grid_ptr grid; 77 }; 78 }; 79 80 // }---------- BUILDER -----------{ 81 82 namespace implementation 83 { 84 85 struct builder_scrollbar_panel : public builder_styled_widget 86 { 87 explicit builder_scrollbar_panel(const config& cfg); 88 89 using builder_styled_widget::build; 90 91 widget* build() const; 92 93 scrollbar_container::scrollbar_mode vertical_scrollbar_mode; 94 scrollbar_container::scrollbar_mode horizontal_scrollbar_mode; 95 96 builder_grid_ptr grid_; 97 }; 98 99 } // namespace implementation 100 101 // }------------ END -------------- 102 103 } // namespace gui2 104