Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_Application Class Reference

#include <pgapplication.h>

Inheritance diagram for PG_Application:

Inheritance graph
[legend]
List of all members.

Public Types

enum  CursorMode { QUERY, NONE, HARDWARE, SOFTWARE }
 Cursor mode. More...
enum  { IDAPPLICATION = PG_WIDGETID_INTERNAL + 100 }

Public Member Functions

 PG_Application ()
 ~PG_Application ()
bool InitScreen (int w, int h, int depth=0, Uint32 flags=SDL_SWSURFACE|SDL_HWPALETTE)
 Initialize the screen.
PG_ThemeLoadTheme (const std::string &xmltheme, bool asDefault=true, const std::string &searchpath=PG_NULLSTR)
 Load a widget theme.
void Run ()
 Run the applications main eventloop.
virtual void RunEventLoop ()
 Run the modal message pump.
void Quit ()
 Exit the main eventloop.
SDL_Surface * SetScreen (SDL_Surface *screen, bool initialize=true)
 Set a custom screen surface.
bool SetBackground (const std::string &filename, PG_Draw::BkMode mode=PG_Draw::TILE)
 Set the application's background image.
bool SetBackground (SDL_Surface *surface, PG_Draw::BkMode mode=PG_Draw::TILE, bool freeBackground=false)
 Set the application's background image.
void SetEmergencyQuit (bool esc)
 Enable / disable the emergency quit key ("ESC").
void PrintVideoTest ()
 Outputs some information about the current video target (only with DEBUG enabled).
void EnableBackground (bool enable=true)
void DeleteBackground ()
void EnableAppIdleCalls (bool enable=true)
 Set AppIdleCalls.
void SetIcon (const std::string &filename)
 Set application`s window-manager icon.
void SetCaption (const std::string &title, const std::string &icon=PG_NULLSTR)
 Set application`s window-manager title and icon name.
