Beispiel #1
0
        private void OpenLeaf(TabGroupLeaf tgl, decimal space)
        {
            if (tgl == null)
            {
                return;
            }

            // Only open the leaf visually, it does not set a leaf active
            Crownwood.DotNetMagic.Controls.TabPage tabPageUI = tgl.TabPages[0];
            StackTabPage page     = (StackTabPage)tabPageUI.Tag;
            StackTab     stackTab = (StackTab)tabPageUI.Control;

            if (page.Component.IsStarted == false)
            {
                page.Component.Start();
            }

            if (stackTab.ApplicationComponentControl == null)
            {
                stackTab.ApplicationComponentControl      = (Control)_component.GetPageView(page).GuiElement;
                stackTab.ApplicationComponentControl.Dock = DockStyle.Fill;
            }

            SetArrowState(stackTab.TitleBar, true);

            tgl.Space = space;
        }
Beispiel #2
0
        private void CreateStackTab(StackTabPage page)
        {
            StackTab stackTab = new StackTab(page, DockStyle.Top);

            if (_component.StackStyle == StackStyle.ShowMultiple)
            {
                stackTab.TitleBar.ActAsButton = ActAsButton.JustArrow;
                stackTab.TitleBar.ArrowButton = ArrowButton.DownArrow;
            }
            else
            {
                stackTab.TitleBar.ActAsButton = ActAsButton.WholeControl;
                stackTab.TitleBar.ArrowButton = ArrowButton.None;
            }

            stackTab.ButtonClicked      += OnTabButtonClick;
            stackTab.TitleClicked       += OnTabTitleClicked;
            stackTab.TitleDoubleClicked += OnTabTitleDoubleClicked;

            TabGroupLeaf tgl = _stackTabControl.RootSequence.AddNewLeaf();

            tgl.MinimumSize = stackTab.MinimumRequestedSize;

            // Prevent user from resizing
            tgl.ResizeBarLock = _component.StackStyle == StackStyle.ShowMultiple ? false : true;

            Crownwood.DotNetMagic.Controls.TabPage tabPageUI = new Crownwood.DotNetMagic.Controls.TabPage(page.Name, stackTab);
            tabPageUI.Tag = page;
            tgl.TabPages.Add(tabPageUI);

            RecalculateTabSizes();
        }
Beispiel #3
0
        private void ChangeComponentPageFromLeaf(TabGroupLeaf tgl)
        {
            StackTabPage page = (StackTabPage)tgl.TabPages[0].Tag;

            if (_component.CurrentPage != page)
            {
                TabGroupLeaf previousLeaf = GetLeafForStackPage(_component.CurrentPage);
                HighlightLeaf(previousLeaf, false);

                if (_component.CurrentPage != page)
                {
                    _component.CurrentPage = page;
                }
            }

            HighlightLeaf(tgl, true);
        }
Beispiel #4
0
        private void RemoveStackTab(StackTabPage page)
        {
            for (int i = 0; i < _stackTabControl.RootSequence.Count; i++)
            {
                TabGroupLeaf tgl = (TabGroupLeaf)_stackTabControl.RootSequence[i];
                Crownwood.DotNetMagic.Controls.TabPage tabPageUI = CollectionUtils.FirstElement <Crownwood.DotNetMagic.Controls.TabPage>(tgl.TabPages);
                if (tabPageUI.Tag == page)
                {
                    // remove the tab page
                    // note that this automatically removes the parent leaf, since it is the only tab
                    tgl.TabPages.Remove(tabPageUI);
                    break;
                }
            }

            RecalculateTabSizes();
        }
Beispiel #5
0
        private TabGroupLeaf GetLeafForStackPage(StackTabPage page)
        {
            TabGroupLeaf tgl = _stackTabControl.FirstLeaf();

            while (tgl != null)
            {
                StackTabPage p = (StackTabPage)tgl.TabPages[0].Tag;

                if (p == page)
                {
                    break;
                }

                tgl = _stackTabControl.NextLeaf(tgl);
            }

            return(tgl);
        }
Beispiel #6
0
		// New constructor
		public StackTab(StackTabPage page, DockStyle docStyle)
		{
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

        	_page = page;
			_titleBar.Dock = docStyle;

            // Set initial values
			_titleBar.PreText = String.Empty;
			_titleBar.Text = _page.Title;
			_titleBar.PostText = String.Empty;
			if (_page.IconSet != null)
				_titleBar.Image = _page.IconSet.CreateIcon(IconSize.Small, _page.ResourceResolver);

			_page.TitleChanged += OnPageTitleChanged;
			_page.IconSetChanged += OnPageIconChanged;
		}
Beispiel #7
0
        // New constructor
        public StackTab(StackTabPage page, DockStyle docStyle)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _page          = page;
            _titleBar.Dock = docStyle;

            // Set initial values
            _titleBar.PreText  = String.Empty;
            _titleBar.Text     = _page.Title;
            _titleBar.PostText = String.Empty;
            if (_page.IconSet != null)
            {
                _titleBar.Image = _page.IconSet.CreateIcon(IconSize.Small, _page.ResourceResolver);
            }

            _page.TitleChanged   += OnPageTitleChanged;
            _page.IconSetChanged += OnPageIconChanged;
        }
		private TabGroupLeaf GetLeafForStackPage(StackTabPage page)
		{
			TabGroupLeaf tgl = _stackTabControl.FirstLeaf();
			while (tgl != null)
			{
				StackTabPage p = (StackTabPage)tgl.TabPages[0].Tag;

				if (p == page)
					break;

				tgl = _stackTabControl.NextLeaf(tgl);
			}

			return tgl;
		}
		private void RemoveStackTab(StackTabPage page)
		{
			for (int i = 0; i < _stackTabControl.RootSequence.Count; i++)
			{
				TabGroupLeaf tgl = (TabGroupLeaf)_stackTabControl.RootSequence[i];
				Crownwood.DotNetMagic.Controls.TabPage tabPageUI = CollectionUtils.FirstElement<Crownwood.DotNetMagic.Controls.TabPage>(tgl.TabPages);
				if(tabPageUI.Tag == page)
				{
					// remove the tab page
					// note that this automatically removes the parent leaf, since it is the only tab
					tgl.TabPages.Remove(tabPageUI);
					break;
				}
			}

			RecalculateTabSizes();
		}
		private void CreateStackTab(StackTabPage page)
		{
			StackTab stackTab = new StackTab(page, DockStyle.Top);

			if (_component.StackStyle == StackStyle.ShowMultiple)
			{
				stackTab.TitleBar.ActAsButton = ActAsButton.JustArrow;
				stackTab.TitleBar.ArrowButton = ArrowButton.DownArrow;
			}
			else
			{
				stackTab.TitleBar.ActAsButton = ActAsButton.WholeControl;
				stackTab.TitleBar.ArrowButton = ArrowButton.None;
			}

			stackTab.ButtonClicked += OnTabButtonClick;
			stackTab.TitleClicked += OnTabTitleClicked;
			stackTab.TitleDoubleClicked += OnTabTitleDoubleClicked;

			TabGroupLeaf tgl = _stackTabControl.RootSequence.AddNewLeaf();
			tgl.MinimumSize = stackTab.MinimumRequestedSize;

			// Prevent user from resizing
			tgl.ResizeBarLock = _component.StackStyle == StackStyle.ShowMultiple ? false : true;

			Crownwood.DotNetMagic.Controls.TabPage tabPageUI = new Crownwood.DotNetMagic.Controls.TabPage(page.Name, stackTab);
			tabPageUI.Tag = page;
			tgl.TabPages.Add(tabPageUI);

			RecalculateTabSizes();
		}