MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
button.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 #ifndef _MFORMS_BUTTON_H_
20 #define _MFORMS_BUTTON_H_
21 
22 #include <mforms/view.h>
23 
24 
25 namespace mforms {
26  class Button;
27 
29  {
31  ToolButton, // A button for a tool bar.
32  AdminActionButton, // A push button that will trigger an action which requires admin privileges.
33  // This will add an indicator to the button (a shield on Windows).
35  };
36 
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 #ifndef SWIG
39  struct ButtonImplPtrs
40  {
41  bool (*create)(Button *self, ButtonType btype);
42  void (*set_text)(Button *self, const std::string &text);
43  void (*set_icon)(Button *self, const std::string &path);
44  void (*enable_internal_padding)(Button *self, bool);
45  };
46 #endif
47 #endif
48 
51  class MFORMS_EXPORT Button : public View
52  {
53  public:
55 
62  void enable_internal_padding(bool flag);
63 
65  void set_text(const std::string &text);
66 
68  void set_icon(const std::string &icon);
69 
70 #ifndef SWIG
71 
75  boost::signals2::signal<void ()>* signal_clicked() { return &_clicked; }
76 
77  public:
78  virtual void callback();
79 
80  bool is_updating() { return _updating; }
81 #endif
82  protected:
83  boost::signals2::signal<void ()> _clicked;
84  ButtonImplPtrs *_button_impl;
85  bool _updating;
86  };
87 };
88 
89 #endif
boost::signals2::signal< void()> _clicked
Definition: button.h:83
bool is_updating()
Definition: button.h:80
boost::signals2::signal< void()> * signal_clicked()
Sets callback for when the button is clicked.
Definition: button.h:75
bool _updating
Definition: button.h:85
ButtonImplPtrs * _button_impl
Definition: button.h:84
#define MFORMS_EXPORT
Definition: base.h:33
A clickable button control.
Definition: button.h:51
ButtonType
Definition: button.h:28
MySQL Workbench 6.1 documentation