The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
theme_list.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by Ignacio Riquelme Morelle <[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_THEME_LIST_HPP_INCLUDED
16 #define GUI_DIALOGS_THEME_LIST_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 
20 struct theme_info;
21 
22 namespace gui2
23 {
24 
25 class ttheme_list : public tdialog
26 {
27 public:
28  explicit ttheme_list(const std::vector<theme_info>& themes,
29  int selection = -1);
30 
31  /**
32  * Returns the selected item index after displaying.
33  * @return -1 if the dialog was canceled.
34  */
35  int selected_index() const
36  {
37  return index_;
38  }
39 
40  /** Sets the initially selected item index (-1 by default). */
42  {
43  index_ = index;
44  }
45 
46 private:
47  int index_;
48 
49  std::vector<theme_info> themes_;
50 
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  /** Inherited from tdialog. */
58  void post_show(twindow& window);
59 };
60 }
61 
62 #endif
ttheme_list(const std::vector< theme_info > &themes, int selection=-1)
Definition: theme_list.cpp:54
void set_selected_index(int index)
Sets the initially selected item index (-1 by default).
Definition: theme_list.hpp:41
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
void post_show(twindow &window)
Inherited from tdialog.
Definition: theme_list.cpp:89
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
Abstract base class for all dialogs.
Definition: dialog.hpp:121
int selected_index() const
Returns the selected item index after displaying.
Definition: theme_list.hpp:35
void pre_show(twindow &window)
Inherited from tdialog.
Definition: theme_list.cpp:59
GLuint index
Definition: glew.h:1782
std::vector< theme_info > themes_
Definition: theme_list.hpp:49
GLsizei const GLcharARB ** string
Definition: glew.h:4503