The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
depcheck_select_new.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2016 by Boldizsár Lipka <[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_MP_DEPCHECK_SELECT_NEW_HPP_INCLUDED
16 #define GUI_DIALOGS_MP_DEPCHECK_SELECT_NEW_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
20 #include <vector>
21 
22 
23 namespace gui2
24 {
25 
27 {
28 public:
29  /**
30  * Constructor.
31  *
32  * @param name the type of which we want to select a new item
33  * @param options the names of the components which can be choosed
34  */
36  const std::vector<std::string>& options);
37 
38  /**
39  * Returns the selected item.
40  *
41  * @return the index of the selected item, or -1 if none was selected
42  * (the dialog was closed with the cancel button)
43  */
44  int result() const
45  {
46  return result_;
47  }
48 
49 protected:
50  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
51  virtual const std::string& window_id() const;
52 
53  /** Inherited from tdialog */
54  virtual void pre_show(twindow& window);
55 
56  /** Inherited from tdialog */
57  virtual void post_show(twindow& window);
58 
59 private:
60  /** the options available */
61  std::vector<std::string> items_;
62 
63  /** the index of the selected item */
64  int result_;
65 };
66 }
67 #endif
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
int result_
the index of the selected item
virtual void post_show(twindow &window)
Inherited from tdialog.
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
const config & options()
Abstract base class for all dialogs.
Definition: dialog.hpp:121
int result() const
Returns the selected item.
virtual void pre_show(twindow &window)
Inherited from tdialog.
tdepcheck_select_new(ng::depcheck::component_type name, const std::vector< std::string > &options)
Constructor.
std::vector< std::string > items_
the options available
GLuint const GLchar * name
Definition: glew.h:1782
GLsizei const GLcharARB ** string
Definition: glew.h:4503