xtd 0.2.0
application.h
Go to the documentation of this file.
1 #pragma once
5 #include "../forms_export.h"
6 #include "../forms_namespace_aliases.h"
8 #include "application_context.h"
9 #include "form_collection.h"
10 #include "imessage_filter.h"
11 #include "message.h"
12 #include "message_loop_callback.h"
13 #include <xtd/forms/window_messages>
14 #include <xtd/delegate>
15 #include <xtd/event_args>
16 #include <xtd/static>
17 #include <cstdint>
18 #include <memory>
19 #include <vector>
20 
22 namespace xtd {
24  namespace forms {
26  class input_dialog;
27  class message_box;
29 
50  class forms_export_ application final static_ {
51  public:
53 
58  static bool allow_quit() noexcept;
59 
65  static xtd::ustring common_app_data_path() noexcept;
66 
67  /*
71  static microsoft::win32::registry_key common_app_data_registry();
72  */
73 
83  static xtd::ustring company_name() noexcept;
84 
87  static bool dark_mode_enabled() noexcept;
88 
91  static bool light_mode_enabled() noexcept;
92 
95  static xtd::ustring executable_name() noexcept;
96 
99  static xtd::ustring executable_path() noexcept;
100 
103  static bool message_loop() noexcept;
104 
108  static const form_collection open_forms() noexcept;
109 
112  static xtd::ustring product_name() noexcept;
113 
116  static xtd::ustring product_version() noexcept;
117 
120  static xtd::ustring startup_path() noexcept;
121 
125  static const xtd::forms::style_sheets::style_sheet& style_sheet() noexcept;
129  static void style_sheet(const xtd::forms::style_sheets::style_sheet& value);
133  static const xtd::forms::style_sheets::style_sheet::style_sheets_t& style_sheets() noexcept;
134 
138  static const xtd::forms::style_sheets::style_sheet::style_sheet_names_t& style_sheet_names() noexcept;
139 
144  static const xtd::forms::style_sheets::style_sheet& system_style_sheet() noexcept;
145 
151  static xtd::ustring user_app_data_path() noexcept;
152 
153  /*
158  static microsoft::win32::registry_key user_app_data_registry();
159  */
160 
164  static bool use_system_controls() noexcept;
165 
166 
170  static bool use_visual_styles() noexcept;
171 
178  static bool use_wait_cursor() noexcept;
185  static void use_wait_cursor(bool use_wait_cursor);
187 
189 
195 
199 
207 
211 
212  /*
218  static event<threading::thread_exception_event_handler> thread_exception;
219  */
220 
226 
228 
233  static void add_message_filter(const imessage_filter& value);
234 
240  static void disable_font_size_correction();
241 
247  static void do_events();
248 
252  static void enable_button_images();
253 
258  static void enable_dark_mode();
259 
264  static void enable_light_mode();
265 
269  static void enable_menu_images();
270 
275  static void enable_standard_controls();
276 
281  static void enable_system_controls();
282 
288  static void enable_system_font_size();
289 
294  static void enable_visual_styles();
295 
301  static void exit();
302 
309  static void exit(cancel_event_args& e);
310 
313  static void exit_thread();
314 
320  static xtd::forms::style_sheets::style_sheet get_style_sheet_from_name(const xtd::ustring& name);
321 
324  static void raise_idle(const event_args& e);
325 
329  static void register_message_loop_callback(message_loop_callback callback);
330 
334  static void remove_message_filter(const imessage_filter& value);
335 
342  static void restart();
343 
350  static void run();
351 
358  static void run(application_context& context);
359 
367  static void run(const form& main_form);
368 
369  /*
375  static void set_unhandled_exception_mode (unhandled_exception_mode mode);
376  */
377 
378  /*
387  static void set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
388  */
390 
391  private:
392  friend class form;
393  friend class input_dialog;
394  friend class message_box;
395 
396  static bool close_open_forms();
397  static void on_app_thread_exit(object& sender, const event_args& e);
398  static bool on_app_thread_exception();
399  static void raise_enter_thread_modal(const event_args& e);
400  static void raise_leave_thread_modal(const event_args& e);
401  static intptr wnd_proc_(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr handle);
402  static void wnd_proc(message& message);
403  static void wm_activate_app(message& message);
404  static void wm_app_idle(message& message);
405  static void wm_quit(message& message);
406 
407  static bool use_visual_styles_;
408  static bool use_system_controls_;
409  static bool use_wait_cursor_;
410  static bool message_loop_;
411  static bool raise_idle_;
412  };
413  }
414 }
Specifies the contextual information about an application thread.
Definition: application_context.h:24
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:37
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Displays a message window, also known as a dialog box, which presents a message to the user...
Definition: message_box.h:38
Defines a message filter interface.
Definition: imessage_filter.h:22
Contains xtd::forms::style_sheets::style_sheet class.
delegate< bool()> message_loop_callback
Represents a method that will check whether the hosting environment is still sending messages...
Definition: message_loop_callback.h:21
static event< application, delegate< void(const event_args &)> > enter_thread_modal
Occurs when the application is about to enter a modal state.
Definition: application.h:198
Contains xtd::forms::message_loop_callback callback.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::application_context class.
Contains xtd::forms::message class.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
static event< application, delegate< void(const event_args &)> > application_exit
Occurs when the application is about to shut down.
Definition: application.h:194
std::map< xtd::ustring, style_sheet > style_sheets_t
Represents a style_sheets collection.
Definition: style_sheet.h:82
Contains xtd::forms::form_collection alias.
Represents a window or dialog box that makes up an application&#39;s user interface.
Definition: form.h:52
Represents an event.
Definition: event.h:21
std::vector< std::reference_wrapper< form > > form_collection
Represents a collection of form objects.
Definition: form_collection.h:22
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition: application.h:50
Represents a common dialog box that displays input dialog.
Definition: input_dialog.h:36
std::vector< xtd::ustring > style_sheet_names_t
Represents a style_sheet names collection.
Definition: style_sheet.h:84
Implements a Windows message.
Definition: message.h:26
static event< application, delegate< void(const event_args &)> > thread_exit
Occurs when a thread is about to shut down. When the main thread for an application is about to be sh...
Definition: application.h:224
static event< application, delegate< void(const event_args &)> > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition: application.h:206
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Contains xtd::forms::imessage_filter interface.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Creates a use wait cursor class.
Definition: use_wait_cursor.h:23
Provides data for a cancelable event.
Definition: cancel_event_args.h:20
The xtd::forms::style_sheets::style_sheet allows you to specify an xtd style sheet.
Definition: style_sheet.h:62
static event< application, delegate< void(const event_args &)> > leave_thread_modal
Occurs when the application is about to leave a modal state.
Definition: application.h:210