GLMenuEntry.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_GLMENUENTRY_H__5AE3319D_D83E_4392_BABB_7E34B2D69BD8__INCLUDED_)
00022 #define AFX_GLMENUENTRY_H__5AE3319D_D83E_4392_BABB_7E34B2D69BD8__INCLUDED_
00023 
00024 #include <GLEXT/GLMenu.h>
00025 #include <GLW/GLWSelector.h>
00026 
00027 class GLTexture;
00028 class Image;
00029 class GLMenuEntry : public GLWSelectorI, public ToolTipI
00030 {
00031 public:
00032         GLMenuEntry(
00033                 const LangString &menuName,
00034                 char *menuNameInternal, 
00035                 const LangString &menuDescription,
00036                 float width, 
00037                 unsigned int state,
00038                 GLMenuI *callback,
00039                 Image *icon,
00040                 unsigned int flags);
00041         virtual ~GLMenuEntry();
00042 
00043         bool click(float currentTop, int x, int y);
00044         bool inMenu(float currentTop, int x, int y);
00045         unsigned int getState() { return state_; }
00046         void draw(float currentTop, float currentLeft);
00047 
00048         void addMenuItem(GLMenuItem &item);
00049         float getX() { return left_; }
00050         float getY() { return top_; }
00051         float getW() { return width_; }
00052         float getH() { return height_; }
00053         bool getSelected() { return selected_; }
00054         LangString &getName() { return menuName_; }
00055         const char *getNameInternal() { return menuNameInternal_.c_str(); }
00056         GLMenuI *getCallback() { return callback_; }
00057         ToolTip &getToolTip() { return toolTip_; }
00058         unsigned int getFlags() { return flags_; }
00059 
00060         virtual void itemSelected(GLWSelectorEntry *entry, int position);
00061         virtual void noItemSelected();
00062 
00063         virtual void populateCalled(unsigned int id);
00064 
00065 protected:
00066         bool selected_;
00067         float left_, top_;
00068         float width_, height_;
00069         unsigned int state_;
00070         unsigned int flags_;
00071         GLMenuI *callback_;
00072         GLTexture *texture_;
00073         ToolTip toolTip_;
00074         Image *icon_;
00075         std::list<GLMenuItem> menuItems_;
00076         LangString menuName_, menuDescription_;
00077         std::string menuNameInternal_;
00078 
00079         void drawText();
00080         void drawIcon();
00081 
00082 };
00083 
00084 #endif // !defined(AFX_GLMENUENTRY_H__5AE3319D_D83E_4392_BABB_7E34B2D69BD8__INCLUDED_)

Generated on Mon Feb 16 15:14:44 2009 for Scorched3D by  doxygen 1.5.3