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
Window Class Reference

#include <window.h>

Inheritance diagram for Window:
EventResponder

Public Member Functions

virtual void setRect (const Rect &r)
 
void setFullScreen (void)
 
void setSizeAndCenter (const Size &size)
 
virtual void open (void)
 
virtual void close (void)
 
virtual void addControl (Control *c)
 
virtual void deleteControl (Control *c)
 
virtual ControlremoveControlFromWindow (Control *c)
 
virtual ControlfindControlById (const std::string &id)
 
virtual GFXColor color (void)
 
virtual void setColor (const GFXColor &c)
 
virtual GuiTexturetexture (void)
 
virtual void setTexture (const std::string &textureName)
 
virtual GFXColor outlineColor (void)
 
virtual void setOutlineColor (const GFXColor &c)
 
virtual float outlineWidth (void)
 
virtual void setOutlineWidth (float width)
 
virtual WindowControllercontroller (void)
 
virtual void setController (WindowController *controller)
 
virtual void draw (void)
 
virtual void readFromXml (const std::string &fileName)
 
virtual bool deleteOnClose (void)
 
virtual void setDeleteOnClose (bool del)
 
virtual bool processMouseDown (const InputEvent &event)
 
virtual bool processMouseUp (const InputEvent &event)
 
virtual bool processMouseMove (const InputEvent &event)
 
virtual bool processMouseDrag (const InputEvent &event)
 
virtual bool processCommand (const EventCommandId &command, Control *control)
 
virtual ~Window ()
 
 Window ()
 
- Public Member Functions inherited from EventResponder
virtual bool processKeyDown (const InputEvent &event)
 
virtual bool processKeyUp (const InputEvent &event)
 
virtual void processUnfocus (const InputEvent &event)
 
virtual void sendCommand (const EventCommandId &command, Control *control)
 
virtual void setCommandTarget (EventResponder *responder)
 
virtual void setModal (bool modal)
 
 EventResponder (void)
 
virtual ~EventResponder (void)
 

Protected Member Functions

void drawBackground (void)
 

Protected Attributes

Rect m_rect
 
GFXColor m_color
 
GFXColor m_outlineColor
 
float m_outlineWidth
 
GuiTexture m_texture
 
bool m_deleteOnClose
 
GroupControlm_controls
 
WindowControllerm_controller
 
- Protected Attributes inherited from EventResponder
bool m_modal
 
EventResponderm_commandTarget
 

Detailed Description

Definition at line 38 of file window.h.

Constructor & Destructor Documentation

Window::~Window ( void  )
virtual

Definition at line 164 of file window.cpp.

References EventManager::addToDeleteQueue(), and m_controls.

165 {
167 }
Window::Window ( void  )

Definition at line 152 of file window.cpp.

References m_controls.

152  :
153  m_rect( 0.0, 0.0, 0.0, 0.0 )
156  , m_outlineWidth( 1.0 )
157  , m_deleteOnClose( true )
158  , m_controls( NULL )
159  , m_controller( NULL )
160 {
161  m_controls = new GroupControl();
162 }

Member Function Documentation

virtual GFXColor Window::color ( void  )
inlinevirtual

Definition at line 66 of file window.h.

References m_color.

67  {
68  return m_color;
69  }
virtual WindowController* Window::controller ( void  )
inlinevirtual

Definition at line 106 of file window.h.

References m_controller.

Referenced by setController().

107  {
108  return m_controller;
109  }
void Window::deleteControl ( Control c)
virtual

Definition at line 68 of file window.cpp.

References GroupControl::deleteControl(), and m_controls.

69 {
71 }
virtual bool Window::deleteOnClose ( void  )
inlinevirtual

Definition at line 122 of file window.h.

References m_deleteOnClose.

123  {
124  return m_deleteOnClose;
125  }
void Window::draw ( void  )
virtual

Definition at line 87 of file window.cpp.

References GroupControl::draw(), drawBackground(), and m_controls.

88 {
90  m_controls->draw();
91 }
void Window::drawBackground ( void  )
protected

