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

PG_Window Class Reference

A window inside the program (not a windowing environment window). More...

#include <pgwindow.h>

Inheritance diagram for PG_Window:

Inheritance graph
[legend]
List of all members.

Public Types

typedef PG_Signal1< PG_Window * > SignalWindowClose
 Signal type declaration.
typedef PG_Signal1< PG_Window * > SignalWindowMinimize
typedef PG_Signal1< PG_Window * > SignalWindowRestore
enum  WindowFlags { MODAL = 0x01, SHOW_CLOSE = 0x02, SHOW_MINIMIZE = 0x04, DEFAULT = SHOW_CLOSE }
enum  { IDWINDOW_CLOSE = PG_WIDGETID_INTERNAL + 14, IDWINDOW_MINIMIZE = PG_WIDGETID_INTERNAL + 15, IDWINDOW_RESTORE = PG_WIDGETID_INTERNAL + 15 }

Public Member Functions

 PG_Window (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, const std::string &windowtext=PG_NULLSTR, WindowFlags flags=DEFAULT, const std::string &style="Window", int heightTitlebar=25)
 Constructor for the PG_Window class.
 ~PG_Window ()
void LoadThemeStyle (const std::string &widgettype)
 Load a specific themestyle.
void SetTitlebarColor (const PG_Color &c)
 set window titlebar color
PG_Color GetTitlebarColor ()
 get window title
void SetTitlebarHeight (Uint8 height)
 set window titlebar height
Uint8 GetTitlebarHeight ()
 get window titlebar height
void SetTitle (const std::string &title, PG_Label::TextAlign alignment=PG_Label::CENTER)
 set window title and alignment
void SetText (const std::string &text)
 Sets text.
const PG_String & GetTitle ()
 get window title
const PG_String & GetText ()
 Returns text.
SDL_Surface * GetIcon ()
 get window icon
void SetIcon (const std::string &filename)
 set window icon
void SetIcon (SDL_Surface *icon)
 set window icon
void SetMoveable (bool moveable=true)
 Make window handle / ignore dragging.

Public Attributes

SignalWindowClose sigClose
SignalWindowMinimize sigMinimize
SignalWindowRestore sigRestore

Protected Member Functions

void RecalcPositions ()
void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
 overridable eventhandler to blit the widget contents to the screen
void eventSizeWidget (Uint16 w, Uint16 h)
 Callback for the SizeWidget event.
virtual bool handleButtonClick (PG_Button *button)
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.

Detailed Description

A window inside the program (not a windowing environment window).

Author:
Alexander Pipelka
Creates a window entirely inside ParaGUI. This window can be modal or non-modal. Non-modal windows can be brought in front of others by clicking the titlebar.

Definition at line 51 of file pgwindow.h.


Member Typedef Documentation

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowClose
 

Signal type declaration.

Definition at line 71 of file pgwindow.h.

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowMinimize
 

Definition at line 72 of file pgwindow.h.

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowRestore
 

Definition at line 73 of file pgwindow.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
IDWINDOW_CLOSE 
IDWINDOW_MINIMIZE 
IDWINDOW_RESTORE 

Definition at line 62 of file pgwindow.h.

enum PG_Window::WindowFlags
 

Enumeration values:
MODAL 
SHOW_CLOSE 
SHOW_MINIMIZE 
DEFAULT 

Definition at line 55 of file pgwindow.h.


Constructor & Destructor Documentation

PG_Window::PG_Window PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const std::string &  windowtext = PG_NULLSTR,
WindowFlags  flags = DEFAULT,
const std::string &  style = "Window",
int  heightTitlebar = 25
 

Constructor for the PG_Window class.

Parameters:
parent pointer to the parent widget or NULL
r screen position of the button
windowtext window titlebar label
flags (DEFAULT = SHOW_CLOSE | SHOW_CLOSE | SHOW_MINIMIZE | MODAL )
style themestyle of the window
heightTitlebar height of the window titlebar

Definition at line 34 of file pgwindow.cpp.

References PG_Label::CENTER, PG_Widget::EnableReceiver(), handleButtonClick(), PG_Widget::Hide(), IDWINDOW_CLOSE, IDWINDOW_MINIMIZE, LoadThemeStyle(), PG_Rect::my_width, PG_Rect::PG_Rect(), PG_ThemeWidget::PG_ThemeWidget(), PG_Label::SetAlignment(), PG_Widget::SetID(), and PG_Button::sigClick.

