File DialogBuild.h         CEGUI build dialog - header

DialogBuild.h

#ifndef __DialogBuild_H__
#define __DialogBuild_H__

#include "OgreConfigFile.h"

#ifndef _CEGUI_fix_h_
#define _CEGUI_fix_h_
#pragma warning (push)
#pragma warning( disable : 4267 )
#include <OgreNoMemoryMacros.h>
#include <CEGUI/CEGUI.h>
#include <OgreCEGUIRenderer.h>
#include <OgreCEGUIResourceProvider.h>
#include <OgreCEGUITexture.h>
#include <OgreMemoryMacros.h>
#pragma warning (pop)
#endif

// Number of columns of buttons on the dialog.
#define DIALOG_BUTTON_COLUMNS 2
// Number of rows of buttons on the dialog.
#define DIALOG_BUTTON_ROWS    3

// Total number of Entity buttons on the dialog box
#define DIALOG_BUTTON_COUNT   (DIALOG_BUTTON_ROWS * DIALOG_BUTTON_COLUMNS)

class DialogBuild : public Ogre::RenderTargetListener
   {
public:
         DialogBuild();
        ~DialogBuild();

   void  show(void);
   void  hide(void);
   void  toggleVisibility();
   bool  isVisible() const;
   void  FrameStarted(Ogre::Real timeElapsed);

protected:
   virtual void   preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
   virtual void   postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
   void           InitializeForItemType(void);
   void           PopulateButtons(void);

private:
   // these must match the IDs assigned in the layout
   static const unsigned int  buttonCancelID;
   static const unsigned int  buttonStructuresID;
   static const unsigned int  buttonBioUnitsID;
   static const unsigned int  buttonMechsID;
   static const unsigned int  buttonVehiclesID;
   static const unsigned int  scrollBarID;
   static const unsigned int  buttonID[DIALOG_BUTTON_COUNT];
   static const unsigned int  buttonLabelID[DIALOG_BUTTON_COUNT];
   static const unsigned int  buttonTextID[DIALOG_BUTTON_COUNT];

   bool                 isShown;
   int                  itemTypeToDisplay;
   int                  scrollOffset;
   Ogre::RenderTexture* rttTex[DIALOG_BUTTON_COUNT];
   Ogre::Camera *       rttCam[DIALOG_BUTTON_COUNT];
   Ogre::SceneNode *    rttNode[DIALOG_BUTTON_COUNT];
   Ogre::Entity *       displayedEntity[DIALOG_BUTTON_COUNT];
   Ogre::Light *        spotLight[DIALOG_BUTTON_COUNT];
   EntityType           displayedEntityType[DIALOG_BUTTON_COUNT];
   CEGUI::Scrollbar *   scrollbar;
   Ogre::SceneNode *    hideObjectsNode;
   CEGUI::Window *      rootWindow;
   CEGUI::OgreCEGUITexture *  ceguiTex;

   bool  HandleKeyDownEvents(const CEGUI::EventArgs& args);
   bool  handleScrollChanged(const CEGUI::EventArgs& args);
   bool  handleButtonCancel(const CEGUI::EventArgs& args);
   bool  handleButtonStructures(const CEGUI::EventArgs& args);
   bool  handleButtonBioUnits(const CEGUI::EventArgs& args);
   bool  handleButtonMechs(const CEGUI::EventArgs& args);
   bool  handleButtonVehicles(const CEGUI::EventArgs& args);
   bool  handleButton00(const CEGUI::EventArgs& args);
   bool  handleButton01(const CEGUI::EventArgs& args);
   bool  handleButton02(const CEGUI::EventArgs& args);
   bool  handleButton03(const CEGUI::EventArgs& args);
   bool  handleButton04(const CEGUI::EventArgs& args);
   bool  handleButton05(const CEGUI::EventArgs& args);
   };

#endif   // #ifndef __DialogBuild_H__