DlgHandler.hh

00001 /*
00002 ** TowBowlTactics, a turn-based strategy football game.
00003 **
00004 ** Copyright (C) 2006-2010 The TBT Team.
00005 **
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 **
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 **
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef DLGHANDLER_HH_
00018 # define DLGHANDLER_HH_
00019 
00020 # include "tools.hh"
00021 
00022 # include "DlgBox.hh"
00023 
00024 BEGIN_NS(sdlvisu);
00025 
00026 class Game;
00027 
00030 enum eDlgAction {
00031   eDlgActInfo,
00032   eDlgActCelebration,
00033   eDlgActTouchdooown,
00034   eDlgActReroll,
00035   eDlgActFollow,
00036   eDlgActTouchback,
00037   eDlgActBlockDice,
00038   eDlgActKickOrReceive
00039 };
00040 
00045 class DialogHandler
00046 {
00047 public:
00048   DialogHandler(Game& g);
00049   ~DialogHandler();
00050 
00051   void push(enum eDlgAction id);
00052   void pop();
00053 
00054   // Special for custom message
00055   void setText(const std::string& txt);
00056   void setIcon(enum eDlgBoxIcon icon);
00057 
00058   // Special for block
00059   void addBlockButton(int dice_face);
00060   void addRerollLabel();
00061   void setBlockChoice();
00062   
00063   static const char* stringify(const enum eDlgAction id);
00064 
00065 private:
00066   Game& g_;
00067 
00068   DialogBox* create(enum eDlgAction style);
00069   
00070   class Callback : public DialogBoxCb
00071   {
00072   public:
00073     Callback(DialogHandler *p, Game* g, enum eDlgAction id)
00074       : parent_(p), g_(g), id_(id) {}
00075   private:
00076     virtual void clicked(int btn_index);
00077     DialogHandler* parent_;
00078     Game* g_;
00079     enum eDlgAction id_;
00080   };
00081 
00082   std::deque<DialogBox*> list_;
00083 
00084   int reroll_index_;
00085   bool block_choice_;
00086 };
00087 
00088 END_NS(sdlvisu);
00089 
00090 #endif /* !DLGHANDLER_HH_ */
Generated on Mon Apr 5 21:17:12 2010 for Stechec/TBT by  doxygen 1.6.3