Definition at line 94 of file window.cpp.

References GuiTexture::draw(), drawRect(), drawRectOutline(), isClear(), m_color, m_outlineColor, m_outlineWidth, m_rect, and m_texture.

Referenced by draw().

95 {
97  if ( !isClear( m_color ) )
99  if ( !isClear( m_outlineColor ) )
101 }
Control * Window::findControlById ( const std::string &  id)
virtual

Definition at line 81 of file window.cpp.

References GroupControl::findControlById(), and m_controls.

Referenced by NavComputer::actionAnd(), NavComputer::actionChain(), BaseComputer::actionConfirmedLoadGame(), BaseComputer::actionConfirmedSaveGame(), BaseComputer::actionLoadGame(), BaseComputer::actionNewGame(), NavComputer::actionNot(), NavComputer::actionOr(), NavComputer::actionRemoveCriteria(), BaseComputer::actionSaveGame(), BaseComputer::actionShowAccountMenu(), BaseComputer::actionShowServerMenu(), BaseComputer::configureCargoCommitControls(), BaseComputer::configureUpgradeCommitControls(), NavComputer::createControls(), BaseComputer::createControls(), BaseComputer::createModeButtons(), ListQuestionDialog::getPicker(), BaseComputer::hideCommitControls(), QuestionDialog::init(), NavComputer::loadAbsoluteButton(), BaseComputer::loadBuyUpgradeControls(), BaseComputer::loadCargoControls(), NavComputer::loadChainLister(), NavComputer::loadCriteriaLister(), BaseComputer::loadLoadSaveControls(), BaseComputer::loadMissionsControls(), BaseComputer::loadNewsControls(), NavComputer::loadPathLister(), BaseComputer::loadSavePickerChangedSelection(), BaseComputer::loadSellUpgradeControls(), BaseComputer::loadShipDealerControls(), BaseComputer::newsPickerChangedSelection(), GameMenu::processMainMenuButton(), GameMenu::processMultiPlayerAcctButton(), GameMenu::processMultiPlayerButton(), GameMenu::processMultiPlayerHostButton(), NavComputer::RenameConfirm::processWindowCommand(), ListQuestionDialog::processWindowCommand(), GameMenu::readJoinGameControls(), NavComputer::recalcTitle(), BaseComputer::recalcTitle(), BaseComputer::BuyUpgradeOperation::selectMount(), BaseComputer::SellUpgradeOperation::selectMount(), BaseComputer::showNetworkStatus(), BaseComputer::showPlayerInfo(), BaseComputer::showShipStats(), UniverseUtil::startMenuInterface(), BaseComputer::switchToControls(), NavComputer::switchToMajorControls(), NavComputer::switchToMinorControls(), NavComputer::updateDescription(), NavComputer::updateNodeDescription(), and BaseComputer::updateTransactionControlsForSelection().

82 {
83  return m_controls->findControlById( id );
84 }
void Window::open ( void  )
virtual

Definition at line 52 of file window.cpp.

References globalWindowManager(), and WindowManager::openWindow().

Referenced by WindowController::run(), and NavComputer::toggleVisibility().

53 {
55 }
virtual GFXColor Window::outlineColor ( void  )
inlinevirtual

Definition at line 86 of file window.h.

References m_outlineColor.

87  {
88  return m_outlineColor;
89  }
virtual float Window::outlineWidth ( void  )
inlinevirtual

Definition at line 96 of file window.h.

References m_outlineWidth.

97  {
98  return m_outlineWidth;
99  }
bool Window::processCommand ( const EventCommandId command,
Control control 
)
virtual

Reimplemented from EventResponder.

Definition at line 135 of file window.cpp.

References WindowManager::closeWindow(), globalWindowManager(), m_controller, m_deleteOnClose, EventResponder::processCommand(), and WindowController::processWindowCommand().

Referenced by close().

