comparison gtk/dw.c @ 48:16eac0f8b45f

Latest fixes, mainly for GTK.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 05 Nov 2001 10:56:39 +0000
parents 997e9ed670ef
children bf42d08d72d7
comparison
equal deleted inserted replaced
47:997e9ed670ef 48:16eac0f8b45f
50 { 0, 0xffff, 0x0000, 0xffff }, /* 13 bright magenta */ 50 { 0, 0xffff, 0x0000, 0xffff }, /* 13 bright magenta */
51 { 0, 0x0000, 0xeeee, 0xeeee }, /* 14 bright cyan */ 51 { 0, 0x0000, 0xeeee, 0xeeee }, /* 14 bright cyan */
52 { 0, 0xffff, 0xffff, 0xffff }, /* 15 bright white */ 52 { 0, 0xffff, 0xffff, 0xffff }, /* 15 bright white */
53 }; 53 };
54 54
55 GdkColor _foreground = { 0, 0x0000, 0x0000, 0x0000 }; 55 #define DW_THREAD_LIMIT 50
56 GdkColor _background = { 0, 0xaaaa, 0xaaaa, 0xaaaa }; 56
57 DWTID _dw_thread_list[DW_THREAD_LIMIT];
58 GdkColor _foreground[DW_THREAD_LIMIT];
59 GdkColor _background[DW_THREAD_LIMIT];
57 60
58 GtkWidget *last_window = NULL; 61 GtkWidget *last_window = NULL;
59 62
60 int _dw_file_active = 0, _dw_ignore_click = 0; 63 int _dw_file_active = 0, _dw_ignore_click = 0;
61 pthread_t _dw_thread = (pthread_t)-1; 64 pthread_t _dw_thread = (pthread_t)-1;
485 GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window), 488 GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window),
486 &sizehints); 489 &sizehints);
487 gdk_flush (); 490 gdk_flush ();
488 } 491 }
489 492
493 /* Find the index of a given thread */
494 int _find_thread_index(DWTID tid)
495 {
496 int z;
497
498 for(z=0;z<DW_THREAD_LIMIT;z++)
499 {
500 if(_dw_thread_list[z] == tid)
501 return z;
502 }
503 return 0;
504 }
505
506 /* Add a thread id to the thread list */
507 void _dw_thread_add(DWTID tid)
508 {
509 int z;
510
511 for(z=0;z<DW_THREAD_LIMIT;z++)
512 {
513 if(_dw_thread_list[z] == (DWTID)-1)
514 {
515 _dw_thread_list[z] = tid;
516 _foreground[z].pixel = _foreground[z].red =_foreground[z].green = _foreground[z].blue = 0;
517 _background[z].pixel = 0;
518 _background[z].red = 0xaaaa;
519 _background[z].green = 0xaaaa;
520 _background[z].blue = 0xaaaa;
521 return;
522 }
523 }
524 }
525
526 /* Remove a thread id to the thread list */
527 void _dw_thread_remove(DWTID tid)
528 {
529 int z;
530
531 for(z=0;z<DW_THREAD_LIMIT;z++)
532 {
533 if(_dw_thread_list[z] == (DWTID)tid)
534 _dw_thread_list[z] = -1;
535 }
536 }
537
490 /* 538 /*
491 * Initializes the Dynamic Windows engine. 539 * Initializes the Dynamic Windows engine.
492 * Parameters: 540 * Parameters:
493 * newthread: True if this is the only thread. 541 * newthread: True if this is the only thread.
494 * False if there is already a message loop running. 542 * False if there is already a message loop running.
521 _dw_border_width = atoi(tmp); 569 _dw_border_width = atoi(tmp);
522 tmp = getenv("DW_BORDER_HEIGHT"); 570 tmp = getenv("DW_BORDER_HEIGHT");
523 if(tmp) 571 if(tmp)
524 _dw_border_height = atoi(tmp); 572 _dw_border_height = atoi(tmp);
525 573
574 for(z=0;z<DW_THREAD_LIMIT;z++)
575 _dw_thread_list[z] = (DWTID)-1;
576
526 return TRUE; 577 return TRUE;
527 } 578 }
528 579
529 /* 580 /*
530 * Runs a message loop for Dynamic Windows. 581 * Runs a message loop for Dynamic Windows.
534 * func: Function pointer to the message filter function. 585 * func: Function pointer to the message filter function.
535 */ 586 */
536 void dw_main(HAB currenthab, void *func) 587 void dw_main(HAB currenthab, void *func)
537 { 588 {
538 _dw_thread = pthread_self(); 589 _dw_thread = pthread_self();
590 _dw_thread_add(_dw_thread);
539 gdk_threads_enter(); 591 gdk_threads_enter();
540 gtk_main(); 592 gtk_main();
541 gdk_threads_leave(); 593 gdk_threads_leave();
542 } 594 }
543 595
683 HWND entrywindow, mainbox, okbutton, buttonbox, stext; 735 HWND entrywindow, mainbox, okbutton, buttonbox, stext;
684 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; 736 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER;
685 DWDialog *dwwait; 737 DWDialog *dwwait;
686 va_list args; 738 va_list args;
687 char outbuf[256]; 739 char outbuf[256];
740 int x, y;
688 741
689 va_start(args, format); 742 va_start(args, format);
690 vsprintf(outbuf, format, args); 743 vsprintf(outbuf, format, args);
691 va_end(args); 744 va_end(args);
692 745
711 764
712 dwwait = dw_dialog_new((void *)entrywindow); 765 dwwait = dw_dialog_new((void *)entrywindow);
713 766
714 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); 767 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait);
715 768
716 dw_window_set_usize(entrywindow, 220, 110); 769 x = (dw_screen_width() - 220)/2;
770 y = (dw_screen_height() - 110)/2;
771
772 dw_window_set_pos_size(entrywindow, x, y, 220, 110);
717 773
718 dw_window_show(entrywindow); 774 dw_window_show(entrywindow);
719 775
720 dw_dialog_wait(dwwait); 776 dw_dialog_wait(dwwait);
721 777
755 int dw_yesno(char *title, char *text) 811 int dw_yesno(char *title, char *text)
756 { 812 {
757 HWND entrywindow, mainbox, nobutton, yesbutton, buttonbox, stext; 813 HWND entrywindow, mainbox, nobutton, yesbutton, buttonbox, stext;
758 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; 814 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER;
759 DWDialog *dwwait; 815 DWDialog *dwwait;
816 int x, y;
760 817
761 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); 818 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle);
762 819
763 mainbox = dw_box_new(BOXVERT, 10); 820 mainbox = dw_box_new(BOXVERT, 10);
764 821
786 dwwait = dw_dialog_new((void *)entrywindow); 843 dwwait = dw_dialog_new((void *)entrywindow);
787 844
788 dw_signal_connect(yesbutton, "clicked", DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait); 845 dw_signal_connect(yesbutton, "clicked", DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait);
789 dw_signal_connect(nobutton, "clicked", DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait); 846 dw_signal_connect(nobutton, "clicked", DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait);
790 847
791 dw_window_set_usize(entrywindow, 220, 110); 848 x = (dw_screen_width() - 220)/2;
849 y = (dw_screen_height() - 110)/2;
850
851 dw_window_set_pos_size(entrywindow, x, y, 220, 110);
792 852
793 dw_window_show(entrywindow); 853 dw_window_show(entrywindow);
794 854
795 return (int)dw_dialog_wait(dwwait);; 855 return (int)dw_dialog_wait(dwwait);;
796 } 856 }
1098 { 1158 {
1099 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "mle"); 1159 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "mle");
1100 if(tmp) 1160 if(tmp)
1101 handle2 = tmp; 1161 handle2 = tmp;
1102 } 1162 }
1163 else if(GTK_IS_TABLE(handle))
1164 {
1165 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "eventbox");
1166 if(tmp)
1167 handle2 = tmp;
1168 }
1103 1169
1104 _set_color(handle2, fore, back); 1170 _set_color(handle2, fore, back);
1105 1171
1106 DW_MUTEX_UNLOCK; 1172 DW_MUTEX_UNLOCK;
1107 return TRUE; 1173 return TRUE;
1208 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). 1274 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
1209 * pad: Number of pixels to pad around the box. 1275 * pad: Number of pixels to pad around the box.
1210 */ 1276 */
1211 HWND dw_box_new(int type, int pad) 1277 HWND dw_box_new(int type, int pad)
1212 { 1278 {
1213 GtkWidget *tmp; 1279 GtkWidget *tmp, *eventbox;
1214 int _locked_by_me = FALSE; 1280 int _locked_by_me = FALSE;
1215 1281
1216 DW_MUTEX_LOCK; 1282 DW_MUTEX_LOCK;
1217 tmp = gtk_table_new(1, 1, FALSE); 1283 tmp = gtk_table_new(1, 1, FALSE);
1284 eventbox = gtk_event_box_new();
1285
1286 gtk_widget_show(eventbox);
1287 gtk_object_set_data(GTK_OBJECT(tmp), "eventbox", (gpointer)eventbox);
1218 gtk_object_set_data(GTK_OBJECT(tmp), "boxtype", (gpointer)type); 1288 gtk_object_set_data(GTK_OBJECT(tmp), "boxtype", (gpointer)type);
1219 gtk_object_set_data(GTK_OBJECT(tmp), "boxpad", (gpointer)pad); 1289 gtk_object_set_data(GTK_OBJECT(tmp), "boxpad", (gpointer)pad);
1220 gtk_widget_show(tmp); 1290 gtk_widget_show(tmp);
1221 DW_MUTEX_UNLOCK; 1291 DW_MUTEX_UNLOCK;
1222 return tmp; 1292 return tmp;
1237 DW_MUTEX_LOCK; 1307 DW_MUTEX_LOCK;
1238 frame = gtk_frame_new(NULL); 1308 frame = gtk_frame_new(NULL);
1239 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); 1309 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
1240 gtk_frame_set_label(GTK_FRAME(frame), title && *title ? title : NULL); 1310 gtk_frame_set_label(GTK_FRAME(frame), title && *title ? title : NULL);
1241 tmp = gtk_table_new(1, 1, FALSE); 1311 tmp = gtk_table_new(1, 1, FALSE);
1312 gtk_container_border_width(GTK_CONTAINER(tmp), pad);
1242 gtk_object_set_data(GTK_OBJECT(tmp), "boxtype", (gpointer)type); 1313 gtk_object_set_data(GTK_OBJECT(tmp), "boxtype", (gpointer)type);
1243 gtk_object_set_data(GTK_OBJECT(tmp), "boxpad", (gpointer)pad); 1314 gtk_object_set_data(GTK_OBJECT(tmp), "boxpad", (gpointer)pad);
1244 gtk_object_set_data(GTK_OBJECT(frame), "boxhandle", (gpointer)tmp); 1315 gtk_object_set_data(GTK_OBJECT(frame), "boxhandle", (gpointer)tmp);
1245 gtk_container_add(GTK_CONTAINER(frame), tmp); 1316 gtk_container_add(GTK_CONTAINER(frame), tmp);
1246 gtk_widget_show(tmp); 1317 gtk_widget_show(tmp);
3269 * green: green value. 3340 * green: green value.
3270 * blue: blue value. 3341 * blue: blue value.
3271 */ 3342 */
3272 void dw_color_foreground_set(unsigned long value) 3343 void dw_color_foreground_set(unsigned long value)
3273 { 3344 {
3274 int _locked_by_me = FALSE; 3345 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id());
3275 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; 3346 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 };
3276 3347
3277 DW_MUTEX_LOCK; 3348 DW_MUTEX_LOCK;
3278 gdk_color_alloc(_dw_cmap, &color); 3349 gdk_color_alloc(_dw_cmap, &color);
3279 _foreground = color; 3350 _foreground[index] = color;
3280 DW_MUTEX_UNLOCK; 3351 DW_MUTEX_UNLOCK;
3281 } 3352 }
3282 3353
3283 /* Sets the current background drawing color. 3354 /* Sets the current background drawing color.
3284 * Parameters: 3355 * Parameters:
3286 * green: green value. 3357 * green: green value.
3287 * blue: blue value. 3358 * blue: blue value.
3288 */ 3359 */
3289 void dw_color_background_set(unsigned long value) 3360 void dw_color_background_set(unsigned long value)
3290 { 3361 {
3291 int _locked_by_me = FALSE; 3362 int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id());
3292 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; 3363 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 };
3293 3364
3294 DW_MUTEX_LOCK; 3365 DW_MUTEX_LOCK;
3295 gdk_color_alloc(_dw_cmap, &color); 3366 gdk_color_alloc(_dw_cmap, &color);
3296 _background = color; 3367 _background[index] = color;
3297 DW_MUTEX_UNLOCK; 3368 DW_MUTEX_UNLOCK;
3298 } 3369 }
3299 3370
3300 GdkGC *_set_colors(GdkWindow *window) 3371 GdkGC *_set_colors(GdkWindow *window)
3301 { 3372 {
3302 GdkGC *gc; 3373 GdkGC *gc;
3374 int index = _find_thread_index(dw_thread_id());
3375
3303 if(!window) 3376 if(!window)
3304 return NULL; 3377 return NULL;
3305 gc = gdk_gc_new(window); 3378 gc = gdk_gc_new(window);
3306 if(gc) 3379 if(gc)
3307 { 3380 {
3308 gdk_gc_set_foreground(gc, &_foreground); 3381 gdk_gc_set_foreground(gc, &_foreground[index]);
3309 gdk_gc_set_background(gc, &_background); 3382 gdk_gc_set_background(gc, &_background[index]);
3310 } 3383 }
3311 return gc; 3384 return gc;
3312 } 3385 }
3313 3386
3314 /* Draw a point on a window (preferably a render window). 3387 /* Draw a point on a window (preferably a render window).
3753 3826
3754 return TRUE; 3827 return TRUE;
3755 } 3828 }
3756 3829
3757 /* 3830 /*
3831 * Setup thread independent color sets.
3832 */
3833 void _dwthreadstart(void *data)
3834 {
3835 void (*threadfunc)(void *) = NULL;
3836 void **tmp = (void **)data;
3837
3838 threadfunc = (void (*)(void *))tmp[0];
3839
3840 _dw_thread_add(dw_thread_id());
3841 threadfunc(tmp[1]);
3842 _dw_thread_remove(dw_thread_id());
3843 free(tmp);
3844 }
3845 /*
3758 * Creates a new thread with a starting point of func. 3846 * Creates a new thread with a starting point of func.
3759 * Parameters: 3847 * Parameters:
3760 * func: Function which will be run in the new thread. 3848 * func: Function which will be run in the new thread.
3761 * data: Parameter(s) passed to the function. 3849 * data: Parameter(s) passed to the function.
3762 * stack: Stack size of new thread (OS/2 and Windows only). 3850 * stack: Stack size of new thread (OS/2 and Windows only).
3763 */ 3851 */
3764 DWTID dw_thread_new(void *func, void *data, int stack) 3852 DWTID dw_thread_new(void *func, void *data, int stack)
3765 { 3853 {
3766 DWTID gtkthread; 3854 DWTID gtkthread;
3767 3855 void **tmp = malloc(sizeof(void *) * 2);
3768 pthread_create(&gtkthread, NULL, func, data); 3856
3857 tmp[0] = func;
3858 tmp[1] = data;
3859
3860 pthread_create(&gtkthread, NULL, (void *)_dwthreadstart, (void *)tmp);
3769 return gtkthread; 3861 return gtkthread;
3770 } 3862 }
3771 3863
3772 /* 3864 /*
3773 * Ends execution of current thread immediately. 3865 * Ends execution of current thread immediately.
3774 */ 3866 */
3775 void dw_thread_end(void) 3867 void dw_thread_end(void)
3776 { 3868 {
3777 pthread_exit(NULL); 3869 pthread_exit(NULL);
3870 }
3871
3872 /*
3873 * Returns the current thread's ID.
3874 */
3875 DWTID dw_thread_id(void)
3876 {
3877 return (DWTID)pthread_self();
3778 } 3878 }
3779 3879
3780 /* 3880 /*
3781 * Cleanly terminates a DW session, should be signal handler safe. 3881 * Cleanly terminates a DW session, should be signal handler safe.
3782 * Parameters: 3882 * Parameters:
3828 * instead of the padding specified on the pack line, this is 3928 * instead of the padding specified on the pack line, this is
3829 * due to a bug in the OS/2 and Win32 renderer and a limitation 3929 * due to a bug in the OS/2 and Win32 renderer and a limitation
3830 * of the GtkTable class. 3930 * of the GtkTable class.
3831 */ 3931 */
3832 if(GTK_IS_TABLE(item)) 3932 if(GTK_IS_TABLE(item))
3833 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad"); 3933 {
3934 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "eventbox");
3935
3936 if(eventbox)
3937 {
3938 gtk_container_add(GTK_CONTAINER(eventbox), item);
3939 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
3940 item = eventbox;
3941 }
3942 }
3834 3943
3835 if(boxtype == BOXVERT) 3944 if(boxtype == BOXVERT)
3836 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); 3945 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1);
3837 else 3946 else
3838 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); 3947 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1);
3856 } 3965 }
3857 else 3966 else
3858 { 3967 {
3859 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); 3968 GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
3860 3969
3970 if(GTK_IS_TABLE(item))
3971 {
3972 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "eventbox");
3973
3974 if(eventbox)
3975 {
3976 gtk_container_add(GTK_CONTAINER(eventbox), item);
3977 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
3978 item = eventbox;
3979 }
3980 }
3981
3982 gtk_container_border_width(GTK_CONTAINER(box), pad);
3861 gtk_container_add(GTK_CONTAINER(box), vbox); 3983 gtk_container_add(GTK_CONTAINER(box), vbox);
3862 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); 3984 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0);
3863 gtk_widget_show(vbox); 3985 gtk_widget_show(vbox);
3864 3986
3865 gtk_widget_set_usize(item, width, height); 3987 gtk_widget_set_usize(item, width, height);
4181 */ 4303 */
4182 void dw_notebook_pack(HWND handle, unsigned long pageid, HWND page) 4304 void dw_notebook_pack(HWND handle, unsigned long pageid, HWND page)
4183 { 4305 {
4184 GtkWidget *label, *child, *oldlabel; 4306 GtkWidget *label, *child, *oldlabel;
4185 gchar *text = NULL; 4307 gchar *text = NULL;
4186 int _locked_by_me = FALSE; 4308 int pad, _locked_by_me = FALSE;
4187 4309
4188 DW_MUTEX_LOCK; 4310 DW_MUTEX_LOCK;
4189 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); 4311 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid);
4190 if(child) 4312 if(child)
4191 { 4313 {
4193 if(oldlabel) 4315 if(oldlabel)
4194 gtk_label_get(GTK_LABEL(oldlabel), &text); 4316 gtk_label_get(GTK_LABEL(oldlabel), &text);
4195 } 4317 }
4196 4318
4197 label = gtk_label_new(text ? text : ""); 4319 label = gtk_label_new(text ? text : "");
4320
4321 if(GTK_IS_TABLE(page))
4322 {
4323 pad = (int)gtk_object_get_data(GTK_OBJECT(page), "boxpad");
4324 gtk_container_border_width(GTK_CONTAINER(page), pad);
4325 }
4198 4326
4199 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, pageid); 4327 gtk_notebook_insert_page(GTK_NOTEBOOK(handle), page, label, pageid);
4200 if(child) 4328 if(child)
4201 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), pageid+1); 4329 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), pageid+1);
4202 DW_MUTEX_UNLOCK; 4330 DW_MUTEX_UNLOCK;
4665 * instead of the padding specified on the pack line, this is 4793 * instead of the padding specified on the pack line, this is
4666 * due to a bug in the OS/2 and Win32 renderer and a limitation 4794 * due to a bug in the OS/2 and Win32 renderer and a limitation
4667 * of the GtkTable class. 4795 * of the GtkTable class.
4668 */ 4796 */
4669 if(GTK_IS_TABLE(item)) 4797 if(GTK_IS_TABLE(item))
4670 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad"); 4798 {
4799 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "eventbox");
4800
4801 if(eventbox)
4802 {
4803 gtk_container_add(GTK_CONTAINER(eventbox), item);
4804 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
4805 item = eventbox;
4806 }
4807 }
4671 4808
4672 if(boxtype == BOXVERT) 4809 if(boxtype == BOXVERT)
4673 { 4810 {
4674 x = 0; 4811 x = 0;
4675 y = boxcount; 4812 y = boxcount;
4701 } 4838 }
4702 else 4839 else
4703 { 4840 {
4704 GtkWidget *vbox = gtk_vbox_new(FALSE, 0); 4841 GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
4705 4842
4843 if(GTK_IS_TABLE(item))
4844 {
4845 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "eventbox");
4846
4847 if(eventbox)
4848 {
4849 gtk_container_add(GTK_CONTAINER(eventbox), item);
4850 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
4851 item = eventbox;
4852 }
4853 }
4854
4855 gtk_container_border_width(GTK_CONTAINER(box), pad);
4706 gtk_container_add(GTK_CONTAINER(box), vbox); 4856 gtk_container_add(GTK_CONTAINER(box), vbox);
4707 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0); 4857 gtk_box_pack_end(GTK_BOX(vbox), item, TRUE, TRUE, 0);
4708 gtk_widget_show(vbox); 4858 gtk_widget_show(vbox);
4709 4859
4710 gtk_widget_set_usize(item, width, height); 4860 gtk_widget_set_usize(item, width, height);
5121 } 5271 }
5122 5272
5123 /* 5273 /*
5124 * Let's demonstrate the functionality of this library. :) 5274 * Let's demonstrate the functionality of this library. :)
5125 */ 5275 */
5126 int main(void) 5276 int main(int argc, char *argv[])
5127 { 5277 {
5128 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | 5278 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR |
5129 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; 5279 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER;
5130 int pageid; 5280 int pageid;
5131 5281
5132 dw_init(TRUE); 5282 dw_init(TRUE, argc, argv);
5133 5283
5134 /* Try a little server dialog. :) */ 5284 /* Try a little server dialog. :) */
5135 mainwindow = dw_window_new(DW_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 5285 mainwindow = dw_window_new(DW_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
5136 5286
5137 lbbox = dw_box_new(BOXVERT, 10); 5287 lbbox = dw_box_new(BOXVERT, 10);