PG_Window::~PG_Window  ) 
 

Definition at line 66 of file pgwindow.cpp.


Member Function Documentation

void PG_Window::eventBlit SDL_Surface *  surface,
const PG_Rect src,
const PG_Rect dst
[protected, virtual]
 

overridable eventhandler to blit the widget contents to the screen

Parameters:
surface pointer to SDL_Surface to be blitted
src source rectangle (client coordinates)
dst destination rectangle (screen coordinates) Override this eventhandler to perform custom blitting behaviour (without drawing onto the widget surface).

Reimplemented from PG_ThemeWidget.

Definition at line 139 of file pgwindow.cpp.

References PG_Widget::DrawBorder(), PG_ThemeWidget::eventBlit(), PG_Widget::my_bordersize, PG_Rect::my_height, PG_Rect::my_width, PG_Rect::my_xpos, and PG_Rect::my_ypos.

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

Definition at line 154 of file pgwindow.cpp.

References PG_Rect::my_height, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, PG_MessageObject::SetCapture(), PG_Widget::Show(), PG_Point::x, and PG_Point::y.

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

Reimplemented in WeaponInfoPanel.

Definition at line 182 of file pgwindow.cpp.

References PG_Application::GetScreen(), PG_Rect::my_height, PG_Rect::my_width, PG_MessageObject::ReleaseCapture(), screen, PG_Point::x, and PG_Point::y.

Referenced by WeaponInfoPanel::eventMouseButtonUp().

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

Reimplemented in WeaponInfoPanel.

Definition at line 210 of file pgwindow.cpp.

References PG_MessageObject::eventMouseMotion(), PG_Widget::GetParent(), PG_Application::GetScreen(), PG_Widget::MoveWidget(), PG_Rect::my_height, PG_Rect::my_width, screen, PG_Point::x, and PG_Point::y.

void PG_Window::eventSizeWidget Uint16  w,
Uint16  h
[protected, virtual]
 

Callback for the SizeWidget event.

Parameters:
w new width
h new height This virtual function can be used to implement custom behavior for SizeWidget events.

Reimplemented from PG_ThemeWidget.

Definition at line 129 of file pgwindow.cpp.

References PG_ThemeWidget::eventSizeWidget(), PG_Rect::my_height, PG_Rect::my_width, and RecalcPositions().

SDL_Surface * PG_Window::GetIcon  ) 
 

get window icon

Returns:
pointer to the window's icon

Definition at line 283 of file pgwindow.cpp.

References PG_Label::GetIcon().

const PG_String & PG_Window::GetText  )  [virtual]
 

Returns text.

Returns:
Pointer to the text of the widget (read-only)

Reimplemented from PG_Widget.

Definition at line 77 of file pgwindow.cpp.

References PG_Widget::GetText().

Referenced by GetTitle().

const PG_String & PG_Window::GetTitle  ) 
 

get window title

Returns:
pointer to the window title string

Definition at line 81 of file pgwindow.cpp.

References GetText().

PG_Color PG_Window::GetTitlebarColor  ) 
 

get window title

Returns:
PG_Color Giving the height of the titlebar

Definition at line 271 of file pgwindow.cpp.

References PG_Widget::GetFontColor().

Uint8 PG_Window::GetTitlebarHeight  ) 
 

get window titlebar height

Returns:
Uint8 height of the titlebar

Definition at line 292 of file pgwindow.cpp.

Referenced by AdminGameWindow::AdminGameWindow(), AuthenticationDialog::AuthenticationDialog(), BitMapEditor::BitMapEditor(), EditGameOptions::EditGameOptions(), EditMapParameters::EditMapParameters(), FileSelectionWindow::FileSelectionWindow(), ItemSelectorWindow::ItemSelectorWindow(), MessageSelectionWindow::MessageSelectionWindow(), VehicleProduction_SelectionWindow::VehicleProduction_SelectionWindow(), and WeaponInfoPanel::WeaponInfoPanel().

bool PG_Window::handleButtonClick PG_Button button  )  [protected, virtual]
 

Reimplemented in ChooseTech.

Definition at line 246 of file pgwindow.cpp.

References PG_Widget::GetID(), PG_Widget::Hide(), IDWINDOW_CLOSE, IDWINDOW_MINIMIZE, PG_Widget::QuitModal(), sigClose, and sigMinimize.

