예제 #1
0
파일: Tab.cs 프로젝트: yzwbrian/Appl4s
        public static void remove(TabItemModel model, KryptonNavigator tab)
        {
            if (tab == null)
            {
                throw new ArgumentNullException("tab");
            }
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            if (string.IsNullOrWhiteSpace(model.Id))
            {
                throw new ArgumentNullException("model[Id]");
            }

            KryptonPage page = findPageById(model.Id, tab);

            if (page == null)
            {
                throw new Exception(string.Format("TabPage[id={0}] is not found.", model.Id));
            }

            tab.Pages.Remove(page);
            if (tab.Button.ButtonSpecs.Count > 1)
            {
                var btnspecSplit = tab.Button.ButtonSpecs[1];
                adjustTab(tab);
            }
        }
예제 #2
0
파일: Tab.cs 프로젝트: yzwbrian/Appl4s
        public static void setTabItemModel(TabItemModel model, UpdateType type, KryptonPage page)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (string.IsNullOrWhiteSpace(model.Id))
            {
                throw new ArgumentNullException("model[Id]");
            }

            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            setPageCloseable(model.Closeable, page);

            if (type == UpdateType.UpdateAllById)
            {
                page.Text         = model.Title;
                page.ImageSmall   = model.Icon;
                page.ToolTipTitle = model.TooltipTitle;
                page.ToolTipBody  = model.TooltipBody;
                page.ToolTipImage = model.TooltipImage;
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(model.Title))
                {
                    page.Text = model.Title;
                }

                if (model.Icon != null)
                {
                    page.ImageSmall = model.Icon;
                }

                if (!string.IsNullOrWhiteSpace(model.TooltipTitle))
                {
                    page.ToolTipTitle = model.TooltipTitle;
                }

                if (!string.IsNullOrWhiteSpace(model.TooltipBody))
                {
                    page.ToolTipBody = model.TooltipBody;
                }

                if (model.TooltipImage != null)
                {
                    page.ToolTipImage = model.TooltipImage;
                }
            }
        }
예제 #3
0
        private TabItemModel newModel()
        {
            TabItemModel model = TabItemModel.createEmpty();

            model.Title        = "新建标签" + (++_tabCount);
            model.Icon         = Properties.Resources.document_edit_24;
            model.Closeable    = true;
            model.TooltipTitle = "新建标签" + _tabCount;
            model.TooltipBody  = "暂无描述";
            model.TooltipImage = Properties.Resources.document_edit_24;
            return(model);
        }
예제 #4
0
파일: Tab.cs 프로젝트: yzwbrian/Appl4s
        public static KryptonPage insert(TabItemModel model, KryptonNavigator tab, int index = -1)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (tab == null)
            {
                throw new ArgumentNullException("tab");
            }

            if (index >= tab.Pages.Count)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            string      id   = new Guid().ToString();
            KryptonPage page = new KryptonPage(model.Title, id)
            {
                ToolTipStyle = LabelStyle.SuperTip
            };

            setTabItemModel(model, UpdateType.UpdateAllById, page);

            if (index == -1)
            {
                tab.Pages.Add(page);
            }
            else
            {
                tab.Pages.Insert(index, page);
            }

            if (tab.Button.ButtonSpecs.Count > 1)
            {
                var btnspecSplit = tab.Button.ButtonSpecs[1];
                adjustTab(tab);
            }

            if (_tabItemMenu != null)
            {
                page.KryptonContextMenu = _tabItemMenu;
            }
            return(page);
        }
예제 #5
0
파일: Tab.cs 프로젝트: yzwbrian/Appl4s
        public static TabItemModel getTabItemModel(KryptonPage page)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            TabItemModel model = TabItemModel.create(page.UniqueName);

            model.Title        = page.Text;
            model.Icon         = page.ButtonSpecs.Count > 0 ? page.ButtonSpecs[0].Image : null;
            model.Closeable    = page.ButtonSpecs.Count > 0;
            model.TooltipTitle = page.ToolTipTitle;
            model.TooltipBody  = page.ToolTipBody;
            model.TooltipImage = page.ToolTipImage;

            return(model);
        }