MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
textentry.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_TEXTENTRY_H_
21 #define _MFORMS_TEXTENTRY_H_
22 
23 #include <mforms/view.h>
24 
25 namespace mforms {
26  class TextEntry;
27 
29  {
33 #ifdef __APPLE__
35 #else
37 #endif
38  };
39 
41  {
47  };
48 
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 #ifndef SWIG
51  struct TextEntryImplPtrs
52  {
53  bool (*create)(TextEntry *self, TextEntryType type);
54  void (*set_text)(TextEntry *self, const std::string &text);
55  void (*set_max_length)(TextEntry *self, int len);
56  std::string (*get_text)(TextEntry *self);
57  void (*set_read_only)(TextEntry *self, bool flag);
58  void (*set_placeholder_text)(TextEntry *self, const std::string &text);
59  void (*set_placeholder_color)(TextEntry *self, const std::string &color);
60  void (*set_bordered)(TextEntry *self, bool flag);
61  };
62 #endif
63 #endif
64 
66  class MFORMS_EXPORT TextEntry : public View
67  {
68  public:
72 
74  void set_max_length(int len);
75 
77  void set_value(const std::string &text);
78 
80  virtual std::string get_string_value();
81 
83  void set_read_only(bool flag);
84 
86  void set_placeholder_text(const std::string &text);
87 
89  void set_placeholder_color(const std::string &color);
90 
92  void set_bordered(bool flag);
93 
94 #ifndef SWIG
95 
98  boost::signals2::signal<void ()>* signal_changed() { return &_signal_changed; }
99 
103  boost::signals2::signal<void (TextEntryAction)>* signal_action() { return &_signal_action; }
104 
105  public:
106  void callback();
107  void action(TextEntryAction action);
108 #endif
109  protected:
110  TextEntryImplPtrs *_textentry_impl;
111 
112  boost::signals2::signal<void ()> _signal_changed;
113  boost::signals2::signal<void (TextEntryAction)> _signal_action;
114 
115  bool _updating;
116  };
117 };
118 
119 #endif
Enter key was pressed.
Definition: textentry.h:42
Up arrow key was pressed with Control/Command held.
Definition: textentry.h:45
boost::signals2::signal< void(TextEntryAction)> * signal_action()
Signal emitted when certain actions are performed:
Definition: textentry.h:103
TextEntryImplPtrs * _textentry_impl
Definition: textentry.h:110
normal text entry, with a distinctive appearance for search
Definition: textentry.h:32
#define MFORMS_EXPORT
Definition: base.h:33
Up arrow key was pressed.
Definition: textentry.h:43
Down arrow key was pressed.
Definition: textentry.h:44
TextEntryAction
Definition: textentry.h:40
Single line text edit control, with support for some special events.
Definition: textentry.h:66
boost::signals2::signal< void()> _signal_changed
Definition: textentry.h:112
TextEntryType
Definition: textentry.h:28
a normal plain text entry
Definition: textentry.h:30
Down arrow key was pressed with Control/Command held.
Definition: textentry.h:46
password entry, will hide typed characters
Definition: textentry.h:31
boost::signals2::signal< void(TextEntryAction)> _signal_action
Definition: textentry.h:113
boost::signals2::signal< void()> * signal_changed()
Signal emitted when the entry is edited.
Definition: textentry.h:98
MySQL Workbench 6.1 documentation