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

PG_MessageObject Class Reference

Base class of all objects (provides message handling). More...

#include <pgmessageobject.h>

Inheritance diagram for PG_MessageObject:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_MessageObject ()
 Creates a PG_MessageObject.
virtual ~PG_MessageObject ()
 Destroys a PG_MessageObject and removes it from the global object list.
void EnableReceiver (bool enable)
 This function enables or disables receiving of SDL_Event messages.
PG_MessageObjectSetCapture ()
 Set a message capture for this object.
void ReleaseCapture ()
 Releases a previous capture.
PG_MessageObjectGetCapture ()
 Return the current capture object.
PG_MessageObjectSetInputFocus ()
 Set an inputfocus for this object.
void ReleaseInputFocus ()
 Release the inputfocus.
bool IsEnabled ()
 Check if the object can receive messages.
virtual bool ProcessEvent (const SDL_Event *event)
 Sends an event directly to an object.

Public Attributes

SignalActive sigActive
SignalKeyDown sigKeyDown
SignalKeyUp sigKeyUp
SignalMouseMotion sigMouseMotion
SignalMouseButtonDown sigMouseButtonDown
SignalMouseButtonUp sigMouseButtonUp
SignalSysWM sigSysWM
SignalVideoResize sigVideoResize
SignalQuit sigQuit
SignalDelete sigDelete

Protected Member Functions

virtual bool eventActive (const SDL_ActiveEvent *active)
 Overridable Eventhandler for the SDL_ActiveEvent message.
virtual bool eventKeyDown (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
virtual bool eventKeyUp (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
virtual bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.
virtual bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
virtual bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
virtual bool eventQuit (int id, PG_MessageObject *widget, unsigned long data)
 Overridable Eventhandler for a SDL_QuitEvent message.
virtual bool eventQuitModal (int id, PG_MessageObject *widget, unsigned long data)
 Overridable Eventhandler for a MSG_QUITMODAL message.
virtual bool eventSysWM (const SDL_SysWMEvent *syswm)
 Overridable Eventhandler for a SDL_SysWMEvent message.
virtual bool eventResize (const SDL_ResizeEvent *event)
 Overridable Eventhandler for a SDL_ResizeEvent message.
virtual void eventInputFocusLost (PG_MessageObject *newfocus)
virtual bool AcceptEvent (const SDL_Event *event)
 Overridable message filter function.

Static Protected Attributes

static PG_MessageObjectcaptureObject = NULL

Friends

class PG_Application

Classes

class  SignalActive
 Signal type declaration. More...
class  SignalDelete
class  SignalKeyDown
class  SignalKeyUp
class  SignalMouseButtonDown
class  SignalMouseButtonUp
class  SignalMouseMotion
class  SignalQuit
class  SignalSysWM
class  SignalVideoResize

Detailed Description

Base class of all objects (provides message handling).

Author:
Alexander Pipelka
Provides a message pump and global handlers for all other PG_MessageObject instances.

Definition at line 50 of file pgmessageobject.h.


Constructor & Destructor Documentation

PG_MessageObject::PG_MessageObject  ) 
 

Creates a PG_MessageObject.

Definition at line 45 of file pgmessageobject.cpp.

PG_MessageObject::~PG_MessageObject  )  [virtual]
 

Destroys a PG_MessageObject and removes it from the global object list.

Definition at line 58 of file pgmessageobject.cpp.

References captureObject, and sigDelete.


Member Function Documentation

bool PG_MessageObject::AcceptEvent const SDL_Event *  event  )  [protected, virtual]
 

Overridable message filter function.

Derivated classes can filter special events. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
event SDL_Event 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 in PG_Widget.

Definition at line 204 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

void PG_MessageObject::EnableReceiver bool  enable  ) 
 

This function enables or disables receiving of SDL_Event messages.

Parameters:
enable Enable or disable the ability of receiving messages. When set to false no event handlers will be called for this object

Definition at line 79 of file pgmessageobject.cpp.

Referenced by PG_Widget::EnableReceiver().

bool PG_MessageObject::eventActive const SDL_ActiveEvent *  active  )  [protected, virtual]
 

Overridable Eventhandler for the SDL_ActiveEvent message.

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

Parameters:
active SDL_ActiveEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Definition at line 156 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

void PG_MessageObject::eventInputFocusLost PG_MessageObject newfocus  )  [protected, virtual]
 

Reimplemented in PG_LineEdit.

Definition at line 244 of file pgmessageobject.cpp.

Referenced by SetInputFocus().

bool PG_MessageObject::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 in ASC_MainScreenWidget, AmmoTransferWindow, VehicleProduction_SelectionWindow, CargoEditor, CargoWidget, SelectFromMap, InternalAmmoTransferWindow, MessageDialog, StartMultiplayerGame, NonEditableLineEdit, ItemSelectorWidget, ItemSelectorWindow, PlayerColorPanel, NewGuiHost, PG_Application, PG_Button, PG_LineEdit, PG_MultiLineEdit, PG_PopupMenu, MapDisplayPG, Maped_MainScreenWidget, IngameMessageViewer, ASC_PG_Dialog, TextRenderer, and ViewFormattedText.

