Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BaseComputer::LoadSaveQuitConfirm Class Reference

#include <basecomputer.h>

Inheritance diagram for BaseComputer::LoadSaveQuitConfirm:
WindowController

Public Member Functions

 LoadSaveQuitConfirm (BaseComputer *player, std::string confirmtype, std::string text)
 
virtual ~LoadSaveQuitConfirm (void)
 
virtual void init (void)
 
virtual bool processWindowCommand (const EventCommandId &command, Control *control)
 
- Public Member Functions inherited from WindowController
virtual void run (void)
 
virtual void draw (void)
 
virtual Windowwindow (void)
 
virtual void setWindow (Window *w)
 
 WindowController ()
 
virtual ~WindowController (void)
 

Additional Inherited Members

- Protected Attributes inherited from WindowController
Windowm_window
 
bool m_deleteOnWindowClose
 

Detailed Description

Definition at line 103 of file basecomputer.h.

Constructor & Destructor Documentation

BaseComputer::LoadSaveQuitConfirm::LoadSaveQuitConfirm ( BaseComputer player,
std::string  confirmtype,
std::string  text 
)
inline

Definition at line 111 of file basecomputer.h.

111  : m_parent( player )
112  , type( confirmtype )
113  , text( text ) {}
virtual BaseComputer::LoadSaveQuitConfirm::~LoadSaveQuitConfirm ( void  )
inlinevirtual

Definition at line 114 of file basecomputer.h.

114 {}

Member Function Documentation

void BaseComputer::LoadSaveQuitConfirm::init ( void  )
virtual

Implements WindowController.

Definition at line 5958 of file basecomputer.cpp.

References Window::addControl(), BOLD_STROKE, GUI_CLEAR(), GUI_OPAQUE_BLACK(), GUI_OPAQUE_WHITE(), Window::setColor(), Control::setColor(), NewButton::setCommand(), Window::setController(), NewButton::setDownColor(), NewButton::setDownTextColor(), StaticDisplay::setFont(), Control::setFont(), NewButton::setHighlightColor(), Control::setId(), NewButton::setLabel(), EventResponder::setModal(), StaticDisplay::setMultiLine(), Window::setOutlineColor(), Window::setOutlineWidth(), Control::setRect(), StaticDisplay::setRect(), Window::setSizeAndCenter(), StaticDisplay::setText(), StaticDisplay::setTextColor(), Control::setTextColor(), Window::setTexture(), WindowController::setWindow(), and WindowController::window().

Referenced by BaseComputer::actionLoadGame(), BaseComputer::actionQuitGame(), and BaseComputer::actionSaveGame().

5959 {
5960  Window *window = new Window;
5961  setWindow( window );
5962 
5963  window->setSizeAndCenter( Size( .9, .5 ) );
5964  window->setTexture( "basecomputer.png" );
5965  window->setColor( GFXColor( 0, 1, 0, .1 ) );
5966  window->setOutlineColor( GFXColor( .7, .7, .7 ) );
5967  window->setOutlineWidth( 2.0 );
5968  window->setController( this );
5969 
5970  //Information.
5971  StaticDisplay *text = new StaticDisplay;
5972  text->setRect( Rect( -.4, -.15, .8, .3 ) );
5973  text->setText( this->text );
5974  text->setTextColor( GFXColor( .7, 1, .4 ) );
5975  text->setMultiLine( true );
5976  text->setColor( GUI_CLEAR );
5977  text->setFont( Font( .07, 1.25 ) );
5978  text->setId( "Information" );
5979  //Put it on the window.
5980  window->addControl( text );
5981 
5982  //Save button.
5983  NewButton *cont = new NewButton;
5984  cont->setRect( Rect( .05, -.19, .30, .1 ) );
5985  cont->setLabel( type );
5986  cont->setCommand( type );
5987  cont->setColor( GFXColor( 1, .5, 0, .25 ) );
5988  cont->setTextColor( GUI_OPAQUE_WHITE() );
5989  cont->setDownColor( GFXColor( 1, .5, 0, .6 ) );
5991  cont->setHighlightColor( GFXColor( 0, 1, 0, .4 ) );
5992  cont->setFont( Font( .08, BOLD_STROKE ) );
5993  //Put the button on the window.
5994  window->addControl( cont );
5995 
5996  //Abort action button
5997  NewButton *resume = new NewButton;
5998  resume->setRect( Rect( -.35, -.20, .30, .12 ) );
5999  resume->setLabel( "Cancel" );
6000  resume->setCommand( "Window::Close" );
6001  resume->setColor( GFXColor( 0, 1, 0, .25 ) );
6002  resume->setTextColor( GUI_OPAQUE_WHITE() );
6003  resume->setDownColor( GFXColor( 0, 1, 0, .6 ) );
6004  resume->setDownTextColor( GUI_OPAQUE_BLACK() );
6005  resume->setHighlightColor( GFXColor( 0, 1, 0, .4 ) );
6006  resume->setFont( Font( .08, BOLD_STROKE ) );
6007  //Put the button on the window.
6008  window->addControl( resume );
6009 
6010  window->setModal( true );
6011 }
bool BaseComputer::LoadSaveQuitConfirm::processWindowCommand ( const EventCommandId command,
Control control 
)
virtual

Reimplemented from WindowController.

Definition at line 6014 of file basecomputer.cpp.

References Window::close(), WindowController::processWindowCommand(), and WindowController::window().

6015 {
6016  if (command == "Save") {
6017  m_parent->actionConfirmedSaveGame();
6018  window()->close();
6019  } else if (command == "Load") {
6020  m_parent->actionConfirmedLoadGame();
6021  } else if (command == "Quit") {
6022  m_parent->actionConfirmedQuitGame();
6023  } else {
6024  //Not a command we know about.
6025  return WindowController::processWindowCommand( command, control );
6026  }
6027  return true;
6028 }

The documentation for this class was generated from the following files: