MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
appview.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_APPVIEW_H_
21 #define _MFORMS_APPVIEW_H_
22 
23 #include <mforms/box.h>
24 #include <mforms/app.h>
25 
26 #include "base/ui_form.h"
27 
28 namespace bec {
29  class UIForm;
30 };
31 
32 namespace mforms {
33  class ToolBar;
34  class MenuBar;
35 
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 #ifndef SWIG
38  struct AppViewImplPtrs
39  {
40  // I *need* an own create function, even if AppView is derived from Box.
41  // Otherwise I cannot tell appart which managed wrapper to create.
42  bool (*create)(AppView *self, bool horizontal);
43  };
44 #endif
45 #endif
46 
53  class MFORMS_EXPORT AppView : public Box , public bec::UIForm
54  {
55  protected:
56  AppViewImplPtrs* _app_view_impl;
57  boost::function<bool ()> _on_close_slot;
58  std::string _context_name;
59  std::string _identifier;
60  std::string _title;
63  bool _is_main;
64 
65  // for docked views
67 
68  public:
69 #ifdef _WIN32
70 
76  AppView(bool horiz, const std::string &context_name, bool is_main);
77 #else
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79  AppView(bool horiz, const std::string &context_name, bool is_main);
80 #endif
81 #endif
82  virtual ~AppView();
83 
86  void set_title(const std::string &title);
87 
88  virtual std::string get_title();
89 
93  void set_identifier(const std::string &identifier) { _identifier= identifier; }
94 
96  std::string identifier() const { return _identifier; }
97 
98  public:
99 
100 #ifndef SWIG
101 
106  void set_on_close(const boost::function<bool ()> &slot) { _on_close_slot= slot; }
107 #endif
108 
109  mforms::MenuBar *get_menubar() { return _menubar; }
110  void set_menubar(mforms::MenuBar *menu);
111 
112  mforms::ToolBar *get_toolbar() { return _toolbar; }
113  void set_toolbar(mforms::ToolBar *toolbar);
114 
116  virtual bool on_close();
117  public:
118  virtual bool is_main_form() { return _is_main; }
119  virtual std::string get_form_context_name() const { return _context_name; }
120 
121 #ifndef SWIG
122  void set_containing_docking_point(mforms::DockingPoint *dpoint);
123 #endif
124  };
125 };
126 
127 #endif
A view that is dockable into the host application window.
Definition: appview.h:53
mforms::ToolBar * get_toolbar()
Definition: appview.h:112
std::string _identifier
Definition: appview.h:59
virtual std::string get_form_context_name() const
Definition: appview.h:119
Places child views sequentially in a vertical or horizontal layout.
Definition: box.h:50
mforms::ToolBar * _toolbar
Definition: appview.h:62
virtual bool is_main_form()
Definition: appview.h:118
#define MFORMS_EXPORT
Definition: base.h:33
std::string _context_name
Definition: appview.h:58
mforms::DockingPoint * _dpoint
Definition: appview.h:66
Proxy class for interfacing with host application windows.
Definition: dockingpoint.h:59
std::string _title
Definition: appview.h:60
boost::function< bool()> _on_close_slot
Definition: appview.h:57
mforms::MenuBar * _menubar
Definition: appview.h:61
std::string identifier() const
Gets the previously unique identifier for this view.
Definition: appview.h:96
void set_identifier(const std::string &identifier)
Sets the unique identifier for this view.
Definition: appview.h:93
A menu that can be added to the host application.
Definition: menubar.h:157
bool _is_main
Definition: appview.h:63
void set_on_close(const boost::function< bool()> &slot)
Sets the callback to be called when the view is closed in the host window.
Definition: appview.h:106
AppViewImplPtrs * _app_view_impl
Definition: appview.h:56
mforms::MenuBar * get_menubar()
Definition: appview.h:109
MySQL Workbench 6.1 documentation