1.10
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
Application Class Reference

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.
 
EventLoopevent ()
 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 Windowmain_window () const
 Get a pointer to the main Window.
 
EGT_NODISCARD Windowmodal_window () const
 Get a pointer to the modal Window.
 
Applicationoperator= (Application &&)=delete
 
Applicationoperator= (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 Screenscreen () 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 Applicationinstance ()
 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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Application() [1/3]

Application ( int  argc = 0,
char **  argv = nullptr,
const std::string &  name = {},
bool  primary = true 
)
explicit
Parameters
[in]argcApplication argument count.
[in]argvApplication argument array.
[in]primaryIs this the primary display application.
[in]nameApplication name. This is used for several things, including identifying the text domain used by gettext().

◆ Application() [2/3]

Application ( const Application )
delete

◆ Application() [3/3]

Application ( Application &&  )
delete

◆ ~Application()

virtual ~Application ( )
virtualnoexcept

Member Function Documentation

◆ argc()

EGT_NODISCARD int argc ( ) const
inline

Get the argc value passed in.

◆ argv()

EGT_NODISCARD const char ** argv ( ) const
inline

Get the argv value passed in.

◆ check_instance()

static bool check_instance ( )
static

Check if there is an available instance.

◆ dump()

void dump ( std::ostream &  out) const

Dump the widget hierarchy and properties to the specified std::ostream.

Example:

app.dump(cout);

◆ dump_timers()

void dump_timers ( std::ostream &  out) const

Dump all allocated timers to the specified std::ostream.

Example:

app.dump_timers(cout);

◆ event()

EventLoop & event ( )
inline

Get a reference to the application event loop instance.

◆ get_input_devices()

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.

◆ instance()

static Application & instance ( )
static

Reference to the main Application instance.

Exceptions
std::runtime_errorIf there is no application instance.

◆ is_composer()

EGT_NODISCARD bool is_composer ( ) const

Check whether the application runs under the Microchip Graphic Composer.

◆ main_window()

EGT_NODISCARD Window * main_window ( ) const
inline

Get a pointer to the main Window.

◆ modal_window()

EGT_NODISCARD Window * modal_window ( ) const
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.

◆ operator=() [1/2]

Application & operator= ( Application &&  )
delete

◆ operator=() [2/2]

Application & operator= ( const Application )
delete

◆ paint_to_file()

void paint_to_file ( const std::string &  filename = {})

Paint the entire Screen to a file.

◆ quit()

virtual void quit ( int  exit_value = 0)
virtual

Calls EventLoop::quit(exit_value) by default.

Allow non-zero exit value

◆ run()

virtual int run ( )
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().

◆ screen()

EGT_NODISCARD Screen * screen ( ) const
inline

Get a pointer to the Screen instance.

◆ setup_search_paths()

static void setup_search_paths ( const std::vector< std::string > &  extra_paths = {})
static

Reset the resources search paths optionally adding extra paths.

Parameters
[in]extra_pathsAn 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

◆ windows()

EGT_NODISCARD const std::vector< Window * > & windows ( ) const
inline

Get the list of all currently allocated Windows.

Friends And Related Symbol Documentation

◆ Timer

friend class Timer
friend

◆ Window

friend class Window
friend

Member Data Documentation

◆ m_argc

int m_argc {0}
protected

Argument count.

◆ m_argv

char** m_argv {nullptr}
protected

Argument list.

◆ m_event

EventLoop m_event
protected

The event loop instance.

◆ m_input_devices

std::vector<std::pair<std::string, std::string> > m_input_devices
protected

List of configured input devices.

◆ m_signals

asio::signal_set m_signals
protected

Signal instance for registered signal handles by the Application.