Mercurial > dwindows
comparison gtk3/dw.c @ 1830:6b90c7e9e520
Attempt at fixing GTK 2.x issue with dw_window_set_bitmap() when
bitmap button is created from data. Also removed dead code on 3.x.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 31 Oct 2012 10:48:25 +0000 |
parents | 9c77567c5b2d |
children | ce7543633fef |
comparison
equal
deleted
inserted
replaced
1829:dc343df88ad8 | 1830:6b90c7e9e520 |
---|---|
3914 * DW pick the appropriate file extension. | 3914 * DW pick the appropriate file extension. |
3915 * (BMP on OS/2 or Windows, XPM on Unix) | 3915 * (BMP on OS/2 or Windows, XPM on Unix) |
3916 */ | 3916 */ |
3917 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) | 3917 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) |
3918 { | 3918 { |
3919 GtkWidget *bitmap; | 3919 GtkWidget *tmp; |
3920 GtkWidget *box; | |
3921 GtkWidget *button; | 3920 GtkWidget *button; |
3922 int _locked_by_me = FALSE; | 3921 int _locked_by_me = FALSE; |
3923 | 3922 |
3924 DW_MUTEX_LOCK; | 3923 DW_MUTEX_LOCK; |
3925 | |
3926 /* Create box for image and label */ | |
3927 box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); | |
3928 gtk_container_set_border_width (GTK_CONTAINER (box), 2); | |
3929 | |
3930 /* Create a new button */ | 3924 /* Create a new button */ |
3931 button = gtk_button_new(); | 3925 tmp = gtk_button_new(); |
3932 /* Now on to the image stuff */ | 3926 /* Now on to the image stuff */ |
3933 bitmap = dw_bitmap_new(id); | 3927 bitmap = dw_bitmap_new(id); |
3934 if(bitmap) | 3928 if(bitmap) |
3935 { | 3929 { |
3936 dw_window_set_bitmap( bitmap, 0, filename ); | 3930 dw_window_set_bitmap( bitmap, 0, filename ); |
3937 /* Pack the image into the box */ | 3931 gtk_container_add (GTK_CONTAINER(tmp), bitmap); |
3938 gtk_box_pack_start( GTK_BOX(box), bitmap, TRUE, FALSE, 3 ); | 3932 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); |
3939 gtk_widget_show( bitmap ); | 3933 } |
3940 g_object_set_data(G_OBJECT(button), "_dw_bitmap", bitmap); | 3934 |
3941 } | |
3942 | |
3943 /* Pack and show all our widgets */ | |
3944 gtk_widget_show( box ); | |
3945 gtk_container_add( GTK_CONTAINER(button), box ); | |
3946 gtk_widget_show( button ); | |
3947 if(text) | 3935 if(text) |
3948 { | 3936 { |
3949 gtk_widget_set_tooltip_text(button, text); | 3937 gtk_widget_set_tooltip_text(tmp, text); |
3950 } | 3938 } |
3951 g_object_set_data(G_OBJECT(button), "_dw_id", GINT_TO_POINTER(id)); | 3939 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
3952 DW_MUTEX_UNLOCK; | 3940 DW_MUTEX_UNLOCK; |
3953 return button; | 3941 return tmp; |
3954 } | 3942 } |
3955 | 3943 |
3956 /* | 3944 /* |
3957 * Create a new bitmap button window (widget) to be packed from data. | 3945 * Create a new bitmap button window (widget) to be packed from data. |
3958 * Parameters: | 3946 * Parameters: |