summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/button.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
commitdf247efec654e512242e4f4f1b0212034f9e01fe (patch)
tree25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/gtklib/button.c
parentd0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff)
parenta5ade52caa489cf0a713e0f02b764000d203140e (diff)
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-1
Diffstat (limited to 'app/wlib/gtklib/button.c')
-rw-r--r--app/wlib/gtklib/button.c44
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);
}