vdk 2.4.0
Public Member Functions | Public Attributes | List of all members
VDKApplication Class Reference

Application object. More...

#include <application.h>

Public Member Functions

 VDKApplication (int *argc, char **argv, char *rcf=(char *) NULL, bool have_locale=false)
virtual ~VDKApplication ()
void Run (void)
void Terminate (void)
GtkWidget * MainWindow ()
virtual void Setup ()=0
gint VDKMessageBox (char *caption, char *text, int mode=VDK_OK, char *oktext=(char *) NULL, char *canceltext=(char *) NULL, unsigned int wait=0)
void SetIdleCallback (GtkFunction idlecb=NULL, gpointer data=(gpointer) NULL)
void SetGarbageCollection (unsigned int tick=1000)
void RemoveGarbageCollection ()
void SetResourceFile (char *rcf)
bool HasResources ()

Public Attributes

VDKFormMainForm

Detailed Description

Application object.

This class initializes GTK+ library and starts event loop. Normally user overrides this class using his own application object. Application objects are responsible to manage also terminating and clean-up procedures.

Constructor & Destructor Documentation

VDKApplication::VDKApplication ( int *  argc,
char **  argv,
char *  rcf = (char*) NULL,
bool  have_locale = false 
)

Constructor, receives main() arguments and pass them to GTK* library.

Parameters
rcif isn't NULL <rc> resource file will be loaded and parsed.
have_localeif true let's VDK to invoke gtk_set_locale() and support any languages that GTK supports.
VDKApplication::~VDKApplication ( )
virtual

Destructor

Member Function Documentation

bool VDKApplication::HasResources ( )
inline

Indicates if the resource file was loaded and parsed

GtkWidget * VDKApplication::MainWindow ( )

Returns underlying gtk+ window of the application main form

void VDKApplication::RemoveGarbageCollection ( )

Remove timed garbage collection.

void VDKApplication::Run ( void  )

Initiates event loop

void VDKApplication::SetGarbageCollection ( unsigned int  tick = 1000)

Set a timed garbage collection that will be invoked each <timing> msecs.

void VDKApplication::SetIdleCallback ( GtkFunction  idlecb = NULL,
gpointer  data = (gpointer) NULL 
)

Sets idle callback function, if a previous idle callback was installed, uninstall it. /param /c idlecb idle callback function must be declared as: void idlecb(gpointer data); /param /c data will be passed to user defined function and must be a non NULL pointer otherwise SetIdleCallback won't work.

void VDKApplication::SetResourceFile ( char *  rcf)

Set a resource file. Tip: this should be done before Run()ning app.

virtual void VDKApplication::Setup ( )
pure virtual

Initializes Main form, user must override this one in his own application object.

void VDKApplication::Terminate ( void  )

Terminates event loop and quits GTK* library. This method is called after a destroy event on MainForm, user normally doesn't care of it.

gint VDKApplication::VDKMessageBox ( char *  caption,
char *  text,
int  mode = VDK_OK,
char *  oktext = (char*) NULL,
char *  canceltext = (char*) NULL,
unsigned int  wait = 0 
)

Provide a modal dialog window for messages to user.

Parameters
mode
  • MB_OK provide only one button with a "Ok" default caption
  • MB_YESNO provides two button with "Yes" and "No" default captions.
  • MB_OKCANCEL provides two button with "Ok" and "Cancel" default captions. Mode can be ored with:
  • MB_ICONSTOP provides a warning icon
  • MB_ICONINFORMATION provides a "information icon"
  • MB_ICONQUESTION provides a question mark icon
  • MB_ICONERROR provides an error icon MessageBox returns an integer that depends on modes and user response:
  • IDOK, user pressed OK button in MB_OK or MB_OKCANCEL mode
  • IDYES, user pressed YES button in MB_YESNO mode
  • IDNO, user pressed NO button in MB_YESNO mode
  • IDCANCEL, user pressed NO button in MB_OKCANCEL mode
oktex
canceltextArgs not more used, mantained for compat with vdk series 1.x.y Both OK,YES and NO buttons captions can be customized using <oktext> and <canceltext> arguments.
waitif set other than 0 makes MessageBox automatically closed after <wait> msecs with IDCANCEL or IDNO result. Tip: MessageBox accepts CR as "yes/ok" and ESC as "no/cancel" default answers.

Member Data Documentation

VDKForm* VDKApplication::MainForm

Must be initialized by the user otherwise an useless default main form will be created


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