private Widget CreatePageTab(WorkBookPage child) { HBox hb = new HBox { Spacing = 0 }; Label lbl = new Label { Markup = new PangoStyle { Size = PangoStyle.TextSize.Small, Text = child.PageTitle } }; hb.PackStart(lbl, false, true, 0); Button btn = new Button { Relief = ReliefStyle.None, FocusOnClick = false }; btn.Add(ComponentHelper.LoadImage("Warehouse.Component.WorkBook.Icon.Close12.png")); btn.Clicked += CloseButton_Clicked; hb.PackEnd(btn, false, true, 0); hb.ShowAll(); return(hb); }
public void AddPage(WorkBookPage page, bool setAsCurrent) { page.OnPageAdding(); HBox hbPageTab = new HBox(); Widget tab = CreatePageTab(page); hbPageTab.PackStart(tab); tab.Show(); Label pageNum = new Label(); pageNum.Text = page.GetHashCode().ToString(); pageNum.Visible = false; pageNum.Name = "WorkBookPageId"; hbPageTab.PackEnd(pageNum); hbPageTab.CanFocus = false; page.CanFocus = true; book.AppendPage(page, hbPageTab); page.Show(); if (setAsCurrent) { CurrentPage = page; } page.OnPageAdded(); }
private void book_SwitchPage(object o, SwitchPageArgs args) { EventHandler <CurrentPageChangedArgs> handler = CurrentPageChanged; if (handler != null) { handler(this, new CurrentPageChangedArgs(previousPage)); } previousPage = CurrentPage; }
public int GetPageIndexByHash(int hashCode) { for (int i = 0; i < book.NPages; i++) { WorkBookPage page = (WorkBookPage)book.GetNthPage(i); if (page.GetHashCode() == hashCode) { return(i); } } return(-1); }
public WorkBookPage GetPageByHash(int hashCode) { for (int i = 0; i < book.NPages; i++) { WorkBookPage page = (WorkBookPage)book.GetNthPage(i); if (page.GetHashCode() == hashCode) { return(page); } } return(null); }
public WorkBookPage FindPageByName(string pageName) { for (int i = 0; i < book.NPages; i++) { WorkBookPage page = (WorkBookPage)book.GetNthPage(i); if (page.PageTitle == pageName) { return(page); } } return(null); }
public void RemovePage(int pageNumber) { book.RemovePage(pageNumber); if (book.NPages == 0) { // the current page was changed to null EventHandler <CurrentPageChangedArgs> handler = CurrentPageChanged; if (handler != null) { handler(this, new CurrentPageChangedArgs(previousPage)); } previousPage = CurrentPage; } }
public CurrentPageChangedArgs(WorkBookPage previousPage) { this.previousPage = previousPage; }
public void RemovePage(WorkBookPage page) { RemovePage(GetPageIndexByHash(page.GetHashCode())); }