GApp Class Reference

Singleton class for handling application wide settings and methods. More...

#include <LgiClasses.h>

Inherits GAppI, and OsApplication.

List of all members.

Public Member Functions

bool IsOk ()
 Returns true if the GApp object initialized correctly.
OsProcessId GetProcessId ()
 Returns this processes ID.
OsThreadId GetGuiThread ()
 Returns the thread currently running the active message loop.
 GApp (char *MimeType, OsAppArguments &AppArgs, GAppArguments *ObjArgs=0)
 Construct the object.
virtual ~GApp ()
 Destroys the object.
char * GetName ()
void SetName (char *Name)
char * GetLgiVersion ()
 Returns the version of Lgi used. String returned is in the form '#.#.#'.
void SetAppArgs (OsAppArguments &AppArgs)
 Resets the arguments.
OsAppArguments * GetAppArgs ()
 Returns the arguemnts.
char * GetArgumentAt (int n)
 Returns the n'th argument as a heap string. Free with DeleteArray(...).
bool Run (bool Loop=true, OnIdleProc IdleCallback=NULL, void *IdleParam=NULL)
 Enters the message loop.
void OnCommandLine ()
 Event called to process the command line.
void OnReceiveFiles (GArray< char * > &Files)
 Event called to process files dropped on the application.
void Exit (int Code=0)
 Exits the event loop with the code specified.
bool GetOption (char *Option, GArray< char > &Buf)
 Parses the command line for a switch.
bool GetOption (char *Option, char *Dst=0, int DstSize=0)
 Parses the command line for a switch.
GXmlTagGetConfig (char *Tag)
 Gets the application conf stored in lgi.conf.
void SetConfig (GXmlTag *Tag)
 Sets a single tag in the config. (Not written to disk).
GViewI * GetFocus ()
 Gets the control with the keyboard focus.
GAutoString GetFileMimeType (char *File)
bool GetAppsForMimeType (char *Mime, GArray< GAppInfo * > &Apps)
 Gets the applications that can handle a file of a certain mime type.
int32 GetMetric (int Metric)
 Get a system metric.
GMouseHookGetMouseHook ()
 Get the mouse hook instance.
class GSymLookupGetSymLookup ()
 Gets the singleton symbol lookup class.

Static Public Member Functions

static GAppObjInstance ()
 Use 'LgiApp' to return a pointer to the GApp object.

Public Attributes

 The system font.
 The system font in bold.
 Pointer to the applications main window.


class GView
class GMouseHook

Detailed Description

Singleton class for handling application wide settings and methods.

This should be the first class you create, passing in the arguments from the operating system. And once your initialization is complete the 'Run' method is called to enter the main application loop that processes messages for the life time of the application.

Constructor & Destructor Documentation

GApp::GApp ( char *  MimeType,
OsAppArguments &  AppArgs,
GAppArguments ObjArgs = 0 

Construct the object.

MimeType  The application's mime type. Typically 'application/x-[appname]'. This is mostly ignored on Win32 and Linux, but is useful on BeOS.
AppArgs  The arguments passed in by the OS.
ObjArgs  Optional args

References AppWnd, GTypeFace::Bold(), GFont::Create(), GFontType::Create(), GetOption(), GFontType::GetSystemFont(), MB_OK, SetAppArgs(), SystemBold, SystemNormal, and GTypeFace::Transparent().

Member Function Documentation

void GApp::Exit ( int  Code = 0  ) 

Exits the event loop with the code specified.

Code  The application exit code.

GAutoString GApp::GetFileMimeType ( char *  File  ) 

Gets the MIME type of a file

the mime type or NULL if unknown.
File  The file to identify

References GArray< Type >::Length(), LGI_PATH_SEPARATOR, GStringPipe::NewStr(), and GProcess::Run().

int32 GApp::GetMetric ( int  Metric  ) 

Get a system metric.



char * GApp::GetName (  ) 

Gets the application name, by default it will be generated from the mime type, but can also be set by calling GApp::SetName

References DIR_CHAR.

bool GApp::GetOption ( char *  Option,
char *  Dst = 0,
int  DstSize = 0 

Parses the command line for a switch.

true if the option exists.
Option  The option to look for.
Dst  The buffer to receive the value of the command line parameter or NULL if you don't care.
DstSize  The buffer size in bytes

References GetOption().

bool GApp::GetOption ( char *  Option,
GArray< char > &  Buf 

Parses the command line for a switch.

true if the option exists.
Option  The option to look for.
Buf  The buffer to receive the value.

References IsOk(), and GArray< Type >::Length().

Referenced by GApp(), and GetOption().

bool GApp::Run ( bool  Loop = true,
OnIdleProc  IdleCallback = NULL,
void *  IdleParam = NULL 

Enters the message loop.

Loop  If true this function will return when the application exits (with LgiCloseApp()). Otherwise if false only pending events will be processed and then the function returns.
IdleCallback  Idle callback
IdleParam  Param for IdleCallback

void GApp::SetName ( char *  Name  ) 

Set the application name. This is currently used to generate the leaf folder for LSP_APP_ROOT

The documentation for this class was generated from the following files:

Generated on Wed Dec 1 15:41:02 2010 for Lgi by  doxygen