xtd 0.2.0
Loading...
Searching...
No Matches
application.h
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.h"
6#include "../forms_namespace_aliases.h"
9#include "form_collection.h"
10#include "imessage_filter.h"
11#include "message.h"
13#include <xtd/delegate>
14#include <xtd/event_args>
15#include <xtd/static>
16#include <cstdint>
17#include <memory>
18#include <vector>
19
21namespace xtd {
23 namespace forms {
25 class input_dialog;
26 class message_box;
28
52 public:
54
59 static bool allow_quit() noexcept;
60
65
70 static bool button_images() noexcept;
71
77 static void button_images(bool value);
78
84 static xtd::ustring common_app_data_path() noexcept;
85
86 /*
90 static microsoft::win32::registry_key common_app_data_registry();
91 */
92
102 static xtd::ustring company_name() noexcept;
103
106 static bool dark_mode() noexcept;
107
111 static void dark_mode(bool value);
112
116 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 0.4.0")]]
117 static bool dark_mode_enabled() noexcept;
118
121 static xtd::ustring executable_name() noexcept;
122
125 static xtd::ustring executable_path() noexcept;
126
133 static bool font_size_correction();
134
141 static void font_size_correction(bool value);
142
146 static bool keep_cloned_controls() noexcept;
147
152 static void keep_cloned_controls(bool value);
153
156 static bool light_mode() noexcept;
157
161 static void light_mode(bool value);
162
166 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 0.4.0")]]
167 static bool light_mode_enabled() noexcept;
168
172 static std::optional<form_ref> main_form();
173
178 static bool menu_images() noexcept;
179
185 static void menu_images(bool value);
186
189 static bool message_loop() noexcept;
190
194 static const form_collection open_forms() noexcept;
195
198 static xtd::ustring product_name() noexcept;
199
202 static xtd::ustring product_version() noexcept;
203
206 static xtd::ustring startup_path() noexcept;
207
211 static const xtd::forms::style_sheets::style_sheet& style_sheet() noexcept;
215 static void style_sheet(const xtd::forms::style_sheets::style_sheet& value);
219 static const xtd::forms::style_sheets::style_sheet::style_sheets_t& style_sheets() noexcept;
220
224 static const xtd::forms::style_sheets::style_sheet::style_sheet_names_t& style_sheet_names() noexcept;
225
230 static bool system_controls() noexcept;
231
237 static void system_controls(bool value);
238
245 static bool system_font_size() noexcept;
246
253 static void system_font_size(bool value);
254
259 static const xtd::forms::style_sheets::style_sheet& system_style_sheet() noexcept;
260
266 static xtd::ustring user_app_data_path() noexcept;
267
268 /*
273 static microsoft::win32::registry_key user_app_data_registry();
274 */
275
280 [[deprecated("Replaced by xtd::application::visual_styles - Will be removed in version 0.4.0")]]
281 static bool use_visual_styles() noexcept;
282
289 static bool use_wait_cursor() noexcept;
297
302 static bool visual_styles() noexcept;
303
309 static void visual_styles(bool value);
311
313
318 static event<application, delegate<void(const event_args&)>> application_exit;
319
322 static event<application, delegate<void(const event_args&)>> enter_thread_modal;
323
330 static event<application, delegate<void(const event_args&)>> idle;
331
334 static event<application, delegate<void(const event_args&)>> leave_thread_modal;
335
336 /*
342 static event<threading::thread_exception_event_handler> thread_exception;
343 */
344
348 static event<application, delegate<void(const event_args&)>> thread_exit;
350
352
357 static void add_message_filter(const imessage_filter& value);
358
364 static void do_events();
365
370 [[deprecated("Replaced by xtd::application::button_images - Will be removed in version 0.4.0")]]
371 static void enable_button_images();
372
378 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 0.4.0")]]
379 static void enable_dark_mode();
380
386 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 0.4.0")]]
387 static void enable_light_mode();
388
393 [[deprecated("Replaced by xtd::application::menu_images - Will be removed in version 0.4.0")]]
394 static void enable_menu_images();
395
400 static void enable_visual_styles();
401
407 static void exit();
408
415 static void exit(cancel_event_args& e);
416
419 static void exit_thread();
420
426 static xtd::forms::style_sheets::style_sheet get_style_sheet_from_name(const xtd::ustring& name);
427
430 static void raise_idle(const event_args& e);
431
435 static void register_message_loop_callback(message_loop_callback callback);
436
440 static void remove_message_filter(const imessage_filter& value);
441
448 static void restart();
449
456 static void run();
457
464 static void run(xtd::forms::application_context& context);
465
473 static void run(const form& main_form);
474
475 /*
481 static void set_unhandled_exception_mode (unhandled_exception_mode mode);
482 */
483
484 /*
493 static void set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
494 */
496
497 private:
498 friend class form;
499 friend class input_dialog;
500 friend class message_box;
501
502 static bool close_open_forms();
503 static void on_app_thread_exit(object& sender, const event_args& e);
504 static bool on_app_thread_exception();
505 static void raise_enter_thread_modal(const event_args& e);
506 static void raise_leave_thread_modal(const event_args& e);
507 static intptr wnd_proc_(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr handle);
508 static void wnd_proc(message& message);
509 static void wm_activate_app(message& message);
510 static void wm_app_idle(message& message);
511 static void wm_quit(message& message);
512
513 static xtd::forms::application_context internal_context_;
514 static xtd::forms::application_context* context_;
515 static bool button_images_;
516 static bool keep_cloned_controls_;
517 static bool light_mode_;
518 static bool font_size_correction_;
519 static bool menu_images_;
520 static bool message_loop_;
521 static bool raise_idle_;
522 static bool system_controls_;
523 static bool system_font_size_;
524 static bool use_wait_cursor_;
525 static bool visual_styles_;
526 };
527 }
528}
Contains xtd::forms::application_context class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Specifies the contextual information about an application thread.
Definition application_context.h:26
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition application.h:51
static bool allow_quit() noexcept
Gets a value indicating whether the caller can quit this application.
Provides a button images factories for use by a button control.
Definition button_images.h:23
Provides data for a cancelable event.
Definition cancel_event_args.h:22
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Defines a message filter interface.
Definition imessage_filter.h:24
Represents a common dialog box that displays input dialog.
Definition input_dialog.h:38
Provides a menu images factories for use by a menu control.
Definition menu_images.h:24
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition message_box.h:40
Implements a Windows message.
Definition message.h:28
Creates a use wait cursor class.
Definition use_wait_cursor.h:25
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:52
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.h:110
Contains xtd::forms::form_collection alias.
delegate< bool()> message_loop_callback
Represents a method that will check whether the hosting environment is still sending messages.
Definition message_loop_callback.h:23
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
#define forms_export_
Define shared library export.
Definition forms_export.h:13
int_least32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::reference_wrapper< form > form_ref
Represent an xtd::forms::form reference.
Definition form_ref.h:25
std::vector< std::reference_wrapper< form > > form_collection
Represents a collection of form objects.
Definition form_collection.h:24
Contains xtd::forms::imessage_filter interface.
Contains xtd::forms::message class.
Contains xtd::forms::message_loop_callback callback.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::style_sheets::style_sheet class.