00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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;
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
00049 void draw();
00050 void refresh();
00051
00052
00053 void gainfocus();
00054 void losefocus();
00055
00056
00059 void mousemotion(const uint mousex, const uint mousey){};
00060
00061
00062 void keydown(const SDL_keysym* keysym);
00063
00064
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
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