Mercurial > dwindows
comparison dwtest.c @ 1456:6bf5dc7da45d
Added automatic widget size detection a variety of places in dwtest.
Fixed missing extra height in spinbutton detection on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 15 Dec 2011 22:03:54 +0000 |
parents | e79cf0d73caf |
children | da9cd5da3440 |
comparison
equal
deleted
inserted
replaced
1455:a56fa83f2a7c | 1456:6bf5dc7da45d |
---|---|
949 dw_listbox_append(rendcombo, "Shapes Double Buffered"); | 949 dw_listbox_append(rendcombo, "Shapes Double Buffered"); |
950 dw_listbox_append(rendcombo, "Shapes Direct"); | 950 dw_listbox_append(rendcombo, "Shapes Direct"); |
951 dw_listbox_append(rendcombo, "File Display"); | 951 dw_listbox_append(rendcombo, "File Display"); |
952 label = dw_text_new("Image X:", 100); | 952 label = dw_text_new("Image X:", 100); |
953 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); | 953 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); |
954 dw_box_pack_start( hbox, label, 60, 25, FALSE, FALSE, 0); | 954 dw_box_pack_start( hbox, label, -1, 25, FALSE, FALSE, 0); |
955 imagexspin = dw_spinbutton_new("20", 1021); | 955 imagexspin = dw_spinbutton_new("20", 1021); |
956 dw_box_pack_start( hbox, imagexspin, 25, 25, TRUE, FALSE, 0); | 956 dw_box_pack_start( hbox, imagexspin, 25, 25, TRUE, FALSE, 0); |
957 label = dw_text_new("Y:", 100); | 957 label = dw_text_new("Y:", 100); |
958 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); | 958 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); |
959 dw_box_pack_start( hbox, label, 25, 25, FALSE, FALSE, 0); | 959 dw_box_pack_start( hbox, label, -1, 25, FALSE, FALSE, 0); |
960 imageyspin = dw_spinbutton_new("20", 1021); | 960 imageyspin = dw_spinbutton_new("20", 1021); |
961 dw_box_pack_start( hbox, imageyspin, 25, 25, TRUE, FALSE, 0); | 961 dw_box_pack_start( hbox, imageyspin, 25, 25, TRUE, FALSE, 0); |
962 dw_spinbutton_set_limits(imagexspin, 2000, 0); | 962 dw_spinbutton_set_limits(imagexspin, 2000, 0); |
963 dw_spinbutton_set_limits(imageyspin, 2000, 0); | 963 dw_spinbutton_set_limits(imageyspin, 2000, 0); |
964 dw_spinbutton_set_pos(imagexspin, 20); | 964 dw_spinbutton_set_pos(imagexspin, 20); |
965 dw_spinbutton_set_pos(imageyspin, 20); | 965 dw_spinbutton_set_pos(imageyspin, 20); |
966 imagestretchcheck = dw_checkbox_new("Stretch", 1021); | 966 imagestretchcheck = dw_checkbox_new("Stretch", 1021); |
967 dw_box_pack_start( hbox, imagestretchcheck, 25, 25, TRUE, FALSE, 0); | 967 dw_box_pack_start( hbox, imagestretchcheck, -1, 25, FALSE, FALSE, 0); |
968 | 968 |
969 button1 = dw_button_new( "Refresh", 1223L ); | 969 button1 = dw_button_new( "Refresh", 1223L ); |
970 dw_box_pack_start( hbox, button1, 100, 25, FALSE, FALSE, 0); | 970 dw_box_pack_start( hbox, button1, 100, 25, FALSE, FALSE, 0); |
971 button2 = dw_button_new( "Print", 1224L ); | 971 button2 = dw_button_new( "Print", 1224L ); |
972 dw_box_pack_start( hbox, button2, 100, 25, FALSE, FALSE, 0); | 972 dw_box_pack_start( hbox, button2, 100, 25, FALSE, FALSE, 0); |
1217 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 1217 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
1218 | 1218 |
1219 create_button(0); | 1219 create_button(0); |
1220 /* make a combobox */ | 1220 /* make a combobox */ |
1221 combox = dw_box_new(BOXVERT, 2); | 1221 combox = dw_box_new(BOXVERT, 2); |
1222 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0); | 1222 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, FALSE, 0); |
1223 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ | 1223 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ |
1224 dw_listbox_append( combobox1, "fred" ); | 1224 dw_listbox_append( combobox1, "fred" ); |
1225 dw_box_pack_start( combox, combobox1, 200, 20, TRUE, FALSE, 0); | 1225 dw_box_pack_start( combox, combobox1, -1, -1, TRUE, FALSE, 0); |
1226 /* | 1226 /* |
1227 dw_window_set_text( combobox, "initial value"); | 1227 dw_window_set_text( combobox, "initial value"); |
1228 */ | 1228 */ |
1229 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); | 1229 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); |
1230 #if 0 | 1230 #if 0 |
1237 } | 1237 } |
1238 dw_debug("after appending 100 items to combobox\n"); | 1238 dw_debug("after appending 100 items to combobox\n"); |
1239 #endif | 1239 #endif |
1240 | 1240 |
1241 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ | 1241 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ |
1242 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0); | 1242 dw_box_pack_start( combox, combobox2, -1, -1, TRUE, FALSE, 0); |
1243 /* | 1243 /* |
1244 dw_window_set_text( combobox, "initial value"); | 1244 dw_window_set_text( combobox, "initial value"); |
1245 */ | 1245 */ |
1246 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); | 1246 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); |
1247 /* add LOTS of items */ | 1247 /* add LOTS of items */ |
1262 /* now insert a couple of items */ | 1262 /* now insert a couple of items */ |
1263 dw_listbox_insert( combobox2, "inserted item 2", 2 ); | 1263 dw_listbox_insert( combobox2, "inserted item 2", 2 ); |
1264 dw_listbox_insert( combobox2, "inserted item 5", 5 ); | 1264 dw_listbox_insert( combobox2, "inserted item 5", 5 ); |
1265 /* make a spinbutton */ | 1265 /* make a spinbutton */ |
1266 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */ | 1266 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */ |
1267 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0); | 1267 dw_box_pack_start( combox, spinbutton, -1, -1, TRUE, FALSE, 0); |
1268 dw_spinbutton_set_limits( spinbutton, 100, 1 ); | 1268 dw_spinbutton_set_limits( spinbutton, 100, 1 ); |
1269 dw_spinbutton_set_pos( spinbutton, 30 ); | 1269 dw_spinbutton_set_pos( spinbutton, 30 ); |
1270 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); | 1270 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); |
1271 /* make a slider */ | 1271 /* make a slider */ |
1272 slider = dw_slider_new( FALSE, 11, 0 ); /* no point in specifying text */ | 1272 slider = dw_slider_new( FALSE, 11, 0 ); /* no point in specifying text */ |
1273 dw_box_pack_start( combox, slider, 200, 20, TRUE, FALSE, 0); | 1273 dw_box_pack_start( combox, slider, -1, -1, TRUE, FALSE, 0); |
1274 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); | 1274 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); |
1275 /* make a percent */ | 1275 /* make a percent */ |
1276 percent = dw_percent_new( 0 ); | 1276 percent = dw_percent_new( 0 ); |
1277 dw_box_pack_start( combox, percent, 200, 20, TRUE, FALSE, 0); | 1277 dw_box_pack_start( combox, percent, -1, -1, TRUE, FALSE, 0); |
1278 } | 1278 } |
1279 | 1279 |
1280 void create_button( int redraw) | 1280 void create_button( int redraw) |
1281 { | 1281 { |
1282 HWND abutton1; | 1282 HWND abutton1; |
1393 /* create a box to pack into the notebook page */ | 1393 /* create a box to pack into the notebook page */ |
1394 scrollbox = dw_scrollbox_new(DW_VERT, 0); | 1394 scrollbox = dw_scrollbox_new(DW_VERT, 0); |
1395 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); | 1395 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); |
1396 | 1396 |
1397 abutton1 = dw_button_new( "Show Adjustments", 0 ); | 1397 abutton1 = dw_button_new( "Show Adjustments", 0 ); |
1398 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 ); | 1398 dw_box_pack_start( scrollbox, abutton1, -1, 30, FALSE, FALSE, 0 ); |
1399 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); | 1399 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); |
1400 | 1400 |
1401 for ( i = 0; i < MAX_WIDGETS; i++ ) | 1401 for ( i = 0; i < MAX_WIDGETS; i++ ) |
1402 { | 1402 { |
1403 tmpbox = dw_box_new( DW_HORZ, 0 ); | 1403 tmpbox = dw_box_new( DW_HORZ, 0 ); |
1463 /* create a box to pack into the notebook page */ | 1463 /* create a box to pack into the notebook page */ |
1464 tmpbox = dw_box_new(DW_VERT, 0); | 1464 tmpbox = dw_box_new(DW_VERT, 0); |
1465 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1); | 1465 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1); |
1466 | 1466 |
1467 startbutton = dw_button_new( "Start Threads", 0 ); | 1467 startbutton = dw_button_new( "Start Threads", 0 ); |
1468 dw_box_pack_start( tmpbox, startbutton, 100, 30, FALSE, FALSE, 0 ); | 1468 dw_box_pack_start( tmpbox, startbutton, -1, 30, FALSE, FALSE, 0 ); |
1469 dw_signal_connect( startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL ); | 1469 dw_signal_connect( startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL ); |
1470 | 1470 |
1471 /* Create the base threading components */ | 1471 /* Create the base threading components */ |
1472 threadmle = dw_mle_new(0); | 1472 threadmle = dw_mle_new(0); |
1473 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0); | 1473 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0); |