MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
simpleform.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; version 2 of the
7  * License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 #ifndef _MFORMS_SIMPLEFORM_H_
20 #define _MFORMS_SIMPLEFORM_H_
21 
22 #include <mforms/form.h>
23 #include <string>
24 #include <list>
25 #include <map>
26 
27 namespace mforms {
28 
29  class Label;
30  class View;
31  class Button;
32  class Panel;
33  class Box;
34  class Table;
35 
36  class MFORMS_EXPORT SimpleForm : public Form
37  {
38  public:
39  SimpleForm(const std::string &title, const std::string &ok_caption);
40  ~SimpleForm();
41 
42  void parse_definition(const std::string &definition);
43 
44  //void begin_group();
45  //void end_group();
46 
47  void add_label(const std::string &text, bool bold);
48 
49  void add_file_picker(const std::string &name, const std::string &caption,
50  const std::string &default_value="");
51 
52  void add_text_entry(const std::string &name, const std::string &caption,
53  const std::string &default_value="");
54 
55  void add_text_area(const std::string &name, const std::string &caption,
56  int rows, const std::string &default_value="");
57 
58  void add_checkbox(const std::string &name, const std::string &caption,
59  bool default_value= false);
60 
61  void add_select(const std::string &name, const std::string &caption,
62  const std::list<std::string> &items, int default_index=-1);
63 
64  bool show();
65 
66  std::map<std::string, View*> get_views();
67  std::string get_string_value(const std::string &name);
68  bool get_bool_value(const std::string &name);
69  int get_int_value(const std::string &name);
70 
71  private:
72 
73  // Visual Studio produces a warning about this structure and its use in the list below. It complains about having no
74  // DLL interface for it. Huh? This is a private structure and never given out to anyone.
75  // If that ever changes then remove the pragma and export the list type properly!
76 #ifdef _WIN32
77 #pragma warning(push)
78 #pragma warning(disable:4251)
79 #endif // _WIN32
80  struct Row
81  {
84  int spacing; // TODO: this spacing has no function in a table. Investigate if it is still necessary.
85  bool fullwidth; // TODO: similar this value
86  };
87  std::list<Row> _rows;
88  std::string _ok_caption; // STL type, produces the same DLL-interface warning.
89 #ifdef _WIN32
90 #pragma warning(pop)
91 #endif // _WIN32
92 
100  };
101 
102 };
103 
104 #endif
Button * _cancel_button
Definition: simpleform.h:96
A standalone, top-level window.
Definition: form.h:72
Container to layout child items in a grid of rows and columns.
Definition: table.h:68
Places child views sequentially in a vertical or horizontal layout.
Definition: box.h:50
A control with some static text.
Definition: label.h:73
#define MFORMS_EXPORT
Definition: base.h:33
Button * _ok_button
Definition: simpleform.h:95
std::list< Row > _rows
Definition: simpleform.h:87
std::string _ok_caption
Definition: simpleform.h:88
A clickable button control.
Definition: button.h:51
MySQL Workbench 6.1 documentation