fltk
1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Fossies Dox: fltk-1.3.5-source.tar.bz2 ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 31 #if defined(USE_X11) && !USE_XFT 38 extern void fl_draw(
const char*,
int,
float,
float);
58 const char* lastspace =
p;
59 char* lastspace_out = o;
60 int width_to_lastspace = 0;
77 width_to_lastspace += (int)
fl_width(lastspace_out, (
int) (o-lastspace_out));
78 if (
p > lastspace+1) {
79 if (word_count && width_to_lastspace > word_wrap) {
80 p = lastspace; o = lastspace_out;
break;
90 if (c <
' ' || c == 127) {
136 if (c <
' ' || c == 127) {
147 if (returnn) *returnn = n;
228 int selstart, selend;
230 selstart = selend = 0;
244 int threshold = height/2;
247 for (
p=
value(), curx=cury=lines=0; ;) {
254 if (curx > newscroll+W-threshold) {
256 newscroll = curx+threshold-W;
260 if (ex < newscroll) newscroll = ex;
261 }
else if (curx < newscroll+threshold) {
262 newscroll = curx-threshold;
264 if (newscroll < 0) newscroll = 0;
278 if (cury < newy) newy = cury;
279 if (cury > newy+
H-height) newy = cury-
H+height;
280 if (newy < -1) newy = -1;
292 float xpos = (float)(X -
xscroll_ + 1);
299 if (ypos <= -height)
goto CONTINUE;
303 if (e < pp)
goto CONTINUE2;
307 float r = (float)(X+W);
319 fl_push_clip((
int)xx-1-height/8,
Y+ypos, (
int)(r-xx+2+height/4), height);
328 if (selstart < selend && selstart <= e-
value() && selend >
p-
value()) {
329 const char* pp =
value()+selstart;
338 float x2 = (float)(X+W);
340 if (pp <= e) x2 = xpos + (float)
expandpos(
p, pp,
buf, &offset2);
341 else offset2 = (int) strlen(
buf);
342 #ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text 350 fl_rectf((
int)(x1+0.5),
Y+ypos, (
int)(x2-x1+0.5), height);
353 fl_draw(
buf+offset1, offset2-offset1, x1, (
float)(
Y+ypos+desc));
354 #ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text 357 float width =
fl_width(
buf+offset1, offset2-offset1);
358 fl_line(x1,
Y+ypos+height-1, x1+width,
Y+ypos+height-1);
363 fl_draw(
buf+offset2, (
int) strlen(
buf+offset2), x2, (
float)(
Y+ypos+desc));
379 selstart == selend) &&
385 fl_line((
int)(xpos+curx-2.5
f),
Y+ypos+height-1,
386 (
int)(xpos+curx+0.5
f),
Y+ypos+height-4,
387 (
int)(xpos+curx+3.5
f),
Y+ypos+height-1);
389 fl_rectf((
int)(xpos+curx+0.5),
Y+ypos, 2, height);
392 Fl::insertion_point_location(xpos+curx,
Y+ypos+height, height);
399 if (*e ==
'\n' || *e ==
' ') e++;
406 if (ypos < 0) ypos = 0;
425 return (c&128 || isalnum(c) || strchr(
"#%-@_~", c));
483 while (j > 0 &&
index(j-1) !=
'\n') j--;
486 for (
const char*
p=
value()+j; ;) {
489 int k = (int) (
p-
value());
490 if (k >= i)
return k;
494 while (i <
size() &&
index(i) !=
'\n') i++;
511 while (j > 0 &&
index(j-1) !=
'\n') j--;
515 for (
const char*
p=
value()+j; ;) {
518 if ((
int) (e-
value()) >= i)
return (
int) (
p-
value());
526 while (i > 0 && !isspace(s[i-1]))
533 while (i < len && !isspace(s[i]))
556 theline--;
if (theline < 0)
break;
561 for (l =
p, r = e; l<r; ) {
575 if (f1 < f0) l = l+cw;
578 newpos = (int) (l-
value());
580 int newmark = drag ?
mark() : newpos;
582 if (newpos >= newmark) {
583 if (newpos == newmark) {
584 if (newpos <
size()) newpos++;
609 newmark = newpos = (int) (l-
value());
639 if (
p == m) is_same = 1;
641 while (p < position_ && p > 0 && (
size() -
p) > 0 &&
649 while (m < mark_ && m > 0 && (
size() - m) > 0 &&
652 while (m <
size() && m >
mark_ && ul < 0) {
697 const char*
p =
value()+i;
699 const char *l, *r, *t;
700 for (l =
p, r = e; l<r; ) {
705 int j = (int) (l-
value());
736 #define MAXFLOATSIZE 40 811 if (e<
b) {
int t=
b;
b=e; e=t;}
812 while (
b != e &&
b > 0 && (
size_ -
b) > 0 &&
815 while (e < size_ && e > 0 && ul < 0) {
819 if (text && !ilen) ilen = (int) strlen(text);
820 if (e<=
b && !ilen)
return 0;
833 if (ulen < 1) ulen = 1;
841 if (ulen < 1) ulen = 1;
899 for (i=0; i<ilen; i++)
900 if (text[i]==
' ')
break;
904 while (
b > 0 &&
index(
b)!=
'\n')
b--;
960 while (b1 > 0 &&
index(b1)!=
'\n') b1--;
1064 if (!t || e <= t)
return 1;
1066 while (isspace(*t & 255) && t < e) t ++;
1068 if (*
p ==
'+' || *
p ==
'-')
p ++;
1069 if (strncmp(
p,
"0x", 2) == 0) {
1071 while (isxdigit(*
p & 255) &&
p < e)
p ++;
1073 while (isdigit(*
p & 255) &&
p < e)
p ++;
1080 while (isspace(*t & 255) && t < e) t ++;
1082 if (*
p ==
'+' || *
p ==
'-')
p ++;
1083 while (isdigit(*
p & 255) &&
p < e)
p ++;
1086 while (isdigit(*
p & 255) &&
p < e)
p ++;
1087 if (*
p ==
'e' || *
p ==
'E') {
1089 if (*
p ==
'+' || *
p ==
'-')
p ++;
1090 while (isdigit(*
p & 255) &&
p < e)
p ++;
1157 if (len >
size_) len += 9;
1216 for (; i<
size_ && i<len && str[i]==
value_[i]; i++) {}
1217 if (i==
size_ && i==len)
return 0;
1224 if (!
size_)
return 0;
1285 return value(str, str ? (
int) strlen(str) : 0);
void fl_font(Fl_Font face, Fl_Fontsize fsize)
FL_EXPORT double fl_width(const char *txt)
const Fl_Align FL_ALIGN_LEFT
void fl_line(int x, int y, int x1, int y1)
void fl_rectf(int x, int y, int w, int h)
static int box_dx(Fl_Boxtype)
FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win=0)
void fl_color(Fl_Color c)
Do the callback whenever the user interacts with the widget.
Do the callback when the button or key is released and the value changes.
#define FL_SHIFT
One of the shift keys is down.
static const char * event_text()
Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg)
static int box_dh(Fl_Boxtype)
const Fl_Color FL_FOREGROUND_COLOR
the default foreground color (0) used for labels and text
static int box_dw(Fl_Boxtype)
unsigned fl_utf8decode(const char *p, const char *end, int *len)
static int test_shortcut(Fl_Shortcut)
Do the callback only when the widget value changes.
static int box_dy(Fl_Boxtype)
header for Unicode and UTF-8 character handling
utility header to pull drawing functions together
const Fl_Font FL_HELVETICA
Helvetica (or Arial) normal (0)
Fl_Color fl_inactive(Fl_Color c)
void fl_beep(int type=FL_BEEP_DEFAULT)
void fl_push_clip(int x, int y, int w, int h)
static int event_length()
Fl_Fontsize FL_NORMAL_SIZE
normal font size
static Fl_Widget * focus()
FL_EXPORT void fl_reset_spot(void)
static Fl_Widget * pushed()
static void copy(const char *stuff, int len, int destination, const char *type)
const Fl_Color FL_SELECTION_COLOR
the default selection/highlight color
static int event_clicks()
int fl_utf_nb_char(const unsigned char *buf, int len)
const Fl_Color FL_BACKGROUND2_COLOR
the default background color for text, list, and valuator widgets
static int visible_focus()
int fl_utf8encode(unsigned ucs, char *buf)
Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight)