예제 #1
0
        public void AppendPage(SidebarPage page)
        {
            page.Sidebar           = this;
            page.CanSelectChanged += HandleCanSelectChanged;
            pages.Add(page);

            string label     = page.Label;
            string icon_name = page.IconName;

            notebook.AppendPage(page.SidebarWidget, new Label(label));
            page.SidebarWidget.Show();

            MenuItem item;

            if (icon_name == null)
            {
                item = new MenuItem(label);
            }
            else
            {
                item = new ImageMenuItem(label);
                (item as ImageMenuItem).Image = new Image();
                ((item as ImageMenuItem).Image as Image).IconName = icon_name;
            }

            item.Activated += HandleItemClicked;
            choose_menu.Append(item);
            item.Show();

            if (notebook.Children.Length == 1)
            {
                choose_button.Label          = label;
                choose_button.Image.IconName = icon_name;
            }
            menu_list.Add(label);
            image_list.Add(icon_name);
        }
예제 #2
0
 public bool IsActive(SidebarPage page)
 {
     return(Notebook.GetNthPage(Notebook.CurrentPage) == page.SidebarWidget);
 }