From 45413d04eacfd9dc23904cb4893918309d3a6a36 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 3 Feb 2016 02:43:09 +0100 Subject: Gtk UI: popup will now overlay both the Scintilla view and message widgets * this is what the Curses UI does for a long time now * the popup does NOT cover the info (header) line, as this would be inconsistent if the header is actually the window's title bar. This should perhaps be adapted in the Curses UI as well, so both UIs look more consistently. * removed unused InterfaceGtk attribute --- src/interface-gtk/interface-gtk.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/interface-gtk/interface-gtk.cpp') diff --git a/src/interface-gtk/interface-gtk.cpp b/src/interface-gtk/interface-gtk.cpp index 7938131..a2d2a1b 100644 --- a/src/interface-gtk/interface-gtk.cpp +++ b/src/interface-gtk/interface-gtk.cpp @@ -169,7 +169,9 @@ void InterfaceGtk::main_impl(int &argc, char **&argv) { static const Cmdline empty_cmdline; - GtkWidget *overlay_widget; + + GtkWidget *vbox; + GtkWidget *overlay_widget, *overlay_vbox; GtkWidget *message_bar_content; /* @@ -193,7 +195,7 @@ InterfaceGtk::main_impl(int &argc, char **&argv) g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(window_delete_cb), event_queue); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); info_current = g_strdup(""); @@ -219,6 +221,15 @@ InterfaceGtk::main_impl(int &argc, char **&argv) gtk_box_pack_start(GTK_BOX(vbox), info_bar_widget, FALSE, FALSE, 0); } + /* + * Overlay widget will allow overlaying the Scintilla view + * and message widgets with the info popup. + * Therefore overlay_vbox (containing the view and popup) + * will be the main child of the overlay. + */ + overlay_widget = gtk_overlay_new(); + overlay_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + /* * The event box is the parent of all Scintilla views * that should be displayed. @@ -226,11 +237,10 @@ InterfaceGtk::main_impl(int &argc, char **&argv) * enabling and disabling GDK updates and in order to filter * mouse and keyboard events going to Scintilla. */ - overlay_widget = gtk_overlay_new(); event_box_widget = gtk_event_box_new(); gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_widget), TRUE); - gtk_container_add(GTK_CONTAINER(overlay_widget), event_box_widget); - gtk_box_pack_start(GTK_BOX(vbox), overlay_widget, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(overlay_vbox), event_box_widget, + TRUE, TRUE, 0); message_bar_widget = gtk_info_bar_new(); gtk_widget_set_name(message_bar_widget, "sciteco-message-bar"); @@ -238,7 +248,11 @@ InterfaceGtk::main_impl(int &argc, char **&argv) message_widget = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(message_widget), 0., 0.); gtk_container_add(GTK_CONTAINER(message_bar_content), message_widget); - gtk_box_pack_start(GTK_BOX(vbox), message_bar_widget, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(overlay_vbox), message_bar_widget, + FALSE, FALSE, 0); + + gtk_container_add(GTK_CONTAINER(overlay_widget), overlay_vbox); + gtk_box_pack_start(GTK_BOX(vbox), overlay_widget, TRUE, TRUE, 0); cmdline_widget = gtk_entry_new(); gtk_widget_set_name(cmdline_widget, "sciteco-cmdline"); -- cgit v1.2.3