Changeset 100

Show
Ignore:
Timestamp:
08/28/09 13:45:06 (12 months ago)
Author:
ibboard
Message:

no-open-ticket

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • IBBoard.GtkSharp/trunk/NotebookUtil.cs

    r97 r100  
    2828                public static int AddPageToNotebookWithCloseButton(Notebook notebook, Widget page, string title) 
    2929                { 
     30                        return notebook.AppendPage(page, CreateNotebookTabLabelWithClose(notebook, page, title));  
     31                } 
     32                 
     33                /// <summary> 
     34                /// Creates a widget to be used as the label for a notebook tab with text and a close button 
     35                /// </summary> 
     36                /// <param name="notebook"> 
     37                /// The <see cref="Notebook"/> the page is on 
     38                /// </param> 
     39                /// <param name="page"> 
     40                /// The <see cref="Widget"/> that is the content of the page 
     41                /// </param> 
     42                /// <param name="title"> 
     43                /// The text to display on the tab 
     44                /// </param> 
     45                /// <returns> 
     46                /// A <see cref="Widget"/> that can be used as a tab label that contains the label with the title text and a close button 
     47                /// </returns> 
     48                public static Widget CreateNotebookTabLabelWithClose(Notebook notebook, Widget page,String title) 
     49                { 
    3050                        HBox hbox = new HBox(); 
    3151                        hbox.PackStart(new Label(title));                        
     
    4161                        close.Name = "NotebookTab.CloseButton";                  
    4262                        close.Clicked += delegate { 
    43                             hbox.Destroy(); 
    44                             page.Destroy(); 
     63                                notebook.Remove(page); 
    4564                        }; 
    4665                        hbox.PackStart(close);                   
    47                         hbox.ShowAll();                  
    48                         return notebook.AppendPage(page, hbox);  
     66                        hbox.ShowAll();  
     67                        return hbox; 
    4968                } 
    5069        }