xtd 0.2.0
application_context.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "form.hpp"
6#include <xtd/any_object>
7#include <xtd/object>
8
10namespace xtd {
12 namespace forms {
27 class application_context : public object {
28 struct data;
29
30 public:
32
39 explicit application_context(const form& main_form) noexcept;
41
47
49
54 std::optional<const_form_ref> main_form() const noexcept;
58 std::optional<form_ref> main_form() noexcept;
62 void main_form(const form& main_form);
66 void main_form(std::nullptr_t);
67
72 xtd::any_object tag() const noexcept;
77 void tag(const xtd::any_object& tag);
79
81
88
90
96
97 protected:
101 virtual void exit_thread_core();
102
107 virtual void on_main_form_closed(object& sender, const event_args& e);
108
109 private:
110 xtd::sptr<data> data_;
111 };
112 }
113}
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Specifies the contextual information about an application thread.
Definition application_context.hpp:27
xtd::any_object tag() const noexcept
Gets an object that contains data about the control.
event< application_context, event_handler > thread_exit
Occurs when the message loop of the thread should be terminated, by calling exit_thread().
Definition application_context.hpp:94
void exit_thread()
Terminates the message loop of the thread.
virtual void exit_thread_core()
Terminates the message loop of the thread.
std::optional< const_form_ref > main_form() const noexcept
Gets the form to use as context.
application_context()
Initializes a new instance of the application_context class with no context.
virtual void on_main_form_closed(object &sender, const event_args &e)
Calls ExitThreadCore(), which raises the ThreadExit event.
application_context(const form &main_form) noexcept
Initializes a new instance of the application_context class with the specified Form.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.hpp:175
std::reference_wrapper< form > form_ref
Represent an xtd::forms::form reference.
Definition form_ref.hpp:25
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::style_sheets::form alias.