MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
checkbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, 2013, 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 
20 #ifndef _MFORMS_CHECKBOX_H_
21 #define _MFORMS_CHECKBOX_H_
22 
23 #include <mforms/base.h>
24 #include <mforms/button.h>
25 
26 
27 namespace mforms {
28  class CheckBox;
29 
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
31 #ifndef SWIG
32  struct CheckBoxImplPtrs
33  {
34  bool (*create)(CheckBox *self, bool square);
35  void (*set_active)(CheckBox *self, bool flag);
36  bool (*get_active)(CheckBox *self);
37  };
38 #endif
39 #endif
40 
43  class MFORMS_EXPORT CheckBox : public Button
44  {
45  public:
46  CheckBox(bool square = false);
47 
49  void set_active(bool flag);
50 
52  bool get_active();
53 
54  virtual int get_int_value() { return get_active() ? 1 : 0; }
55  virtual bool get_bool_value() { return get_active(); }
56  virtual std::string get_string_value() { return get_active() ? "1" : "0"; }
57 
58  protected:
59  CheckBoxImplPtrs *_checkbox_impl;
60  };
61 };
62 
63 #endif
A checkbox toggle control.
Definition: checkbox.h:43
virtual std::string get_string_value()
Get string value from the view if it's holding some.
Definition: checkbox.h:56
virtual bool get_bool_value()
Get bool value from the view if it's holding some.
Definition: checkbox.h:55
#define MFORMS_EXPORT
Definition: base.h:33
CheckBoxImplPtrs * _checkbox_impl
Definition: checkbox.h:59
A clickable button control.
Definition: button.h:51
virtual int get_int_value()
Get int value from the view if it's holding some.
Definition: checkbox.h:54
MySQL Workbench 6.1 documentation