ActionMenu.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 5 -*- */
00002 
00003 /*
00004  * Combination of a first person action and a real time strategy battle game.
00005  */
00006 
00007 /*
00008  * ActionMenu.h
00009  * MetalWarriors
00010  * $Revision: 1.5 $
00011  *
00012  * Created by Daniel Aarno on Sun Oct 12 2003.
00013  * Copyright (c) 2003 Daniel Aarno and Erik Ytterberg - All rights reserved.
00014  *
00015  *     This program is free software; you can redistribute it and/or modify
00016  *     it under the terms of the GNU General Public License as published by
00017  *     the Free Software Foundation; either version 2 of the License, or
00018  *     (at your option) any later version.
00019  *
00020  *     This program is distributed in the hope that it will be useful,
00021  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *     GNU General Public License for more details.
00024  *
00025  *     You should have received a copy of the GNU General Public License
00026  *     along with this program; if not, write to the Free Software
00027  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00028  */
00029 
00030 #ifndef ACTIONMENU_H
00031 #define ACTIONMENU_H
00032 
00033 #include <string>
00034 #include <list>
00035 
00036 class MenuItem
00037 {
00038   //protected:
00039   public:
00040   std::string label;
00041 
00042  public:
00043   MenuItem(char *label_);
00044   virtual ~MenuItem(void) {}
00045   virtual void draw(void);
00046   virtual void invokeAction(void) {}
00047   virtual bool shiftUp(void) {return false;}
00048   virtual bool shiftDown(void) {return false;}
00049   virtual void foldOut(void) {}
00050   virtual bool foldIn(void) {return false;}
00051   virtual void update(float dtime) {}
00052   
00053 };
00054 
00055 class Menu
00056 {
00057  protected:
00058   std::list<MenuItem*> items;
00059   std::list<MenuItem*>::iterator current;
00060   std::list<MenuItem*>::iterator pending;
00061   bool outFolded;
00062   float roll;
00063 
00064   public:
00065   Menu(void);
00066   virtual ~Menu(void) {}
00067   virtual void update(float dtime);
00068   virtual void draw(void);
00069   void addItem(MenuItem* new_item);
00070   void nextItem(void);
00071   void prevItem(void);
00072   virtual void invokeAction();
00073   virtual bool shiftUp(void);
00074   virtual bool shiftDown(void);
00075   virtual void foldOut(void);
00076   virtual bool foldIn(void);
00077 };
00078 
00079 
00080 class SubMenu : public Menu, public MenuItem
00081 {
00082  public:
00083   SubMenu(char *label_): MenuItem(label_) {}
00084   virtual ~SubMenu() {}
00085   void draw(void);
00086   virtual void invokeAction() {Menu::invokeAction();}
00087   virtual bool shiftUp(void) {return Menu::shiftUp();}
00088   virtual bool shiftDown(void) {return Menu::shiftDown();}
00089   virtual void foldOut(void) {Menu::foldOut();}
00090   virtual bool foldIn(void) {return Menu::foldIn();}
00091   virtual void update(float dtime) {Menu::update(dtime);}
00092 };
00093 
00094 class ActionMenu : public Menu
00095 {
00096 
00097  public:
00098   ActionMenu(void);
00099   //void update(float dtime);
00100   void draw(void);
00101     
00102 };
00103 
00104 
00105 
00106 
00107 #endif /*ACTIONMENU_H*/

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7