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
NavComputer::RenameConfirm Class Reference

#include <navcomputer.h>

Inheritance diagram for NavComputer::RenameConfirm:
WindowController

Public Member Functions

 RenameConfirm (NavComputer *player)
 
virtual ~RenameConfirm (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 78 of file navcomputer.h.

Constructor & Destructor Documentation

NavComputer::RenameConfirm::RenameConfirm ( NavComputer player)
inline

Definition at line 84 of file navcomputer.h.

84 : m_parent( player ) {}
virtual NavComputer::RenameConfirm::~RenameConfirm ( void  )
inlinevirtual

Definition at line 85 of file navcomputer.h.

85 {}

Member Function Documentation

void NavComputer::RenameConfirm::init ( void  )
virtual

Implements WindowController.

Definition at line 1045 of file navcomputer.cpp.

References Window::addControl(), BOLD_STROKE, GUI_CLEAR(), GUI_OPAQUE_BLACK(), GUI_OPAQUE_MEDIUM_GRAY(), GUI_OPAQUE_WHITE(), nav_keyboard_queue, 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(), Control::setOutlineColor(), Window::setOutlineColor(), Window::setOutlineWidth(), Control::setRect(), StaticDisplay::setRect(), Window::setSizeAndCenter(), StaticDisplay::setText(), StaticDisplay::setTextColor(), Control::setTextColor(), StaticDisplay::setTextMargins(), Window::setTexture(), WindowController::setWindow(), and WindowController::window().

Referenced by NavComputer::actionRename().

1046 {
1047  Window *window = new Window;
1048  setWindow( window );
1049 
1050  window->setSizeAndCenter( Size( .9, .62 ) );
1051  window->setTexture( "basecomputer.png" );
1052  window->setColor( GFXColor( 0, 1, 0, .1 ) );
1053  window->setOutlineColor( GFXColor( .7, .7, .7 ) );
1054  window->setOutlineWidth( 2.0 );
1055  window->setController( this );
1056 
1057  //Information.
1058  StaticDisplay *text = new StaticDisplay;
1059  text->setRect( Rect( -.4, .11, .8, .15 ) );
1060  text->setText( "Enter the new name for this path." );
1061  text->setTextColor( GFXColor( .7, 1, .4 ) );
1062  text->setMultiLine( true );
1063  text->setColor( GUI_CLEAR );
1064  text->setFont( Font( .07, 1.25 ) );
1065  text->setId( "Information" );
1066  //Put it on the window.
1067  window->addControl( text );
1068 
1069  //Path name input box.
1070  StaticDisplay *pathNameBox = new TextInputDisplay( &nav_keyboard_queue, "\x1b\n\t\r" );
1071  pathNameBox->setRect( Rect( -.4, -.09, .8, .15 ) );
1072  pathNameBox->setColor( GFXColor( 0, 1, 1, .1 ) );
1073  pathNameBox->setOutlineColor( GUI_OPAQUE_MEDIUM_GRAY() );
1074  pathNameBox->setFont( Font( .07 ) );
1075  pathNameBox->setMultiLine( true );
1076  pathNameBox->setTextColor( GUI_OPAQUE_WHITE() );
1077  pathNameBox->setTextMargins( Size( .02, .01 ) );
1078  pathNameBox->setId( "PathNameBox" );
1079  window->addControl( pathNameBox );
1080 
1081  //Confirm Button.
1082  NewButton *confirm = new NewButton;
1083  confirm->setRect( Rect( .05, -.25, .30, .10 ) );
1084  confirm->setLabel( "Rename" );
1085  confirm->setCommand( "Rename" );
1086  confirm->setColor( GFXColor( 1, .5, 0, .25 ) );
1087  confirm->setTextColor( GUI_OPAQUE_WHITE() );
1088  confirm->setDownColor( GFXColor( 1, .5, 0, .6 ) );
1089  confirm->setDownTextColor( GUI_OPAQUE_BLACK() );
1090  confirm->setHighlightColor( GFXColor( 0, 1, 0, .4 ) );
1091  confirm->setFont( Font( .08, BOLD_STROKE ) );
1092  //Put the button on the window.
1093  window->addControl( confirm );
1094 
1095  //Resume Game button.
1096  NewButton *resume = new NewButton;
1097  resume->setRect( Rect( -.35, -.26, .30, .12 ) );
1098  resume->setLabel( "Cancel" );
1099  resume->setCommand( "Window::Close" );
1100  resume->setColor( GFXColor( 0, 1, 0, .25 ) );
1101  resume->setTextColor( GUI_OPAQUE_WHITE() );
1102  resume->setDownColor( GFXColor( 0, 1, 0, .6 ) );
1103  resume->setDownTextColor( GUI_OPAQUE_BLACK() );
1104  resume->setHighlightColor( GFXColor( 0, 1, 0, .4 ) );
1105  resume->setFont( Font( .08, BOLD_STROKE ) );
1106  //Put the button on the window.
1107  window->addControl( resume );
1108 
1109  window->setModal( true );
1110 }
bool NavComputer::RenameConfirm::processWindowCommand ( const EventCommandId command,
Control control 
)
virtual

Reimplemented from WindowController.

Definition at line 1113 of file navcomputer.cpp.

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

1114 {
1115  if (command == "Rename") {
1116  TextInputDisplay *input = static_cast< TextInputDisplay* > ( window()->findControlById( "PathNameBox" ) );
1117  assert( input != NULL );
1118  m_parent->actionRenameConfirmed( input->text() );
1119  window()->close();
1120  } else {
1121  //Not a command we know about.
1122  return WindowController::processWindowCommand( command, control );
1123  }
1124  return true;
1125 }

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