void GetCaption (std::string &title, std::string &icon)
 Get application`s window-manager title and icon name.
int Iconify (void)
 Iconify/Minimise the window-manager window.
bool GetAppIdleCallsEnabled ()
 Get the behaviour concerning empty queues (see EnableAppIdleCalls()).
bool PumpIntoEventQueue (const SDL_Event *event)
 Sends an event to the global message queue.

Static Public Member Functions

static SDL_Surface * GetScreen ()
 Get the current screen surface.
static bool LockScreen ()
 Set a lock on the screen surface (to avoid concurrent drawing operations).
static bool UnlockScreen ()
 Unlock the screen surface.
static void RedrawBackground (const PG_Rect &rect)
 Redraw the application background.
static const std::string & GetRelativePath (const std::string &file)
 Tries to find a specifies file.
static int GetScreenHeight ()
 Get the current screen (or window) height.
static int GetScreenWidth ()
 Get the current screen (or window) width.
static void FlipPage ()
 Do a page flip (only for double buffered screens).
static PG_ThemeGetTheme ()
 Get the current default widgettheme.
static bool GetBulkMode ()
 Check if the application is currently in bulk mode.
static void SetBulkMode (bool bulk=true)
 Set the bulk mode.
static bool LoadLayout (const std::string &name)
 Load layout from the XML file.
static bool LoadLayout (const std::string &name, void(*WorkCallback)(int now, int max))
 Load layout from the XML file.
static bool LoadLayout (const std::string &name, void(*WorkCallback)(int now, int max), void *UserSpace)
 Load layout from the XML file.
static PG_WidgetGetWidgetByName (const std::string &Name)
 Get widget by name.
template<class T>
static T * GetWidget (const std::string &Name)
template<class T>
static T * GetWidget (int id)
static PG_WidgetGetWidgetById (int id)
 Get widget by id.
static void SetFontColor (const PG_Color &Color)
 Set default font color.
static void SetFontAlpha (int Alpha)
 Set default font transparency (!!!).
static void SetFontStyle (PG_Font::Style Style)
 Set default font style.
static void SetFontSize (int Size)
 Set default font size.
static void SetFontIndex (int Index)
 Set default font index.
static void SetFontName (const std::string &Name)
 Set default font name.
static void SetCursor (SDL_Surface *image)
 Set a graphical mouse cursor.
static void DrawCursor (bool update=true)
 Update the graphical mouse cursor.
static CursorMode ShowCursor (CursorMode mode)
 Set or query the type of mouse cursor to use.
static void DisableDirtyUpdates (bool disable)
 Disable dirty widget updates.
static bool GetDirtyUpdatesDisabled ()
 Check if the 'dirty update' mode is disabled globally.
static PG_ApplicationGetApp ()
static void FlushEventQueue ()
 Flush the event queue.
static void ClearOldMousePosition ()
 If software cursors are enabled and you move the mouse, the old location has to be refreshed somehow with the underlying graphics.
static void TranslateNumpadKeys (SDL_KeyboardEvent *key)
 Translates numeric keypad keys into other keys in dependency of NUM_LOCK state.
static void SetEventSupplier (PG_EventSupplier *eventSupplier)
 Registers a new source for obtaining SDL_Event objects from.
static PG_EventSupplierGetEventSupplier ()
 Returns the EventSupplier that's currently active.
static void SetUpdateOverlappingSiblings (bool update=true)
 Set the default sibling update mode.
static bool GetUpdateOverlappingSiblings ()
 Get the default sibling update mode.
static void SetHighlightingTag (PG_Char c)
static PG_Char GetHighlightingTag ()
static void UpdateRect (SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
static void UpdateRects (SDL_Surface *screen, int numrects, SDL_Rect *rects)

Public Attributes

SignalXMLTag sigXMLTag
SignalAppIdle sigAppIdle

Static Public Attributes

static PG_FontDefaultFont = NULL

Protected Member Functions

void Shutdown ()
 Cleanup the application data.
bool eventKeyUp (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
bool eventKeyDown (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
bool eventQuit (int id, PG_MessageObject *widget, unsigned long data)
 Overridable Eventhandler for a SDL_QuitEvent message.
bool eventResize (const SDL_ResizeEvent *event)
 Overridable Eventhandler for a SDL_ResizeEvent message.
virtual void eventInit ()
virtual void eventIdle ()

Protected Attributes

bool my_quitEventLoop

Classes

class  BulkModeActivator
class  ScreenLocker
class  SignalAppIdle
class  SignalXMLTag
 Signal type declaration. More...

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
IDAPPLICATION 

Definition at line 108 of file pgapplication.h.

enum PG_Application::CursorMode
 

Cursor mode.

Enumeration values:
QUERY  Used to query the current mode.
NONE  Show no cursor at all.
HARDWARE  Use hardware (standard SDL) cursor.
SOFTWARE  Use ParaGUI software cursor (when possible).

Definition at line 101 of file pgapplication.h.


Constructor & Destructor Documentation

PG_Application::PG_Application  ) 
 

Definition at line 90 of file pgapplication.cpp.

References PG_FileArchive::AddArchive(), PG_FileArchive::GetBaseDir(), PARAGUI_ShutDownCode(), PG_LogWRN(), and PG_Draw::TILE.

PG_Application::~PG_Application  ) 
 

Definition at line 141 of file pgapplication.cpp.

References PG_FileArchive::RemoveAllArchives(), and Shutdown().


Member Function Documentation

void PG_Application::ClearOldMousePosition  )  [static]
 

If software cursors are enabled and you move the mouse, the old location has to be refreshed somehow with the underlying graphics.

This is done by this function. Note that bulkmode has to be disabled for this function to be called.

Definition at line 247 of file pgapplication.cpp.

References GetBulkMode(), GetScreen(), PG_Rect::my_width, and SOFTWARE.

Referenced by RunEventLoop(), PG_Widget::RunModal(), SetCursor(), and ShowCursor().

void PG_Application::DeleteBackground  ) 
 

Definition at line 1018 of file pgapplication.cpp.

References PG_FileArchive::UnloadSurface().

Referenced by Shutdown().

void PG_Application::DisableDirtyUpdates bool  disable  )  [static]
 

Disable dirty widget updates.

This function is used to disable dirty widget updates globally. Dirty updates are usually used to speed up blitting. However, it can cause problems with 'semitransparent' widgets.

Parameters:
disable disable ditry updates
Note:
All widgets created after this call wont use the dirty update anymore. Widgets created before will still use this mode if enabled.

Definition at line 1034 of file pgapplication.cpp.

void PG_Application::DrawCursor bool  update = true  )  [static]
 

Update the graphical mouse cursor.

This will redraw the graphical curser pointer, if enabled. You might need to call this if you stop the normal event loop from running.

Parameters:
update true if you want to "Update" the screen content immediately.

Definition at line 261 of file pgapplication.cpp.

References PG_Draw::CreateRGBSurface(), GetBulkMode(), PG_EventSupplier::GetMouseState(), GetScreen(), PG_Rect::my_height, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, SOFTWARE, and UpdateRects().

Referenced by PG_Widget::BulkBlit(), RunEventLoop(), PG_Widget::RunModal(), SetCursor(), and ShowCursor().

void PG_Application::EnableAppIdleCalls bool  enable = true  ) 
 

Set AppIdleCalls.

Parameters:
enable whether to enable or disable AppIdleCalls If you enable AppIdleCalls, the PGApplication object will emit a sigAppIdle signal whenever no events are in the queue and sleep for a short interval (this is the behaviour inherited from PG_MessageObject). However, if you disable it, the object will just call SDL_WaitEvent(). Enable this if you know something to do in idle periods and don't forget to connect the sigAppIdle signal then.

Definition at line 197 of file pgapplication.cpp.

Referenced by ASC_PG_App::ASC_PG_App().

void PG_Application::EnableBackground bool  enable = true  ) 
 

Definition at line 1014 of file pgapplication.cpp.

void PG_Application::eventIdle  )  [protected, virtual]
 

Reimplemented in ASC_PG_App.

Definition at line 1056 of file pgapplication.cpp.

References sigAppIdle.

Referenced by ASC_PG_App::eventIdle(), and RunEventLoop().

void PG_Application::eventInit  )  [protected, virtual]
 

Definition at line 636 of file pgapplication.cpp.

Referenced by InitScreen().

bool PG_Application::eventKeyDown 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 unpressed to pressed. 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 PG_MessageObject.

Definition at line 347 of file pgapplication.cpp.

bool PG_Application::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 PG_MessageObject.

Definition at line 363 of file pgapplication.cpp.

References Quit().

bool PG_Application::eventQuit int  id,
PG_MessageObject 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:
id id of the sending widget
widget pointer to the widget
data event specific data
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 PG_MessageObject.

Reimplemented in ASC_PG_App.

Definition at line 744 of file pgapplication.cpp.

References GetBulkMode(), my_quitEventLoop, and PG_FileArchive::UnloadSurface().

Referenced by ASC_PG_App::eventQuit(), and Quit().

bool PG_Application::eventResize const SDL_ResizeEvent *  event  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_ResizeEvent message.

The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
event SDL_ResizeEvent 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 PG_MessageObject.

Definition at line 373 of file pgapplication.cpp.

References PG_MessageObject::sigVideoResize, UpdateRect(), and PG_Widget::UpdateRect().

void PG_Application::FlipPage  )  [static]
 

Do a page flip (only for double buffered screens).

Definition at line 573 of file pgapplication.cpp.

void PG_Application::FlushEventQueue  )  [static]
 

Flush the event queue.

Definition at line 1046 of file pgapplication.cpp.

References PG_EventSupplier::PollEvent().

Referenced by RunEventLoop().

PG_Application * PG_Application::GetApp  )  [static]
 

Definition at line 1042 of file pgapplication.cpp.

Referenced by PG_Widget::activateHotkey(), AI_KeyboardWatcher::AI_KeyboardWatcher(), mainloopidle(), MapDisplayPG::MapDisplayPG(), Maped_MainScreenWidget::Maped_MainScreenWidget(), NewGuiHost::NewGuiHost(), PG_LineEdit::PG_LineEdit(), PG_ToolTipHelp::PG_ToolTipHelp(), PlayerColorPanel::PlayerColorPanel(), trunreplay::run(), PG_Widget::RunModal(), MainScreenWidget::setup(), StartupScreen::StartupScreen(), and XMLStartDoc().

bool PG_Application::GetAppIdleCallsEnabled  ) 
 

Get the behaviour concerning empty queues (see EnableAppIdleCalls()).

Returns:
the current behaviour of the application object

Definition at line 201 of file pgapplication.cpp.

bool PG_Application::GetBulkMode  )  [static]
 

Check if the application is currently in bulk mode.

Returns:
true / false Bulkmode means that all widget are always blitted at once.

Definition at line 1006 of file pgapplication.cpp.

Referenced by AntiBulkHandler::AntiBulkHandler(), BulkGraphicUpdates::BulkGraphicUpdates(), PG_Application::BulkModeActivator::BulkModeActivator(), ClearOldMousePosition(), DrawCursor(), eventQuit(), PG_Widget::Hide(), PG_Widget::MoveWidget(), RedrawBackground(), PG_Widget::RestoreBackground(), SetBackground(), DashboardPanel::showUnitData(), PG_Widget::Update(), and PG_Widget::UpdateRect().

void PG_Application::GetCaption std::string &  title,
std::string &  icon
 

Get application`s window-manager title and icon name.

