From 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 29 Apr 2017 12:11:08 +0200 Subject: New upstream version 4.3.0 --- app/wlib/gtklib/control.c | 283 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 app/wlib/gtklib/control.c (limited to 'app/wlib/gtklib/control.c') diff --git a/app/wlib/gtklib/control.c b/app/wlib/gtklib/control.c new file mode 100644 index 0000000..e824c94 --- /dev/null +++ b/app/wlib/gtklib/control.c @@ -0,0 +1,283 @@ +/** \file control.c + * Control Utilities + */ +/* + * Copyright 2016 Martin Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#include +#include + +#define GTK_DISABLE_SINGLE_INCLUDES +#define GDK_DISABLE_DEPRECATED +#define GTK_DISABLE_DEPRECATED +#define GSEAL_ENABLE + +#include +#include + +#include "gtkint.h" + +#define GTKCONTROLHILITEWIDTH (3) + +/** + * Cause the control to be displayed or hidden. + * Used to hide control (such as a list) while it is being updated. + * + * \param b IN Control + * \param show IN TRUE for visible + */ + +void wControlShow( + wControl_p b, + wBool_t show) +{ + if (b->type == B_LINES) { + wlibLineShow((wLine_p)b, show); + return; + } + + if (b->widget == NULL) { + abort(); + } + + if (show) { + gtk_widget_show(b->widget); + + if (b->label) { + gtk_widget_show(b->label); + } + } else { + gtk_widget_hide(b->widget); + + if (b->label) { + gtk_widget_hide(b->label); + } + } +} + +/** + * Cause the control to be marked active or inactive. + * Inactive controls donot respond to actions. + * + * \param b IN Control + * \param active IN TRUE for active + */ + +void wControlActive( + wControl_p b, + int active) +{ + if (b->widget == NULL) { + abort(); + } + + gtk_widget_set_sensitive(GTK_WIDGET(b->widget), active); +} + +/** + * Returns the width of