add x_draw_clipped_string and use it in the text_list gui
This commit is contained in:
@@ -16,10 +16,12 @@ printf("PAINT text_list %p xywh %d %d %d %d\n", _this, this->common.x, this->com
|
||||
this->common.width, this->common.height);
|
||||
for (i = 0, j = this->starting_line;
|
||||
i < this->allocated_nlines && j < this->text_count; i++, j++)
|
||||
x_draw_string(g->x, g->xwin, FOREGROUND_COLOR,
|
||||
x_draw_clipped_string(g->x, g->xwin, FOREGROUND_COLOR,
|
||||
this->common.x,
|
||||
this->common.y + i * this->line_height + this->baseline,
|
||||
this->text[j]);
|
||||
this->text[j],
|
||||
this->common.x, this->common.y,
|
||||
this->common.width, this->common.height);
|
||||
}
|
||||
|
||||
static void hints(gui *_gui, widget *_w, int *width, int *height)
|
||||
|
||||
@@ -279,6 +279,18 @@ void x_draw_string(x_connection *_c, x_window *_w, int color,
|
||||
XDrawString(c->d, w->p, c->colors[color], x, y, t, tlen);
|
||||
}
|
||||
|
||||
void x_draw_clipped_string(x_connection *_c, x_window *_w, int color,
|
||||
int x, int y, const char *t,
|
||||
int clipx, int clipy, int clipwidth, int clipheight)
|
||||
{
|
||||
struct x_connection *c = _c;
|
||||
|
||||
XRectangle clip = { clipx, clipy, clipwidth, clipheight };
|
||||
XSetClipRectangles(c->d, c->colors[color], 0, 0, &clip, 1, Unsorted);
|
||||
x_draw_string(_c, _w, color, x, y, t);
|
||||
XSetClipMask(c->d, c->colors[color], None);
|
||||
}
|
||||
|
||||
void x_draw(x_connection *_c, x_window *_w)
|
||||
{
|
||||
struct x_connection *c = _c;
|
||||
|
||||
@@ -41,6 +41,10 @@ void x_fill_rectangle(x_connection *c, x_window *w, int color,
|
||||
void x_draw_string(x_connection *_c, x_window *_w, int color,
|
||||
int x, int y, const char *t);
|
||||
|
||||
void x_draw_clipped_string(x_connection *_c, x_window *_w, int color,
|
||||
int x, int y, const char *t,
|
||||
int clipx, int clipy, int clipwidth, int clipheight);
|
||||
|
||||
/* specials functions to plot many points
|
||||
* you call several times x_add_point() then x_plot_points()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user