136 {
137  //The controller should see the command first.
138  if (m_controller != NULL)
139  if ( m_controller->processWindowCommand( command, control ) )
140  return true;
141  //Default command responders.
142  if (command == "Window::Close") {
143  //Close the window!
144  //CAREFUL! This may delete this object! Should be the last line in the function.
146  return true;
147  }
148  return EventResponder::processCommand( command, control );
149 }
bool Window::processMouseDown ( const InputEvent event)
virtual

Reimplemented from EventResponder.

Definition at line 107 of file window.cpp.

References m_controls, EventResponder::processMouseDown(), and GroupControl::processMouseDown().

108 {
109  if ( m_controls->processMouseDown( event ) )
110  return true;
111  return EventResponder::processMouseDown( event );
112 }
bool Window::processMouseDrag ( const InputEvent event)
virtual

Reimplemented from EventResponder.

Definition at line 128 of file window.cpp.

References m_controls, EventResponder::processMouseDrag(), and GroupControl::processMouseDrag().

129 {
130  if ( m_controls->processMouseDrag( event ) )
131  return true;
132  return EventResponder::processMouseDrag( event );
133 }
bool Window::processMouseMove ( const InputEvent event)
virtual

Reimplemented from EventResponder.

Definition at line 121 of file window.cpp.

References m_controls, EventResponder::processMouseMove(), and GroupControl::processMouseMove().

122 {
123  if ( m_controls->processMouseMove( event ) )
124  return true;
125  return EventResponder::processMouseMove( event );
126 }
bool Window::processMouseUp ( const InputEvent event)
virtual

Reimplemented from EventResponder.

Definition at line 114 of file window.cpp.

References m_controls, EventResponder::processMouseUp(), and GroupControl::processMouseUp().

115 {
116  if ( m_controls->processMouseUp( event ) )
117  return true;
118  return EventResponder::processMouseUp( event );
119 }
void Window::readFromXml ( const std::string &  fileName)
virtual

Definition at line 104 of file window.cpp.

104 {}
virtual void Window::setController ( WindowController controller)
inlinevirtual
virtual void Window::setDeleteOnClose ( bool  del)
inlinevirtual

Definition at line 126 of file window.h.

References m_deleteOnClose.

Referenced by NavComputer::init(), and WindowController::run().

127  {
128  m_deleteOnClose = del;
129  }
void Window::setFullScreen ( void  )

Definition at line 41 of file window.cpp.

References FULL_SCREEN_RECT(), and setRect().

Referenced by NavComputer::createControls(), BaseComputer::createControls(), and GameMenu::init().

42 {
44 }
virtual void Window::setOutlineColor ( const GFXColor c)
inlinevirtual
void Window::setRect ( const Rect r)
virtual

Definition at line 37 of file window.cpp.

References m_rect.

Referenced by setFullScreen(), and setSizeAndCenter().

38 {
39  m_rect = r;
40 }
void Window::setSizeAndCenter ( const Size size)
virtual GuiTexture& Window::texture ( void  )
inlinevirtual

Definition at line 76 of file window.h.

References m_texture.

77  {
78  return m_texture;
79  }

Member Data Documentation

GFXColor Window::m_color
protected

Definition at line 151 of file window.h.

Referenced by color(), drawBackground(), and setColor().

WindowController* Window::m_controller
protected

Definition at line 157 of file window.h.

Referenced by controller(), processCommand(), and setController().

bool Window::m_deleteOnClose
protected

Definition at line 155 of file window.h.

Referenced by deleteOnClose(), processCommand(), and setDeleteOnClose().

GFXColor Window::m_outlineColor
protected

Definition at line 152 of file window.h.

Referenced by drawBackground(), outlineColor(), and setOutlineColor().

float Window::m_outlineWidth
protected

Definition at line 153 of file window.h.

Referenced by drawBackground(), outlineWidth(), and setOutlineWidth().

Rect Window::m_rect
protected

Definition at line 150 of file window.h.

Referenced by drawBackground(), and setRect().

GuiTexture Window::m_texture
protected

Definition at line 154 of file window.h.

Referenced by drawBackground(), setTexture(), and texture().


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