diff --git a/src/include/lib3270.h b/src/include/lib3270.h index c31d454..7a24880 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -636,6 +636,14 @@ LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix); /** + * Get a small text description of the toggle. + * + * @return Constant string with the toggle name. + * + */ + LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix); + + /** * Revert toggle status. * * @param h Session handle. diff --git a/src/lib3270/toggles.c b/src/lib3270/toggles.c index 28be59d..e7371ab 100644 --- a/src/lib3270/toggles.c +++ b/src/lib3270/toggles.c @@ -55,35 +55,39 @@ #include "togglesc.h" #include "api.h" -static const char *toggle_names[LIB3270_TOGGLE_COUNT] = +static const struct _toggle { - "monocase", - "cursorblink", - "showtiming", - "cursorpos", - "dstrace", - "linewrap", - "blankfill", - "screentrace", - "eventtrace", - "marginedpaste", - "rectselect", - "crosshair", - "fullscreen", - "reconnect", - "insert", - "smartpaste", - "bold", - "keepselected", - "underline", - "autoconnect", - "kpalternative", /**< Keypad +/- move to next/previous field */ - "beep", /**< Beep on errors */ - "fieldattr", /**< View Field attribute */ - "altscreen", /**< auto resize on altscreen */ - "keepalive", /**< Enable network keep-alive with SO_KEEPALIVE */ - "nettrace", /**< Enable network in/out trace */ - + const char *name; + const char *descr; +} +toggle_info[LIB3270_TOGGLE_COUNT] = +{ + { "monocase", "" }, + { "cursorblink", "" }, + { "showtiming", "" }, + { "cursorpos", "" }, + { "dstrace", "" }, + { "linewrap", "" }, + { "blankfill", "" }, + { "screentrace", "" }, + { "eventtrace", "" }, + { "marginedpaste", "" }, + { "rectselect", "" }, + { "crosshair", "" }, + { "fullscreen", "" }, + { "reconnect", "" }, + { "insert", "" }, + { "smartpaste", "" }, + { "bold", "" }, + { "keepselected", "" }, + { "underline", "" }, + { "autoconnect", "" }, + { "kpalternative", "" }, /**< Keypad +/- move to next/previous field */ + { "beep", "" }, /**< Beep on errors */ + { "fieldattr", "" }, /**< View Field attribute */ + { "altscreen", "" }, /**< auto resize on altscreen */ + { "keepalive", "" }, /**< Enable network keep-alive with SO_KEEPALIVE */ + { "nettrace", "" }, /**< Enable network in/out trace */ }; LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) @@ -237,6 +241,13 @@ void shutdown_toggles(H3270 *session) #endif } +LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix) +{ + if(ix < N_TOGGLES) + return toggle_names[ix]; + return ""; +} + LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix) { if(ix < N_TOGGLES) diff --git a/src/pw3270/v3270/widget.c b/src/pw3270/v3270/widget.c index 3c68c87..9c40f1f 100644 --- a/src/pw3270/v3270/widget.c +++ b/src/pw3270/v3270/widget.c @@ -68,6 +68,21 @@ /*--[ Widget definition ]----------------------------------------------------------------------------*/ + enum + { + PROP_0, + + /* Construct */ + PROP_TYPE, + + /* Normal Props */ + PROP_FULLSCREEN, + + + /* Toggle - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ + PROP_TOGGLE + }; + G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); /*--[ Globals ]--------------------------------------------------------------------------------------*/ @@ -296,6 +311,25 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa return FALSE; } +static void v3270_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +{ + v3270 *window = GTK_V3270(object); + + switch (prop_id) + { + case PROP_FULLSCREEN: + if(g_value_get_boolean (value)) + gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(object)))); + else + gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(object)))); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } + +} + static void v3270_class_init(v3270Class *klass) { GObjectClass * gobject_class = G_OBJECT_CLASS(klass); @@ -561,6 +595,36 @@ static void v3270_class_init(v3270Class *klass) v3270_VOID__VOID, G_TYPE_NONE, 0); + + // Properties + gobject_class->set_property = v3270_set_property; + + g_object_class_install_property( + gobject_class, + PROP_FULLSCREEN, + g_param_spec_boolean("fullscreen", + "Fullscreen","If TRUE, the toplevel window was set to fullscreen", + FALSE, + G_PARAM_WRITABLE|G_PARAM_READABLE)); + + + // Toggle properties + int f; + + for(f=0;f