GClasses

GClasses::GWidgetDialog Class Reference

A form or dialog. More...

#include <GWidgets.h>

Inheritance diagram for GClasses::GWidgetDialog:
GClasses::GWidgetGroup GClasses::GWidget

List of all members.

Public Member Functions

 GWidgetDialog (int w, int h, unsigned int cBackground)
virtual ~GWidgetDialog ()
virtual WidgetType type ()
void setBackgroundImage (GImage *pImage)
 Sets the background image.
GWidgetAtomicgrabbedWidget ()
 Returns the widget that the mouse is currently grabbing.
GWidgetAtomicfocusWidget ()
 Returns the widget that currently has focus.
void setFocusWidget (GWidgetAtomic *pWidget)
 Sets the widget with focus.
virtual void pressButton (int button, int x, int y)
 You should call this when the user presses a mouse button.
virtual void releaseButton (int button)
 You should call this method when the mouse releases (un-clicks)
virtual void onDestroyWidget (GWidget *pWidget)
virtual void handleChar (char c)
 You should call this method when the user presses a key.
virtual void handleSpecialKey (int key)
 You should call this method when the user presses a special key.
virtual bool handleMousePos (int x, int y)
 You should call this method when the user moves the mouse.
virtual void draw (GImage *pCanvas, int x, int y)
 Draws this widget on pCanvas at (x,y)
GImageimage ()
 Updates everything that needs to be updated, and makes an image of the dialog in its current state so you can blit it to the screen.
unsigned int backgroundColor ()
 Returns the background color.
bool * runningFlag ()
 This method is used when running the dialog as a popup modal dialog. The flag is initialized to true. It is the controller's job to check this flag and close the dialog when it is set to false.
void close ()
 Sets m_bRunning to false. It's the controller's job to watch this flag and do something about it.

Protected Member Functions

void grabWidget (GWidgetAtomic *pWidget, int button, int mouseX, int mouseY)
 This is called by pressAt when the user clicks on an atomic widget.

Protected Attributes

GImage m_image
GWidgetAtomicm_pGrabbedWidget
GWidgetAtomicm_pFocusWidget
unsigned int m_cBackground
int m_prevMouseX
int m_prevMouseY
bool m_bRunning

Detailed Description

A form or dialog.


Constructor & Destructor Documentation

GClasses::GWidgetDialog::GWidgetDialog ( int  w,
int  h,
unsigned int  cBackground 
)
virtual GClasses::GWidgetDialog::~GWidgetDialog ( ) [virtual]

Member Function Documentation

unsigned int GClasses::GWidgetDialog::backgroundColor ( ) [inline]

Returns the background color.

void GClasses::GWidgetDialog::close ( ) [inline]

Sets m_bRunning to false. It's the controller's job to watch this flag and do something about it.

virtual void GClasses::GWidgetDialog::draw ( GImage pCanvas,
int  x,
int  y 
) [virtual]

Draws this widget on pCanvas at (x,y)

Implements GClasses::GWidget.

GWidgetAtomic* GClasses::GWidgetDialog::focusWidget ( ) [inline]

Returns the widget that currently has focus.

GWidgetAtomic* GClasses::GWidgetDialog::grabbedWidget ( ) [inline]

Returns the widget that the mouse is currently grabbing.

void GClasses::GWidgetDialog::grabWidget ( GWidgetAtomic pWidget,
int  button,
int  mouseX,
int  mouseY 
) [protected]

This is called by pressAt when the user clicks on an atomic widget.

virtual void GClasses::GWidgetDialog::handleChar ( char  c) [virtual]

You should call this method when the user presses a key.

virtual bool GClasses::GWidgetDialog::handleMousePos ( int  x,
int  y 
) [virtual]

You should call this method when the user moves the mouse.

virtual void GClasses::GWidgetDialog::handleSpecialKey ( int  key) [virtual]

You should call this method when the user presses a special key.

GImage* GClasses::GWidgetDialog::image ( )

Updates everything that needs to be updated, and makes an image of the dialog in its current state so you can blit it to the screen.

virtual void GClasses::GWidgetDialog::onDestroyWidget ( GWidget pWidget) [virtual]

Reimplemented from GClasses::GWidgetGroup.

virtual void GClasses::GWidgetDialog::pressButton ( int  button,
int  x,
int  y 
) [virtual]

You should call this when the user presses a mouse button.

virtual void GClasses::GWidgetDialog::releaseButton ( int  button) [virtual]

You should call this method when the mouse releases (un-clicks)

bool* GClasses::GWidgetDialog::runningFlag ( ) [inline]

This method is used when running the dialog as a popup modal dialog. The flag is initialized to true. It is the controller's job to check this flag and close the dialog when it is set to false.

void GClasses::GWidgetDialog::setBackgroundImage ( GImage pImage)

Sets the background image.

void GClasses::GWidgetDialog::setFocusWidget ( GWidgetAtomic pWidget)

Sets the widget with focus.

virtual WidgetType GClasses::GWidgetDialog::type ( ) [inline, virtual]

Implements GClasses::GWidget.


Member Data Documentation

unsigned int GClasses::GWidgetDialog::m_cBackground [protected]