Parameters:
title return place for title name pointer
icon return place for icon name pointer Set pointers to the window title and icon name.

Definition at line 865 of file pgapplication.cpp.

bool PG_Application::GetDirtyUpdatesDisabled  )  [static]
 

Check if the 'dirty update' mode is disabled globally.

Returns:
true - if the 'dirty update' mode is disabled globally

Definition at line 1038 of file pgapplication.cpp.

Referenced by PG_Widget::SetDirtyUpdate().

PG_EventSupplier * PG_Application::GetEventSupplier  )  [static]
 

Returns the EventSupplier that's currently active.

See also:
SetEventSupplier
Returns:
the active EventSupplier

Definition at line 242 of file pgapplication.cpp.

Referenced by PG_MenuBar::enterButton(), PG_WidgetDnD::eventMouseButtonDown(), PG_ScrollBar::ScrollButton::eventMouseButtonDown(), StoringPosition::eventMouseButtonDown(), PG_WidgetDnD::eventMouseButtonUp(), PG_ScrollBar::eventMouseButtonUp(), StoringPosition::eventMouseButtonUp(), PG_WidgetDnD::eventMouseMotion(), filterQueuedZoomEvents(), PG_Widget::IsMouseInside(), PG_ToolTipHelp::onIdle(), ASC_PG_App::processEvent(), PG_Widget::RunModal(), PG_Widget::StartWidgetDrag(), MapSwitcher::toggle(), and PG_PopupMenu::trackMenu().

