MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
app.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_APP_H_
21 #define _MFORMS_APP_H_
22 
23 #include <map>
24 
25 #include "mforms/dockingpoint.h"
26 #include "base/geometry.h"
27 #include "base/drawing.h"
28 
29 namespace mforms {
30 
31  // Known system colors.
33  {
34  SystemColorHighlight, // The system-defined color of the background of selected items.
35  // This includes selected menu items as well as selected text.
36  SystemColorEditor, // Background color for editor controls.
37  SystemColorDisabled, // Background color for disabled controls.
38  SystemColorContainer, // Usually a gray. The default background for container controls. TODO: Linux.
39  };
40 
41  class App;
42  class AppView;
43  class View;
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 #ifndef SWIG
47  struct AppImplPtrs
48  {
49  void (*set_status_text)(App *app, const std::string &title);
50 
51  std::string (*get_resource_path)(App *app, const std::string &file);
52  std::string (*get_executable_path)(App *app, const std::string &file);
53  base::Rect (*get_application_bounds)(App *app);
54 
55  int (*enter_event_loop)(App *app, float max_wait_time);
56  void (*exit_event_loop)(App *app, int result);
57 
58  void (*begin_thread_loop)();
59  void (*end_thread_loop)();
60 
61  base::Color (*get_system_color)(SystemColor type);
62 
63  float (*backing_scale_factor)(App *app);
64  };
65 #endif
66 #endif
67 
74  {
75  private:
76  App() : DockingPoint() {}
77 
78  App(DockingPointDelegate *delegate, bool delete_on_destroy);
79 
80  public:
81 #ifndef SWIG
82  // for use by host application
83  static void instantiate(DockingPointDelegate *delegate, bool delete_on_destroy);
84 #endif
85  public:
86 
89  static App *get();
90 
93  void set_status_text(const std::string &text);
94 
98  std::string get_resource_path(const std::string &file);
99 
100  std::string get_executable_path(const std::string &file);
101 
102  std::string get_user_data_folder() { return _user_data_folder; }
103 
105  base::Rect get_application_bounds();
106 
110  int enter_event_loop(float timeout = 0.0);
111 
113  void exit_event_loop(int retcode);
114 
115  // use in threads where mforms is called
116  static void begin_thread_loop();
117  static void end_thread_loop();
118 
119  // Retrieve system information like predefined colors, screen size, monitor count etc.
120  base::Color get_system_color(SystemColor type);
121 
122  float backing_scale_factor();
123 #ifndef DOXYGEN_SHOULD_SKIP_THIS
124 #ifndef SWIG
125  void set_user_data_folder_path(const std::string &path) { _user_data_folder = path; }
126 #endif
127 #endif
128  protected:
129  AppImplPtrs *_app_impl;
130 
131  private:
132  std::string _user_data_folder;
133  };
134 };
135 
136 #endif
SystemColor
Definition: app.h:32
App()
Definition: app.h:76
AppImplPtrs * _app_impl
Definition: app.h:129
#define MFORMS_EXPORT
Definition: base.h:33
Proxy class for interfacing with host application windows.
Definition: dockingpoint.h:59
Proxy class for interfacing with the host application window.
Definition: app.h:73
std::string get_user_data_folder()
Definition: app.h:102
std::string _user_data_folder
Definition: app.h:132
MySQL Workbench 6.1 documentation