From 27a559b9b1ddb82a0c8452046366cde8112a6a98 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 24 Jun 2004 20:59:26 +0000 Subject: [PATCH] added X to tabs git-svn-id: http://ltt.polymtl.ca/svn@612 04897980-b3bd-0310-b5e0-8ef037075253 --- .../gui/lttvwindow/lttvwindow/callbacks.c | 50 ++++++++++++++++-- .../gui/lttvwindow/lttvwindow/callbacks.h | 6 ++- .../gui/lttvwindow/pixmaps/Makefile.am | 3 +- .../modules/gui/lttvwindow/pixmaps/close.png | Bin 0 -> 618 bytes 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 1e678444..412f9298 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -1554,14 +1554,14 @@ on_close_activate (GtkMenuItem *menuitem, */ void -on_close_tab_activate (GtkMenuItem *menuitem, +on_close_tab_activate (GtkWidget *widget, gpointer user_data) { gint page_num; GtkWidget * notebook; GtkWidget * page; - MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); - notebook = lookup_widget((GtkWidget*)menuitem, "MNotebook"); + MainWindow * mw_data = get_window_data_struct(widget); + notebook = lookup_widget(widget, "MNotebook"); if(notebook == NULL){ g_printf("Notebook does not exist\n"); return; @@ -1573,6 +1573,22 @@ on_close_tab_activate (GtkMenuItem *menuitem, } +void +on_close_tab_X_clicked (GtkWidget *widget, + gpointer user_data) +{ + gint page_num; + GtkWidget *notebook = lookup_widget(widget, "MNotebook"); + if(notebook == NULL){ + g_printf("Notebook does not exist\n"); + return; + } + + if((page_num = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), widget)) != -1) + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), page_num); + +} + void on_add_trace_activate (GtkMenuItem *menuitem, @@ -2600,6 +2616,7 @@ void construct_main_window(MainWindow * parent) g_printf("Notebook does not exist\n"); return; } + gtk_notebook_popup_enable (GTK_NOTEBOOK(notebook)); //for now there is no name field in LttvTraceset structure //Use "Traceset" as the label for the default tab if(parent) { @@ -2743,10 +2760,33 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->multi_vpaned = (GtkMultiVPaned*)gtk_multi_vpaned_new(); gtk_widget_show((GtkWidget*)tab->multi_vpaned); tab->mw = mw; + + { + /* Display a label with a X */ + GtkWidget *w_hbox = gtk_hbox_new(FALSE, 4); + GtkWidget *w_label = gtk_label_new (label); + GtkWidget *pixmap = create_pixmap(GTK_WIDGET(notebook), "close.png"); + GtkWidget *w_button = gtk_button_new (); + gtk_container_add(GTK_CONTAINER(w_button), pixmap); + //GtkWidget *w_button = gtk_button_new_with_label("x"); + + gtk_button_set_relief(GTK_BUTTON(w_button), GTK_RELIEF_NONE); + + gtk_box_pack_start(GTK_BOX(w_hbox), w_label, TRUE, TRUE, 0); + gtk_box_pack_end(GTK_BOX(w_hbox), w_button, FALSE, + FALSE, 0); - tab->label = gtk_label_new (label); - gtk_widget_show (tab->label); + g_signal_connect_swapped (w_button, "clicked", + G_CALLBACK (on_close_tab_X_clicked), + tab->multi_vpaned); + gtk_widget_show (w_label); + gtk_widget_show (pixmap); + gtk_widget_show (w_button); + gtk_widget_show (w_hbox); + + tab->label = w_hbox; + } /* Start with empty events requests list */ tab->events_requests = NULL; tab->events_request_pending = FALSE; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h index 31589b38..81425a3d 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h @@ -54,7 +54,11 @@ on_close_activate (GtkMenuItem *menuitem, gpointer user_data); void -on_close_tab_activate (GtkMenuItem *menuitem, +on_close_tab_X_clicked (GtkWidget *widget, + gpointer user_data); + +void +on_close_tab_activate (GtkWidget *widget, gpointer user_data); void diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am index eb375f40..4cde1ff3 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am @@ -24,4 +24,5 @@ EXTRA_DIST = \ stock_zoom_out_24.png\ stock_stop_24.png\ stock_redo_24.png\ - stock_refresh_24.png + stock_refresh_24.png\ + close.png diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png new file mode 100644 index 0000000000000000000000000000000000000000..3506f4b769a4c309bc181ebd96779fcbe5c57430 GIT binary patch literal 618 zcmeAS@N?(olHy`uVBq!ia0vp^AT~D#8<2F%laT;YY)RhkE)4%caKYZ?lYt_f1s;*b zKvlvZ%*Zfn4oDe$iKnkC`xQ0`5phM{;D@?EA=whwh!W@g+}zZ>5(ej@)Wnk16ovB4 zk_?5Aj8p}8Pv3y|DXMu442X%)0%C3;ehtJwf%rQR zYXb3VAU0tF5~3eId|yAAtAwV{=#(zLjyyG7N8AIwpOQr3NL^Zf_xcz|Ni})Wy{wwym;|~K~X^wsQ5g? z()DYB{O4vs`FI9U@Laom?tgM()PJDBf1pYKqaq<}5Z}qs@;^|`F0dQdt>4D5b@Mg` zOAAAWnyMNG4h{~6`}eOi96xcMVc-7aK=lmVU^nhNypKUrMiHz?Q&Y2AQBm<~2{6_) zfu4Z^eo)MG{`m955GZhy0~nq_0CMvSAlCf>4I7{hqCMelXAh>Zo&+iIboFyt=akR{ E0PB&lsQ>@~ literal 0 HcmV?d00001 -- 2.34.1