Definition at line 161 of file pgmessageobject.cpp.

Referenced by PG_Widget::activateHotkey(), and ProcessEvent().

bool PG_MessageObject::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 in NewGuiHost, PG_Application, and Maped_MainScreenWidget.

Definition at line 166 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

bool PG_MessageObject::eventMouseButtonDown const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent 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 in GraphWidget, StoringPosition, SelectionWidget, SmallButtonHolder, PG_Button, PG_ColorSelector::PG_ColorBox, PG_ListBox, PG_MaskEdit, PG_MultiLineEdit, PG_PopupMenu, PG_ScrollBar::ScrollButton, PG_ScrollBar, PG_ScrollWidget, PG_WidgetDnD, PG_Window, MapDisplayPG, Maped_MainScreenWidget, and TargetCoordinateLocator.

Definition at line 176 of file pgmessageobject.cpp.

Referenced by PG_Widget::Action(), PG_PopupMenu::eventMouseButtonDown(), PG_MaskEdit::eventMouseButtonDown(), and ProcessEvent().

bool PG_MessageObject::eventMouseButtonUp const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent 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 in WeaponInfoPanel, ExperienceOverview, ListBoxImageItem< SelectionType >, DiplomaticModeChooser< SelectionType >, StoringPosition, SelectionWidget, SmallButtonHolder, PG_Button, PG_CheckButton, PG_ColorSelector::PG_ColorBox, PG_LineEdit, PG_ListBox, PG_ListBoxBaseItem, PG_MultiLineEdit, PG_PopupMenu, PG_RadioButton, PG_ScrollBar::ScrollButton, PG_ScrollBar, PG_Slider, PG_WidgetDnD, PG_Window, and MapDisplayPG.

Definition at line 181 of file pgmessageobject.cpp.

Referenced by PG_Widget::Action(), PG_ScrollBar::eventMouseButtonUp(), PG_PopupMenu::eventMouseButtonUp(), and ProcessEvent().

bool PG_MessageObject::eventMouseMotion const SDL_MouseMotionEvent *  motion  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseMotionEvent message.

This handler is called when mouse movement is detected. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
motion SDL_MouseMotionEvent 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 in WeaponInfoPanel, GraphWidget, StoringPosition, SmallButtonHolder, PG_ColorSelector::PG_ColorBox, PG_ListBox, PG_MultiLineEdit, PG_PopupMenu, PG_ScrollBar::ScrollButton, PG_ScrollBar, PG_WidgetDnD, PG_Window, and MapDisplayPG.

Definition at line 171 of file pgmessageobject.cpp.

Referenced by PG_Window::eventMouseMotion(), PG_WidgetDnD::eventMouseMotion(), PG_ScrollBar::eventMouseMotion(), PG_MultiLineEdit::eventMouseMotion(), and ProcessEvent().

bool PG_MessageObject::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 in PG_Application, and ASC_PG_App.

Definition at line 186 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

bool PG_MessageObject::eventQuitModal int  id,
PG_MessageObject widget,
unsigned long  data
[protected, virtual]
 

Overridable Eventhandler for a MSG_QUITMODAL 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 in PG_Widget.

Definition at line 190 of file pgmessageobject.cpp.

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

Definition at line 200 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

bool PG_MessageObject::eventSysWM const SDL_SysWMEvent *  syswm  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_SysWMEvent message.

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

Parameters:
syswm SDL_SysWMEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Definition at line 195 of file pgmessageobject.cpp.

Referenced by ProcessEvent().

PG_MessageObject * PG_MessageObject::GetCapture  ) 
 

Return the current capture object.

Definition at line 289 of file pgmessageobject.cpp.

References captureObject.

bool PG_MessageObject::IsEnabled  ) 
 

Check if the object can receive messages.

Returns:
true/false returns true when the object can receive messages or false if not.

Definition at line 293 of file pgmessageobject.cpp.

bool PG_MessageObject::ProcessEvent const SDL_Event *  event  )  [virtual]
 

Sends an event directly to an object.

Parameters:
event SDL_Event 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 in SmallButtonHolder.

Definition at line 86 of file pgmessageobject.cpp.

References AcceptEvent(), captureObject, eventActive(), eventKeyDown(), eventKeyUp(), eventMouseButtonDown(), eventMouseButtonUp(), eventMouseMotion(), eventQuit(), eventResize(), eventSysWM(), PG_Application::IDAPPLICATION, sigActive, sigKeyDown, sigKeyUp, sigMouseButtonDown, sigMouseButtonUp, sigMouseMotion, sigQuit, sigSysWM, and sigVideoResize.

Referenced by PG_Widget::ProcessEvent(), and PG_Application::PumpIntoEventQueue().

void PG_MessageObject::ReleaseCapture  ) 
 

Releases a previous capture.

Definition at line 220 of file pgmessageobject.cpp.

