xtd 0.2.0
application_context.h
Go to the documentation of this file.
1 #pragma once
5 #include "form.h"
6 #include <xtd/object>
7 
9 namespace xtd {
11  namespace forms {
24  class application_context : public object {
25  struct data;
26 
27  public:
29 
36  explicit application_context(const form& main_form) noexcept;
38 
42 
44 
49  std::optional<const_form_ref> main_form() const noexcept;
53  std::optional<form_ref> main_form() noexcept;
57  void main_form(const form& main_form);
61  void main_form(std::nullptr_t);
62 
67  std::any tag() const noexcept;
72  void tag(std::any tag);
74 
76 
81  void exit_thread();
83 
85 
91 
92  protected:
96  virtual void exit_thread_core();
97 
102  virtual void on_main_form_closed(object& sender, const event_args& e);
103 
104  private:
105  std::shared_ptr<data> data_;
106  };
107  }
108 }
Specifies the contextual information about an application thread.
Definition: application_context.h:24
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
std::any tag() const noexcept
Gets an object that contains data about the control.
application_context()
Initializes a new instance of the application_context class with no context.
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.h:89
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
Contains xtd::forms::form container.
virtual void on_main_form_closed(object &sender, const event_args &e)
Calls ExitThreadCore(), which raises the ThreadExit event.
Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifie...
void exit_thread()
Terminates the message loop of the thread.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
std::optional< const_form_ref > main_form() const noexcept
Gets the form to use as context.
virtual void exit_thread_core()
Terminates the message loop of the thread.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13