Entry.hh

00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 ** 
00004 ** Copyright (C) 2006 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 ENTRY_H
00018 # define ENTRY_H
00019 
00020 # include "Global.hh"
00021 # include "Colors.hh"
00022 # include "GuiError.hh"
00023 # include "Widget.hh"
00024 
00025 # include <SDL_gfxPrimitives.h>
00026 
00027 # define ENTRY_ALPHA 170
00028 
00032 class Entry: public Widget
00033 {
00034     protected:
00035   TTF_Font* font;
00036   string* txt;
00037   ushort index;
00038 
00039   SDL_Color fgColor;
00040   SDL_Color bgColor, bgColorFocus;  // Color of the background of the entry in default or focus mode
00041 
00042     public:
00043   Entry(const uint x, const uint y, const uint w, const uint h,
00044         string* txt, SDL_Surface* screen, Widget* father);
00045   Entry(const uint w, const uint h, string* txt, SDL_Surface* screen, Widget* father);
00046   ~Entry(); 
00047 
00048   // Draw
00049   void draw();
00050   void refresh();
00051 
00052   // Focus
00053   void gainfocus();
00054   void losefocus();
00055 
00056   // Mouse
00059   void mousemotion(const uint mousex, const uint mousey){};
00060 
00061   //keyboard
00062   void keydown(const SDL_keysym* keysym);
00063 
00064   // Txt
00065   void add_char(const char c);
00066   void delete_char();
00067   ushort get_index(); 
00068   void set_index(const ushort i);
00069   void set_txt(string* txt);
00070   string get_txt();
00071 
00072   // Color
00073 
00078   void setbgColor(SDL_Color bgColor);
00079 
00083   SDL_Color getbgColor()
00084   {
00085     return(bgColor);
00086   }
00087 
00091   void setfgColor(SDL_Color fgColor);
00092 
00096   SDL_Color getfgColor()
00097   {
00098     return(fgColor);
00099   }
00100 };
00101 
00102 #endif

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7