References captureObject.

Referenced by PG_PopupMenu::eventHide(), PG_Window::eventMouseButtonUp(), PG_WidgetDnD::eventMouseButtonUp(), PG_ColorSelector::PG_ColorBox::eventMouseButtonUp(), PG_Button::eventMouseButtonUp(), StoringPosition::eventMouseButtonUp(), PG_PopupMenu::eventMouseMotion(), PG_Widget::Hide(), SmallButtonHolder::ProcessEvent(), and SmallButtonHolder::Unlock().

void PG_MessageObject::ReleaseInputFocus  ) 
 

Release the inputfocus.

Definition at line 248 of file pgmessageobject.cpp.

Referenced by PG_LineEdit::EditEnd(), and PG_Widget::Hide().

PG_MessageObject * PG_MessageObject::SetCapture  ) 
 

Set a message capture for this object.

This object will receive all SDL_Event messages regardless if it is able to process them or not.

Definition at line 210 of file pgmessageobject.cpp.

References captureObject.

Referenced by PG_Window::eventMouseButtonDown(), PG_WidgetDnD::eventMouseButtonDown(), PG_ColorSelector::PG_ColorBox::eventMouseButtonDown(), PG_Button::eventMouseButtonDown(), StoringPosition::eventMouseButtonDown(), PG_PopupMenu::eventShow(), SmallButtonHolder::Lock(), UnitInfoPanel::onClick(), SmallButtonHolder::ProcessEvent(), and ExperienceOverview::RunModal().

PG_MessageObject * PG_MessageObject::SetInputFocus  ) 
 

Set an inputfocus for this object.

Returns:
pointer to the object that had the inputfocus till now If the inputfocus is set all key events will be sent to this object

Definition at line 228 of file pgmessageobject.cpp.

References eventInputFocusLost().

Referenced by ChangePasswordDialog::ChangePasswordDialog(), ASC_PG_Dialog::closeWindow(), PG_LineEdit::EditBegin(), NewMessage::NewMessage(), and SaveGameBaseDialog::SaveGameBaseDialog().


Friends And Related Function Documentation

friend class PG_Application [friend]
 

Definition at line 318 of file pgmessageobject.h.


Member Data Documentation

PG_MessageObject * PG_MessageObject::captureObject = NULL [static, protected]
 

Definition at line 39 of file pgmessageobject.cpp.

Referenced by GetCapture(), ProcessEvent(), PG_Application::PumpIntoEventQueue(), ReleaseCapture(), SetCapture(), and ~PG_MessageObject().

SignalActive PG_MessageObject::sigActive
 

Definition at line 155 of file pgmessageobject.h.

Referenced by ProcessEvent().

SignalDelete PG_MessageObject::sigDelete
 

Definition at line 165 of file pgmessageobject.h.

Referenced by MessageSelectionWindow::messageSelected(), PG_DropDown::PG_DropDown(), PG_ToolTipHelp::PG_ToolTipHelp(), ASC_PG_App::queueWidgetForDeletion(), and ~PG_MessageObject().

SignalKeyDown PG_MessageObject::sigKeyDown
 

Definition at line 156 of file pgmessageobject.h.

Referenced by ProcessEvent().

SignalKeyUp PG_MessageObject::sigKeyUp
 

Definition at line 157 of file pgmessageobject.h.

Referenced by ProcessEvent().

SignalMouseButtonDown PG_MessageObject::sigMouseButtonDown
 

Definition at line 159 of file pgmessageobject.h.

Referenced by OverviewMapPanel::OverviewMapPanel(), ProcessEvent(), UnitInfoPanel::UnitInfoPanel(), UnitInfoDialog::userHandler(), and Weathercast::Weathercast().

SignalMouseButtonUp PG_MessageObject::sigMouseButtonUp
 

Definition at line 160 of file pgmessageobject.h.

Referenced by ProcessEvent(), and UnitInfoPanel::UnitInfoPanel().

SignalMouseMotion PG_MessageObject::sigMouseMotion
 

Definition at line 158 of file pgmessageobject.h.

Referenced by OverviewMapPanel::OverviewMapPanel(), PG_ToolTipHelp::PG_ToolTipHelp(), ProcessEvent(), PG_ToolTipHelp::ShowHelp(), and Weathercast::Weathercast().

SignalQuit PG_MessageObject::sigQuit
 

Definition at line 163 of file pgmessageobject.h.

Referenced by ASC_PG_App::eventQuit(), GameThreadParams::GameThreadParams(), ProcessEvent(), PG_Application::Quit(), and ASC_PG_App::Quit().

SignalSysWM PG_MessageObject::sigSysWM
 

Definition at line 161 of file pgmessageobject.h.

Referenced by ProcessEvent().

SignalVideoResize PG_MessageObject::sigVideoResize
 

Definition at line 162 of file pgmessageobject.h.

Referenced by PG_Application::eventResize(), and ProcessEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:07 2008 for Advanced Strategic Command by  doxygen 1.4.2