PG_Char PG_Application::GetHighlightingTag  )  [static]
 

Definition at line 1325 of file pgapplication.cpp.

Referenced by PG_Widget::extractHotkey(), PG_Widget::GetTextSize(), and PG_Widget::RenderText().

const std::string & PG_Application::GetRelativePath const std::string &  file  )  [static]
 

Tries to find a specifies file.

Parameters:
file file to look for
Returns:
path where the file was found (or NULL if not found)

Definition at line 563 of file pgapplication.cpp.

References PG_FileArchive::Exists(), and PG_FileArchive::GetRealDir().

static SDL_Surface* PG_Application::GetScreen  )  [inline, static]
 

Get the current screen surface.

Returns:
pointer the screen surface

Definition at line 179 of file pgapplication.h.

References screen.

Referenced by AmmoTransferWindow::AmmoTransferWindow(), PG_RectList::Blit(), ClearOldMousePosition(), PG_ThemeWidget::CreateThemedSurface(), MapDisplayPG::displayMovementStep(), DrawCursor(), PG_WidgetDnD::drawDragArea(), PG_Widget::DrawHLine(), PG_Widget::DrawLine(), PG_Widget::DrawText(), PG_Widget::DrawVLine(), SelectionWidget::eventBlit(), PG_Widget::eventBlit(), PG_ThemeWidget::eventBlit(), PG_RichEdit::eventBlit(), PG_ProgressBar::eventBlit(), PG_PopupMenu::eventBlit(), PG_Button::eventBlit(), Emboss::eventBlit(), MapDisplayPG::eventBlit(), MainScreenWidget::eventBlit(), StoringPosition::eventBlit(), DamageBarWidget::eventBlit(), GraphWidget::eventBlit(), BarGraphWidget::eventBlit(), ASC_PG_App::eventIdle(), ASC_MainScreenWidget::eventKeyDown(), PG_Window::eventMouseButtonUp(), PG_Window::eventMouseMotion(), execuseraction(), PG_Widget::FadeIn(), PG_Widget::FadeOut(), PG_Widget::Hide(), ASC_PG_App::InitScreen(), InternalAmmoTransferWindow::InternalAmmoTransferWindow(), GraphWidget::mapColor(), PG_Widget::MoveWidget(), Weathercast::painter(), OverviewMapPanel::painter(), WeaponInfoLine::painter(), DashboardPanel::painter(), AttackPanel::painter(), Weathercast::paintWeatherArea(), PG_Layout::GetParamRect(), PG_Widget::RestoreBackground(), SetBackground(), PG_Widget::SetPixel(), PG_ToolTipHelp::ShowHelp(), showSDLInfo(), PG_Widget::SizeWidget(), ReplayRecorder::start(), ASC_PG_App::toggleFullscreen(), PG_Widget::Update(), PG_WidgetDnD::updateDragArea(), PG_Widget::UpdateRect(), and PG_Widget::UpdateScreen().

