Mercurial > dwindows
comparison dwtest.c @ 1049:b3674ea2909f
Put http://dwindows.netlabs.org back in as test site for HTML widget
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 01 Jun 2011 23:07:27 +0000 |
parents | 2c2fcfeeffcc |
children | 34f1d6f5f1c3 |
comparison
equal
deleted
inserted
replaced
1048:70bad8a91370 | 1049:b3674ea2909f |
---|---|
232 { | 232 { |
233 if(render_type != 1) | 233 if(render_type != 1) |
234 { | 234 { |
235 HPIXMAP hpm; | 235 HPIXMAP hpm; |
236 unsigned long width,height; | 236 unsigned long width,height; |
237 | 237 |
238 if ( hwnd == textbox1 ) | 238 if ( hwnd == textbox1 ) |
239 hpm = text1pm; | 239 hpm = text1pm; |
240 else if ( hwnd == textbox2 ) | 240 else if ( hwnd == textbox2 ) |
241 hpm = text2pm; | 241 hpm = text2pm; |
242 else | 242 else |
243 return TRUE; | 243 return TRUE; |
244 | 244 |
245 width = (int)DW_PIXMAP_WIDTH(hpm); | 245 width = (int)DW_PIXMAP_WIDTH(hpm); |
246 height = (int)DW_PIXMAP_HEIGHT(hpm); | 246 height = (int)DW_PIXMAP_HEIGHT(hpm); |
247 | 247 |
248 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); | 248 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); |
249 dw_flush(); | 249 dw_flush(); |
250 } | 250 } |
251 else | 251 else |
252 { | 252 { |
284 void draw_file( int row, int col ) | 284 void draw_file( int row, int col ) |
285 { | 285 { |
286 char buf[10]; | 286 char buf[10]; |
287 int i,y,fileline; | 287 int i,y,fileline; |
288 char *pLine; | 288 char *pLine; |
289 | 289 |
290 if ( current_file ) | 290 if ( current_file ) |
291 { | 291 { |
292 dw_color_foreground_set(DW_CLR_WHITE); | 292 dw_color_foreground_set(DW_CLR_WHITE); |
293 dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); | 293 dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); |
294 dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm)); | 294 dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm)); |
295 | 295 |
296 for ( i = 0;(i < rows) && (i+row < num_lines); i++) | 296 for ( i = 0;(i < rows) && (i+row < num_lines); i++) |
297 { | 297 { |
298 fileline = i + row - 1; | 298 fileline = i + row - 1; |
299 y = i*font_height; | 299 y = i*font_height; |
300 dw_color_background_set( 1 + (fileline % 15) ); | 300 dw_color_background_set( 1 + (fileline % 15) ); |
312 void draw_shapes(int direct) | 312 void draw_shapes(int direct) |
313 { | 313 { |
314 int width = (int)DW_PIXMAP_WIDTH(text2pm), height = (int)DW_PIXMAP_HEIGHT(text2pm); | 314 int width = (int)DW_PIXMAP_WIDTH(text2pm), height = (int)DW_PIXMAP_HEIGHT(text2pm); |
315 HPIXMAP pixmap = direct ? NULL : text2pm; | 315 HPIXMAP pixmap = direct ? NULL : text2pm; |
316 HWND window = direct ? textbox2 : 0; | 316 HWND window = direct ? textbox2 : 0; |
317 | 317 |
318 image_x = (int)dw_spinbutton_get_pos(imagexspin); | 318 image_x = (int)dw_spinbutton_get_pos(imagexspin); |
319 image_y = (int)dw_spinbutton_get_pos(imageyspin); | 319 image_y = (int)dw_spinbutton_get_pos(imageyspin); |
320 | 320 |
321 dw_color_foreground_set(DW_CLR_WHITE); | 321 dw_color_foreground_set(DW_CLR_WHITE); |
322 dw_draw_rect(window, pixmap, TRUE, 0, 0, width, height); | 322 dw_draw_rect(window, pixmap, TRUE, 0, 0, width, height); |
323 dw_color_foreground_set(DW_CLR_DARKPINK); | 323 dw_color_foreground_set(DW_CLR_DARKPINK); |
324 dw_draw_rect(window, pixmap, TRUE, 10, 10, width - 20, height - 20); | 324 dw_draw_rect(window, pixmap, TRUE, 10, 10, width - 20, height - 20); |
325 dw_color_foreground_set(DW_CLR_GREEN); | 325 dw_color_foreground_set(DW_CLR_GREEN); |
327 dw_draw_text(window, pixmap, 10, 10, "This should be aligned with the edges."); | 327 dw_draw_text(window, pixmap, 10, 10, "This should be aligned with the edges."); |
328 if(image) | 328 if(image) |
329 { | 329 { |
330 dw_pixmap_bitblt(window, pixmap, image_x, image_y, DW_PIXMAP_WIDTH(image), DW_PIXMAP_HEIGHT(image), 0, image, 0, 0); | 330 dw_pixmap_bitblt(window, pixmap, image_x, image_y, DW_PIXMAP_WIDTH(image), DW_PIXMAP_HEIGHT(image), 0, image, 0, 0); |
331 } | 331 } |
332 | 332 |
333 /* If we aren't drawing direct do a bitblt */ | 333 /* If we aren't drawing direct do a bitblt */ |
334 if(!direct) | 334 if(!direct) |
335 { | 335 { |
336 text_expose( textbox2, NULL, NULL); | 336 text_expose( textbox2, NULL, NULL); |
337 } | 337 } |
425 } | 425 } |
426 | 426 |
427 int DWSIGNAL menu_callback(HWND window, void *data) | 427 int DWSIGNAL menu_callback(HWND window, void *data) |
428 { | 428 { |
429 char buf[100]; | 429 char buf[100]; |
430 | 430 |
431 sprintf( buf, "%s menu item selected", (char *)data ); | 431 sprintf( buf, "%s menu item selected", (char *)data ); |
432 dw_messagebox( "Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf ); | 432 dw_messagebox( "Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf ); |
433 return 0; | 433 return 0; |
434 } | 434 } |
435 | 435 |
452 | 452 |
453 int DWSIGNAL helpabout_callback(HWND window, void *data) | 453 int DWSIGNAL helpabout_callback(HWND window, void *data) |
454 { | 454 { |
455 char buf[100]; | 455 char buf[100]; |
456 DWEnv env; | 456 DWEnv env; |
457 | 457 |
458 dw_environment_query(&env); | 458 dw_environment_query(&env); |
459 sprintf( buf, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\ndwindows Version: %d.%d.%d", | 459 sprintf( buf, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\ndwindows Version: %d.%d.%d", |
460 env.osName, env.buildDate, env.buildTime, | 460 env.osName, env.buildDate, env.buildTime, |
461 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, | 461 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, |
462 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion ); | 462 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion ); |
513 int len; | 513 int len; |
514 long spvalue; | 514 long spvalue; |
515 char buf1[100]; | 515 char buf1[100]; |
516 char buf2[100]; | 516 char buf2[100]; |
517 char buf3[500]; | 517 char buf3[500]; |
518 | 518 |
519 idx = dw_listbox_selected( combobox1 ); | 519 idx = dw_listbox_selected( combobox1 ); |
520 dw_listbox_get_text( combobox1, idx, buf1, 99 ); | 520 dw_listbox_get_text( combobox1, idx, buf1, 99 ); |
521 idx = dw_listbox_selected( combobox2 ); | 521 idx = dw_listbox_selected( combobox2 ); |
522 dw_listbox_get_text( combobox2, idx, buf2, 99 ); | 522 dw_listbox_get_text( combobox2, idx, buf2, 99 ); |
523 dw_calendar_get_date( cal, &y, &m, &d ); | 523 dw_calendar_get_date( cal, &y, &m, &d ); |
532 } | 532 } |
533 | 533 |
534 int DWSIGNAL redraw_button_box_callback(HWND window, void *data) | 534 int DWSIGNAL redraw_button_box_callback(HWND window, void *data) |
535 { | 535 { |
536 #if 0 | 536 #if 0 |
537 | 537 |
538 long x, y, width, height; | 538 long x, y, width, height; |
539 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height); | 539 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height); |
540 dw_window_destroy( filetoolbarbox ); | 540 dw_window_destroy( filetoolbarbox ); |
541 create_button(1); | 541 create_button(1); |
542 dw_window_set_pos_size(filetoolbarbox, x, y, width, height); | 542 dw_window_set_pos_size(filetoolbarbox, x, y, width, height); |
596 /* Handle size change of the main render window */ | 596 /* Handle size change of the main render window */ |
597 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) | 597 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) |
598 { | 598 { |
599 HPIXMAP old1 = text1pm, old2 = text2pm; | 599 HPIXMAP old1 = text1pm, old2 = text2pm; |
600 unsigned long depth = dw_color_depth_get(); | 600 unsigned long depth = dw_color_depth_get(); |
601 | 601 |
602 rows = height / font_height; | 602 rows = height / font_height; |
603 cols = width / font_width; | 603 cols = width / font_width; |
604 | 604 |
605 /* Create new pixmaps with the current sizes */ | 605 /* Create new pixmaps with the current sizes */ |
606 text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth); | 606 text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth); |
607 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth); | 607 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth); |
608 | 608 |
609 /* Destroy the old pixmaps */ | 609 /* Destroy the old pixmaps */ |
610 dw_pixmap_destroy(old1); | 610 dw_pixmap_destroy(old1); |
611 dw_pixmap_destroy(old2); | 611 dw_pixmap_destroy(old2); |
612 | 612 |
613 /* Update scrollbar ranges with new values */ | 613 /* Update scrollbar ranges with new values */ |
614 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); | 614 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); |
615 dw_scrollbar_set_range(vscrollbar, num_lines, rows); | 615 dw_scrollbar_set_range(vscrollbar, num_lines, rows); |
616 | 616 |
617 /* Redraw the window */ | 617 /* Redraw the window */ |
618 update_render(); | 618 update_render(); |
619 return TRUE; | 619 return TRUE; |
620 } | 620 } |
621 | 621 |
622 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data ) | 622 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data ) |
623 { | 623 { |
624 char buf[200]; | 624 char buf[200]; |
625 HWND statline = (HWND)data; | 625 HWND statline = (HWND)data; |
626 | 626 |
627 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text ); | 627 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text ); |
628 dw_window_set_text( statline, buf); | 628 dw_window_set_text( statline, buf); |
629 return 0; | 629 return 0; |
630 } | 630 } |
631 | 631 |
632 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata ) | 632 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata ) |
633 { | 633 { |
634 char buf[200]; | 634 char buf[200]; |
635 HWND statline = (HWND)data; | 635 HWND statline = (HWND)data; |
636 | 636 |
637 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata ); | 637 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata ); |
638 dw_window_set_text( statline, buf); | 638 dw_window_set_text( statline, buf); |
639 return 0; | 639 return 0; |
640 } | 640 } |
641 | 641 |
642 int DWSIGNAL list_select_cb( HWND window, int item, void *data ) | 642 int DWSIGNAL list_select_cb( HWND window, int item, void *data ) |
643 { | 643 { |
644 char buf[200]; | 644 char buf[200]; |
645 HWND statline = (HWND)data; | 645 HWND statline = (HWND)data; |
646 | 646 |
647 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item ); | 647 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item ); |
648 dw_window_set_text( statline, buf); | 648 dw_window_set_text( statline, buf); |
649 return 0; | 649 return 0; |
650 } | 650 } |
651 | 651 |
652 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) | 652 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) |
653 { | 653 { |
654 char buf[200]; | 654 char buf[200]; |
655 HWND statline = (HWND)data; | 655 HWND statline = (HWND)data; |
656 | 656 |
657 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); | 657 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); |
658 dw_window_set_text( statline, buf); | 658 dw_window_set_text( statline, buf); |
659 return 0; | 659 return 0; |
660 } | 660 } |
661 | 661 |
663 { | 663 { |
664 char buf[200]; | 664 char buf[200]; |
665 char *str; | 665 char *str; |
666 HWND statline = (HWND)data; | 666 HWND statline = (HWND)data; |
667 unsigned long size; | 667 unsigned long size; |
668 | 668 |
669 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); | 669 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); |
670 dw_window_set_text( statline, buf); | 670 dw_window_set_text( statline, buf); |
671 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); | 671 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); |
672 mle_point = dw_mle_import( container_mle, buf, mle_point); | 672 mle_point = dw_mle_import( container_mle, buf, mle_point); |
673 str = dw_container_query_start(container, DW_CRA_SELECTED); | 673 str = dw_container_query_start(container, DW_CRA_SELECTED); |
699 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data ) | 699 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data ) |
700 { | 700 { |
701 char buf[200], buf1[100]; | 701 char buf[200], buf1[100]; |
702 HWND statline = (HWND)data; | 702 HWND statline = (HWND)data; |
703 int column_type; | 703 int column_type; |
704 | 704 |
705 if(column_num == 0) | 705 if(column_num == 0) |
706 strcpy(buf1,"Filename"); | 706 strcpy(buf1,"Filename"); |
707 else | 707 else |
708 { | 708 { |
709 column_type = dw_filesystem_get_column_type( window, column_num-1 ); | 709 column_type = dw_filesystem_get_column_type( window, column_num-1 ); |
732 } | 732 } |
733 | 733 |
734 void archive_add(void) | 734 void archive_add(void) |
735 { | 735 { |
736 HWND browsefilebutton, browsefolderbutton, browsebox; | 736 HWND browsefilebutton, browsefolderbutton, browsebox; |
737 | 737 |
738 lbbox = dw_box_new(BOXVERT, 10); | 738 lbbox = dw_box_new(BOXVERT, 10); |
739 | 739 |
740 dw_box_pack_start(notebookbox1, lbbox, 150, 70, TRUE, TRUE, 0); | 740 dw_box_pack_start(notebookbox1, lbbox, 150, 70, TRUE, TRUE, 0); |
741 | 741 |
742 /* Archive Name */ | 742 /* Archive Name */ |
743 stext = dw_text_new("File to browse", 0); | 743 stext = dw_text_new("File to browse", 0); |
744 | 744 |
745 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); | 745 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); |
746 | 746 |
747 dw_box_pack_start(lbbox, stext, 130, 15, TRUE, TRUE, 2); | 747 dw_box_pack_start(lbbox, stext, 130, 15, TRUE, TRUE, 2); |
748 | 748 |
749 browsebox = dw_box_new(BOXHORZ, 0); | 749 browsebox = dw_box_new(BOXHORZ, 0); |
750 | 750 |
751 dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); | 751 dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); |
752 | 752 |
753 entryfield = dw_entryfield_new("", 100L); | 753 entryfield = dw_entryfield_new("", 100L); |
754 | 754 |
755 dw_entryfield_set_limit(entryfield, 260); | 755 dw_entryfield_set_limit(entryfield, 260); |
756 | 756 |
757 dw_box_pack_start(browsebox, entryfield, 100, 15, TRUE, TRUE, 4); | 757 dw_box_pack_start(browsebox, entryfield, 100, 15, TRUE, TRUE, 4); |
758 | 758 |
759 browsefilebutton = dw_button_new("Browse File", 1001L); | 759 browsefilebutton = dw_button_new("Browse File", 1001L); |
760 | 760 |
761 dw_box_pack_start(browsebox, browsefilebutton, 40, 15, TRUE, TRUE, 0); | 761 dw_box_pack_start(browsebox, browsefilebutton, 40, 15, TRUE, TRUE, 0); |
762 | 762 |
763 browsefolderbutton = dw_button_new("Browse Folder", 1001L); | 763 browsefolderbutton = dw_button_new("Browse Folder", 1001L); |
764 | 764 |
765 dw_box_pack_start(browsebox, browsefolderbutton, 40, 15, TRUE, TRUE, 0); | 765 dw_box_pack_start(browsebox, browsefolderbutton, 40, 15, TRUE, TRUE, 0); |
766 | 766 |
767 dw_window_set_color(browsebox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 767 dw_window_set_color(browsebox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
768 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 768 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
769 | 769 |
770 /* Buttons */ | 770 /* Buttons */ |
771 buttonbox = dw_box_new(BOXHORZ, 10); | 771 buttonbox = dw_box_new(BOXHORZ, 10); |
772 | 772 |
773 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); | 773 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); |
774 | 774 |
775 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); | 775 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); |
776 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); | 776 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); |
777 | 777 |
778 colorchoosebutton = dw_button_new("Color Chooser Dialog", 1004L); | 778 colorchoosebutton = dw_button_new("Color Chooser Dialog", 1004L); |
779 dw_box_pack_start(buttonbox, colorchoosebutton, 130, 30, TRUE, TRUE, 2); | 779 dw_box_pack_start(buttonbox, colorchoosebutton, 130, 30, TRUE, TRUE, 2); |
780 | 780 |
781 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); | 781 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); |
782 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); | 782 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); |
783 | 783 |
784 cancelbutton = dw_button_new("Exit", 1002L); | 784 cancelbutton = dw_button_new("Exit", 1002L); |
785 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); | 785 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); |
786 dw_window_click_default( mainwindow, cancelbutton ); | 786 dw_window_click_default( mainwindow, cancelbutton ); |
787 | 787 |
788 /* Set some nice fonts and colors */ | 788 /* Set some nice fonts and colors */ |
789 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); | 789 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
790 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); | 790 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
791 dw_window_set_color(okbutton, DW_CLR_PALEGRAY, DW_CLR_DARKCYAN); | 791 dw_window_set_color(okbutton, DW_CLR_PALEGRAY, DW_CLR_DARKCYAN); |
792 | 792 |
793 dw_signal_connect(browsefilebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_file_callback), (void *)notebookbox1); | 793 dw_signal_connect(browsefilebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_file_callback), (void *)notebookbox1); |
794 dw_signal_connect(browsefolderbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_folder_callback), (void *)notebookbox1); | 794 dw_signal_connect(browsefolderbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_folder_callback), (void *)notebookbox1); |
795 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); | 795 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); |
796 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); | 796 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
797 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow); | 797 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow); |
808 | 808 |
809 void text_add(void) | 809 void text_add(void) |
810 { | 810 { |
811 unsigned long depth = dw_color_depth_get(); | 811 unsigned long depth = dw_color_depth_get(); |
812 HWND vscrollbox, hbox, button1, label; | 812 HWND vscrollbox, hbox, button1, label; |
813 | 813 |
814 /* create a box to pack into the notebook page */ | 814 /* create a box to pack into the notebook page */ |
815 pagebox = dw_box_new(BOXHORZ, 2); | 815 pagebox = dw_box_new(BOXHORZ, 2); |
816 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); | 816 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); |
817 /* now a status area under this box */ | 817 /* now a status area under this box */ |
818 hbox = dw_box_new(BOXHORZ, 1 ); | 818 hbox = dw_box_new(BOXHORZ, 1 ); |
844 dw_spinbutton_set_pos(imagexspin, 20); | 844 dw_spinbutton_set_pos(imagexspin, 20); |
845 dw_spinbutton_set_pos(imageyspin, 20); | 845 dw_spinbutton_set_pos(imageyspin, 20); |
846 | 846 |
847 button1 = dw_button_new( "Refresh", 1223L ); | 847 button1 = dw_button_new( "Refresh", 1223L ); |
848 dw_box_pack_start( hbox, button1, 50, 25, TRUE, FALSE, 0); | 848 dw_box_pack_start( hbox, button1, 50, 25, TRUE, FALSE, 0); |
849 | 849 |
850 /* create render box for number pixmap */ | 850 /* create render box for number pixmap */ |
851 textbox1 = dw_render_new( 100 ); | 851 textbox1 = dw_render_new( 100 ); |
852 dw_window_set_font(textbox1, FIXEDFONT); | 852 dw_window_set_font(textbox1, FIXEDFONT); |
853 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height); | 853 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height); |
854 font_width = font_width / 2; | 854 font_width = font_width / 2; |
855 vscrollbox = dw_box_new(BOXVERT, 0); | 855 vscrollbox = dw_box_new(BOXVERT, 0); |
856 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0); | 856 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0); |
857 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0); | 857 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0); |
858 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); | 858 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); |
859 | 859 |
860 /* pack empty space 1 character wide */ | 860 /* pack empty space 1 character wide */ |
861 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0); | 861 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0); |
862 | 862 |
863 /* create box for filecontents and horz scrollbar */ | 863 /* create box for filecontents and horz scrollbar */ |
864 textboxA = dw_box_new( BOXVERT,0 ); | 864 textboxA = dw_box_new( BOXVERT,0 ); |
865 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); | 865 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); |
866 | 866 |
867 /* create render box for filecontents pixmap */ | 867 /* create render box for filecontents pixmap */ |
868 textbox2 = dw_render_new( 101 ); | 868 textbox2 = dw_render_new( 101 ); |
869 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0); | 869 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0); |
870 dw_window_set_font(textbox2, FIXEDFONT); | 870 dw_window_set_font(textbox2, FIXEDFONT); |
871 /* create horizonal scrollbar */ | 871 /* create horizonal scrollbar */ |
872 hscrollbar = dw_scrollbar_new(FALSE, 50); | 872 hscrollbar = dw_scrollbar_new(FALSE, 50); |
873 dw_box_pack_start( textboxA, hscrollbar, 100, SCROLLBARWIDTH, TRUE, FALSE, 0); | 873 dw_box_pack_start( textboxA, hscrollbar, 100, SCROLLBARWIDTH, TRUE, FALSE, 0); |
874 | 874 |
875 /* create vertical scrollbar */ | 875 /* create vertical scrollbar */ |
876 vscrollbox = dw_box_new(BOXVERT, 0); | 876 vscrollbox = dw_box_new(BOXVERT, 0); |
877 vscrollbar = dw_scrollbar_new(TRUE, 50); | 877 vscrollbar = dw_scrollbar_new(TRUE, 50); |
878 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0); | 878 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0); |
879 /* Pack an area of empty space 14x14 pixels */ | 879 /* Pack an area of empty space 14x14 pixels */ |
880 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0); | 880 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0); |
881 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); | 881 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); |
882 | 882 |
883 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, (int)depth ); | 883 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, (int)depth ); |
884 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, (int)depth ); | 884 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, (int)depth ); |
885 image = dw_pixmap_new_from_file(textbox2, "image/test"); | 885 image = dw_pixmap_new_from_file(textbox2, "image/test"); |
886 if(!image) | 886 if(!image) |
887 image = dw_pixmap_new_from_file(textbox2, "~/test"); | 887 image = dw_pixmap_new_from_file(textbox2, "~/test"); |
888 if(image) | 888 if(image) |
889 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE); | 889 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE); |
890 | 890 |
891 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); | 891 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); |
892 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); | 892 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); |
893 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); | 893 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); |
894 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); | 894 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); |
895 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); | 895 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); |
905 | 905 |
906 void tree_add(void) | 906 void tree_add(void) |
907 { | 907 { |
908 HTREEITEM t1,t2,t3,t4,t5,t6; | 908 HTREEITEM t1,t2,t3,t4,t5,t6; |
909 HWND listbox; | 909 HWND listbox; |
910 | 910 |
911 /* create a box to pack into the notebook page */ | 911 /* create a box to pack into the notebook page */ |
912 listbox = dw_listbox_new(1024, TRUE); | 912 listbox = dw_listbox_new(1024, TRUE); |
913 dw_box_pack_start( notebookbox3, listbox, 500, 200, TRUE, TRUE, 0); | 913 dw_box_pack_start( notebookbox3, listbox, 500, 200, TRUE, TRUE, 0); |
914 dw_listbox_append(listbox, "Test 1"); | 914 dw_listbox_append(listbox, "Test 1"); |
915 dw_listbox_append(listbox, "Test 2"); | 915 dw_listbox_append(listbox, "Test 2"); |
916 dw_listbox_append(listbox, "Test 3"); | 916 dw_listbox_append(listbox, "Test 3"); |
917 dw_listbox_append(listbox, "Test 4"); | 917 dw_listbox_append(listbox, "Test 4"); |
918 dw_listbox_append(listbox, "Test 5"); | 918 dw_listbox_append(listbox, "Test 5"); |
919 | 919 |
920 /* create a box to pack into the notebook page */ | 920 /* create a box to pack into the notebook page */ |
921 treebox = dw_box_new(BOXHORZ, 2); | 921 treebox = dw_box_new(BOXHORZ, 2); |
922 dw_box_pack_start( notebookbox3, treebox, 500, 200, TRUE, TRUE, 0); | 922 dw_box_pack_start( notebookbox3, treebox, 500, 200, TRUE, TRUE, 0); |
923 | 923 |
924 /* now a tree area under this box */ | 924 /* now a tree area under this box */ |
925 tree = dw_tree_new(101); | 925 tree = dw_tree_new(101); |
926 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1); | 926 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1); |
927 | 927 |
928 /* and a status area to see whats going on */ | 928 /* and a status area to see whats going on */ |
929 tree_status = dw_status_text_new("", 0); | 929 tree_status = dw_status_text_new("", 0); |
930 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1); | 930 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1); |
931 | 931 |
932 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME ); | 932 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME ); |
933 fileicon = dw_icon_load_from_file( FILE_ICON_NAME ); | 933 fileicon = dw_icon_load_from_file( FILE_ICON_NAME ); |
934 | 934 |
935 /* set up our signal trappers... */ | 935 /* set up our signal trappers... */ |
936 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status); | 936 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status); |
937 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status); | 937 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status); |
938 | 938 |
939 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, (void *)1 ); | 939 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, (void *)1 ); |
940 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, (void *)2 ); | 940 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, (void *)2 ); |
941 t3 = dw_tree_insert(tree, "tree file 1", fileicon, t1, (void *)3 ); | 941 t3 = dw_tree_insert(tree, "tree file 1", fileicon, t1, (void *)3 ); |
942 t4 = dw_tree_insert(tree, "tree file 2", fileicon, t1, (void *)4 ); | 942 t4 = dw_tree_insert(tree, "tree file 2", fileicon, t1, (void *)4 ); |
943 t5 = dw_tree_insert(tree, "tree file 3", fileicon, t2, (void *)5 ); | 943 t5 = dw_tree_insert(tree, "tree file 3", fileicon, t2, (void *)5 ); |
959 int z; | 959 int z; |
960 CTIME time; | 960 CTIME time; |
961 CDATE date; | 961 CDATE date; |
962 unsigned long size; | 962 unsigned long size; |
963 HICN thisicon; | 963 HICN thisicon; |
964 | 964 |
965 /* create a box to pack into the notebook page */ | 965 /* create a box to pack into the notebook page */ |
966 containerbox = dw_box_new(BOXHORZ, 2); | 966 containerbox = dw_box_new(BOXHORZ, 2); |
967 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0); | 967 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0); |
968 | 968 |
969 /* now a container area under this box */ | 969 /* now a container area under this box */ |
970 container = dw_container_new(100, TRUE); | 970 container = dw_container_new(100, TRUE); |
971 dw_box_pack_start( notebookbox4, container, 500, 200, TRUE, FALSE, 1); | 971 dw_box_pack_start( notebookbox4, container, 500, 200, TRUE, FALSE, 1); |
972 | 972 |
973 /* and a status area to see whats going on */ | 973 /* and a status area to see whats going on */ |
974 container_status = dw_status_text_new("", 0); | 974 container_status = dw_status_text_new("", 0); |
975 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1); | 975 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1); |
976 | 976 |
977 titles[0] = "Type"; | 977 titles[0] = "Type"; |
978 titles[1] = "Size"; | 978 titles[1] = "Size"; |
979 titles[2] = "Time"; | 979 titles[2] = "Time"; |
980 titles[3] = "Date"; | 980 titles[3] = "Date"; |
981 | 981 |
982 dw_filesystem_setup(container, flags, titles, 4); | 982 dw_filesystem_setup(container, flags, titles, 4); |
983 containerinfo = dw_container_alloc(container, 3); | 983 containerinfo = dw_container_alloc(container, 3); |
984 | 984 |
985 for(z=0;z<3;z++) | 985 for(z=0;z<3;z++) |
986 { | 986 { |
987 names[z] = (char *)malloc( 100 ); | 987 names[z] = (char *)malloc( 100 ); |
988 /* yes, there is a memory leak here */ | 988 /* yes, there is a memory leak here */ |
989 sprintf(names[z],"Don't allocate from stack: Item: %d",z); | 989 sprintf(names[z],"Don't allocate from stack: Item: %d",z); |
993 else thisicon = fileicon; | 993 else thisicon = fileicon; |
994 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); | 994 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); |
995 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); | 995 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); |
996 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon); | 996 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon); |
997 dw_filesystem_set_item(container, containerinfo, 1, z, &size); | 997 dw_filesystem_set_item(container, containerinfo, 1, z, &size); |
998 | 998 |
999 time.seconds = z+10; | 999 time.seconds = z+10; |
1000 time.minutes = z+10; | 1000 time.minutes = z+10; |
1001 time.hours = z+10; | 1001 time.hours = z+10; |
1002 dw_filesystem_set_item(container, containerinfo, 2, z, &time); | 1002 dw_filesystem_set_item(container, containerinfo, 2, z, &time); |
1003 | 1003 |
1004 date.day = z+10; | 1004 date.day = z+10; |
1005 date.month = z+10; | 1005 date.month = z+10; |
1006 date.year = z+2000; | 1006 date.year = z+2000; |
1007 dw_filesystem_set_item(container, containerinfo, 3, z, &date); | 1007 dw_filesystem_set_item(container, containerinfo, 3, z, &date); |
1008 | 1008 |
1009 dw_container_set_row_title(containerinfo, z, names[z]); | 1009 dw_container_set_row_title(containerinfo, z, names[z]); |
1010 } | 1010 } |
1011 | 1011 |
1012 dw_container_insert(container, containerinfo, 3); | 1012 dw_container_insert(container, containerinfo, 3); |
1013 | 1013 |
1014 containerinfo = dw_container_alloc(container, 1); | 1014 containerinfo = dw_container_alloc(container, 1); |
1015 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon); | 1015 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon); |
1016 size = 324; | 1016 size = 324; |
1017 dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon); | 1017 dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon); |
1018 dw_filesystem_set_item(container, containerinfo, 1, 0, &size); | 1018 dw_filesystem_set_item(container, containerinfo, 1, 0, &size); |
1019 dw_filesystem_set_item(container, containerinfo, 2, 0, &time); | 1019 dw_filesystem_set_item(container, containerinfo, 2, 0, &time); |
1020 dw_filesystem_set_item(container, containerinfo, 3, 0, &date); | 1020 dw_filesystem_set_item(container, containerinfo, 3, 0, &date); |
1021 dw_container_set_row_title(containerinfo, 0, strdup("Extra")); | 1021 dw_container_set_row_title(containerinfo, 0, strdup("Extra")); |
1022 | 1022 |
1023 dw_container_insert(container, containerinfo, 1); | 1023 dw_container_insert(container, containerinfo, 1); |
1024 dw_container_optimize(container); | 1024 dw_container_optimize(container); |
1025 | 1025 |
1026 container_mle = dw_mle_new( 111 ); | 1026 container_mle = dw_mle_new( 111 ); |
1027 dw_box_pack_start( containerbox, container_mle, 500, 200, TRUE, TRUE, 0); | 1027 dw_box_pack_start( containerbox, container_mle, 500, 200, TRUE, TRUE, 0); |
1028 | 1028 |
1029 mle_point = dw_mle_import(container_mle, "", -1); | 1029 mle_point = dw_mle_import(container_mle, "", -1); |
1030 sprintf(buffer, "[%d]", mle_point); | 1030 sprintf(buffer, "[%d]", mle_point); |
1031 mle_point = dw_mle_import(container_mle, buffer, mle_point); | 1031 mle_point = dw_mle_import(container_mle, buffer, mle_point); |
1032 sprintf(buffer, "[%d]abczxydefijkl", mle_point); | 1032 sprintf(buffer, "[%d]abczxydefijkl", mle_point); |
1033 mle_point = dw_mle_import(container_mle, buffer, mle_point); | 1033 mle_point = dw_mle_import(container_mle, buffer, mle_point); |
1034 dw_mle_delete(container_mle, 9, 3); | 1034 dw_mle_delete(container_mle, 9, 3); |
1035 mle_point = dw_mle_import(container_mle, "gh", 12); | 1035 mle_point = dw_mle_import(container_mle, "gh", 12); |
1036 dw_mle_get_size(container_mle, (unsigned long*)&mle_point, NULL); | 1036 dw_mle_get_size(container_mle, (unsigned long*)&mle_point, NULL); |
1037 sprintf(buffer, "[%d]\r\n\r\n", mle_point); | 1037 sprintf(buffer, "[%d]\r\n\r\n", mle_point); |
1038 mle_point = dw_mle_import(container_mle, buffer, mle_point); | 1038 mle_point = dw_mle_import(container_mle, buffer, mle_point); |
1039 dw_mle_set_cursor(container_mle, mle_point); | 1039 dw_mle_set_cursor(container_mle, mle_point); |
1040 /* connect our event trappers... */ | 1040 /* connect our event trappers... */ |
1041 dw_signal_connect(container, DW_SIGNAL_ITEM_ENTER, DW_SIGNAL_FUNC(item_enter_cb), (void *)container_status); | 1041 dw_signal_connect(container, DW_SIGNAL_ITEM_ENTER, DW_SIGNAL_FUNC(item_enter_cb), (void *)container_status); |
1042 dw_signal_connect(container, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)container_status); | 1042 dw_signal_connect(container, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)container_status); |
1043 dw_signal_connect(container, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(container_select_cb), (void *)container_status); | 1043 dw_signal_connect(container, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(container_select_cb), (void *)container_status); |
1046 | 1046 |
1047 /* Beep every second */ | 1047 /* Beep every second */ |
1048 int DWSIGNAL timer_callback(void *data) | 1048 int DWSIGNAL timer_callback(void *data) |
1049 { | 1049 { |
1050 dw_beep(200, 200); | 1050 dw_beep(200, 200); |
1051 | 1051 |
1052 /* Return TRUE so we get called again */ | 1052 /* Return TRUE so we get called again */ |
1053 return TRUE; | 1053 return TRUE; |
1054 } | 1054 } |
1055 | 1055 |
1056 | 1056 |
1057 void buttons_add(void) | 1057 void buttons_add(void) |
1058 { | 1058 { |
1059 HWND abutton1,abutton2,calbox; | 1059 HWND abutton1,abutton2,calbox; |
1060 int i; | 1060 int i; |
1061 char **text; | 1061 char **text; |
1062 | 1062 |
1063 /* create a box to pack into the notebook page */ | 1063 /* create a box to pack into the notebook page */ |
1064 buttonsbox = dw_box_new(BOXVERT, 2); | 1064 buttonsbox = dw_box_new(BOXVERT, 2); |
1065 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); | 1065 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); |
1066 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); | 1066 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); |
1067 | 1067 |
1068 calbox = dw_box_new(DW_HORZ, 0); | 1068 calbox = dw_box_new(DW_HORZ, 0); |
1069 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1); | 1069 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1); |
1070 cal = dw_calendar_new(100); | 1070 cal = dw_calendar_new(100); |
1071 dw_box_pack_start(calbox, cal, 180, 160, TRUE, TRUE, 0); | 1071 dw_box_pack_start(calbox, cal, 180, 160, TRUE, TRUE, 0); |
1072 /* | 1072 /* |
1084 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 1084 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
1085 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); | 1085 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); |
1086 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); | 1086 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); |
1087 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); | 1087 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); |
1088 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 1088 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
1089 | 1089 |
1090 create_button(0); | 1090 create_button(0); |
1091 /* make a combobox */ | 1091 /* make a combobox */ |
1092 combox = dw_box_new(BOXVERT, 2); | 1092 combox = dw_box_new(BOXVERT, 2); |
1093 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0); | 1093 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0); |
1094 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ | 1094 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ |
1106 sprintf( buf, "item %d", i); | 1106 sprintf( buf, "item %d", i); |
1107 dw_listbox_append( combobox1, buf ); | 1107 dw_listbox_append( combobox1, buf ); |
1108 } | 1108 } |
1109 fprintf(stderr,"after appending 100 items to combobox\n"); | 1109 fprintf(stderr,"after appending 100 items to combobox\n"); |
1110 #endif | 1110 #endif |
1111 | 1111 |
1112 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ | 1112 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ |
1113 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0); | 1113 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0); |
1114 /* | 1114 /* |
1115 dw_window_set_text( combobox, "initial value"); | 1115 dw_window_set_text( combobox, "initial value"); |
1116 */ | 1116 */ |
1148 void create_button( int redraw) | 1148 void create_button( int redraw) |
1149 { | 1149 { |
1150 HWND abutton1; | 1150 HWND abutton1; |
1151 filetoolbarbox = dw_box_new( BOXVERT, 0 ); | 1151 filetoolbarbox = dw_box_new( BOXVERT, 0 ); |
1152 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); | 1152 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); |
1153 | 1153 |
1154 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); | 1154 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); |
1155 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); | 1155 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); |
1156 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL ); | 1156 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL ); |
1157 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); | 1157 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); |
1158 | 1158 |
1159 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); | 1159 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); |
1160 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); | 1160 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); |
1161 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); | 1161 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); |
1162 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); | 1162 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); |
1163 | 1163 |
1164 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); | 1164 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); |
1165 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); | 1165 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); |
1166 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); | 1166 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); |
1167 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); | 1167 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); |
1168 if ( redraw ) | 1168 if ( redraw ) |
1174 | 1174 |
1175 #ifdef DEPRECATED | 1175 #ifdef DEPRECATED |
1176 void mdi_add(void) | 1176 void mdi_add(void) |
1177 { | 1177 { |
1178 HWND mdibox, mdi, mdi1w, mdi1box, ef, mdi2w, mdi2box, bb; | 1178 HWND mdibox, mdi, mdi1w, mdi1box, ef, mdi2w, mdi2box, bb; |
1179 | 1179 |
1180 /* create a box to pack into the notebook page */ | 1180 /* create a box to pack into the notebook page */ |
1181 mdibox = dw_box_new(DW_HORZ, 0); | 1181 mdibox = dw_box_new(DW_HORZ, 0); |
1182 | 1182 |
1183 dw_box_pack_start(notebookbox6, mdibox, 500, 200, TRUE, TRUE, 1); | 1183 dw_box_pack_start(notebookbox6, mdibox, 500, 200, TRUE, TRUE, 1); |
1184 | 1184 |
1185 /* now a mdi under this box */ | 1185 /* now a mdi under this box */ |
1186 mdi = dw_mdi_new(333); | 1186 mdi = dw_mdi_new(333); |
1187 dw_box_pack_start(mdibox, mdi, 500, 200, TRUE, TRUE, 2); | 1187 dw_box_pack_start(mdibox, mdi, 500, 200, TRUE, TRUE, 2); |
1188 | 1188 |
1189 mdi1w = dw_window_new(mdi, "MDI1", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | 1189 mdi1w = dw_window_new(mdi, "MDI1", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); |
1190 mdi1box = dw_box_new(DW_HORZ, 0); | 1190 mdi1box = dw_box_new(DW_HORZ, 0); |
1191 dw_box_pack_start(mdi1w, mdi1box, 0, 0, TRUE, TRUE, 0); | 1191 dw_box_pack_start(mdi1w, mdi1box, 0, 0, TRUE, TRUE, 0); |
1192 ef = dw_entryfield_new("", 0); | 1192 ef = dw_entryfield_new("", 0); |
1193 dw_box_pack_start(mdi1box, ef, 100, 20, FALSE, FALSE, 4); | 1193 dw_box_pack_start(mdi1box, ef, 100, 20, FALSE, FALSE, 4); |
1194 dw_window_set_size(mdi1w, 200, 100); | 1194 dw_window_set_size(mdi1w, 200, 100); |
1195 dw_window_show(mdi1w); | 1195 dw_window_show(mdi1w); |
1196 | 1196 |
1197 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | 1197 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); |
1198 mdi2box = dw_box_new(DW_HORZ, 0); | 1198 mdi2box = dw_box_new(DW_HORZ, 0); |
1199 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); | 1199 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); |
1200 ef = dw_entryfield_new( "", 0); | 1200 ef = dw_entryfield_new( "", 0); |
1201 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); | 1201 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); |
1207 #endif | 1207 #endif |
1208 | 1208 |
1209 void menu_add(void) | 1209 void menu_add(void) |
1210 { | 1210 { |
1211 HMENUI menuitem,menu; | 1211 HMENUI menuitem,menu; |
1212 | 1212 |
1213 mainmenubar = dw_menubar_new( mainwindow ); | 1213 mainmenubar = dw_menubar_new( mainwindow ); |
1214 /* add menus to the menubar */ | 1214 /* add menus to the menubar */ |
1215 menu = dw_menu_new( 0 ); | 1215 menu = dw_menu_new( 0 ); |
1216 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0 ); | 1216 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0 ); |
1217 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); | 1217 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
1218 /* | 1218 /* |
1219 * Add the "File" menu to the menubar... | 1219 * Add the "File" menu to the menubar... |
1220 */ | 1220 */ |
1221 dw_menu_append_item( mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu ); | 1221 dw_menu_append_item( mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu ); |
1222 | 1222 |
1223 changeable_menu = dw_menu_new( 0 ); | 1223 changeable_menu = dw_menu_new( 0 ); |
1224 checkable_menuitem = dw_menu_append_item( changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0 ); | 1224 checkable_menuitem = dw_menu_append_item( changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0 ); |
1225 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"checkable"); | 1225 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"checkable"); |
1226 noncheckable_menuitem = dw_menu_append_item( changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0 ); | 1226 noncheckable_menuitem = dw_menu_append_item( changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0 ); |
1227 dw_signal_connect( noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"non-checkable"); | 1227 dw_signal_connect( noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"non-checkable"); |
1232 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), (void *)NULL); | 1232 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), (void *)NULL); |
1233 /* | 1233 /* |
1234 * Add the "Menu" menu to the menubar... | 1234 * Add the "Menu" menu to the menubar... |
1235 */ | 1235 */ |
1236 dw_menu_append_item( mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu ); | 1236 dw_menu_append_item( mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu ); |
1237 | 1237 |
1238 menu = dw_menu_new( 0 ); | 1238 menu = dw_menu_new( 0 ); |
1239 menuitem = dw_menu_append_item( menu, "~About", 1091, 0, TRUE, FALSE, 0 ); | 1239 menuitem = dw_menu_append_item( menu, "~About", 1091, 0, TRUE, FALSE, 0 ); |
1240 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), (void *)mainwindow); | 1240 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), (void *)mainwindow); |
1241 /* | 1241 /* |
1242 * Add the "Help" menu to the menubar... | 1242 * Add the "Help" menu to the menubar... |
1245 } | 1245 } |
1246 | 1246 |
1247 int DWSIGNAL scrollbox_button_callback(HWND window, void *data) | 1247 int DWSIGNAL scrollbox_button_callback(HWND window, void *data) |
1248 { | 1248 { |
1249 int pos, range; | 1249 int pos, range; |
1250 | 1250 |
1251 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT ); | 1251 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT ); |
1252 range = dw_scrollbox_get_range( scrollbox, DW_VERT ); | 1252 range = dw_scrollbox_get_range( scrollbox, DW_VERT ); |
1253 fprintf( stderr, "Pos %d Range %d\n", pos, range ); | 1253 fprintf( stderr, "Pos %d Range %d\n", pos, range ); |
1254 return 0; | 1254 return 0; |
1255 } | 1255 } |
1257 void scrollbox_add(void) | 1257 void scrollbox_add(void) |
1258 { | 1258 { |
1259 HWND tmpbox,abutton1; | 1259 HWND tmpbox,abutton1; |
1260 char buf[100]; | 1260 char buf[100]; |
1261 int i; | 1261 int i; |
1262 | 1262 |
1263 /* create a box to pack into the notebook page */ | 1263 /* create a box to pack into the notebook page */ |
1264 scrollbox = dw_scrollbox_new(DW_VERT, 0); | 1264 scrollbox = dw_scrollbox_new(DW_VERT, 0); |
1265 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); | 1265 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); |
1266 | 1266 |
1267 abutton1 = dw_button_new( "Show Adjustments", 0 ); | 1267 abutton1 = dw_button_new( "Show Adjustments", 0 ); |
1268 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 ); | 1268 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 ); |
1269 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); | 1269 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); |
1270 | 1270 |
1271 for ( i = 0; i < MAX_WIDGETS; i++ ) | 1271 for ( i = 0; i < MAX_WIDGETS; i++ ) |
1272 { | 1272 { |
1273 tmpbox = dw_box_new( DW_HORZ, 0 ); | 1273 tmpbox = dw_box_new( DW_HORZ, 0 ); |
1274 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2); | 1274 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2); |
1275 sprintf( buf, "Label %d", i ); | 1275 sprintf( buf, "Label %d", i ); |
1294 #ifdef DEPRECATED | 1294 #ifdef DEPRECATED |
1295 ULONG notebookpage6; | 1295 ULONG notebookpage6; |
1296 #endif | 1296 #endif |
1297 ULONG notebookpage7; | 1297 ULONG notebookpage7; |
1298 ULONG notebookpage8; | 1298 ULONG notebookpage8; |
1299 | 1299 |
1300 dw_init(TRUE, argc, argv); | 1300 dw_init(TRUE, argc, argv); |
1301 | 1301 |
1302 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | 1302 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); |
1303 dw_window_set_icon(mainwindow, fileicon); | 1303 dw_window_set_icon(mainwindow, fileicon); |
1304 | 1304 |
1305 notebookbox = dw_box_new( BOXVERT, 5 ); | 1305 notebookbox = dw_box_new( BOXVERT, 5 ); |
1306 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); | 1306 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); |
1307 /* MUST pack a box into the mainwindow BEFORE adding menus */ | 1307 /* MUST pack a box into the mainwindow BEFORE adding menus */ |
1308 menu_add(); | 1308 menu_add(); |
1309 | 1309 |
1310 notebook = dw_notebook_new( 1, TRUE ); | 1310 notebook = dw_notebook_new( 1, TRUE ); |
1311 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); | 1311 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); |
1312 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL); | 1312 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL); |
1313 | 1313 |
1314 notebookbox1 = dw_box_new( BOXVERT, 5 ); | 1314 notebookbox1 = dw_box_new( BOXVERT, 5 ); |
1315 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); | 1315 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); |
1316 dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); | 1316 dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); |
1317 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry"); | 1317 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry"); |
1318 archive_add(); | 1318 archive_add(); |
1319 | 1319 |
1320 notebookbox2 = dw_box_new( BOXVERT, 5 ); | 1320 notebookbox2 = dw_box_new( BOXVERT, 5 ); |
1321 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); | 1321 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); |
1322 dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); | 1322 dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); |
1323 dw_notebook_page_set_text( notebook, notebookpage2, "render"); | 1323 dw_notebook_page_set_text( notebook, notebookpage2, "render"); |
1324 text_add(); | 1324 text_add(); |
1325 | 1325 |
1326 notebookbox3 = dw_box_new( BOXVERT, 5 ); | 1326 notebookbox3 = dw_box_new( BOXVERT, 5 ); |
1327 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE ); | 1327 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE ); |
1328 dw_notebook_pack( notebook, notebookpage3, notebookbox3 ); | 1328 dw_notebook_pack( notebook, notebookpage3, notebookbox3 ); |
1329 dw_notebook_page_set_text( notebook, notebookpage3, "tree"); | 1329 dw_notebook_page_set_text( notebook, notebookpage3, "tree"); |
1330 tree_add(); | 1330 tree_add(); |
1331 | 1331 |
1332 notebookbox4 = dw_box_new( BOXVERT, 5 ); | 1332 notebookbox4 = dw_box_new( BOXVERT, 5 ); |
1333 notebookpage4 = dw_notebook_page_new( notebook, 1, FALSE ); | 1333 notebookpage4 = dw_notebook_page_new( notebook, 1, FALSE ); |
1334 dw_notebook_pack( notebook, notebookpage4, notebookbox4 ); | 1334 dw_notebook_pack( notebook, notebookpage4, notebookbox4 ); |
1335 dw_notebook_page_set_text( notebook, notebookpage4, "container"); | 1335 dw_notebook_page_set_text( notebook, notebookpage4, "container"); |
1336 container_add(); | 1336 container_add(); |
1337 | 1337 |
1338 notebookbox5 = dw_box_new( BOXVERT, 5 ); | 1338 notebookbox5 = dw_box_new( BOXVERT, 5 ); |
1339 notebookpage5 = dw_notebook_page_new( notebook, 1, FALSE ); | 1339 notebookpage5 = dw_notebook_page_new( notebook, 1, FALSE ); |
1340 dw_notebook_pack( notebook, notebookpage5, notebookbox5 ); | 1340 dw_notebook_pack( notebook, notebookpage5, notebookbox5 ); |
1341 dw_notebook_page_set_text( notebook, notebookpage5, "buttons"); | 1341 dw_notebook_page_set_text( notebook, notebookpage5, "buttons"); |
1342 buttons_add(); | 1342 buttons_add(); |
1343 | 1343 |
1344 #ifdef DEPRECATED | 1344 #ifdef DEPRECATED |
1345 notebookbox6 = dw_box_new( BOXVERT, 5 ); | 1345 notebookbox6 = dw_box_new( BOXVERT, 5 ); |
1346 notebookpage6 = dw_notebook_page_new( notebook, 1, FALSE ); | 1346 notebookpage6 = dw_notebook_page_new( notebook, 1, FALSE ); |
1347 dw_notebook_pack( notebook, notebookpage6, notebookbox6 ); | 1347 dw_notebook_pack( notebook, notebookpage6, notebookbox6 ); |
1348 dw_notebook_page_set_text( notebook, notebookpage6, "mdi"); | 1348 dw_notebook_page_set_text( notebook, notebookpage6, "mdi"); |
1349 mdi_add(); | 1349 mdi_add(); |
1350 #endif | 1350 #endif |
1351 | 1351 |
1352 notebookbox7 = dw_box_new( BOXVERT, 6 ); | 1352 notebookbox7 = dw_box_new( BOXVERT, 6 ); |
1353 notebookpage7 = dw_notebook_page_new( notebook, 1, FALSE ); | 1353 notebookpage7 = dw_notebook_page_new( notebook, 1, FALSE ); |
1354 dw_notebook_pack( notebook, notebookpage7, notebookbox7 ); | 1354 dw_notebook_pack( notebook, notebookpage7, notebookbox7 ); |
1355 dw_notebook_page_set_text( notebook, notebookpage7, "html"); | 1355 dw_notebook_page_set_text( notebook, notebookpage7, "html"); |
1356 | 1356 |
1357 rawhtml = dw_html_new(1001); | 1357 rawhtml = dw_html_new(1001); |
1358 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); | 1358 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); |
1359 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>"); | 1359 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>"); |
1360 html = dw_html_new(1002); | 1360 html = dw_html_new(1002); |
1361 dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0); | 1361 dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0); |
1362 /* | 1362 dw_html_url(html, "http://dwindows.netlabs.org"); |
1363 * This originally had: | 1363 |
1364 dw_html_url(html, "http://dwindows.netlabs.org"); | |
1365 * but as the base file is XML, the Windows browser instance can't display it. | |
1366 * Instead a pure HTML based web page is displayed. MHES 5/4/2008 | |
1367 */ | |
1368 dw_html_url(html, "http://www.rexx.org"); | |
1369 | |
1370 notebookbox8 = dw_box_new( BOXVERT, 7 ); | 1364 notebookbox8 = dw_box_new( BOXVERT, 7 ); |
1371 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE ); | 1365 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE ); |
1372 dw_notebook_pack( notebook, notebookpage8, notebookbox8 ); | 1366 dw_notebook_pack( notebook, notebookpage8, notebookbox8 ); |
1373 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox"); | 1367 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox"); |
1374 scrollbox_add(); | 1368 scrollbox_add(); |
1375 | 1369 |
1376 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); | 1370 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
1377 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0); | 1371 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0); |
1378 dw_window_set_size(mainwindow, 640, 520); | 1372 dw_window_set_size(mainwindow, 640, 520); |
1379 dw_window_show(mainwindow); | 1373 dw_window_show(mainwindow); |
1380 | 1374 |
1381 dw_main(); | 1375 dw_main(); |
1382 | 1376 |
1383 return 0; | 1377 return 0; |
1384 } | 1378 } |