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

PG_Window Class Reference

Inheritance diagram for PG_Window:

Inheritance graph
[legend]
Collaboration diagram for PG_Window:

Collaboration graph
[legend]
List of all members.

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.

Examples:

paratest.cpp.


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 char *windowtext=NULL, WindowFlags flags=DEFAULT, const char *style="Window", int heightTitlebar=25)
 ~PG_Window ()
void LoadThemeStyle (const char *widgettype)
 Load a specific themestyle.

void SetColorTitlebar (const PG_Color &c)
void SetTitle (const char *title, PG_Label::TextAlign alignment=PG_Label::CENTER)
 set window title and alignment

const char * GetTitle ()
 get window title

SDL_Surface * GetIcon ()
 get window icon

void SetIcon (const char *filename)
void SetIcon (SDL_Surface *icon)

Public Attributes

SignalWindowClose sigClose
SignalWindowMinimize sigMinimize
SignalWindowRestore sigRestore

Protected Member Functions

void eventShow ()
 overridable eventhandler called whenever the widget gets shown.

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.

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.


Member Typedef Documentation

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowClose
 

Signal type declaration.

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowMinimize
 

typedef PG_Signal1<PG_Window*> PG_Window::SignalWindowRestore
 


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
IDWINDOW_CLOSE 
IDWINDOW_MINIMIZE 
IDWINDOW_RESTORE 

enum PG_Window::WindowFlags
 

Enumeration values:
MODAL 
SHOW_CLOSE 
SHOW_MINIMIZE 
DEFAULT 


Constructor & Destructor Documentation

PG_Window::PG_Window PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const char *  windowtext = NULL,
WindowFlags  flags = DEFAULT,
const char *  style = "Window",
int  heightTitlebar = 25
 

PG_Window::~PG_Window  ) 
 


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.

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.

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.

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.

void PG_Window::eventShow  )  [protected, virtual]
 

overridable eventhandler called whenever the widget gets shown.

Reimplemented from PG_Widget.

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.

SDL_Surface* PG_Window::GetIcon  ) 
 

get window icon

Returns:
pointer to the window's icon

const char* PG_Window::GetTitle  ) 
 

get window title

Returns:
pointer to the window title string

bool PG_Window::handleButtonClick PG_Button button  )  [protected]
 

Examples:
paratest.cpp.

void PG_Window::LoadThemeStyle const char *  widgettype  ) 
 

Load a specific themestyle.

Parameters:
widgettype name of widget type to load

Reimplemented from PG_ThemeWidget.

Reimplemented in PG_MessageBox.

void PG_Window::SetColorTitlebar const PG_Color c  ) 
 

void PG_Window::SetIcon SDL_Surface *  icon  ) 
 

void PG_Window::SetIcon const char *  filename  ) 
 

void PG_Window::SetTitle const char *  title,
PG_Label::TextAlign  alignment = PG_Label::CENTER
 

set window title and alignment

Parameters:
title new window title
alignment alignment of the text (PG_TA_LEFT | PG_TA_CENTER | PG_TA_RIGHT)


Member Data Documentation

SignalWindowClose PG_Window::sigClose
 

SignalWindowMinimize PG_Window::sigMinimize
 

SignalWindowRestore PG_Window::sigRestore
 



The ParaGUI Project - Alexander Pipelka