int PG_Application::GetScreenHeight  )  [static]
 

Get the current screen (or window) height.

Returns:
height in pixels

Definition at line 994 of file pgapplication.cpp.

Referenced by ASC_PG_Dialog::centerRectangle(), MapDisplayPG::displayUnitMovement(), PG_DropDown::handleButtonClick(), MainScreenWidget::mouseScrollChecker(), PG_PopupMenu::openMenu(), PG_Widget::RecalcClipRect(), PG_PopupMenu::recalcRect(), selectItemID(), ASCGUI_Window::setup(), PG_Widget::SizeWidget(), StartupScreen::StartupScreen(), PG_Widget::UpdateScreen(), and PG_Widget::WidgetDrag().

int PG_Application::GetScreenWidth  )  [static]
 

Get the current screen (or window) width.

Returns:
width in pixels

Definition at line 998 of file pgapplication.cpp.

Referenced by CargoDialog::CargoDialog(), ASC_PG_Dialog::centerRectangle(), MapDisplayPG::displayUnitMovement(), LayoutablePanel::eventHide(), LayoutablePanel::eventMoveWidget(), LayoutablePanel::eventShow(), PG_DropDown::handleButtonClick(), MessageSelectionWindow::messageSelected(), MainScreenWidget::mouseScrollChecker(), PG_PopupMenu::openMenu(), PG_Widget::RecalcClipRect(), PG_PopupMenu::recalcRect(), ASCGUI_Window::setup(), PG_Widget::SizeWidget(), StartupScreen::StartupScreen(), PG_Widget::UpdateScreen(), viewmessages(), and PG_Widget::WidgetDrag().

PG_Theme * PG_Application::GetTheme  )  [static]
 

Get the current default widgettheme.

Returns:
pointer to PG_Theme definition

Definition at line 1002 of file pgapplication.cpp.

Referenced by PG_Window::LoadThemeStyle(), PG_Widget::LoadThemeStyle(), PG_ThemeWidget::LoadThemeStyle(), PG_Slider::LoadThemeStyle(), PG_RadioButton::LoadThemeStyle(), PG_ProgressBar::LoadThemeStyle(), PG_PopupMenu::LoadThemeStyle(), PG_ListBoxItem::LoadThemeStyle(), PG_LineEdit::LoadThemeStyle(), PG_Label::LoadThemeStyle(), and PG_Button::LoadThemeStyle().

bool PG_Application::GetUpdateOverlappingSiblings  )  [static]
 

Get the default sibling update mode.

Returns:
default sibling update mode

Definition at line 1295 of file pgapplication.cpp.

Referenced by PG_WidgetDataInternal::PG_WidgetDataInternal().

template<class T>
static T* PG_Application::GetWidget int  id  )  [inline, static]
 

Definition at line 388 of file pgapplication.h.

template<class T>
static T* PG_Application::GetWidget const std::string &  Name  )  [inline, static]
 

Definition at line 383 of file pgapplication.h.

PG_Widget * PG_Application::GetWidgetById int  id  )  [static]
 

Get widget by id.

Parameters:
id id of the widget
Returns:
pointer to the requested widget or 0 if failed

Definition at line 962 of file pgapplication.cpp.

References FindInChildObjects(), and PG_Widget::GetWidgetList().

PG_Widget * PG_Application::GetWidgetByName const std::string &  Name  )  [static]
 

Get widget by name.

Parameters:
Name name of the widget
Returns:
pointer to the requested widget or null if failed

Definition at line 958 of file pgapplication.cpp.

References FindInChildObjects(), and PG_Widget::GetWidgetList().

Referenced by UnitInfoPanel::onClick(), and XMLStartDoc().

int PG_Application::Iconify void   ) 
 

Iconify/Minimise the window-manager window.

Returns:
returns non-zero on success or 0 if iconification is not support or was refused by the window manager. If the application is running in a window managed environment Iconify attempts to iconify/minimise it.=20

