Application Class Reference

#include <Pt/Forms/Application.h>

Main element of a Pt::Forms graphical user interface. More...

Inherits Application.

Public Member Functions

const Stylestyle () const
 Returns the current style.
 
void setStyle (const Style &s)
 Sets the global style for all widgets.
 
const StyleOptionsstyleOptions () const
 Returns the current style options.
 
void setStyleOptions (const StyleOptions &options)
 Replaces the style options for all widgets.
 
void sendKeyEvent (const KeyEvent &ev)
 Emulates a key event.
 
void sendMouseEvent (const MouseEvent &ev)
 Emulates a mouse event.
 
EventLoop & loop ()
 Returns the event loop.
 
void run ()
 Starts the contained event loop.
 
void exit ()
 Exits from the contained event loop.
 
bool ignoreSystemSignal (int sig)
 Ignores a system signal.
 
bool catchSystemSignal (int sig)
 Catch a system signal.
 
bool raiseSystemSignal (int sig)
 Raise a system signal.
 
Signal< int > & systemSignal ()
 Notifies when a system signal was caught.
 
int & argc () const
 Number of command line arguments.
 
char ** argv () const
 Command line arguments.
 
void setArgs (int &argc, char **argv)
 Set command line arguments.
 
template<typename T >
Arg< T > getArg (const char *name)
 Returns the value of a long option.
 
template<typename T >
Arg< T > getArg (const char *name, const T &def)
 Returns the value of a long option.
 
template<typename T >
Arg< T > getArg (const char name)
 Returns the value of a short option.
 
template<typename T >
Arg< T > getArg (const char name, const T &def)
 Returns the value of a short option.
 

Static Public Member Functions

static void chdir (const Path &path)
 Changes the current directory.
 
static Path cwd ()
 Returns the current directory.
 
static Path rootdir ()
 Returns the system root path. More...
 
static Path tmpdir ()
 Returns the systems tmp directory. More...
 
static void setEnvVar (const std::string &name, const std::string &value)
 Set environment variable. More...
 
static void unsetEnvVar (const std::string &name)
 Unset environment variable. More...
 
static std::string getEnvVar (const std::string &name)
 Get environment variable. More...
 

Detailed Description

Create one Application before creating Forms windows or controls. It owns the GUI runtime and its primary Screen, dispatches platform events, and provides application-wide services such as styles, style options, input methods, fonts, and scaling. Start its inherited event loop with Pt::System::Application::run() after the visual hierarchy is shown.

Member Function Documentation

◆ rootdir()

static Path rootdir ( )
staticinherited

Returns "/" (root) on Linux, "c:\" on Windows

◆ tmpdir()

static Path tmpdir ( )
staticinherited

Returns the value of the environment variable named TEMP or TMP. If neither one is set, "/tmp" is returned on POSIX systems or a path to the current directory.

◆ setEnvVar()

static void setEnvVar ( const std::string &  name,
const std::string &  value 
)
staticinherited
Exceptions
SystemError

◆ unsetEnvVar()

static void unsetEnvVar ( const std::string &  name)
staticinherited
Exceptions
SystemError

◆ getEnvVar()

static std::string getEnvVar ( const std::string &  name)
staticinherited
Exceptions
SystemError