Beispiel #1
0
		public Tabs()
		{
			GradientColor = SystemColors.Control;
			BackColor = SystemColors.Control;
			ForeColor = Color.FromArgb(66,65,66);
			
			Tab Tab = new Tab(true);
			Tab.Name = "Default";
			Add(Tab);
			CurrentTab = Tab;
			TabHeight = 18;
		}
Beispiel #2
0
		public virtual void Collapse(Tab source, Tab target)
		{
			if (source.Default) throw new TabsException("Default Tab cannot be collapsed.");
			foreach (Element element in source.Elements)
			{
				target.Elements.Add(element.Key,element);
			}
			
			List.Remove(source);
			OnRemove(0,source);			
		}
Beispiel #3
0
		public virtual void MoveElement(Element element, Tab source, Tab target)
		{
			target.Elements.Add(element.Key,element);
			source.Elements.Remove(element.Key);
		}
Beispiel #4
0
		//Returns true if list contains Tab
		public virtual bool Contains(Tab value)  
		{
			return List.Contains(value);
		}
Beispiel #5
0
		//Returns the index of an Tab
		public virtual int IndexOf(Tab value)  
		{
			return List.IndexOf(value);
		}
Beispiel #6
0
		//Removes an Tab from the list
		public virtual void Remove(Tab value )  
		{
			if (value.Default) throw new TabsException("The default Tab cannot be removed.");
			Collapse(value,this["default"]);
		}
Beispiel #7
0
		//Inserts an element into the list
		public virtual void Insert(int index, Tab value)  
		{
			List.Insert(index, value);
			OnInsert(index,value);
		}
Beispiel #8
0
		//Methods
		//Adds an Tab to the list 
		public virtual int Add(Tab value)  
		{
			int index = List.Add(value);
			OnInsert(index,value);
			return index;
		}
		private void RenderTab(Graphics graphics, Tab tab)
		{
			Pen pen;

			//Setup background and text rectangle
			RectangleF rect = tab.Rectangle;
			RectangleF innerRect = tab.Rectangle;
			innerRect.Inflate(-1,-1);

			if (rect.IsEmpty) return;

			//Draw the gradient background
			LinearGradientBrush gradient = new LinearGradientBrush(rect,Tabs.BackColor,Tabs.GradientColor,LinearGradientMode.Vertical);
			graphics.FillRectangle(gradient,rect);

			//Draw left + top
			pen = (tab.Pressed) ? SystemPens.ControlDark : SystemPens.ControlLightLight;
			graphics.DrawLine(pen,new PointF(rect.Left,rect.Bottom),new PointF(rect.Left,rect.Top));
			graphics.DrawLine(pen,new PointF(rect.Left,rect.Top),new PointF(rect.Right,rect.Top));

			//Draw right bottom
			pen = (tab.Pressed) ? SystemPens.ControlLightLight : SystemPens.ControlDark;
			graphics.DrawLine(pen,new PointF(rect.Right,rect.Top),new PointF(rect.Right,rect.Bottom));
			graphics.DrawLine(pen,new PointF(rect.Right,rect.Bottom),new PointF(rect.Left,rect.Bottom));

			StringFormat format = new StringFormat();
			format.LineAlignment = StringAlignment.Center;

			//Offset by one if pressed
			if (tab.Pressed) innerRect.Offset(1,1);

			SolidBrush brush = new SolidBrush(Tabs.ForeColor);
			graphics.DrawString(tab.Name,mFont,brush,innerRect,format);
		}
		//Constructors
		public PaletteRender()
		{
			mScrollTab = new Tab();
			mScrollTab.Visible = false;
			mScrollTab.ButtonStyle = ButtonStyle.Down;
		}