Definition at line 873 of file pgapplication.cpp.

bool PG_Application::InitScreen int  w,
int  h,
int  depth = 0,
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 PG_ screen initialization flags

Reimplemented in ASC_PG_App.

Definition at line 159 of file pgapplication.cpp.

References eventInit(), PG_LogDBG(), PG_LogERR(), PG_LOGMTH_CONSOLE, PrintVideoTest(), and SetScreen().

Referenced by ASC_PG_App::InitScreen().

bool PG_Application::LoadLayout const std::string &  name,
void(*)(int now, int max)  WorkCallback,
void *  UserSpace
[static]
 

Load layout from the XML file.

Parameters:
name name of the xml file
WorkCallback address of the progress callback function
UserSpace address of user data with are returned by Processing instruction etc.
Returns:
returns non-zero on success or 0 if not succes

Definition at line 886 of file pgapplication.cpp.

References PG_Layout::Load().

bool PG_Application::LoadLayout const std::string &  name,
void(*)(int now, int max)  WorkCallback
[static]
 

Load layout from the XML file.

Parameters:
name name of the xml file
WorkCallback address of the progress callback function
Returns:
returns non-zero on success or 0 if not succes

Definition at line 882 of file pgapplication.cpp.

References PG_Layout::Load().

bool PG_Application::LoadLayout const std::string &  name  )  [static]
 

Load layout from the XML file.

Parameters:
name name of the xml file
Returns:
returns non-zero on success or 0 if not succes

Definition at line 878 of file pgapplication.cpp.

References PG_Layout::Load().

PG_Theme * PG_Application::LoadTheme const std::string &  xmltheme,
bool  asDefault = true,
const std::string &  searchpath = PG_NULLSTR
 

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

Definition at line 638 of file pgapplication.cpp.

References PG_FileArchive::AddArchive(), DefaultFont, PG_Theme::FindDefaultFontName(), PG_Theme::FindDefaultFontSize(), PG_Theme::FindDefaultFontStyle(), PG_Theme::FindSurface(), PG_Theme::GetColor(), PG_Theme::GetProperty(), PG_Font::GetSize(), PG_Theme::Load(), PARAGUI_THEMEDIR, PG_FontEngine::PG_Font, PG_LogDBG(), PG_LogMSG(), PG_LogWRN(), and PG_Font::SetStyle().

Referenced by ASC_PG_App::reloadTheme().

static bool PG_Application::LockScreen  )  [inline, static]
 

Set a lock on the screen surface (to avoid concurrent drawing operations).

Returns:
true - the lock was established successfully

Definition at line 188 of file pgapplication.h.

void PG_Application::PrintVideoTest  ) 
 

Outputs some information about the current video target (only with DEBUG enabled).

Referenced by InitScreen().

bool PG_Application::PumpIntoEventQueue const SDL_Event *  event  ) 
 

Sends an event to the global message queue.

Parameters:
event SDL_Event message
Returns:
true - the message was processed by the framework

Definition at line 1216 of file pgapplication.cpp.

References PG_MessageObject::captureObject, PG_Widget::FindWidgetFromPos(), PG_Widget::GetWidgetList(), PG_Rect::next(), PG_Widget::ProcessEvent(), and PG_MessageObject::ProcessEvent().

Referenced by ASC_PG_App::processEvent(), and RunEventLoop().

void PG_Application::Quit  ) 
 

Exit the main eventloop.

Reimplemented in ASC_PG_App.

Definition at line 341 of file pgapplication.cpp.

References eventQuit(), and PG_MessageObject::sigQuit.

Referenced by eventKeyUp(), and ASC_PG_App::Quit().

void PG_Application::RedrawBackground const PG_Rect rect  )  [static]
 

Redraw the application background.

Parameters:
rect the part of the screen to be redrawn

Definition at line 523 of file pgapplication.cpp.

References PG_Draw::DrawTile(), GetBulkMode(), PG_Color::MapRGB(), PG_Draw::ScaleSurface(), PG_Draw::STRETCH, and PG_FileArchive::UnloadSurface().

Referenced by PG_Widget::RestoreBackground(), SetBackground(), and PG_Widget::UpdateRect().

void PG_Application::Run  ) 
 

Run the applications main eventloop.

If theaded is false this function will exit when the eventloop quits (MSG_QUIT). If threaded is true it will return immediately and a thread processing events is started. CAUTION: Threaded eventloops are unsuported under Win32 (windows specific behavior)

