The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
list.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[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 GUI_DIALOGS_ADDON_LIST_HPP_INCLUDED
16 #define GUI_DIALOGS_ADDON_LIST_HPP_INCLUDED
17 
18 #include "addon/info.hpp"
19 #include "addon/state.hpp"
20 
21 #include "gui/dialogs/dialog.hpp"
23 #include "gui/widgets/pane.hpp"
24 
25 #include "config.hpp" // needed for config::const_child_itors
26 
27 namespace gui2
28 {
29 class ttext_;
30 class ttext_box;
31 class pane;
32 class tselectable_;
33 
34 /** Shows the list of addons on the server. */
35 class taddon_list : public tdialog
36 {
37 public:
38  explicit taddon_list(const config& cfg);
39 
40 private:
41  void register_sort_button(twindow& window, const std::string& id, const tgenerator_::torder_func& up, const tgenerator_::torder_func& down);
42  void register_sort_button_alphabetical(twindow& window, const std::string& id, const std::string& prop_id);
43  void register_sort_button_numeric(twindow& window, const std::string& id, const std::string& prop_id);
44 
46  void on_filtertext_changed(ttext_* textbox, const std::string& text);
47 
48  std::vector<tselectable_*> orders_;
49 
50  void on_addon_select(twindow& window);
51  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
52  virtual const std::string& window_id() const;
53 
54  /** Inherited from tdialog. */
55  void pre_show(twindow& window);
56 
57  /** Config which contains the list with the campaigns. */
58  const config& cfg_;
59 
60  /**
61  * Debug iterators for testing with --new-widgets
62  */
64 
66 
68 
69  std::vector<std::string> ids_;
70 
71  void browse_url_callback(ttext_box& url_box);
72  void copy_url_callback(ttext_box& url_box);
73  void options_button_callback(twindow& window);
74  void show_help(twindow& window);
75 };
76 
77 } // namespace gui2
78 
79 #endif
void register_sort_button_alphabetical(twindow &window, const std::string &id, const std::string &prop_id)
Definition: list.cpp:234
void options_button_callback(twindow &window)
Definition: list.cpp:493
void register_sort_button(twindow &window, const std::string &id, const tgenerator_::torder_func &up, const tgenerator_::torder_func &down)
Definition: list.cpp:227
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
Class for a single line text area.
Definition: text_box.hpp:118
void on_addon_select(twindow &window)
Definition: list.cpp:542
void browse_url_callback(ttext_box &url_box)
Definition: list.cpp:512
taddon_list(const config &cfg)
Definition: list.cpp:179
addons_list addons_
Definition: list.hpp:65
Definitions for the interface to Wesnoth Markup Language (WML).
std::function< bool(unsigned, unsigned)> torder_func
Definition: generator.hpp:239
std::pair< const_child_iterator, const_child_iterator > const_child_itors
Definition: config.hpp:214
void register_sort_button_numeric(twindow &window, const std::string &id, const std::string &prop_id)
Definition: list.cpp:242
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
void show_help(twindow &window)
Definition: list.cpp:507
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
config::const_child_itors cfg_iterators_
Debug iterators for testing with –new-widgets.
Definition: list.hpp:63
void on_order_button_click(twindow &window, const tgenerator_::torder_func &up, const tgenerator_::torder_func &down, twidget &w)
Definition: list.cpp:203
Abstract base class for all dialogs.
Definition: dialog.hpp:121
void pre_show(twindow &window)
Inherited from tdialog.
Definition: list.cpp:382
std::map< std::string, addon_info > addons_list
Definition: info.hpp:26
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1858
void copy_url_callback(ttext_box &url_box)
Definition: list.cpp:519
const config & cfg_
Config which contains the list with the campaigns.
Definition: list.hpp:58
std::vector< tselectable_ * > orders_
Definition: list.hpp:48
addons_tracking_list tracking_info_
Definition: list.hpp:67
void on_filtertext_changed(ttext_ *textbox, const std::string &text)
Definition: list.cpp:190
std::vector< std::string > ids_
Definition: list.hpp:69
std::map< std::string, addon_tracking_info > addons_tracking_list
Definition: state.hpp:62
Base class for all widgets.
Definition: widget.hpp:49
Shows the list of addons on the server.
Definition: list.hpp:35
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Abstract base class for text items.
Definition: text.hpp:43