Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

guibutton.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           guibutton.h  -  description
00003                              -------------------
00004     begin                : Fri Sep 7 2001
00005     copyright            : (C) 2001 by T Kontkanen
00006     email                : tkontkanen@mail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GUIBUTTON_H
00019 #define GUIBUTTON_H
00020 
00021 #include "game.h"
00022 #include "font.h"
00023 
00024 class Game;
00025 
00030 class GUIButton {
00031 public:
00033     GUIButton( Game *parentgame, Texture *icon, const char *tooltip, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE );
00035     GUIButton( Game *parentgame, const char *text, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE );
00037     ~GUIButton();
00038     
00040     void setAutoRefresh( bool enable ) { autorefresh=enable; }
00042     void setCallback( void (*callback)() ) { buttonCallback=callback; }
00043     
00045     bool clicked() { return click; }
00047     void render();
00049     void refresh();
00051     void setFont( BFont *tipfont ) { font=tipfont; }
00052 private:
00053     int ismouseover; //0=no mouse focus, 1=mouse hovering, 2=mouse howering & pressed
00054     Texture *tex;
00055     const char *tip, *buttontext;
00056     Vector pos, size, *basepos;
00057     Game *game;
00058     BFont *font;
00059     int buttontype; //0=icon+tip, 1=text only
00060     float normalcolor[4], hovercolor[4], activecolor[4], currentcolor[4];
00061     
00063     void (*buttonCallback)();
00064     bool click, autorefresh;
00065     SDLKey hotk;
00066     int modk;
00067 };
00068 
00069 #endif

Generated at Fri Oct 5 20:23:52 2001 for Executor by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001