Reimplemented in ASC_PG_App.

Definition at line 193 of file pgapplication.cpp.

References RunEventLoop().

Referenced by PG_main(), and ASC_PG_App::Run().

void PG_Application::RunEventLoop  )  [virtual]
 

Run the modal message pump.

This function will exit when the main window was closed.

Definition at line 207 of file pgapplication.cpp.

References ClearOldMousePosition(), DrawCursor(), eventIdle(), FlushEventQueue(), my_quitEventLoop, PG_EventSupplier::PollEvent(), PumpIntoEventQueue(), and PG_EventSupplier::WaitEvent().

Referenced by Run().

bool PG_Application::SetBackground SDL_Surface *  surface,
PG_Draw::BkMode  mode = PG_Draw::TILE,
bool  freeBackground = false
 

Set the application's background image.

Parameters:
surface pointer to a background surface
mode background mode (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)
freeBackground true if the background surface shall be freed when it is no longer used
Returns:
true - background image was altered successfully

Definition at line 498 of file pgapplication.cpp.

References GetBulkMode(), GetScreen(), PG_Widget::GetWidgetList(), RedrawBackground(), PG_FileArchive::UnloadSurface(), and UpdateRect().

bool PG_Application::SetBackground const std::string &  filename,
PG_Draw::BkMode  mode = PG_Draw::TILE
 

Set the application's background image.

Parameters:
filename path to a bitmap file
mode background mode (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)
Returns:
true - background image was altered successfully

Definition at line 486 of file pgapplication.cpp.

References PG_FileArchive::LoadSurface(), and PG_LogWRN().

void PG_Application::SetBulkMode bool  bulk = true  )  [static]
 

Set the bulk mode.

Parameters:
bulk whether or not enable bulk mode If bulk mode is enabled, all widgets are blitted at once. I.e. paragui will not draw the mouse pointer if the mouse is moved. Note however, that YOU have to care for the drawing process then. You need to call PG_Widget::BulkUpdate() every now and then to redraw the screen. See dblbuf.cpp for an example.

Definition at line 760 of file pgapplication.cpp.

Referenced by AntiBulkHandler::AntiBulkHandler(), BulkGraphicUpdates::BulkGraphicUpdates(), PG_Application::BulkModeActivator::BulkModeActivator(), PG_Application::BulkModeActivator::disable(), BulkGraphicUpdates::release(), DashboardPanel::showUnitData(), WeaponInfoPanel::showWeapon(), and AntiBulkHandler::~AntiBulkHandler().

void PG_Application::SetCaption const std::string &  title,
const std::string &  icon = PG_NULLSTR
 

Set application`s window-manager title and icon name.

Parameters:
title title name
icon icon name Sets the title-bar and icon name of the display window.

Definition at line 858 of file pgapplication.cpp.

References SetIcon().

void PG_Application::SetCursor SDL_Surface *  image  )  [static]
 

Set a graphical mouse cursor.

This function makes the cursor use software rendering with the image specified. Note that this can be slow and result in sluggish mouse performance. Note that calling this function doesn't enable software rendering. An additional call to PG_ShowCursor is required.

Note:
The image will receive an additional reference and should be freed by the caller using SDL_FreeSurface when the caller is done using it.

If image is zero, the hardware cursor will be restored. Note however that the cursor mode will remain at PG_CURSOR_SOFTWARE, so any subsequent calls to this function will reenable the software cursor automatically.

Parameters:
image the new cursor
See also:
PG_ShowCursor, PG_DrawCursor

Definition at line 389 of file pgapplication.cpp.

References ClearOldMousePosition(), DrawCursor(), PG_FileArchive::UnloadSurface(), and UpdateRects().

Referenced by StoringPosition::eventMouseMotion().

void PG_Application::SetEmergencyQuit bool  esc  ) 
 

Enable / disable the emergency quit key ("ESC").

Parameters:
esc true - "ESC" key actiavted

Definition at line 792 of file pgapplication.cpp.

void PG_Application::SetEventSupplier PG_EventSupplier eventSupplier  )  [static]
 

Registers a new source for obtaining SDL_Event objects from.

This source will be used in all event loops in Paragui.

Parameters:
eventSupplier the new event source. Paragui will not delete this object. If NULL is passed, Paragui will obtain its events directly from SDL

Definition at line 235 of file