ButtonWidget.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2005  The Pentagram Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef BUTTONWIDGET_H_INCLUDED
00020 #define BUTTONWIDGET_H_INCLUDED
00021 
00022 #include "Gump.h"
00023 #include "FrameID.h"
00024 
00025 class ButtonWidget : public Gump
00026 {
00027 public:
00028         // p_dynamic_class stuff
00029         ENABLE_RUNTIME_CLASSTYPE();
00030 
00031         ButtonWidget();
00032         ButtonWidget(int X, int Y, std::string txt, bool gamefont, int font,
00033                                  uint32 mouseOverBlendCol = 0, int width = 0, int height = 0,
00034                                  sint32 layer = LAYER_NORMAL);
00035         ButtonWidget(int X, int Y, FrameID frame_up, FrameID frame_down,
00036                                  bool mouseOver = false, sint32 layer = LAYER_NORMAL);
00037         virtual ~ButtonWidget(void);
00038 
00039         virtual void InitGump(Gump* newparent, bool take_focus=true);
00040         virtual uint16 TraceObjId(int mx, int my);
00041         virtual bool PointOnGump(int mx, int my);
00042 
00043         virtual Gump* OnMouseDown(int button, int mx, int my);
00044         virtual void OnMouseUp(int  button, int mx, int my);
00045         virtual void OnMouseClick(int button, int mx, int my);
00046         virtual void OnMouseDouble(int button, int mx, int my);
00047 
00048         virtual void OnMouseOver();
00049         virtual void OnMouseLeft();
00050 
00052         int getVlead();
00053 
00054         //void SetShapeDown(Shape *_shape, uint32 _framenum);
00055         //void SetShapeUp(Shape *_shape, uint32 _framenum);
00056 
00057         enum Message
00058         {
00059                 BUTTON_CLICK            = 0,
00060                 BUTTON_UP                       = 1,
00061                 BUTTON_DOUBLE           = 2
00062         };
00063 
00064 protected:
00065         Shape *shape_up;
00066         uint32 framenum_up;
00067         Shape *shape_down;
00068         uint32 framenum_down;
00069         uint16 textwidget;
00070         uint32 mouseOverBlendCol;
00071         bool mouseOver;
00072         int origw, origh;
00073 
00074 public:
00075         bool loadData(IDataSource* ids, uint32 version);
00076 protected:
00077         virtual void saveData(ODataSource* ods);
00078 };
00079 
00080 #endif // BUTTONWIDGET_H_INCLUDED

Generated on Fri Jul 27 22:27:10 2007 for pentagram by  doxygen 1.4.7