Referenced by ChooseTech::handleButtonClick(), and PG_Window().

void PG_Window::LoadThemeStyle const std::string &  widgettype  ) 
 

Load a specific themestyle.

Parameters:
widgettype name of widget type to load

Reimplemented from PG_ThemeWidget.

Reimplemented in MessageDialog, and PG_MessageBox.

Definition at line 100 of file pgwindow.cpp.

References PG_Theme::GetColor(), PG_Widget::GetFontColor(), PG_Theme::GetProperty(), PG_Application::GetTheme(), PG_Button::LoadThemeStyle(), PG_ThemeWidget::LoadThemeStyle(), RecalcPositions(), SetTitlebarColor(), and PG_Widget::Show().

Referenced by PG_MessageBox::LoadThemeStyle(), MessageDialog::LoadThemeStyle(), and PG_Window().

void PG_Window::RecalcPositions  )  [protected]
 

Definition at line 85 of file pgwindow.cpp.

References PG_Widget::MoveWidget(), PG_Rect::my_width, PG_Rect::PG_Rect(), and PG_Widget::SizeWidget().

Referenced by eventSizeWidget(), LoadThemeStyle(), and SetTitlebarHeight().

void PG_Window::SetIcon SDL_Surface *  icon  ) 
 

set window icon

Parameters:
icon pointer to imagedata (SDL_Surface)

Definition at line 279 of file pgwindow.cpp.

References PG_Label::SetIcon().

void PG_Window::SetIcon const std::string &  filename  ) 
 

set window icon

Parameters:
filename image-file to load

Definition at line 275 of file pgwindow.cpp.

References PG_Label::SetIcon().

void PG_Window::SetMoveable bool  moveable = true  ) 
 

Make window handle / ignore dragging.

Definition at line 296 of file pgwindow.cpp.

void PG_Window::SetText const std::string &  text  )  [virtual]
 

Sets text.

Parameters:
text Set the widget text and update widget C++ version, handles std::string

Reimplemented from PG_Widget.

Definition at line 68 of file pgwindow.cpp.

References PG_Widget::SetText().

Referenced by SetTitle().

void PG_Window::SetTitle const std::string &  title,
PG_Label::TextAlign  alignment = PG_Label::CENTER
 

set window title and alignment

Parameters:
title new window title
alignment alignment of the text (PG_Label::LEFT | PG_Label::CENTER | PG_Label::RIGHT)

Definition at line 72 of file pgwindow.cpp.

References PG_Label::SetAlignment(), and SetText().

Referenced by FileSelectionWindow::FileSelectionWindow(), and ASCGUI_Window::setup().

void PG_Window::SetTitlebarColor const PG_Color c  ) 
 

set window titlebar color

Parameters:
c pointer to a PG_Color

Definition at line 267 of file pgwindow.cpp.

References PG_Widget::SetFontColor().

Referenced by LoadThemeStyle(), and SetWindowAtts().

void PG_Window::SetTitlebarHeight Uint8  height  ) 
 

set window titlebar height

Returns:
height height of the titlebar

Definition at line 287 of file pgwindow.cpp.

References RecalcPositions().

Referenced by ASCGUI_Window::setup().


Member Data Documentation

SignalWindowClose PG_Window::sigClose
 

Definition at line 155 of file pgwindow.h.

Referenced by AddWeatherAreaDialog::AddWeatherAreaDialog(), AddWindChangeDialog::AddWindChangeDialog(), ChanceSettingsDialog::buildUpForm(), CargoDialog::CargoDialog(), ChangePasswordDialog::ChangePasswordDialog(), EventAreasDialog::EventAreasDialog(), EventWindChangesDialog::EventWindChangesDialog(), handleButtonClick(), ResourcePlacementDialog::ResourcePlacementDialog(), SaveGameBaseDialog::SaveGameBaseDialog(), SoundSettings::SoundSettings(), StartMultiplayerGame::StartMultiplayerGame(), UnitInfoDialog::UnitInfoDialog(), Weathercast::Weathercast(), and WeatherDialog::WeatherDialog().

SignalWindowMinimize PG_Window::sigMinimize
 

Definition at line 156 of file pgwindow.h.

Referenced by handleButtonClick().

SignalWindowRestore PG_Window::sigRestore
 

Definition at line 157 of file pgwindow.h.


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