added X to tabs
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 24 Jun 2004 20:59:26 +0000 (20:59 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 24 Jun 2004 20:59:26 +0000 (20:59 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@612 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png [new file with mode: 0644]

index 1e678444220e43f70e57d51104d68a15041a4868..412f9298da4471478bd990c0c6c9ae1155621b48 100644 (file)
@@ -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;
index 31589b387691129252aac1ec5459c4d841a4d9bf..81425a3d34100ee12aade39983239f52cc0eba6e 100644 (file)
@@ -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
index eb375f402b530f734e42cdeb476e65b0319a7562..4cde1ff3c7f41dc9c873a88db8ca93aee1e59528 100644 (file)
@@ -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 (file)
index 0000000..3506f4b
Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/close.png differ
This page took 0.034147 seconds and 4 git commands to generate.