57FXIMPLEMENT(
MFXLCDLabel, FXHorizontalFrame, MFXLCDLabelMap, ARRAYNUMBER(MFXLCDLabelMap))
64MFXLCDLabel::
MFXLCDLabel(FXComposite* p,
MFXStaticToolTip* staticToolTip, FXuint nfig, FXObject* tgt, FXSelector sel, FXuint opts, FXint pl, FXint pr, FXint pt, FXint pb, FXint hs) :
65 FXHorizontalFrame(p, opts, 0, 0, 0, 0, pl, pr, pt, pb, hs, 0),
67 myStaticToolTip(staticToolTip) {
69 fxerror(
"%s: must have at least one figure.\n", getClassName());
74 for (FXint i = 0; i < myNFigures; i++) {
91 FXHorizontalFrame::create();
92 for (FXWindow* child = getFirst(); child; child = child->getNext()) {
100 for (FXWindow* child = getFirst(); child; child = child->getNext()) {
103 FXHorizontalFrame::detach();
109 for (FXWindow* child = getFirst(); child; child = child->getNext()) {
112 FXHorizontalFrame::destroy();
257 setText(FXStringVal(*((FXint*)ptr)));
264 setText(FXStringVal(*((FXdouble*)ptr)));
278 *((FXint*)ptr) = FXIntVal(
getText());
285 *((FXdouble*)ptr) = FXDoubleVal(
getText());
299 FXEvent*
event = (FXEvent*) ptr;
300 FXDCWindow dc(
this, event);
301 drawFrame(dc, 0, 0, width, height);
305 dc.fillRectangle(border, border, width - (border << 1), height - (border << 1));
322 return FXHorizontalFrame::onEnter(obj, sel, ptr);
330 return FXHorizontalFrame::onLeave(obj, sel, ptr);
338 return FXHorizontalFrame::onMotion(sender, sel, ptr);
344 FXuint seltype = FXSELTYPE(sel);
347 target->handle(
this, FXSEL(seltype, message), ptr);
356 return padleft + getFirst()->getDefaultWidth() *
myNFigures + hspacing * (
myNFigures - 1) + padright + (border << 1);
362 return padtop + getFirst()->getDefaultHeight() + padbottom + (border << 1);
374 FXHorizontalFrame::save(store);
382 FXHorizontalFrame::load(store);
391 return getParent()->handle(sender, sel, ptr);
400 return getParent()->handle(sender, sel, ptr);
413 displayString.replace(0,
'-');
417 for (; (i + txt.length()) <
myNFigures; i++) {
418 displayString.replace(i,
'0');
420 displayString.insert(i, txt);
421 }
else if (options & JUSTIFY_RIGHT) {
422 for (; (i + lbl.length()) <
myNFigures; i++) {}
423 displayString.insert(i, lbl);
425 displayString.insert(0, lbl);
435 if (options & LAYOUT_FILL) {
436 const FXint w = this->width - padleft - padright - (border << 1);
437 const FXint h = this->height - padtop - padbottom - (border << 1);
438 hspacing = FXMAX(w, h) / 50;
450 FXint st = FXMIN(hsl, vsl) / 4;
454 FXint groove = st / 4;
458 if (options & LAYOUT_FILL_X) {
465 if (options & LAYOUT_FILL_Y) {
473 child->
setText(displayString[i++]);
479 child->
setText(displayString[i++]);
#define FXMAPKEY(key, func)
FXDEFMAP(MFXLCDLabel) MFXLCDLabelMap[]
A widget which has the seven-segment display used as the drawing object for each letter in the label....
virtual FXint getDefaultHeight()
return minimum height
void drawString(const FXString &lbl)
Draw a string.
long onQueryHelp(FXObject *, FXSelector, void *ptr)
let parent show help if appropriate
virtual void save(FXStream &store) const
save resources
long onPaint(FXObject *, FXSelector, void *)
handle paint event
void setVertical(const FXint len)
set segment vertical length - must be more than twice the segment width
long onCmdSetRealValue(FXObject *, FXSelector, void *ptr)
Update real value from a message.
void setGroove(const FXint w)
set groove width - must be less than segment width
FXString myToolTipText
toolTip text
virtual void create()
create resrouces
long onRedirectEvent(FXObject *, FXSelector, void *ptr)
redirect events to main window
FXint getVertical() const
get segment vertical length - must be more than twice the segment width
virtual FXint getDefaultWidth()
return minimum width
long onCmdGetStringValue(FXObject *, FXSelector, void *ptr)
Obtain string value from text field.
FXString getText() const
get text
FXint myNFigures
The number of shown figuresi, greater than zero.
long onCmdSetStringValue(FXObject *, FXSelector, void *ptr)
Update string value from a message.
virtual void load(FXStream &store)
load resources
long onEnter(FXObject *obj, FXSelector sel, void *ptr)
called when mouse enter in MFXMenuButtonTooltip
void setThickness(const FXint w)
set segment width - must be less than half the segment length
long onLeave(FXObject *obj, FXSelector sel, void *ptr)
called when mouse leaves in MFXMenuButtonTooltip
FXint getThickness() const
get segment width - must be less than half the segment length
void setToolTipText(const FXString &text)
set tooltip text
long onCmdSetIntValue(FXObject *, FXSelector, void *ptr)
Update int value from a message.
MFXStaticToolTip * myStaticToolTip
pointer to staticToolTip
virtual ~MFXLCDLabel()
destructor
FXint getHorizontal() const
get segment horizontal length - must be more than twice the segment width
FXint getGroove() const
get groove width - must be less than segment width
void setText(FXString lbl)
manipulate text in LCD label
virtual void destroy()
destroy resources
FXColor getFgColor() const
get forground color
void setHorizontal(const FXint len)
set segment horizontal length - must be more than twice the segment width
long onQueryTip(FXObject *, FXSelector, void *ptr)
let parent show tip if appropriate
void setFgColor(FXColor clr)
set forground color
void setBgColor(FXColor clr)
set background color
long onCmdGetIntValue(FXObject *, FXSelector, void *ptr)
Obtain int value from text field.
virtual void detach()
detach resources
long onMotion(FXObject *obj, FXSelector sel, void *ptr)
called when mouse motion in MFXMenuButtonTooltip
FXString myLabel
FOX constructor.
FXColor getBgColor() const
get background color
long onCmdSetValue(FXObject *, FXSelector, void *ptr)
Update value from a message.
long onCmdGetRealValue(FXObject *, FXSelector, void *ptr)
Obtain real value from text field.
Seven-segment (eg LCD/watch style) widget.
void setText(const FXchar val)
set the text on the display
void setThickness(const FXint w)
get/set segment thickness
void setHorizontal(const FXint len)
get/set horizontal segment length
FXint getThickness() const
void setVertical(const FXint len)
get/set vertical segment length
FXColor getFgColor() const
void setBgColor(const FXColor clr)
get/set background color
FXint getVertical() const
FXint getHorizontal() const
void setFgColor(const FXColor clr)
get/set foreground color
FXColor getBgColor() const
void setGroove(const FXint w)
get/set myGroove thickness