116 FXMAPFUNC(SEL_UPDATE, FXTextField::ID_PASTE_SEL, MFXTextFieldIcon::onUpdYes),
130 FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
131 FXFrame(p, opts, x, y, w, h, pl, pr, pt, pb),
132 myStaticToolTip(staticToolTip) {
137 flags |= FLAG_ENABLED;
140 if (!(options & JUSTIFY_RIGHT)) {
141 options |= JUSTIFY_LEFT;
143 defaultCursor = getApp()->getDefaultCursor(DEF_TEXT_CURSOR);
144 dragCursor = getApp()->getDefaultCursor(DEF_TEXT_CURSOR);
145 myFont = getApp()->getNormalFont();
146 backColor = getApp()->getBackColor();
147 myTextColor = getApp()->getForeColor();
148 mySelectedBackgroundColor = getApp()->getSelbackColor();
149 mySelectedTextColor = getApp()->getSelforeColor();
150 myCursorColor = getApp()->getForeColor();
263 FXEvent*
event = (FXEvent*)ptr;
273 if (FXFrame::onSelectionRequest(sender, sel, ptr)) {
278 if (event->target == stringType || event->target == textType || event->target == utf8Type || event->target == utf16Type) {
293 if (options & TEXTFIELD_PASSWD) {
294 string.assign(
'*',
string.count());
298 if (event->target == utf8Type) {
299 FXTRACE((100,
"Request UTF8\n"));
300 setDNDData(FROM_SELECTION, event->target,
string);
305 if (event->target == stringType || event->target == textType) {
307 FXTRACE((100,
"Request ASCII\n"));
308 setDNDData(FROM_SELECTION, event->target, ascii.utf2mb(
string));
313 if (event->target == utf16Type) {
314 FXUTF16LECodec unicode;
315 FXTRACE((100,
"Request UTF16\n"));
316 setDNDData(FROM_SELECTION, event->target, unicode.utf2mb(
string));
342 FXEvent*
event = (FXEvent*)ptr;
346 if (FXFrame::onClipboardRequest(sender, sel, ptr)) {
351 if (event->target == stringType || event->target == textType || event->target == utf8Type || event->target == utf16Type) {
357 if (options & TEXTFIELD_PASSWD) {
358 string.assign(
'*',
string.count());
362 if (event->target == utf8Type) {
363 FXTRACE((100,
"Request UTF8\n"));
364 setDNDData(FROM_CLIPBOARD, event->target,
string);
369 if (event->target == stringType || event->target == textType) {
371 FXTRACE((100,
"Request ASCII\n"));
372 setDNDData(FROM_CLIPBOARD, event->target, ascii.utf2mb(
string));
377 if (event->target == utf16Type) {
378 FXUTF16LECodec unicode;
379 FXTRACE((100,
"Request UTF16\n"));
380 setDNDData(FROM_CLIPBOARD, event->target, unicode.utf2mb(
string));
685 FXEvent*
event = (FXEvent*)ptr;
686 if (flags & FLAG_PRESSED) {
688 FXint ll = border + padleft;
689 FXint rr = width - border - padright;
693 if (options & TEXTFIELD_PASSWD) {
700 if (options & JUSTIFY_RIGHT) {
703 if (event->win_x < ll) {
709 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
712 newcursor =
index(ll);
716 if (rr < event->win_x) {
722 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
725 newcursor =
index(rr);
730 else if (options & JUSTIFY_LEFT) {
733 if (event->win_x < ll) {
739 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
742 newcursor =
index(ll);
746 if (rr < event->win_x) {
752 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
755 newcursor =
index(rr);
759 if (event->win_x < ll) {
765 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
768 newcursor =
index(ll);
771 if (rr < event->win_x) {
777 getApp()->addTimeout(
this, ID_AUTOSCROLL, getApp()->getScrollSpeed(), event);
780 newcursor =
index(rr);
873 FXint cl, ch, xx, xlo, xhi;
874 if ((state ^ flags) & FLAG_CARET) {
885 xlo = FXMAX(xx - 2, border);
886 xhi = FXMIN(xx + 3, width - border);
888 dc.setClipRectangle(xlo, border, xhi - xlo, height - (border << 1));
890 if (state & FLAG_CARET) {
893 dc.fillRectangle(xx, padtop + border, 1, height - padbottom - padtop - (border << 1));
894 dc.fillRectangle(xx - 2, padtop + border, 5, 1);
895 dc.fillRectangle(xx - 2, height - border - padbottom - 1, 5, 1);
898 dc.setForeground(backColor);
899 dc.fillRectangle(xx - 2, border, 5, height - (border << 1));
1139 FXint sx, ex, xx, yy, cw, hh, ww, si, ei, lx, rx, t;
1140 FXint rr = width - border - padright;
1141 FXint ll = border + padleft;
1142 FXint mm = (ll + rr) / 2;
1151 hh =
myFont->getFontHeight();
1153 if (options & JUSTIFY_TOP) {
1154 yy = padtop + border;
1155 }
else if (options & JUSTIFY_BOTTOM) {
1157 yy = height - padbottom - border - hh;
1160 yy = border + padtop + (height - padbottom - padtop - (border << 1) - hh) / 2;
1170 if (options & TEXTFIELD_PASSWD) {
1171 cw =
myFont->getTextWidth(
"*", 1);
1174 if (options & JUSTIFY_RIGHT) {
1176 }
else if (options & JUSTIFY_LEFT) {
1198 if (rx - cw < width) {
1213 if (!hasSelection() || to <= si || ei <= fm) {
1232 dc.fillRectangle(sx, padtop + border, ex - sx, height - padtop - padbottom - (border << 1));
1236 dc.setForeground(baseColor);
1237 dc.fillRectangle(sx, padtop + border, ex - sx, height - padtop - padbottom - (border << 1));
1247 if (options & JUSTIFY_RIGHT) {
1249 }
else if (options & JUSTIFY_LEFT) {
1275 if (rx - cw < width) {
1291 if (!hasSelection() || to <= si || ei <= fm) {
1310 dc.fillRectangle(sx, padtop + border, ex - sx, height - padtop - padbottom - (border << 1));
1314 dc.setForeground(baseColor);
1315 dc.fillRectangle(sx, padtop + border, ex - sx, height - padtop - padbottom - (border << 1));