1.10 |
Application definition. More...
#include <app.h>
Public Member Functions | |
Application (Application &&)=delete | |
Application (const Application &)=delete | |
Application (int argc=0, char **argv=nullptr, const std::string &name={}, bool primary=true) | |
virtual | ~Application () noexcept |
EGT_NODISCARD int | argc () const |
Get the argc value passed in. | |
EGT_NODISCARD const char ** | argv () const |
Get the argv value passed in. | |
void | dump (std::ostream &out) const |
Dump the widget hierarchy and properties to the specified std::ostream. | |
void | dump_timers (std::ostream &out) const |
Dump all allocated timers to the specified std::ostream. | |
EventLoop & | event () |
Get a reference to the application event loop instance. | |
const std::vector< std::pair< std::string, std::string > > & | get_input_devices () |
Get a list of input devices configured with the EGT_INPUT_DEVICES environment variable. | |
EGT_NODISCARD bool | is_composer () const |
Check whether the application runs under the Microchip Graphic Composer. | |
EGT_NODISCARD Window * | main_window () const |
Get a pointer to the main Window. | |
EGT_NODISCARD Window * | modal_window () const |
Get a pointer to the modal Window. | |
Application & | operator= (Application &&)=delete |
Application & | operator= (const Application &)=delete |
void | paint_to_file (const std::string &filename={}) |
Paint the entire Screen to a file. | |
virtual void | quit (int exit_value=0) |
Calls EventLoop::quit(exit_value) by default. | |
virtual int | run () |
Run the application. | |
EGT_NODISCARD Screen * | screen () const |
Get a pointer to the Screen instance. | |
EGT_NODISCARD const std::vector< Window * > & | windows () const |
Get the list of all currently allocated Windows. | |
Static Public Member Functions | |
static bool | check_instance () |
Check if there is an available instance. | |
static Application & | instance () |
Reference to the main Application instance. | |
static void | setup_search_paths (const std::vector< std::string > &extra_paths={}) |
Reset the resources search paths optionally adding extra paths. | |
Protected Attributes | |
int | m_argc {0} |
Argument count. | |
char ** | m_argv {nullptr} |
Argument list. | |
EventLoop | m_event |
The event loop instance. | |
std::vector< std::pair< std::string, std::string > > | m_input_devices |
List of configured input devices. | |
asio::signal_set | m_signals |
Signal instance for registered signal handles by the Application. | |
Friends | |
class | Timer |
class | Window |
Application definition.
This is basically just a helper class that does standard setup for inputs, outputs, the event loop, and more. It also acts as sort of a global access to get to these things because of this.
|
explicit |
[in] | argc | Application argument count. |
[in] | argv | Application argument array. |
[in] | primary | Is this the primary display application. |
[in] | name | Application name. This is used for several things, including identifying the text domain used by gettext(). |
|
delete |
|
delete |
|
virtualnoexcept |
|
inline |
Get the argc value passed in.
|
inline |
Get the argv value passed in.
|
static |
Check if there is an available instance.
void dump | ( | std::ostream & | out | ) | const |
Dump the widget hierarchy and properties to the specified std::ostream.
Example:
void dump_timers | ( | std::ostream & | out | ) | const |
Dump all allocated timers to the specified std::ostream.
Example:
|
inline |
Get a reference to the application event loop instance.
const std::vector< std::pair< std::string, std::string > > & get_input_devices | ( | ) |
Get a list of input devices configured with the EGT_INPUT_DEVICES environment variable.
|
static |
Reference to the main Application instance.
std::runtime_error | If there is no application instance. |
EGT_NODISCARD bool is_composer | ( | ) | const |
Check whether the application runs under the Microchip Graphic Composer.
|
inline |
Get a pointer to the modal Window.
The modal window is a single window that will receive all events. Only one window can be modal at any given time.
|
delete |
|
delete |
void paint_to_file | ( | const std::string & | filename = {} | ) |
Paint the entire Screen to a file.
|
virtual |
Calls EventLoop::quit(exit_value) by default.
Allow non-zero exit value
|
virtual |
Run the application.
This will initialize the application and start running the event loop. This function will block until the event loop is told to exit by calling quit().
|
static |
Reset the resources search paths optionally adding extra paths.
[in] | extra_paths | An optional list of extra search paths. |
The current search paths list is cleared then filled with: 1 - paths from the EGT_SEARCH_PATH env variable 2 - paths from extra_paths 3 - the current working directory 4 - the application directory
|
inline |
Get the list of all currently allocated Windows.
|
friend |
|
friend |
|
protected |
Argument count.
|
protected |
Argument list.
|
protected |
The event loop instance.
|
protected |
List of configured input devices.
|
protected |
Signal instance for registered signal handles by the Application.