Main Page Class Hierarchy Compound List File List Compound Members File Members Related Pages Examples
SDLApplication Class Reference
The class that represent an application in ParaGUI. It handles the main loop, screen attibutes etc.
More...
#include <sdlapplication.h>
Inheritance diagram for SDLApplication
[legend]Collaboration diagram for SDLApplication:
[legend]List of all members.
Public Methods |
| SDLApplication () |
| ~SDLApplication () |
bool | InitScreen (int w, int h, int depth=DISPLAY_DEPTH, Uint32 flags = SDL_SWSURFACE | SDL_HWPALETTE) |
| Initialize the screen. More...
|
SDLTheme* | LoadTheme (const char* xmltheme, bool asDefault = true, const char* searchpath = NULL) |
| Load a widget theme. More...
|
SDL_Thread* | Run () |
| Run the applications main eventloop. More...
|
void | Quit () |
| Exit the main eventloop. More...
|
void | Shutdown () |
| Cleanup the application data. More...
|
SDL_Surface* | SetScreen (SDL_Surface* screen) |
bool | SetBackground (const char* filename, int mode=BKMODE_TILE) |
bool | SetBackground (SDL_Surface* surface, int mode=BKMODE_TILE) |
void | RedrawBackground () |
void | PrintVideoTest () |
Static Public Methods |
SDL_Surface* | GetScreen () |
TTF_Font* | GetDefaultFont () |
bool | UnlockScreen () |
bool | LockScreen () |
void | SetApplicationPath (char* path) |
char* | GetApplicationPath () |
char* | GetRelativePath (char* file) |
int | GetScreenHeight () |
int | GetScreenWidth () |
void | FlipPage () |
TTF_Font* | LoadFont (char* filename, int size) |
SDLTheme* | GetTheme () |
bool | GetBulkMode () |
Protected Methods |
bool | eventKeyUp (const SDL_KeyboardEvent* key) |
| Overridable Eventhandler for a SDL_KeyboardEvent message. More...
|
bool | eventQuit (int id, SDLWidget* widget, unsigned long data) |
| Overridable Eventhandler for a SDL_QuitEvent message. More...
|
virtual void | eventInit () |
Detailed Description
The class that represent an application in ParaGUI. It handles the main loop, screen attibutes etc.
-
Author(s):
-
Alexander Pipelka
Every Paragui application needs to have a SDLApplication
object. The Application object is the controller for events, screen initialization, theme support and main loop. Here is an example of the steps necesary for creating a simple Paragui application that opens a 640x480 window with a button in the middle.
#include <paragui.h>
#include <sdlapplication.h>
#include <sdlbutton.h>
PARAGUI_CALLBACK(buttonHandler) {
cout << "Ouch !\\n";
return true;
}
int main( int argc, char **argv ) {
const int WIDTH = 640;
const int HEIGHT = 480;
SDLApplication app;
app.LoadTheme("qnx");
app.InitScreen(640,480,16,SDL_SWSURFACE);
SDLButton btnOK(NULL,0, SDLWidget::mkrect((WIDTH-100)/2,(HEIGHT-20)/2,100,20),"Push me !");
btnOK.SetEventCallback(MSG_BUTTONCLICK,buttonHandler);
btnOK.Show();
app.Run();
}
-
Examples:
-
tut1.cpp, tut2.cpp, tut3.cpp, and tut4.cpp.
Definition at line 90 of file sdlapplication.h.
Constructor & Destructor Documentation
SDLApplication::SDLApplication (
|
)
|
|
SDLApplication::~SDLApplication (
|
)
|
|
Member Function Documentation
void SDLApplication::FlipPage (
|
) [static]
|
|
char * SDLApplication::GetApplicationPath (
|
) [static]
|
|
bool SDLApplication::GetBulkMode (
|
) [static]
|
|
TTF_Font * SDLApplication::GetDefaultFont (
|
) [static]
|
|
char * SDLApplication::GetRelativePath (
|
char * file ) [static]
|
|
SDL_Surface * SDLApplication::GetScreen (
|
) [static]
|
|
int SDLApplication::GetScreenHeight (
|
) [static]
|
|
int SDLApplication::GetScreenWidth (
|
) [static]
|
|
SDLTheme * SDLApplication::GetTheme (
|
) [static]
|
|
bool SDLApplication::InitScreen (
|
int w,
|
|
int h,
|
|
int depth = DISPLAY_DEPTH,
|
|
Uint32 flags = SDL_SWSURFACE | SDL_HWPALETTE )
|
|
|
Initialize the screen.
-
Parameters:
-
w
|
screenwidth in pixels |
h
|
screenheight in pixels |
depth
|
screendepth in bits per pixel |
flags
|
SDL screen initialization flags |
-
Examples:
-
tut1.cpp, tut2.cpp, tut3.cpp, and tut4.cpp.
|
TTF_Font * SDLApplication::LoadFont (
|
char * filename,
|
|
int size ) [static]
|
|
SDLTheme * SDLApplication::LoadTheme (
|
const char * xmltheme,
|
|
bool asDefault = true,
|
|
const char * searchpath = NULL )
|
|
|
Load a widget theme.
-
Parameters:
-
xmltheme
|
name of the theme (e.g. default) |
asDefault
|
apply the theme as default widgettheme |
searchpath
|
path where the themefile is located |
-
Examples:
-
tut1.cpp, tut2.cpp, tut3.cpp, and tut4.cpp.
|
bool SDLApplication::LockScreen (
|
) [static]
|
|
void SDLApplication::PrintVideoTest (
|
)
|
|
void SDLApplication::Quit (
|
)
|
|
void SDLApplication::RedrawBackground (
|
)
|
|
SDL_Thread * SDLApplication::Run (
|
)
|
|
void SDLApplication::SetApplicationPath (
|
char * path ) [static]
|
|
bool SDLApplication::SetBackground (
|
SDL_Surface * surface,
|
|
int mode = BKMODE_TILE )
|
|
bool SDLApplication::SetBackground (
|
const char * filename,
|
|
int mode = BKMODE_TILE )
|
|
SDL_Surface * SDLApplication::SetScreen (
|
SDL_Surface * screen )
|
|
void SDLApplication::Shutdown (
|
)
|
|
|
Cleanup the application data.
|
bool SDLApplication::UnlockScreen (
|
) [static]
|
|
void SDLApplication::eventInit (
|
) [protected, virtual]
|
|
bool SDLApplication::eventKeyUp (
|
const SDL_KeyboardEvent * key ) [protected, virtual]
|
|
|
Overridable Eventhandler for a SDL_KeyboardEvent message.
This handler is called when a key changed it's state from pressed to unpressed. The default implementation returns 'false' which indicates that this message is not processed by this object. -
Parameters:
-
key
|
SDL_KeyboardEvent message
|
-
Returns:
-
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.
Reimplemented from SDLMessageObject. |
bool SDLApplication::eventQuit (
|
int id,
|
|
SDLWidget * widget,
|
|
unsigned long data ) [protected, virtual]
|
|
|
Overridable Eventhandler for a SDL_QuitEvent message.
The default implementation returns 'false' which indicates that this message is not processed by this object. -
Parameters:
-
quit
|
SDL_QuitEvent message
|
-
Returns:
-
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.
Reimplemented from SDLMessageObject. |
The documentation for this class was generated from the following file: