comparison dwtest.c @ 1785:c5ea64e8b436

Added UTF8/Wide conversion for GTK2/3. Also added some code in the test program to use it.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 25 Jul 2012 00:46:00 +0000
parents 9de6d1cc8fb8
children ed8851658015
comparison
equal deleted inserted replaced
1784:86ace55df07b 1785:c5ea64e8b436
996 void text_add(void) 996 void text_add(void)
997 { 997 {
998 unsigned long depth = dw_color_depth_get(); 998 unsigned long depth = dw_color_depth_get();
999 HWND vscrollbox, hbox, button1, button2, label; 999 HWND vscrollbox, hbox, button1, button2, label;
1000 int vscrollbarwidth, hscrollbarheight; 1000 int vscrollbarwidth, hscrollbarheight;
1001 wchar_t widestring[100] = L"DWTest Wide";
1002 char *utf8string = dw_wchar_to_utf8(widestring);
1001 1003
1002 /* create a box to pack into the notebook page */ 1004 /* create a box to pack into the notebook page */
1003 pagebox = dw_box_new(DW_HORZ, 2); 1005 pagebox = dw_box_new(DW_HORZ, 2);
1004 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); 1006 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0);
1005 /* now a status area under this box */ 1007 /* now a status area under this box */
1090 if(!image) 1092 if(!image)
1091 image = dw_pixmap_new_from_file(textbox2, "~/test"); 1093 image = dw_pixmap_new_from_file(textbox2, "~/test");
1092 if(image) 1094 if(image)
1093 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE); 1095 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE);
1094 1096
1095 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); 1097 dw_messagebox(utf8string ? utf8string : "DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height);
1096 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*width1, font_height*rows); 1098 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*width1, font_height*rows);
1097 dw_draw_rect(0, text2pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*cols, font_height*rows); 1099 dw_draw_rect(0, text2pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*cols, font_height*rows);
1098 dw_signal_connect(textbox1, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(context_menu_event), NULL); 1100 dw_signal_connect(textbox1, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(context_menu_event), NULL);
1099 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 1101 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);
1100 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 1102 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);