54 FXuint opt, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
55 MFXTextFieldIcon(p, staticToolTip,
GUIIcon::
SEARCH, tgt, sel, opt, x, y, w, h, pl, pr, pt, pb),
69 FXEvent* ev = (FXEvent*)ptr;
70 FXDCWindow dc(
this, ev);
72 drawFrame(dc, 0, 0, width, height);
75 dc.setForeground(backColor);
77 dc.setForeground(baseColor);
80 dc.fillRectangle(border, border, width - (border << 1), height - (border << 1));
82 dc.setClipRectangle(border, border, width - (border << 1), height - (border << 1));
84 if (hasFocus() || (
contents.count() > 0)) {
90 if (flags & FLAG_CARET) {
94 dc.fillRectangle(xx, padtop + border, 1, height - padbottom - padtop - (border << 1));
95 dc.fillRectangle(xx - 2, padtop + border, 5, 1);
96 dc.fillRectangle(xx - 2, height - border - padbottom - 1, 5, 1);
99 dc.drawIcon(
myIcon, 3, border + padtop + (height - padbottom - padtop - (border << 1) -
ICON_SIZE) / 2);
134 FXint xx, yy, cw, hh, ww, si, ei, lx, rx, t;
135 FXint rr = width - border - padright;
136 FXint ll = border + padleft;
137 FXint mm = (ll + rr) / 2;
138 FXint to = (int)searchString.length();
144 dc.setForeground(FXRGBA(128, 128, 128, 255));
146 hh =
myFont->getFontHeight();
148 if (options & JUSTIFY_TOP) {
149 yy = padtop + border;
150 }
else if (options & JUSTIFY_BOTTOM) {
152 yy = height - padbottom - border - hh;
155 yy = border + padtop + (height - padbottom - padtop - (border << 1) - hh) / 2;
165 ww =
myFont->getTextWidth(searchString.text(), searchString.length());
167 if (options & JUSTIFY_RIGHT) {
169 }
else if (options & JUSTIFY_LEFT) {
179 lx = xx +
myFont->getTextWidth(&searchString[0], fm);
180 rx = lx +
myFont->getTextWidth(&searchString[fm], to - fm);
182 t = searchString.inc(fm);
183 cw =
myFont->getTextWidth(&searchString[fm], t - fm);
191 t = searchString.dec(to);
192 cw =
myFont->getTextWidth(&searchString[t], to - t);
193 if (rx - cw < width) {
207 xx +=
myFont->getTextWidth(searchString.text(), fm);
208 yy +=
myFont->getFontAscent();
209 dc.drawText(xx, yy, &searchString[fm], to - fm);
FXDEFMAP(MFXTextFieldSearch) MFXTextFieldSearchMap[]
FXint coord(FXint i) const
coordinates
long onKeyPress(FXObject *, FXSelector, void *)
long onFocusIn(FXObject *, FXSelector, void *)
long onFocusOut(FXObject *, FXSelector, void *)
void drawTextRange(FXDCWindow &dc, FXint fm, FXint to)
draw text range
void setFont(FXFont *fnt)
Set the text font.
long onFocusSelf(FXObject *, FXSelector, void *)
FXTextFieldIcon (based on FXTextFieldIcon)
long onFocusSelf(FXObject *sender, FXSelector sel, void *ptr)
focus self
void drawSearchTextRange(FXDCWindow &dc, FXint fm, const FXString &searchString)
draw search text range
long onFocusIn(FXObject *sender, FXSelector sel, void *ptr)
focus in
long onPaint(FXObject *obj, FXSelector sel, void *ptr)
paint
long onKeyPress(FXObject *obj, FXSelector sel, void *ptr)
key press
long onFocusOut(FXObject *sender, FXSelector sel, void *ptr)
focus out