#include <pgapplication.h>
Inheritance diagram for PG_Application:

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_Theme * | LoadTheme (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_Theme * | GetTheme () |
| 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_Widget * | GetWidgetByName (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_Widget * | GetWidgetById (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_Application * | GetApp () |
| 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_EventSupplier * | GetEventSupplier () |
| 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_Font * | DefaultFont = 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... | |
|
|
Definition at line 108 of file pgapplication.h. |
|
|
Cursor mode.
Definition at line 101 of file pgapplication.h. |
|
|
Definition at line 90 of file pgapplication.cpp. References PG_FileArchive::AddArchive(), PG_FileArchive::GetBaseDir(), PARAGUI_ShutDownCode(), PG_LogWRN(), and PG_Draw::TILE. |
|
|
Definition at line 141 of file pgapplication.cpp. References PG_FileArchive::RemoveAllArchives(), and Shutdown(). |
|
|
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(). |
|
|
Definition at line 1018 of file pgapplication.cpp. References PG_FileArchive::UnloadSurface(). Referenced by Shutdown(). |
|
|
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.
Definition at line 1034 of file pgapplication.cpp. |
|
|
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.
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(). |
|
|
Set AppIdleCalls.
Definition at line 197 of file pgapplication.cpp. Referenced by ASC_PG_App::ASC_PG_App(). |
|
|
Definition at line 1014 of file pgapplication.cpp. |
|
|
Reimplemented in ASC_PG_App. Definition at line 1056 of file pgapplication.cpp. References sigAppIdle. Referenced by ASC_PG_App::eventIdle(), and RunEventLoop(). |
|
|
Definition at line 636 of file pgapplication.cpp. Referenced by InitScreen(). |
|
|
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.
Reimplemented from PG_MessageObject. Definition at line 347 of file pgapplication.cpp. |
|
|
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.
Reimplemented from PG_MessageObject. Definition at line 363 of file pgapplication.cpp. References Quit(). |
|
||||||||||||||||
|
Overridable Eventhandler for a SDL_QuitEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object.
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(). |
|
|
Overridable Eventhandler for a SDL_ResizeEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object.
Reimplemented from PG_MessageObject. Definition at line 373 of file pgapplication.cpp. References PG_MessageObject::sigVideoResize, UpdateRect(), and PG_Widget::UpdateRect(). |
|
|
Do a page flip (only for double buffered screens).
Definition at line 573 of file pgapplication.cpp. |
|
|
Flush the event queue.
Definition at line 1046 of file pgapplication.cpp. References PG_EventSupplier::PollEvent(). Referenced by RunEventLoop(). |
|
|
|
Get the behaviour concerning empty queues (see EnableAppIdleCalls()).
Definition at line 201 of file pgapplication.cpp. |
|
|
Check if the application is currently in bulk mode.
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(). |
|
||||||||||||
|
Get application`s window-manager title and icon name.
Definition at line 865 of file pgapplication.cpp. |
|
|
Check if the 'dirty update' mode is disabled globally.
Definition at line 1038 of file pgapplication.cpp. Referenced by PG_Widget::SetDirtyUpdate(). |
|
|
Returns the EventSupplier that's currently active.
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(). |
|
|
Definition at line 1325 of file pgapplication.cpp. Referenced by PG_Widget::extractHotkey(), PG_Widget::GetTextSize(), and PG_Widget::RenderText(). |
|
|
Tries to find a specifies file.
Definition at line 563 of file pgapplication.cpp. References PG_FileArchive::Exists(), and PG_FileArchive::GetRealDir(). |
|
|
|
Get the current screen (or window) height.
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(). |
|
|
Get the current screen (or window) width.
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(). |
|
|
Get the current default widgettheme.
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(). |
|
|
Get the default sibling update mode.
Definition at line 1295 of file pgapplication.cpp. Referenced by PG_WidgetDataInternal::PG_WidgetDataInternal(). |
|
||||||||||
|
Definition at line 388 of file pgapplication.h. |
|
||||||||||
|
Definition at line 383 of file pgapplication.h. |
|
|
Get widget by id.
Definition at line 962 of file pgapplication.cpp. References FindInChildObjects(), and PG_Widget::GetWidgetList(). |
|
|
Get widget by name.
Definition at line 958 of file pgapplication.cpp. References FindInChildObjects(), and PG_Widget::GetWidgetList(). Referenced by UnitInfoPanel::onClick(), and XMLStartDoc(). |
|
|
Iconify/Minimise the window-manager window.
Definition at line 873 of file pgapplication.cpp. |
|
||||||||||||||||||||
|
Initialize the screen.
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(). |
|
||||||||||||||||
|
Load layout from the XML file.
Definition at line 886 of file pgapplication.cpp. References PG_Layout::Load(). |
|
||||||||||||
|
Load layout from the XML file.
Definition at line 882 of file pgapplication.cpp. References PG_Layout::Load(). |
|
|
Load layout from the XML file.
Definition at line 878 of file pgapplication.cpp. References PG_Layout::Load(). |
|
||||||||||||||||
|
Load a widget theme.
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(). |
|
|
Set a lock on the screen surface (to avoid concurrent drawing operations).
Definition at line 188 of file pgapplication.h. |
|
|
Outputs some information about the current video target (only with DEBUG enabled).
Referenced by InitScreen(). |
|
|
Sends an event to the global message queue.
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(). |
|
|
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(). |
|
|
Redraw the application background.
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(). |
|
|
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(). |
|
|
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(). |
|
||||||||||||||||
|
Set the application's background image.
Definition at line 498 of file pgapplication.cpp. References GetBulkMode(), GetScreen(), PG_Widget::GetWidgetList(), RedrawBackground(), PG_FileArchive::UnloadSurface(), and UpdateRect(). |
|
||||||||||||
|
Set the application's background image.
Definition at line 486 of file pgapplication.cpp. References PG_FileArchive::LoadSurface(), and PG_LogWRN(). |
|
|
Set the bulk mode.
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(). |
|
||||||||||||
|
Set application`s window-manager title and icon name.
Definition at line 858 of file pgapplication.cpp. References SetIcon(). |
|
|
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.
Definition at line 389 of file pgapplication.cpp. References ClearOldMousePosition(), DrawCursor(), PG_FileArchive::UnloadSurface(), and UpdateRects(). Referenced by StoringPosition::eventMouseMotion(). |
|
|
Enable / disable the emergency quit key ("ESC").
Definition at line 792 of file pgapplication.cpp. |
|
|
Registers a new source for obtaining SDL_Event objects from. This source will be used in all event loops in Paragui.
Definition at line 235 of file |