comparison dwtest.c @ 2742:06b368d2e4f9

Switch to using DW_SIZE_AUTO constant in the test program. This makes it more clear from looking at the code what it is doing. Also some general code style cleanup.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 20 Dec 2021 12:29:55 +0000
parents c1f8e598960d
children b17197a2fb28
comparison
equal deleted inserted replaced
2741:0b1030337dd3 2742:06b368d2e4f9
978 978
979 copypastefield = dw_entryfield_new("", 0); 979 copypastefield = dw_entryfield_new("", 0);
980 980
981 dw_entryfield_set_limit(copypastefield, 260); 981 dw_entryfield_set_limit(copypastefield, 260);
982 982
983 dw_box_pack_start(browsebox, copypastefield, -1, -1, TRUE, FALSE, 4); 983 dw_box_pack_start(browsebox, copypastefield, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 4);
984 984
985 copybutton = dw_button_new("Copy", 0); 985 copybutton = dw_button_new("Copy", 0);
986 986
987 dw_box_pack_start(browsebox, copybutton, -1, -1, FALSE, FALSE, 0); 987 dw_box_pack_start(browsebox, copybutton, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
988 988
989 pastebutton = dw_button_new("Paste", 0); 989 pastebutton = dw_button_new("Paste", 0);
990 990
991 dw_box_pack_start(browsebox, pastebutton, -1, -1, FALSE, FALSE, 0); 991 dw_box_pack_start(browsebox, pastebutton, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
992 992
993 /* Archive Name */ 993 /* Archive Name */
994 stext = dw_text_new("File to browse", 0); 994 stext = dw_text_new("File to browse", 0);
995 995
996 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); 996 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER);
1116 dw_box_pack_start(notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); 1116 dw_box_pack_start(notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0);
1117 /* now a status area under this box */ 1117 /* now a status area under this box */
1118 hbox = dw_box_new(DW_HORZ, 1 ); 1118 hbox = dw_box_new(DW_HORZ, 1 );
1119 dw_box_pack_start(notebookbox2, hbox, 100, 20, TRUE, FALSE, 1); 1119 dw_box_pack_start(notebookbox2, hbox, 100, 20, TRUE, FALSE, 1);
1120 status1 = dw_status_text_new("", 0); 1120 status1 = dw_status_text_new("", 0);
1121 dw_box_pack_start(hbox, status1, 100, -1, TRUE, FALSE, 1); 1121 dw_box_pack_start(hbox, status1, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
1122 status2 = dw_status_text_new("", 0); 1122 status2 = dw_status_text_new("", 0);
1123 dw_box_pack_start(hbox, status2, 100, -1, TRUE, FALSE, 1); 1123 dw_box_pack_start(hbox, status2, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
1124 /* a box with combobox and button */ 1124 /* a box with combobox and button */
1125 hbox = dw_box_new(DW_HORZ, 1 ); 1125 hbox = dw_box_new(DW_HORZ, 1 );
1126 dw_box_pack_start(notebookbox2, hbox, 100, 25, TRUE, FALSE, 1); 1126 dw_box_pack_start(notebookbox2, hbox, 100, 25, TRUE, FALSE, 1);
1127 rendcombo = dw_combobox_new( "Shapes Double Buffered", 0 ); 1127 rendcombo = dw_combobox_new( "Shapes Double Buffered", 0 );
1128 dw_box_pack_start(hbox, rendcombo, 80, 25, TRUE, TRUE, 0); 1128 dw_box_pack_start(hbox, rendcombo, 80, 25, TRUE, TRUE, 0);
1129 dw_listbox_append(rendcombo, "Shapes Double Buffered"); 1129 dw_listbox_append(rendcombo, "Shapes Double Buffered");
1130 dw_listbox_append(rendcombo, "Shapes Direct"); 1130 dw_listbox_append(rendcombo, "Shapes Direct");
1131 dw_listbox_append(rendcombo, "File Display"); 1131 dw_listbox_append(rendcombo, "File Display");
1132 label = dw_text_new("Image X:", 100); 1132 label = dw_text_new("Image X:", 100);
1133 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); 1133 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER);
1134 dw_box_pack_start(hbox, label, -1, 25, FALSE, TRUE, 0); 1134 dw_box_pack_start(hbox, label, DW_SIZE_AUTO, 25, FALSE, TRUE, 0);
1135 imagexspin = dw_spinbutton_new("20", 1021); 1135 imagexspin = dw_spinbutton_new("20", 1021);
1136 dw_box_pack_start(hbox, imagexspin, 25, 25, TRUE, TRUE, 0); 1136 dw_box_pack_start(hbox, imagexspin, 25, 25, TRUE, TRUE, 0);
1137 label = dw_text_new("Y:", 100); 1137 label = dw_text_new("Y:", 100);
1138 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); 1138 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER);
1139 dw_box_pack_start(hbox, label, -1, 25, FALSE, TRUE, 0); 1139 dw_box_pack_start(hbox, label, DW_SIZE_AUTO, 25, FALSE, TRUE, 0);
1140 imageyspin = dw_spinbutton_new("20", 1021); 1140 imageyspin = dw_spinbutton_new("20", 1021);
1141 dw_box_pack_start(hbox, imageyspin, 25, 25, TRUE, TRUE, 0); 1141 dw_box_pack_start(hbox, imageyspin, 25, 25, TRUE, TRUE, 0);
1142 dw_spinbutton_set_limits(imagexspin, 2000, 0); 1142 dw_spinbutton_set_limits(imagexspin, 2000, 0);
1143 dw_spinbutton_set_limits(imageyspin, 2000, 0); 1143 dw_spinbutton_set_limits(imageyspin, 2000, 0);
1144 dw_spinbutton_set_pos(imagexspin, 20); 1144 dw_spinbutton_set_pos(imagexspin, 20);
1145 dw_spinbutton_set_pos(imageyspin, 20); 1145 dw_spinbutton_set_pos(imageyspin, 20);
1146 imagestretchcheck = dw_checkbox_new("Stretch", 1021); 1146 imagestretchcheck = dw_checkbox_new("Stretch", 1021);
1147 dw_box_pack_start(hbox, imagestretchcheck, -1, 25, FALSE, TRUE, 0); 1147 dw_box_pack_start(hbox, imagestretchcheck, DW_SIZE_AUTO, 25, FALSE, TRUE, 0);
1148 1148
1149 button1 = dw_button_new("Refresh", 1223L ); 1149 button1 = dw_button_new("Refresh", 1223L );
1150 dw_box_pack_start(hbox, button1, -1, 25, FALSE, TRUE, 0); 1150 dw_box_pack_start(hbox, button1, DW_SIZE_AUTO, 25, FALSE, TRUE, 0);
1151 button2 = dw_button_new("Print", 1224L ); 1151 button2 = dw_button_new("Print", 1224L );
1152 dw_box_pack_start(hbox, button2, -1, 25, FALSE, TRUE, 0); 1152 dw_box_pack_start(hbox, button2, DW_SIZE_AUTO, 25, FALSE, TRUE, 0);
1153 1153
1154 /* Pre-create the scrollbars so we can query their sizes */ 1154 /* Pre-create the scrollbars so we can query their sizes */
1155 vscrollbar = dw_scrollbar_new(DW_VERT, 50); 1155 vscrollbar = dw_scrollbar_new(DW_VERT, 50);
1156 hscrollbar = dw_scrollbar_new(DW_HORZ, 50); 1156 hscrollbar = dw_scrollbar_new(DW_HORZ, 50);
1157 dw_window_get_preferred_size(vscrollbar, &vscrollbarwidth, NULL); 1157 dw_window_get_preferred_size(vscrollbar, &vscrollbarwidth, NULL);
1185 /* create render box for filecontents pixmap */ 1185 /* create render box for filecontents pixmap */
1186 textbox2 = dw_render_new(101); 1186 textbox2 = dw_render_new(101);
1187 dw_box_pack_start(textboxA, textbox2, 10, 10, TRUE, TRUE, 0); 1187 dw_box_pack_start(textboxA, textbox2, 10, 10, TRUE, TRUE, 0);
1188 dw_window_set_font(textbox2, FIXEDFONT); 1188 dw_window_set_font(textbox2, FIXEDFONT);
1189 /* create horizonal scrollbar */ 1189 /* create horizonal scrollbar */
1190 dw_box_pack_start(textboxA, hscrollbar, -1, -1, TRUE, FALSE, 0); 1190 dw_box_pack_start(textboxA, hscrollbar, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1191 1191
1192 /* create vertical scrollbar */ 1192 /* create vertical scrollbar */
1193 vscrollbox = dw_box_new(DW_VERT, 0); 1193 vscrollbox = dw_box_new(DW_VERT, 0);
1194 dw_box_pack_start(vscrollbox, vscrollbar, -1, -1, FALSE, TRUE, 0); 1194 dw_box_pack_start(vscrollbox, vscrollbar, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, TRUE, 0);
1195 /* Pack an area of empty space 14x14 pixels */ 1195 /* Pack an area of empty space 14x14 pixels */
1196 dw_box_pack_start(vscrollbox, 0, vscrollbarwidth, hscrollbarheight, FALSE, FALSE, 0); 1196 dw_box_pack_start(vscrollbox, 0, vscrollbarwidth, hscrollbarheight, FALSE, FALSE, 0);
1197 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 1197 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
1198 1198
1199 text1pm = dw_pixmap_new(textbox1, font_width*width1, font_height*rows, (int)depth); 1199 text1pm = dw_pixmap_new(textbox1, font_width*width1, font_height*rows, (int)depth);
1258 1258
1259 dw_box_pack_start(notebookbox3, tree, 500, 200, TRUE, TRUE, 1); 1259 dw_box_pack_start(notebookbox3, tree, 500, 200, TRUE, TRUE, 1);
1260 1260
1261 /* and a status area to see whats going on */ 1261 /* and a status area to see whats going on */
1262 tree_status = dw_status_text_new("", 0); 1262 tree_status = dw_status_text_new("", 0);
1263 dw_box_pack_start(notebookbox3, tree_status, 100, -1, TRUE, FALSE, 1); 1263 dw_box_pack_start(notebookbox3, tree_status, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
1264 1264
1265 /* set up our signal trappers... */ 1265 /* set up our signal trappers... */
1266 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), DW_POINTER(tree_status)); 1266 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), DW_POINTER(tree_status));
1267 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), DW_POINTER(tree_status)); 1267 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), DW_POINTER(tree_status));
1268 1268
1463 HWND text; 1463 HWND text;
1464 1464
1465 hbox = dw_box_new(DW_HORZ, 0); 1465 hbox = dw_box_new(DW_HORZ, 0);
1466 1466
1467 checkbox = dw_checkbox_new("Word wrap", 0); 1467 checkbox = dw_checkbox_new("Word wrap", 0);
1468 dw_box_pack_start(hbox, checkbox, -1, -1, FALSE, TRUE, 1); 1468 dw_box_pack_start(hbox, checkbox, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, TRUE, 1);
1469 text = dw_text_new("Foreground:", 0); 1469 text = dw_text_new("Foreground:", 0);
1470 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER); 1470 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
1471 dw_box_pack_start(hbox, text, -1, -1, FALSE, TRUE, 1); 1471 dw_box_pack_start(hbox, text, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, TRUE, 1);
1472 mlefore = color_combobox(); 1472 mlefore = color_combobox();
1473 dw_box_pack_start(hbox, mlefore, 150, -1, TRUE, FALSE, 1); 1473 dw_box_pack_start(hbox, mlefore, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
1474 text = dw_text_new("Background:", 0); 1474 text = dw_text_new("Background:", 0);
1475 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER); 1475 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
1476 dw_box_pack_start(hbox, text, -1, -1, FALSE, TRUE, 1); 1476 dw_box_pack_start(hbox, text, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, TRUE, 1);
1477 mleback = color_combobox(); 1477 mleback = color_combobox();
1478 dw_box_pack_start(hbox, mleback, 150, -1, TRUE, FALSE, 1); 1478 dw_box_pack_start(hbox, mleback, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
1479 dw_checkbox_set(checkbox, TRUE); 1479 dw_checkbox_set(checkbox, TRUE);
1480 text = dw_text_new("Font:", 0); 1480 text = dw_text_new("Font:", 0);
1481 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER); 1481 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
1482 dw_box_pack_start(hbox, text, -1, -1, FALSE, TRUE, 1); 1482 dw_box_pack_start(hbox, text, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, TRUE, 1);
1483 fontsize = dw_spinbutton_new("9", 0); 1483 fontsize = dw_spinbutton_new("9", 0);
1484 dw_box_pack_start(hbox, fontsize, -1, -1, FALSE, FALSE, 1); 1484 dw_box_pack_start(hbox, fontsize, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 1);
1485 dw_spinbutton_set_limits(fontsize, 100, 5); 1485 dw_spinbutton_set_limits(fontsize, 100, 5);
1486 dw_spinbutton_set_pos(fontsize, 9); 1486 dw_spinbutton_set_pos(fontsize, 9);
1487 fontname = dw_combobox_new("Default", 0); 1487 fontname = dw_combobox_new("Default", 0);
1488 dw_listbox_append(fontname, "Default"); 1488 dw_listbox_append(fontname, "Default");
1489 dw_listbox_append(fontname, "Arial"); 1489 dw_listbox_append(fontname, "Arial");
1493 dw_listbox_append(fontname, "DejaVu Sans"); 1493 dw_listbox_append(fontname, "DejaVu Sans");
1494 dw_listbox_append(fontname, "Times New Roman"); 1494 dw_listbox_append(fontname, "Times New Roman");
1495 dw_listbox_append(fontname, "Times New Roman Bold"); 1495 dw_listbox_append(fontname, "Times New Roman Bold");
1496 dw_listbox_append(fontname, "Times New Roman Italic"); 1496 dw_listbox_append(fontname, "Times New Roman Italic");
1497 dw_listbox_append(fontname, "Times New Roman Bold Italic"); 1497 dw_listbox_append(fontname, "Times New Roman Bold Italic");
1498 dw_box_pack_start(hbox, fontname, 150, -1, TRUE, FALSE, 1); 1498 dw_box_pack_start(hbox, fontname, 150, DW_SIZE_AUTO, TRUE, FALSE, 1);
1499 dw_box_pack_start(notebookbox4, hbox, -1, -1, TRUE, FALSE, 1); 1499 dw_box_pack_start(notebookbox4, hbox, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 1);
1500 1500
1501 dw_window_set_data(hbox, "mlefore", DW_POINTER(mlefore)); 1501 dw_window_set_data(hbox, "mlefore", DW_POINTER(mlefore));
1502 dw_window_set_data(hbox, "mleback", DW_POINTER(mleback)); 1502 dw_window_set_data(hbox, "mleback", DW_POINTER(mleback));
1503 dw_window_set_data(hbox, "fontsize", DW_POINTER(fontsize)); 1503 dw_window_set_data(hbox, "fontsize", DW_POINTER(fontsize));
1504 dw_window_set_data(hbox, "fontname", DW_POINTER(fontname)); 1504 dw_window_set_data(hbox, "fontname", DW_POINTER(fontname));
1508 container = dw_container_new(100, TRUE); 1508 container = dw_container_new(100, TRUE);
1509 dw_box_pack_start(notebookbox4, container, 500, 200, TRUE, FALSE, 1); 1509 dw_box_pack_start(notebookbox4, container, 500, 200, TRUE, FALSE, 1);
1510 1510
1511 /* and a status area to see whats going on */ 1511 /* and a status area to see whats going on */
1512 container_status = dw_status_text_new("", 0); 1512 container_status = dw_status_text_new("", 0);
1513 dw_box_pack_start(notebookbox4, container_status, 100, -1, TRUE, FALSE, 1); 1513 dw_box_pack_start(notebookbox4, container_status, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
1514 1514
1515 titles[0] = "Type"; 1515 titles[0] = "Type";
1516 titles[1] = "Size"; 1516 titles[1] = "Size";
1517 titles[2] = "Time"; 1517 titles[2] = "Time";
1518 titles[3] = "Date"; 1518 titles[3] = "Date";
1615 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); 1615 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
1616 1616
1617 calbox = dw_box_new(DW_HORZ, 0); 1617 calbox = dw_box_new(DW_HORZ, 0);
1618 dw_box_pack_start(notebookbox5, calbox, 0, 0, TRUE, FALSE, 1); 1618 dw_box_pack_start(notebookbox5, calbox, 0, 0, TRUE, FALSE, 1);
1619 cal = dw_calendar_new(100); 1619 cal = dw_calendar_new(100);
1620 dw_box_pack_start(calbox, cal, -1, -1, TRUE, FALSE, 0); 1620 dw_box_pack_start(calbox, cal, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1621 1621
1622 dw_calendar_set_date(cal, 2019, 4, 30); 1622 dw_calendar_set_date(cal, 2019, 4, 30);
1623 1623
1624 /* 1624 /*
1625 * Create our file toolbar boxes... 1625 * Create our file toolbar boxes...
1639 /* make a combobox */ 1639 /* make a combobox */
1640 combox = dw_box_new(DW_VERT, 2); 1640 combox = dw_box_new(DW_VERT, 2);
1641 dw_box_pack_start(notebookbox5, combox, 25, 200, TRUE, FALSE, 0); 1641 dw_box_pack_start(notebookbox5, combox, 25, 200, TRUE, FALSE, 0);
1642 combobox1 = dw_combobox_new("fred", 0); /* no point in specifying an initial value */ 1642 combobox1 = dw_combobox_new("fred", 0); /* no point in specifying an initial value */
1643 dw_listbox_append(combobox1, "fred"); 1643 dw_listbox_append(combobox1, "fred");
1644 dw_box_pack_start(combox, combobox1, -1, -1, TRUE, FALSE, 0); 1644 dw_box_pack_start(combox, combobox1, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1645 /* 1645 /*
1646 dw_window_set_text( combobox, "initial value"); 1646 dw_window_set_text( combobox, "initial value");
1647 */ 1647 */
1648 dw_signal_connect(combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL); 1648 dw_signal_connect(combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL);
1649 #if 0 1649 #if 0
1656 } 1656 }
1657 dw_debug("after appending 100 items to combobox\n"); 1657 dw_debug("after appending 100 items to combobox\n");
1658 #endif 1658 #endif
1659 1659
1660 combobox2 = dw_combobox_new("joe", 0); /* no point in specifying an initial value */ 1660 combobox2 = dw_combobox_new("joe", 0); /* no point in specifying an initial value */
1661 dw_box_pack_start(combox, combobox2, -1, -1, TRUE, FALSE, 0); 1661 dw_box_pack_start(combox, combobox2, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1662 /* 1662 /*
1663 dw_window_set_text(combobox, "initial value"); 1663 dw_window_set_text(combobox, "initial value");
1664 */ 1664 */
1665 dw_signal_connect(combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL); 1665 dw_signal_connect(combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL);
1666 /* add LOTS of items */ 1666 /* add LOTS of items */
1681 /* now insert a couple of items */ 1681 /* now insert a couple of items */
1682 dw_listbox_insert(combobox2, "inserted item 2", 2); 1682 dw_listbox_insert(combobox2, "inserted item 2", 2);
1683 dw_listbox_insert(combobox2, "inserted item 5", 5); 1683 dw_listbox_insert(combobox2, "inserted item 5", 5);
1684 /* make a spinbutton */ 1684 /* make a spinbutton */
1685 spinbutton = dw_spinbutton_new("", 0); /* no point in specifying text */ 1685 spinbutton = dw_spinbutton_new("", 0); /* no point in specifying text */
1686 dw_box_pack_start(combox, spinbutton, -1, -1, TRUE, FALSE, 0); 1686 dw_box_pack_start(combox, spinbutton, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1687 dw_spinbutton_set_limits(spinbutton, 100, 1); 1687 dw_spinbutton_set_limits(spinbutton, 100, 1);
1688 dw_spinbutton_set_pos(spinbutton, 30); 1688 dw_spinbutton_set_pos(spinbutton, 30);
1689 dw_signal_connect(spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL); 1689 dw_signal_connect(spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL);
1690 /* make a slider */ 1690 /* make a slider */
1691 slider = dw_slider_new(FALSE, 11, 0); /* no point in specifying text */ 1691 slider = dw_slider_new(FALSE, 11, 0); /* no point in specifying text */
1692 dw_box_pack_start(combox, slider, -1, -1, TRUE, FALSE, 0); 1692 dw_box_pack_start(combox, slider, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1693 dw_signal_connect(slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL); 1693 dw_signal_connect(slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL);
1694 /* make a percent */ 1694 /* make a percent */
1695 percent = dw_percent_new(0); 1695 percent = dw_percent_new(0);
1696 dw_box_pack_start(combox, percent, -1, -1, TRUE, FALSE, 0); 1696 dw_box_pack_start(combox, percent, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
1697 } 1697 }
1698 1698
1699 void create_button( int redraw) 1699 void create_button(int redraw)
1700 { 1700 {
1701 HWND abutton1; 1701 HWND abutton1;
1702 filetoolbarbox = dw_box_new(DW_VERT, 0); 1702 filetoolbarbox = dw_box_new(DW_VERT, 0);
1703 dw_box_pack_start(buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0); 1703 dw_box_pack_start(buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0);
1704 1704
1815 /* create a box to pack into the notebook page */ 1815 /* create a box to pack into the notebook page */
1816 scrollbox = dw_scrollbox_new(DW_VERT, 0); 1816 scrollbox = dw_scrollbox_new(DW_VERT, 0);
1817 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); 1817 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1);
1818 1818
1819 abutton1 = dw_button_new("Show Adjustments", 0); 1819 abutton1 = dw_button_new("Show Adjustments", 0);
1820 dw_box_pack_start(scrollbox, abutton1, -1, -1, FALSE, FALSE, 0); 1820 dw_box_pack_start(scrollbox, abutton1, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
1821 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL); 1821 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL);
1822 1822
1823 for(i = 0; i < MAX_WIDGETS; i++) 1823 for(i = 0; i < MAX_WIDGETS; i++)
1824 { 1824 {
1825 tmpbox = dw_box_new(DW_HORZ, 0); 1825 tmpbox = dw_box_new(DW_HORZ, 0);
1826 dw_box_pack_start(scrollbox, tmpbox, 0, 0, TRUE, FALSE, 2); 1826 dw_box_pack_start(scrollbox, tmpbox, 0, 0, TRUE, FALSE, 2);
1827 sprintf(buf, "Label %d", i); 1827 sprintf(buf, "Label %d", i);
1828 labelarray[i] = dw_text_new(buf , 0); 1828 labelarray[i] = dw_text_new(buf , 0);
1829 dw_box_pack_start( tmpbox, labelarray[i], 0, -1, TRUE, FALSE, 0); 1829 dw_box_pack_start(tmpbox, labelarray[i], 0, DW_SIZE_AUTO, TRUE, FALSE, 0);
1830 sprintf(buf, "Entry %d", i); 1830 sprintf(buf, "Entry %d", i);
1831 entryarray[i] = dw_entryfield_new(buf , i); 1831 entryarray[i] = dw_entryfield_new(buf , i);
1832 dw_box_pack_start(tmpbox, entryarray[i], 0, -1, TRUE, FALSE, 0); 1832 dw_box_pack_start(tmpbox, entryarray[i], 0, DW_SIZE_AUTO, TRUE, FALSE, 0);
1833 } 1833 }
1834 } 1834 }
1835 1835
1836 /* Section for thread/event test */ 1836 /* Section for thread/event test */
1837 HWND threadmle, startbutton; 1837 HWND threadmle, startbutton;
1885 /* create a box to pack into the notebook page */ 1885 /* create a box to pack into the notebook page */
1886 tmpbox = dw_box_new(DW_VERT, 0); 1886 tmpbox = dw_box_new(DW_VERT, 0);
1887 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1); 1887 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1);
1888 1888
1889 startbutton = dw_button_new( "Start Threads", 0 ); 1889 startbutton = dw_button_new( "Start Threads", 0 );
1890 dw_box_pack_start(tmpbox, startbutton, -1, -1, FALSE, FALSE, 0); 1890 dw_box_pack_start(tmpbox, startbutton, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
1891 dw_signal_connect(startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL); 1891 dw_signal_connect(startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL);
1892 1892
1893 /* Create the base threading components */ 1893 /* Create the base threading components */
1894 threadmle = dw_mle_new(0); 1894 threadmle = dw_mle_new(0);
1895 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0); 1895 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0);
2086 2086
2087 dw_box_pack_start(notebookbox7, hbox, 0, 0, TRUE, FALSE, 0); 2087 dw_box_pack_start(notebookbox7, hbox, 0, 0, TRUE, FALSE, 0);
2088 2088
2089 /* Add navigation buttons */ 2089 /* Add navigation buttons */
2090 item = dw_button_new("Back", 0); 2090 item = dw_button_new("Back", 0);
2091 dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); 2091 dw_box_pack_start(hbox, item, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
2092 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_back_clicked), DW_POINTER(html)); 2092 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_back_clicked), DW_POINTER(html));
2093 2093
2094 item = dw_button_new("Forward", 0); 2094 item = dw_button_new("Forward", 0);
2095 dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); 2095 dw_box_pack_start(hbox, item, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
2096 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_forward_clicked), DW_POINTER(html)); 2096 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_forward_clicked), DW_POINTER(html));
2097 2097
2098 /* Put in some extra space */ 2098 /* Put in some extra space */
2099 dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0); 2099 dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0);
2100 2100
2101 item = dw_button_new("Reload", 0); 2101 item = dw_button_new("Reload", 0);
2102 dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); 2102 dw_box_pack_start(hbox, item, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
2103 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_reload_clicked), DW_POINTER(html)); 2103 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_reload_clicked), DW_POINTER(html));
2104 2104
2105 /* Put in some extra space */ 2105 /* Put in some extra space */
2106 dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0); 2106 dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0);
2107 dw_box_pack_start(hbox, javascript, -1, -1, TRUE, FALSE, 0); 2107 dw_box_pack_start(hbox, javascript, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, FALSE, 0);
2108 2108
2109 item = dw_button_new("Run", 0); 2109 item = dw_button_new("Run", 0);
2110 dw_window_set_data(item, "javascript", DW_POINTER(javascript)); 2110 dw_window_set_data(item, "javascript", DW_POINTER(javascript));
2111 dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0); 2111 dw_box_pack_start(hbox, item, DW_SIZE_AUTO, DW_SIZE_AUTO, FALSE, FALSE, 0);
2112 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_run_clicked), DW_POINTER(html)); 2112 dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_run_clicked), DW_POINTER(html));
2113 dw_window_click_default(javascript, item); 2113 dw_window_click_default(javascript, item);
2114 2114
2115 dw_box_pack_start(notebookbox7, html, 0, 100, TRUE, TRUE, 0); 2115 dw_box_pack_start(notebookbox7, html, 0, 100, TRUE, TRUE, 0);
2116 dw_html_url(html, "https://dbsoft.org/dw_help.php"); 2116 dw_html_url(html, "https://dbsoft.org/dw_help.php");
2117 htmlstatus = dw_status_text_new("HTML status loading...", 0); 2117 htmlstatus = dw_status_text_new("HTML status loading...", 0);
2118 dw_box_pack_start(notebookbox7, htmlstatus, 100, -1, TRUE, FALSE, 1); 2118 dw_box_pack_start(notebookbox7, htmlstatus, 100, DW_SIZE_AUTO, TRUE, FALSE, 1);
2119 dw_signal_connect(html, DW_SIGNAL_HTML_CHANGED, DW_SIGNAL_FUNC(web_html_changed), DW_POINTER(htmlstatus)); 2119 dw_signal_connect(html, DW_SIGNAL_HTML_CHANGED, DW_SIGNAL_FUNC(web_html_changed), DW_POINTER(htmlstatus));
2120 dw_signal_connect(html, DW_SIGNAL_HTML_RESULT, DW_SIGNAL_FUNC(web_html_result), DW_POINTER(javascript)); 2120 dw_signal_connect(html, DW_SIGNAL_HTML_RESULT, DW_SIGNAL_FUNC(web_html_result), DW_POINTER(javascript));
2121 } 2121 }
2122 else 2122 else
2123 { 2123 {
2124 html = dw_text_new("HTML widget not available.", 0); 2124 html = dw_text_new("HTML widget not available.", 0);
2125 dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0); 2125 dw_box_pack_start(notebookbox7, html, 0, 100, TRUE, TRUE, 0);
2126 } 2126 }
2127 } 2127 }
2128 2128
2129 /* Pretty list of features corresponding to the DWFEATURE enum in dw.h */ 2129 /* Pretty list of features corresponding to the DWFEATURE enum in dw.h */
2130 char *DWFeatureList[] = { 2130 char *DWFeatureList[] = {
2187 2187
2188 dw_debug("%s: %s (%d)\n", DWFeatureList[feat], status, result); 2188 dw_debug("%s: %s (%d)\n", DWFeatureList[feat], status, result);
2189 } 2189 }
2190 2190
2191 /* Create our window */ 2191 /* Create our window */
2192 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test UTF8 中国語 (繁体) cañón", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 2192 mainwindow = dw_window_new(HWND_DESKTOP, "dwindows test UTF8 中国語 (繁体) cañón", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
2193 dw_window_set_icon(mainwindow, fileicon); 2193 dw_window_set_icon(mainwindow, fileicon);
2194 2194
2195 menu_add(); 2195 menu_add();
2196 2196
2197 notebookbox = dw_box_new( DW_VERT, 5 ); 2197 notebookbox = dw_box_new(DW_VERT, 5);
2198 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); 2198 dw_box_pack_start(mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0);
2199 2199
2200 foldericon = dw_icon_load_from_file(FOLDER_ICON_NAME); 2200 foldericon = dw_icon_load_from_file(FOLDER_ICON_NAME);
2201 fileicon = dw_icon_load_from_file(FILE_ICON_NAME); 2201 fileicon = dw_icon_load_from_file(FILE_ICON_NAME);
2202 2202
2203 if(!foldericon && !fileicon) 2203 if(!foldericon && !fileicon)
2213 foldericon = dw_icon_load_from_file(pathbuff); 2213 foldericon = dw_icon_load_from_file(pathbuff);
2214 strncpy(&pathbuff[pos], FILE_ICON_NAME, 1024-pos); 2214 strncpy(&pathbuff[pos], FILE_ICON_NAME, 1024-pos);
2215 fileicon = dw_icon_load_from_file(pathbuff); 2215 fileicon = dw_icon_load_from_file(pathbuff);
2216 } 2216 }
2217 2217
2218 notebook = dw_notebook_new( 1, TRUE ); 2218 notebook = dw_notebook_new(1, TRUE);
2219 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); 2219 dw_box_pack_start(notebookbox, notebook, 100, 100, TRUE, TRUE, 0);
2220 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL); 2220 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL);
2221 2221
2222 notebookbox1 = dw_box_new( DW_VERT, 5 ); 2222 notebookbox1 = dw_box_new(DW_VERT, 5);
2223 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); 2223 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE);
2224 dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); 2224 dw_notebook_pack( notebook, notebookpage1, notebookbox1);
2225 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry"); 2225 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry");
2226 archive_add(); 2226 archive_add();
2227 2227
2228 notebookbox2 = dw_box_new( DW_VERT, 5 ); 2228 notebookbox2 = dw_box_new(DW_VERT, 5);
2229 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); 2229 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE);
2230 dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); 2230 dw_notebook_pack( notebook, notebookpage2, notebookbox2);
2231 dw_notebook_page_set_text( notebook, notebookpage2, "render"); 2231 dw_notebook_page_set_text(notebook, notebookpage2, "render");
2232 text_add(); 2232 text_add();
2233 2233
2234 notebookbox3 = dw_box_new( DW_VERT, 5 ); 2234 notebookbox3 = dw_box_new(DW_VERT, 5);
2235 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE ); 2235 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE);
2236 dw_notebook_pack( notebook, notebookpage3, notebookbox3 ); 2236 dw_notebook_pack( notebook, notebookpage3, notebookbox3);
2237 dw_notebook_page_set_text( notebook, notebookpage3, "tree"); 2237 dw_notebook_page_set_text( notebook, notebookpage3, "tree");
2238 tree_add(); 2238 tree_add();
2239 2239
2240 notebookbox4 = dw_box_new( DW_VERT, 5 ); 2240 notebookbox4 = dw_box_new(DW_VERT, 5);
2241 notebookpage4 = dw_notebook_page_new( notebook, 1, FALSE ); 2241 notebookpage4 = dw_notebook_page_new(notebook, 1, FALSE);
2242 dw_notebook_pack( notebook, notebookpage4, notebookbox4 ); 2242 dw_notebook_pack( notebook, notebookpage4, notebookbox4 );
2243 dw_notebook_page_set_text( notebook, notebookpage4, "container"); 2243 dw_notebook_page_set_text( notebook, notebookpage4, "container");
2244 container_add(); 2244 container_add();
2245 2245
2246 notebookbox5 = dw_box_new( DW_VERT, 5 ); 2246 notebookbox5 = dw_box_new(DW_VERT, 5);
2247 notebookpage5 = dw_notebook_page_new( notebook, 1, FALSE ); 2247 notebookpage5 = dw_notebook_page_new(notebook, 1, FALSE);
2248 dw_notebook_pack( notebook, notebookpage5, notebookbox5 ); 2248 dw_notebook_pack(notebook, notebookpage5, notebookbox5);
2249 dw_notebook_page_set_text( notebook, notebookpage5, "buttons"); 2249 dw_notebook_page_set_text(notebook, notebookpage5, "buttons");
2250 buttons_add(); 2250 buttons_add();
2251 2251
2252 #ifdef DW_INCLUDE_DEPRECATED 2252 #ifdef DW_INCLUDE_DEPRECATED
2253 notebookbox6 = dw_box_new( DW_VERT, 5 ); 2253 notebookbox6 = dw_box_new(DW_VERT, 5);
2254 notebookpage6 = dw_notebook_page_new( notebook, 1, FALSE ); 2254 notebookpage6 = dw_notebook_page_new(notebook, 1, FALSE);
2255 dw_notebook_pack( notebook, notebookpage6, notebookbox6 ); 2255 dw_notebook_pack(notebook, notebookpage6, notebookbox6);
2256 dw_notebook_page_set_text( notebook, notebookpage6, "mdi"); 2256 dw_notebook_page_set_text(notebook, notebookpage6, "mdi");
2257 mdi_add(); 2257 mdi_add();
2258 #endif 2258 #endif
2259 notebookbox7 = dw_box_new( DW_VERT, 6 ); 2259
2260 notebookpage7 = dw_notebook_page_new( notebook, 1, FALSE ); 2260 notebookbox7 = dw_box_new(DW_VERT, 6);
2261 dw_notebook_pack( notebook, notebookpage7, notebookbox7 ); 2261 notebookpage7 = dw_notebook_page_new(notebook, 1, FALSE);
2262 dw_notebook_page_set_text( notebook, notebookpage7, "html"); 2262 dw_notebook_pack(notebook, notebookpage7, notebookbox7);
2263 dw_notebook_page_set_text(notebook, notebookpage7, "html");
2263 html_add(); 2264 html_add();
2264 2265
2265 notebookbox8 = dw_box_new( DW_VERT, 7 ); 2266 notebookbox8 = dw_box_new(DW_VERT, 7);
2266 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE ); 2267 notebookpage8 = dw_notebook_page_new(notebook, 1, FALSE);
2267 dw_notebook_pack( notebook, notebookpage8, notebookbox8 ); 2268 dw_notebook_pack(notebook, notebookpage8, notebookbox8);
2268 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox"); 2269 dw_notebook_page_set_text(notebook, notebookpage8, "scrollbox");
2269 scrollbox_add(); 2270 scrollbox_add();
2270 2271
2271 notebookbox9 = dw_box_new( DW_VERT, 8 ); 2272 notebookbox9 = dw_box_new(DW_VERT, 8);
2272 notebookpage9 = dw_notebook_page_new( notebook, 1, FALSE ); 2273 notebookpage9 = dw_notebook_page_new(notebook, 1, FALSE);
2273 dw_notebook_pack( notebook, notebookpage9, notebookbox9 ); 2274 dw_notebook_pack(notebook, notebookpage9, notebookbox9);
2274 dw_notebook_page_set_text( notebook, notebookpage9, "thread/event"); 2275 dw_notebook_page_set_text(notebook, notebookpage9, "thread/event");
2275 thread_add(); 2276 thread_add();
2276 2277
2277 /* Set the default field */ 2278 /* Set the default field */
2278 dw_window_default(mainwindow, copypastefield); 2279 dw_window_default(mainwindow, copypastefield);
2279 2280