diff options
author | QC <qball@gmpclient.org> | 2015-09-26 20:34:34 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2015-09-26 20:34:34 +0200 |
commit | 8f1f03e6d23bd2fb6d3a9362c3cd9e0df779184f (patch) | |
tree | 86290109aedfda2a25fa066bfffb0ea1804ec7eb /test/textbox-test.c | |
parent | 29e81fdb078a7f19e062c2f6d711b074969503d4 (diff) |
Use cairo to do drawing.
Diffstat (limited to 'test/textbox-test.c')
-rw-r--r-- | test/textbox-test.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/textbox-test.c b/test/textbox-test.c index a4009053..3c4aade1 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -83,11 +83,16 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) 0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput, vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr ); TASSERT ( mw != None ); + + cairo_surface_t *surface = cairo_xlib_surface_create ( display, mw, vinfo.visual, 200, 100 ); + // Create a drawable. + cairo_t *draw = cairo_create ( surface ); + cairo_set_operator ( draw, CAIRO_OPERATOR_SOURCE ); // Set alternate row to normal row. config.menu_bg_alt = config.menu_bg; - textbox_setup ( &vinfo, map ); + textbox_setup ( ); textbox *box = - textbox_create ( mw, &vinfo, map, TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, 0, 0, -1, -1, + textbox_create ( TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, 0, 0, -1, -1, NORMAL, "test" ); TASSERT ( box != NULL ); @@ -158,19 +163,19 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) TASSERT ( box->cursor == 5 ); textbox_font ( box, HIGHLIGHT ); - textbox_draw ( box ); + textbox_draw ( box, draw ); - textbox_show ( box ); textbox_move ( box, 12, 13 ); TASSERT ( box->x == 12 ); TASSERT ( box->y == 13 ); - textbox_hide ( box ); textbox_free ( box ); textbox_cleanup ( ); cleanup_abe (); + cairo_destroy ( draw ); + cairo_surface_destroy ( surface ); XDestroyWindow ( display, mw ); XCloseDisplay ( display ); } |