diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:12 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:12 +0200 |
commit | e50482f994b6ebcce864a412111d376e99205cdb (patch) | |
tree | ff3192c6aaf213c4922521bed988e4ed4147f537 /app/wlib/gtklib/button.c | |
parent | d3897ce090dbeb220ed2c782f095597e417cf3cc (diff) | |
parent | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff) |
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1'
with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
Diffstat (limited to 'app/wlib/gtklib/button.c')
-rw-r--r-- | app/wlib/gtklib/button.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/app/wlib/gtklib/button.c b/app/wlib/gtklib/button.c index b5fabe8..51106c8 100644 --- a/app/wlib/gtklib/button.c +++ b/app/wlib/gtklib/button.c @@ -94,15 +94,23 @@ void wlibSetLabel( } else { pixbuf = wlibPixbufFromXBM( bm ); } + double scaleicon; + wPrefGetFloat(PREFSECTION, LARGEICON, &scaleicon, 1.0); + if (scaleicon<1.0) scaleicon=1.0; + if (scaleicon>2.0) scaleicon=2.0; + GdkPixbuf *pixbuf2 = + gdk_pixbuf_scale_simple(pixbuf, gdk_pixbuf_get_width(pixbuf)*scaleicon, gdk_pixbuf_get_height(pixbuf)*scaleicon, GDK_INTERP_BILINEAR); + g_object_ref_sink(pixbuf); + g_object_unref((gpointer)pixbuf); if (*imageG==NULL) { - *imageG = gtk_image_new_from_pixbuf(pixbuf); + *imageG = gtk_image_new_from_pixbuf(pixbuf2); gtk_container_add(GTK_CONTAINER(widget), *imageG); gtk_widget_show(*imageG); } else { - gtk_image_set_from_pixbuf(GTK_IMAGE(*imageG), pixbuf); + gtk_image_set_from_pixbuf(GTK_IMAGE(*imageG), pixbuf2); } - g_object_ref_sink(pixbuf); - g_object_unref((gpointer)pixbuf); + g_object_ref_sink(pixbuf2); + g_object_unref((gpointer)pixbuf2); } else { if (*labelG==NULL) { *labelG = (GtkLabel*)gtk_label_new(wlibConvertInput(labelStr)); @@ -172,6 +180,18 @@ static void pushButt( } /** + * Called after expose event default hander - allows the button to be outlined + */ +static wBool_t exposeButt( + GtkWidget *widget, + GdkEventExpose *event, + gpointer g) +{ + wControl_p b = (wControl_p)g; + return wControlExpose(widget,event,b); +} + +/** * Create a button * * \param parent IN parent window @@ -198,7 +218,10 @@ wButton_p wButtonCreate( void * data) { wButton_p b; - b = wlibAlloc(parent, B_BUTTON, x, y, labelStr, sizeof *b, data); + if (option&BO_ICON) //The labelStr here is a wIcon_p + b = wlibAlloc(parent, B_BUTTON, x, y, " ", sizeof *b, data); + else + b = wlibAlloc(parent, B_BUTTON, x, y, labelStr, sizeof *b, data); b->option = option; b->action = action; wlibComputePos((wControl_p)b); @@ -206,9 +229,12 @@ wButton_p wButtonCreate( b->widget = gtk_toggle_button_new(); g_signal_connect(GTK_OBJECT(b->widget), "clicked", G_CALLBACK(pushButt), b); + g_signal_connect_after(GTK_OBJECT(b->widget), "expose-event", + G_CALLBACK(exposeButt), b); if (width > 0) { gtk_widget_set_size_request(b->widget, width, -1); } + if( labelStr ){ wButtonSetLabel(b, labelStr); } @@ -484,6 +510,8 @@ wChoice_p wRadioCreate( b->valueP = valueP; wlibComputePos((wControl_p)b); + ((wControl_p)b)->outline = FALSE; + if (option&BC_HORZ) { b->widget = gtk_hbox_new(FALSE, 0); } else { @@ -506,6 +534,8 @@ wChoice_p wRadioCreate( gtk_widget_show(butt); g_signal_connect(GTK_OBJECT(butt), "toggled", G_CALLBACK(pushChoice), b); + g_signal_connect_after(GTK_OBJECT(b->widget), "expose-event", + G_CALLBACK(exposeButt), b); wlibAddHelpString(butt, helpStr); } @@ -586,6 +616,8 @@ wChoice_p wToggleCreate( b->action = action; wlibComputePos((wControl_p)b); + ((wControl_p)b)->outline = FALSE; + if (option&BC_HORZ) { b->widget = gtk_hbox_new(FALSE, 0); } else { @@ -604,6 +636,8 @@ wChoice_p wToggleCreate( gtk_widget_show(butt); g_signal_connect(GTK_OBJECT(butt), "toggled", G_CALLBACK(pushChoice), b); + g_signal_connect_after(GTK_OBJECT(b->widget), "expose-event", + G_CALLBACK(exposeButt), b); wlibAddHelpString(butt, helpStr); } |