53MFXTextFieldSearch::
MFXTextFieldSearch(FXComposite* p, FXint ncols, FXObject* tgt, FXSelector sel, FXuint opt, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
54 MFXTextFieldIcon(p, ncols,
GUIIconSubSys::getIcon(
GUIIcon::
SEARCH), tgt, sel, opt, x, y, w, h, pl, pr, pt, pb),
68 FXEvent* ev = (FXEvent*)ptr;
69 FXDCWindow dc(
this, ev);
71 drawFrame(dc, 0, 0, width, height);
74 dc.setForeground(backColor);
76 dc.setForeground(baseColor);
79 dc.fillRectangle(border, border, width - (border << 1), height - (border << 1));
81 dc.setClipRectangle(border, border, width - (border << 1), height - (border << 1));
83 if (hasFocus() || (
contents.count() > 0)) {
89 if (flags & FLAG_CARET) {
93 dc.fillRectangle(xx, padtop + border, 1, height - padbottom - padtop - (border << 1));
94 dc.fillRectangle(xx - 2, padtop + border, 5, 1);
95 dc.fillRectangle(xx - 2, height - border - padbottom - 1, 5, 1);
98 dc.drawIcon(
icon, 3, border + padtop + (height - padbottom - padtop - (border << 1) -
ICON_SIZE) / 2);
133 FXint xx, yy, cw, hh, ww, si, ei, lx, rx, t;
134 FXint rr = width - border - padright;
135 FXint ll = border + padleft;
136 FXint mm = (ll + rr) / 2;
137 FXint to = (int)searchString.length();
143 dc.setForeground(FXRGBA(128, 128, 128, 255));
145 hh =
font->getFontHeight();
147 if (options & JUSTIFY_TOP) {
148 yy = padtop + border;
149 }
else if (options & JUSTIFY_BOTTOM) {
151 yy = height - padbottom - border - hh;
154 yy = border + padtop + (height - padbottom - padtop - (border << 1) - hh) / 2;
164 ww =
font->getTextWidth(searchString.text(), searchString.length());
166 if (options & JUSTIFY_RIGHT) {
167 xx =
shift + rr - ww;
168 }
else if (options & JUSTIFY_LEFT) {
173 xx =
shift + mm - ww / 2;
178 lx = xx +
font->getTextWidth(&searchString[0], fm);
179 rx = lx +
font->getTextWidth(&searchString[fm], to - fm);
181 t = searchString.inc(fm);
182 cw =
font->getTextWidth(&searchString[fm], t - fm);
190 t = searchString.dec(to);
191 cw =
font->getTextWidth(&searchString[t], to - t);
192 if (rx - cw < width) {
206 xx +=
font->getTextWidth(searchString.text(), fm);
207 yy +=
font->getFontAscent();
208 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