Beispiel #1
0
        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);
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        private void book_SwitchPage(object o, SwitchPageArgs args)
        {
            EventHandler <CurrentPageChangedArgs> handler = CurrentPageChanged;

            if (handler != null)
            {
                handler(this, new CurrentPageChangedArgs(previousPage));
            }
            previousPage = CurrentPage;
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
 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;
 }
Beispiel #9
0
 public void RemovePage(WorkBookPage page)
 {
     RemovePage(GetPageIndexByHash(page.GetHashCode()));
 }