Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

TextField.cpp

Go to the documentation of this file.
00001 /*
00002  * $Id: TextField.cpp,v 1.4 2002/08/08 05:36:38 virtualcasino Exp $
00003  */
00004 #include<TextField.h>
00005 #include<SDL.h>
00006 #include<SDL_gfxPrimitives.h>
00007 #include<Resource.h>
00008 
00009 namespace clawsoft{
00010 
00011         TextField::TextField():TextBox(){
00012                 setClassName("TextField");
00013                 mapped = false;
00014         }
00015 
00016         TextField::TextField(Rect &r):TextBox(r){
00017                 setClassName("TextField");
00018                 mapped = false;
00019         }
00020         
00021         bool TextField::onReturn(){
00022                 return true;
00023         }
00024 
00025         void TextField::drawBorder(){
00026                 Sint16 vx[6], vy[6];
00027                 int temp;
00028                 if(!mapped){
00029                         map();
00030                         mapped = true;
00031                 }
00032                 vx[0] = X();            vy[0] = Y() + H();
00033                 vx[1] = vx[0];          vy[1] = Y() + border;
00034                 vx[2] = X() + border;   vy[2] = Y();
00035                 vx[3] = X() + W();      vy[3] = vy[2];
00036                 vx[4] = vx[3];          vy[4] = Y() + H() - border;
00037                 vx[5] = vx[3] - border; vy[5] = vy[0];
00038                 if(grabbed || mouse.inFocus(*this)){
00039                         temp = 96;
00040                 }
00041                 else
00042                         temp = 16;
00043                 filledPolygonRGBA(Screen, vx, vy, 6, 0, temp, 0, 64);
00044                 polygonRGBA(Screen, vx, vy, 6, 0, 255, 0, 255);
00045 
00046         }
00047 
00048         void TextField::map(){
00049                 SDL_Surface *surf;
00050                 surf = SystemFont[MINI_FONT].renderText("aA1qL");
00051                 H(surf->h + border * 2);
00052                 SDL_FreeSurface(surf);
00053         }
00054 
00055 }

Powered by:

SourceForge Logo