Mercurial > dwindows
comparison dwtest.c @ 221:3fd010a0a33f
Fixed the expose_event with dynamic pixmaps.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 05 Feb 2003 00:14:21 +0000 |
parents | 79968cf0f3b3 |
children | 7bb6cb6f612c |
comparison
equal
deleted
inserted
replaced
220:d84054c1d587 | 221:3fd010a0a33f |
---|---|
53 char **lp; | 53 char **lp; |
54 | 54 |
55 /* This gets called when a part of the graph needs to be repainted. */ | 55 /* This gets called when a part of the graph needs to be repainted. */ |
56 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) | 56 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) |
57 { | 57 { |
58 HPIXMAP hpm = (HPIXMAP)data; | 58 HPIXMAP hpm = (hwnd == textbox1 ? text1pm : text2pm); |
59 int width = DW_PIXMAP_WIDTH(hpm); | 59 int width = DW_PIXMAP_WIDTH(hpm); |
60 int height = DW_PIXMAP_HEIGHT(hpm); | 60 int height = DW_PIXMAP_HEIGHT(hpm); |
61 | 61 |
62 dw_pixmap_bitblt(hwnd, NULL, 0, 0, width, height, NULL, hpm, 0, 0 ); | 62 dw_pixmap_bitblt(hwnd, NULL, 0, 0, width, height, NULL, hpm, 0, 0 ); |
63 dw_flush(); | 63 dw_flush(); |
272 dw_box_pack_start( notebookbox2, status, 100, 20, TRUE, FALSE, 1); | 272 dw_box_pack_start( notebookbox2, status, 100, 20, TRUE, FALSE, 1); |
273 | 273 |
274 /* create render box for number pixmap */ | 274 /* create render box for number pixmap */ |
275 textbox1 = dw_render_new( 100 ); | 275 textbox1 = dw_render_new( 100 ); |
276 dw_window_set_font(textbox1, FIXEDFONT); | 276 dw_window_set_font(textbox1, FIXEDFONT); |
277 dw_font_text_extents(textbox1, NULL, "O", &font_width, &font_height ); | 277 dw_font_text_extents(textbox1, NULL, "O", &font_width, &font_height); |
278 dw_box_pack_start(pagebox, textbox1, (font_width*width1)+2, font_height*rows, FALSE, TRUE, 0); | 278 dw_box_pack_start(pagebox, textbox1, (font_width*width1)+2, font_height*rows, FALSE, TRUE, 0); |
279 | 279 |
280 /* create box for filecontents and horz scrollbar */ | 280 /* create box for filecontents and horz scrollbar */ |
281 textboxA = dw_box_new( BOXVERT,0 ); | 281 textboxA = dw_box_new( BOXVERT,0 ); |
282 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); | 282 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); |
297 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth ); | 297 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth ); |
298 | 298 |
299 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height); | 299 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height); |
300 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); | 300 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); |
301 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); | 301 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); |
302 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm); | 302 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
303 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm); | 303 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
304 dw_signal_connect(textbox2, "configure_event", DW_SIGNAL_FUNC(configure_event), text2pm); | 304 dw_signal_connect(textbox2, "configure_event", DW_SIGNAL_FUNC(configure_event), text2pm); |
305 dw_signal_connect(hscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); | 305 dw_signal_connect(hscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
306 dw_signal_connect(vscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); | 306 dw_signal_connect(vscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
307 } | 307 } |
308 | 308 |