FXEX::FXSevenSegment Class Reference

#include <FXSevenSegment.h>

Inheritance diagram for FXEX::FXSevenSegment:

FXFrame

Detailed Description

Seven-segment (eg LCD/watch style) widget

Definition at line 45 of file FXSevenSegment.h.


Public Member Functions

 FXSevenSegment (FXComposite *p, FXObject *tgt=NULL, FXSelector sel=0, FXuint opts=FRAME_NONE, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
 create a seven segment display
FXColor getBgColor () const
virtual FXint getDefaultHeight ()
 Return minimum height.
virtual FXint getDefaultWidth ()
 Return minimum width.
FXColor getFgColor () const
FXint getGroove () const
FXint getHorizontal () const
FXchar getText () const
 get the text on the display
FXint getThickness () const
FXint getVertical () const
virtual void load (FXStream &store)
 load resources
long onCmdGetIntValue (FXObject *, FXSelector, void *)
long onCmdGetStringValue (FXObject *, FXSelector, void *)
long onCmdSetIntValue (FXObject *, FXSelector, void *)
long onCmdSetStringValue (FXObject *, FXSelector, void *)
long onCmdSetValue (FXObject *, FXSelector, void *)
long onPaint (FXObject *, FXSelector, void *)
long onQueryHelp (FXObject *, FXSelector, void *)
long onQueryTip (FXObject *, FXSelector, void *)
virtual void save (FXStream &store) const
 save resources
void setBgColor (const FXColor clr)
 get/set background color
void setFgColor (const FXColor clr)
 get/set foreground color
void setGroove (const FXint width)
 get/set groove thickness
void setHorizontal (const FXint len)
 get/set horizontal segment length
void setText (const FXchar val)
 set the text on the display
void setThickness (const FXint width)
 get/set segment thickness
void setVertical (const FXint len)
 get/set vertical segment length
virtual ~FXSevenSegment ()
 dtor

Protected Member Functions

void drawBottomSegment (FXDCWindow &dc, FXshort x, FXshort y)
virtual void drawFigure (FXDCWindow &dc, FXchar figure)
void drawLeftBottomSegment (FXDCWindow &dc, FXshort x, FXshort y)
void drawLeftTopSegment (FXDCWindow &dc, FXshort x, FXshort y)
void drawMiddleSegment (FXDCWindow &dc, FXshort x, FXshort y)
void drawRightBottomSegment (FXDCWindow &dc, FXshort x, FXshort y)
void drawRightTopSegment (FXDCWindow &dc, FXshort x, FXshort y)
void drawSegments (FXDCWindow &dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7)
void drawTopSegment (FXDCWindow &dc, FXshort x, FXshort y)
 FXSevenSegment ()

Private Member Functions

void checkSize ()

Private Attributes

FXColor bgcolor
FXColor fgcolor
FXint groove
FXint hsl
FXint st
FXchar value
FXint vsl

Constructor & Destructor Documentation

FXEX::FXSevenSegment::FXSevenSegment (  )  [inline, protected]

Definition at line 62 of file FXSevenSegment.h.

00062 {}

FXEX::FXSevenSegment::FXSevenSegment ( FXComposite *  p,
FXObject tgt = NULL,
FXSelector  sel = 0,
FXuint  opts = FRAME_NONE,
FXint  pl = DEFAULT_PAD,
FXint  pr = DEFAULT_PAD,
FXint  pt = DEFAULT_PAD,
FXint  pb = DEFAULT_PAD 
)

create a seven segment display

virtual FXEX::FXSevenSegment::~FXSevenSegment (  )  [inline, virtual]

dtor

Definition at line 150 of file FXSevenSegment.h.

00150 {}


Member Function Documentation

void FXEX::FXSevenSegment::checkSize (  )  [private]

Definition at line 364 of file FXSevenSegment.cpp.

References groove, hsl, st, and vsl.

Referenced by setGroove(), setHorizontal(), setThickness(), and setVertical().

00364                                {
00365     if (hsl<3) {
00366         hsl=3;
00367         st=1;
00368     }
00369     if (vsl<3) {
00370         vsl=3;
00371         st=1;
00372     }
00373     if (st<1) st=1;
00374     if (hsl<(st<<1)) hsl=(st<<1)+1;
00375     if (vsl<(st<<1)) vsl=(st<<1)+1;
00376     if (hsl<8 || vsl<8) groove=2;
00377     if (hsl<1 || vsl<3 || st<3) groove=1;
00378     if (groove>=st) groove=st-1;
00379 }

void FXEX::FXSevenSegment::drawBottomSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 521 of file FXSevenSegment.cpp.

References hsl, and st.

Referenced by drawSegments().

00521                                                                          {
00522     FXPoint points[4];
00523     points[0].x=x+st;
00524     points[0].y=y;
00525     points[1].x=x+hsl-st;
00526     points[1].y=y;
00527     points[2].x=x+hsl;
00528     points[2].y=y+st;
00529     points[3].x=x;
00530     points[3].y=y+st;
00531     dc.fillPolygon(points,4);
00532 }

void FXEX::FXSevenSegment::drawFigure ( FXDCWindow &  dc,
FXchar  figure 
) [protected, virtual]

Definition at line 207 of file FXSevenSegment.cpp.

References drawSegments().

Referenced by onPaint().

00207                                                             {
00208     switch (figure) {
00209     case ' ' :
00210         drawSegments(dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE);
00211         break;
00212     case '(' :
00213         drawSegments(dc, TRUE ,TRUE ,FALSE,FALSE,TRUE ,FALSE,TRUE);
00214         break;
00215     case ')' :
00216         drawSegments(dc, TRUE ,FALSE,TRUE ,FALSE,FALSE,TRUE ,TRUE);
00217         break;
00218     case '[' :
00219         drawSegments(dc, TRUE ,TRUE ,FALSE,FALSE,TRUE ,FALSE,TRUE);
00220         break;
00221     case ']' :
00222         drawSegments(dc, TRUE ,FALSE,TRUE ,FALSE,FALSE,TRUE ,TRUE);
00223         break;
00224     case '=' :
00225         drawSegments(dc, FALSE,FALSE,FALSE,TRUE ,FALSE,FALSE,TRUE);
00226         break;
00227 //    case '+' : drawSegments (dc, FALSE,FALSE,FALSE,TRUE ,FALSE,FALSE,FALSE); break;
00228     case '-' :
00229         drawSegments(dc, FALSE,FALSE,FALSE,TRUE ,FALSE,FALSE,FALSE);
00230         break;
00231     case '_' :
00232         drawSegments(dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE);
00233         break;
00234     case '0' :
00235         drawSegments(dc, TRUE ,TRUE ,TRUE ,FALSE,TRUE ,TRUE ,TRUE);
00236         break;
00237     case '1' :
00238         drawSegments(dc, FALSE,FALSE,TRUE ,FALSE,FALSE,TRUE ,FALSE);
00239         break;
00240     case '2' :
00241         drawSegments(dc, TRUE ,FALSE,TRUE ,TRUE ,TRUE ,FALSE,TRUE);
00242         break;
00243     case '3' :
00244         drawSegments(dc, TRUE ,FALSE,TRUE ,TRUE ,FALSE,TRUE ,TRUE);
00245         break;
00246     case '4' :
00247         drawSegments(dc, FALSE,TRUE ,TRUE ,TRUE ,FALSE,TRUE ,FALSE);
00248         break;
00249     case '5' :
00250         drawSegments(dc, TRUE ,TRUE ,FALSE,TRUE ,FALSE,TRUE ,TRUE);
00251         break;
00252     case '6' :
00253         drawSegments(dc, TRUE ,TRUE ,FALSE,TRUE ,TRUE ,TRUE ,TRUE);
00254         break;
00255     case '7' :
00256         drawSegments(dc, TRUE ,FALSE,TRUE ,FALSE,FALSE,TRUE ,FALSE);
00257         break;
00258     case '8' :
00259         drawSegments(dc, TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,TRUE);
00260         break;
00261     case '9' :
00262         drawSegments(dc, TRUE ,TRUE ,TRUE ,TRUE ,FALSE,TRUE ,TRUE);
00263         break;
00264     case 'a' :
00265     case 'A' :
00266         drawSegments(dc, TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,FALSE);
00267         break;
00268     case 'b' :
00269     case 'B' :
00270         drawSegments(dc, FALSE,TRUE ,FALSE,TRUE ,TRUE ,TRUE ,TRUE);
00271         break;
00272     case 'c' :
00273     case 'C' :
00274         drawSegments(dc, TRUE ,TRUE ,FALSE,FALSE,TRUE ,FALSE,TRUE);
00275         break;
00276     case 'd' :
00277     case 'D' :
00278         drawSegments(dc, FALSE,FALSE,TRUE ,TRUE ,TRUE ,TRUE ,TRUE);
00279         break;
00280     case 'e' :
00281     case 'E' :
00282         drawSegments(dc, TRUE ,TRUE ,FALSE,TRUE ,TRUE ,FALSE,TRUE);
00283         break;
00284     case 'f' :
00285     case 'F' :
00286         drawSegments(dc, TRUE ,TRUE ,FALSE,TRUE ,TRUE ,FALSE,FALSE);
00287         break;
00288     case 'g' :
00289     case 'G' :
00290         drawSegments(dc, TRUE ,TRUE ,FALSE,FALSE,TRUE ,TRUE ,TRUE);
00291         break;
00292     case 'h' :
00293     case 'H' :
00294         drawSegments(dc, FALSE,TRUE ,FALSE,TRUE ,TRUE ,TRUE ,FALSE);
00295         break;
00296     case 'i' :
00297     case 'I' :
00298         drawSegments(dc, FALSE,FALSE,FALSE,FALSE,FALSE,TRUE ,FALSE);
00299         break;
00300     case 'j' :
00301     case 'J' :
00302         drawSegments(dc, FALSE,FALSE,TRUE ,FALSE,TRUE ,TRUE ,TRUE);
00303         break;
00304 //    case 'k' :
00305 //    case 'k' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
00306     case 'l' :
00307     case 'L' :
00308         drawSegments(dc, FALSE,TRUE ,FALSE,FALSE,TRUE ,FALSE,TRUE);
00309         break;
00310 //    case 'm' :
00311 //    case 'M' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
00312     case 'n' :
00313     case 'N' :
00314         drawSegments(dc, FALSE,FALSE,FALSE,TRUE ,TRUE ,TRUE ,FALSE);
00315         break;
00316     case 'o' :
00317     case 'O' :
00318         drawSegments(dc, TRUE ,TRUE ,TRUE ,FALSE,TRUE ,TRUE ,TRUE);
00319         break;
00320     case 'p' :
00321     case 'P' :
00322         drawSegments(dc, TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,FALSE,FALSE);
00323         break;
00324     case 'q' :
00325     case 'Q' :
00326         drawSegments(dc, TRUE ,TRUE ,TRUE ,TRUE ,FALSE,TRUE ,FALSE);
00327         break;
00328     case 'r' :
00329     case 'R' :
00330         drawSegments(dc, FALSE,FALSE,FALSE,TRUE ,TRUE ,FALSE,FALSE);
00331         break;
00332     case 's' :
00333     case 'S' :
00334         drawSegments(dc, TRUE ,TRUE ,FALSE,TRUE ,FALSE,TRUE ,TRUE);
00335         break;
00336     case 't' :
00337     case 'T' :
00338         drawSegments(dc, FALSE,TRUE ,FALSE,TRUE ,TRUE ,FALSE,FALSE);
00339         break;
00340     case 'u' :
00341     case 'U' :
00342         drawSegments(dc, FALSE,TRUE ,TRUE ,FALSE,TRUE ,TRUE ,TRUE);
00343         break;
00344 //    case 'v' :
00345 //    case 'V' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
00346 //    case 'w' :
00347 //    case 'W' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
00348     case 'x' :
00349     case 'X' :
00350         drawSegments(dc, FALSE,TRUE ,TRUE ,TRUE ,TRUE ,TRUE ,FALSE);
00351         break;
00352     case 'y' :
00353     case 'Y' :
00354         drawSegments(dc, FALSE,TRUE ,TRUE ,TRUE ,FALSE,TRUE ,TRUE);
00355         break;
00356 //    case 'z' :
00357 //    case 'Z' :
00358     default  :
00359         fxerror("FXSevenSegment doesnt support: %c\n",figure);
00360     }
00361 }

void FXEX::FXSevenSegment::drawLeftBottomSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 495 of file FXSevenSegment.cpp.

References st, and vsl.

Referenced by drawSegments().

00495                                                                              {
00496     FXPoint points[4];
00497     points[0].x=x;
00498     points[0].y=y;
00499     points[1].x=x+st;
00500     points[1].y=y+(st>>1);
00501     points[2].x=x+st;
00502     points[2].y=y+vsl-st;
00503     points[3].x=x;
00504     points[3].y=y+vsl;
00505     dc.fillPolygon(points,4);
00506 }

void FXEX::FXSevenSegment::drawLeftTopSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 452 of file FXSevenSegment.cpp.

References st, and vsl.

Referenced by drawSegments().

00452                                                                           {
00453     FXPoint points[4];
00454     points[0].x=x;
00455     points[0].y=y;
00456     points[1].x=x+st;
00457     points[1].y=y+st;
00458     points[2].x=x+st;
00459     points[2].y=y+vsl-(st>>1);
00460     points[3].x=x;
00461     points[3].y=y+vsl;
00462     dc.fillPolygon(points,4);
00463 }

void FXEX::FXSevenSegment::drawMiddleSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 478 of file FXSevenSegment.cpp.

References hsl, and st.

Referenced by drawSegments().

00478                                                                          {
00479     FXPoint points[6];
00480     points[0].x=x+st;
00481     points[0].y=y;
00482     points[1].x=x+hsl-st;
00483     points[1].y=y;
00484     points[2].x=x+hsl;
00485     points[2].y=y+(st>>1);
00486     points[3].x=x+hsl-st;
00487     points[3].y=y+st;
00488     points[4].x=x+st;
00489     points[4].y=y+st;
00490     points[5].x=x;
00491     points[5].y=y+(st>>1);
00492     dc.fillPolygon(points,6);
00493 }

void FXEX::FXSevenSegment::drawRightBottomSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 508 of file FXSevenSegment.cpp.

References st, and vsl.

Referenced by drawSegments().

00508                                                                               {
00509     FXPoint points[4];
00510     points[0].x=x+st;
00511     points[0].y=y;
00512     points[1].x=x+st;
00513     points[1].y=y+vsl;
00514     points[2].x=x;
00515     points[2].y=y+vsl-st;
00516     points[3].x=x;
00517     points[3].y=y+(st>>1);
00518     dc.fillPolygon(points,4);
00519 }

void FXEX::FXSevenSegment::drawRightTopSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 465 of file FXSevenSegment.cpp.

References st, and vsl.

Referenced by drawSegments().

00465                                                                            {
00466     FXPoint points[4];
00467     points[0].x=x+st;
00468     points[0].y=y;
00469     points[1].x=x+st;
00470     points[1].y=y+vsl;
00471     points[2].x=x;
00472     points[2].y=y+vsl-(st>>1);
00473     points[3].x=x;
00474     points[3].y=y+st;
00475     dc.fillPolygon(points,4);
00476 }

void FXEX::FXSevenSegment::drawSegments ( FXDCWindow &  dc,
FXbool  s1,
FXbool  s2,
FXbool  s3,
FXbool  s4,
FXbool  s5,
FXbool  s6,
FXbool  s7 
) [protected]

Definition at line 383 of file FXSevenSegment.cpp.

References drawBottomSegment(), drawLeftBottomSegment(), drawLeftTopSegment(), drawMiddleSegment(), drawRightBottomSegment(), drawRightTopSegment(), drawTopSegment(), groove, hsl, st, and vsl.

Referenced by drawFigure().

00383                                                                                                                       {
00384     FXint sx=border+padleft, sy=border+padtop;
00385     FXint x,y;
00386     if (options&LAYOUT_FILL) {
00387         if (options&LAYOUT_FILL_X) {
00388             hsl=width-padleft-padright-(border<<1);
00389             if (hsl<4) hsl=4;
00390         }
00391         if (options&LAYOUT_FILL_Y) {
00392             vsl=(height-padtop-padbottom-(border<<1))>>1;
00393             if (vsl<4) vsl=4;
00394         }
00395         st=FXMIN(hsl,vsl)/4;
00396         groove=st/4;
00397         if (st<1) st=1;
00398         if (groove<1) groove=1;
00399         if (options&LAYOUT_FILL_X) hsl-=groove<<1;
00400         if (options&LAYOUT_FILL_Y) vsl-=groove<<1;
00401     }
00402     if (s1) {
00403         x=sx+groove;
00404         y=sy;
00405         drawTopSegment(dc,x,y);
00406     }
00407     if (s2) {
00408         x=sx;
00409         y=sy+groove;
00410         drawLeftTopSegment(dc,x,y);
00411     }
00412     if (s3) {
00413         x=sx+groove+hsl-st+groove;
00414         y=sy+groove;
00415         drawRightTopSegment(dc,x,y);
00416     }
00417     if (s4) {
00418         x=sx+groove;
00419         y=sy+groove+vsl-(st>>1)+groove;
00420         drawMiddleSegment(dc,x,y);
00421     }
00422     if (s5) {
00423         x=sx;
00424         y=sy+(groove<<1)+vsl+groove;
00425         drawLeftBottomSegment(dc,x,y);
00426     }
00427     if (s6) {
00428         x=sx+groove+hsl-st+groove;
00429         y=sy+(groove<<1)+vsl+groove;
00430         drawRightBottomSegment(dc,x,y);
00431     }
00432     if (s7) {
00433         x=sx+groove;
00434         y=sy+(groove<<1)+vsl+groove+vsl+groove-st;
00435         drawBottomSegment(dc,x,y);
00436     }
00437 }

void FXEX::FXSevenSegment::drawTopSegment ( FXDCWindow &  dc,
FXshort  x,
FXshort  y 
) [protected]

Definition at line 439 of file FXSevenSegment.cpp.

References hsl, and st.

Referenced by drawSegments().

00439                                                                       {
00440     FXPoint points[4];
00441     points[0].x=x;
00442     points[0].y=y;
00443     points[1].x=x+hsl;
00444     points[1].y=y;
00445     points[2].x=x+hsl-st;
00446     points[2].y=y+st;
00447     points[3].x=x+st;
00448     points[3].y=y+st;
00449     dc.fillPolygon(points,4);
00450 }

FXColor FXEX::FXSevenSegment::getBgColor (  )  const [inline]

Definition at line 109 of file FXSevenSegment.h.

References bgcolor.

Referenced by FXEX::FXLCDLabel::getBgColor(), FXEX::FXLCDLabel::onPaint(), and FXEX::FXLCDLabel::setBgColor().

00109                                {
00110         return bgcolor;
00111     }

FXint FXEX::FXSevenSegment::getDefaultHeight (  )  [virtual]

Return minimum height.

Definition at line 84 of file FXSevenSegment.cpp.

References groove, and vsl.

00084                                        {
00085     return padtop + (groove<<2) + (vsl<<1) + padbottom + (border<<1);
00086 }

FXint FXEX::FXSevenSegment::getDefaultWidth (  )  [virtual]

Return minimum width.

Definition at line 79 of file FXSevenSegment.cpp.

References groove, and hsl.

00079                                       {
00080     return padleft + (groove<<1) + hsl + padright + (border<<1);
00081 }

FXColor FXEX::FXSevenSegment::getFgColor (  )  const [inline]

Definition at line 103 of file FXSevenSegment.h.

References fgcolor.

Referenced by FXEX::FXLCDLabel::getFgColor(), FXEX::FXLCDLabel::onPaint(), and FXEX::FXLCDLabel::setFgColor().

00103                                {
00104         return fgcolor;
00105     }

FXint FXEX::FXSevenSegment::getGroove (  )  const [inline]

Definition at line 133 of file FXSevenSegment.h.

References groove.

Referenced by FXEX::FXLCDLabel::getGroove(), and FXEX::FXLCDLabel::setGroove().

00133                             {
00134         return groove;
00135     }

FXint FXEX::FXSevenSegment::getHorizontal (  )  const [inline]

Definition at line 115 of file FXSevenSegment.h.

References hsl.

Referenced by FXEX::FXLCDLabel::getHorizontal(), and FXEX::FXLCDLabel::setHorizontal().

00115                                 {
00116         return hsl;
00117     }

FXchar FXEX::FXSevenSegment::getText (  )  const [inline]

get the text on the display

Definition at line 97 of file FXSevenSegment.h.

References value.

00097                            {
00098         return value;
00099     }

FXint FXEX::FXSevenSegment::getThickness (  )  const [inline]

Definition at line 127 of file FXSevenSegment.h.

References st.

Referenced by FXEX::FXLCDLabel::getThickness(), and FXEX::FXLCDLabel::setThickness().

00127                                {
00128         return st;
00129     }

FXint FXEX::FXSevenSegment::getVertical (  )  const [inline]

Definition at line 121 of file FXSevenSegment.h.

References vsl.

Referenced by FXEX::FXLCDLabel::getVertical(), and FXEX::FXLCDLabel::setVertical().

00121                               {
00122         return vsl;
00123     }

void FXEX::FXSevenSegment::load ( FXStream &  store  )  [virtual]

load resources

Definition at line 545 of file FXSevenSegment.cpp.

References bgcolor, fgcolor, groove, hsl, load(), st, value, and vsl.

00545                                          {
00546     FXFrame::load(store);
00547     store >> value;
00548     store >> fgcolor;
00549     store >> bgcolor;
00550     store >> hsl;
00551     store >> vsl;
00552     store >> st;
00553     store >> groove;
00554 }

long FXEX::FXSevenSegment::onCmdGetIntValue ( FXObject sender,
FXSelector  ,
void *   
)

Definition at line 175 of file FXSevenSegment.cpp.

References ASCII_ZERO, and value.

00175                                                                        {
00176     FXint i=value-ASCII_ZERO;
00177     if (i < 0) i=0;
00178     if (i > 9) i=9;
00179     sender->handle(this,FXSEL(SEL_COMMAND,ID_SETINTVALUE),(void*)&i);
00180     return 1;
00181 }

long FXEX::FXSevenSegment::onCmdGetStringValue ( FXObject sender,
FXSelector  ,
void *   
)

Definition at line 193 of file FXSevenSegment.cpp.

References value.

00193                                                                           {
00194     FXString s(value,1);
00195     sender->handle(this,FXSEL(SEL_COMMAND,ID_SETSTRINGVALUE),(void*)&s);
00196     return 1;
00197 }

long FXEX::FXSevenSegment::onCmdSetIntValue ( FXObject ,
FXSelector  ,
void *  ptr 
)

Definition at line 184 of file FXSevenSegment.cpp.

References ASCII_ZERO, and setText().

00184                                                                     {
00185     FXint i=*((FXint*)ptr);
00186     if (i < 0) i=0;
00187     if (i > 9) i=9;
00188     setText((FXchar)(i+ASCII_ZERO));
00189     return 1;
00190 }

long FXEX::FXSevenSegment::onCmdSetStringValue ( FXObject ,
FXSelector  ,
void *  ptr 
)

Definition at line 200 of file FXSevenSegment.cpp.

References setText().

00200                                                                        {
00201     FXString *s=(FXString*)ptr;
00202     if ((*s).length()) setText((*s)[0]);
00203     return 1;
00204 }

long FXEX::FXSevenSegment::onCmdSetValue ( FXObject ,
FXSelector  ,
void *  ptr 
)

Definition at line 168 of file FXSevenSegment.cpp.

References setText().

00168                                                                  {
00169     FXchar *c=(FXchar*)ptr;
00170     if (c[0] != '\0') setText(c[0]);
00171     return 1;
00172 }

long FXEX::FXSevenSegment::onPaint ( FXObject ,
FXSelector  ,
void *  ptr 
)

Definition at line 156 of file FXSevenSegment.cpp.

References bgcolor, drawFigure(), fgcolor, and value.

00156                                                            {
00157     FXEvent *event= (FXEvent*) ptr;
00158     FXDCWindow dc(this, event);
00159     drawFrame(dc,0,0,width,height);
00160     dc.setForeground(bgcolor);
00161     dc.fillRectangle(border, border, width-(border<<1), height-(border<<1));
00162     dc.setForeground(fgcolor);
00163     drawFigure(dc,value);
00164     return 1;
00165 }

long FXEX::FXSevenSegment::onQueryHelp ( FXObject sender,
FXSelector  sel,
void *  ptr 
)

Definition at line 563 of file FXSevenSegment.cpp.

00563                                                                           {
00564     if (getParent()) return getParent()->handle(sender,sel,ptr);
00565     return 0;
00566 }

long FXEX::FXSevenSegment::onQueryTip ( FXObject sender,
FXSelector  sel,
void *  ptr 
)

Definition at line 557 of file FXSevenSegment.cpp.

00557                                                                          {
00558     if (getParent()) return getParent()->handle(sender,sel,ptr);
00559     return 0;
00560 }

void FXEX::FXSevenSegment::save ( FXStream &  store  )  const [virtual]

save resources

Definition at line 534 of file FXSevenSegment.cpp.

References bgcolor, fgcolor, groove, hsl, st, value, and vsl.

00534                                                {
00535     FXFrame::save(store);
00536     store << value;
00537     store << fgcolor;
00538     store << bgcolor;
00539     store << hsl;
00540     store << vsl;
00541     store << st;
00542     store << groove;
00543 }

void FXEX::FXSevenSegment::setBgColor ( const FXColor  clr  ) 

get/set background color

Definition at line 107 of file FXSevenSegment.cpp.

References bgcolor.

Referenced by FXEX::FXLCDLabel::setBgColor().

00107                                                  {
00108     if (bgcolor!=clr) {
00109         bgcolor=clr;
00110         recalc();
00111         update();
00112     }
00113 }

void FXEX::FXSevenSegment::setFgColor ( const FXColor  clr  ) 

get/set foreground color

Definition at line 98 of file FXSevenSegment.cpp.

References fgcolor.

Referenced by FXEX::FXLCDLabel::setFgColor().

00098                                                  {
00099     if (fgcolor!=clr) {
00100         fgcolor=clr;
00101         recalc();
00102         update();
00103     }
00104 }

void FXEX::FXSevenSegment::setGroove ( const FXint  width  ) 

get/set groove thickness

Definition at line 146 of file FXSevenSegment.cpp.

References checkSize(), and groove.

Referenced by FXEX::FXLCDLabel::drawString(), and FXEX::FXLCDLabel::setGroove().

00146                                                 {
00147     if (width!=groove) {
00148         groove=width;
00149         checkSize();
00150         recalc();
00151         update();
00152     }
00153 }

void FXEX::FXSevenSegment::setHorizontal ( const FXint  len  ) 

get/set horizontal segment length

Definition at line 116 of file FXSevenSegment.cpp.

References checkSize(), and hsl.

Referenced by FXEX::FXLCDLabel::drawString(), and FXEX::FXLCDLabel::setHorizontal().

00116                                                   {
00117     if (len!=hsl) {
00118         hsl=len;
00119         checkSize();
00120         recalc();
00121         update();
00122     }
00123 }

void FXEX::FXSevenSegment::setText ( const FXchar  val  ) 

set the text on the display

Definition at line 89 of file FXSevenSegment.cpp.

References value.

Referenced by FXEX::FXLCDLabel::drawString(), onCmdSetIntValue(), onCmdSetStringValue(), and onCmdSetValue().

00089                                        {
00090     if (FXString(val,1).upper() != FXString(value,1).upper()) {
00091         value=val;
00092         recalc();
00093         update();
00094     }
00095 }

void FXEX::FXSevenSegment::setThickness ( const FXint  width  ) 

get/set segment thickness

Definition at line 136 of file FXSevenSegment.cpp.

References checkSize(), and st.

Referenced by FXEX::FXLCDLabel::drawString(), and FXEX::FXLCDLabel::setThickness().

00136                                                    {
00137     if (width!=st) {
00138         st=width;
00139         checkSize();
00140         recalc();
00141         update();
00142     }
00143 }

void FXEX::FXSevenSegment::setVertical ( const FXint  len  ) 

get/set vertical segment length

Definition at line 126 of file FXSevenSegment.cpp.

References checkSize(), and vsl.

Referenced by FXEX::FXLCDLabel::drawString(), and FXEX::FXLCDLabel::setVertical().

00126                                                 {
00127     if (len!=vsl) {
00128         vsl=len;
00129         checkSize();
00130         recalc();
00131         update();
00132     }
00133 }


Field Documentation

FXColor FXEX::FXSevenSegment::bgcolor [private]

Definition at line 52 of file FXSevenSegment.h.

Referenced by getBgColor(), load(), onPaint(), save(), and setBgColor().

FXColor FXEX::FXSevenSegment::fgcolor [private]

Definition at line 51 of file FXSevenSegment.h.

Referenced by getFgColor(), load(), onPaint(), save(), and setFgColor().

FXint FXEX::FXSevenSegment::hsl [private]

FXint FXEX::FXSevenSegment::st [private]

FXchar FXEX::FXSevenSegment::value [private]

FXint FXEX::FXSevenSegment::vsl [private]


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:07:01 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6