public MainWindow() : base(WindowType.Toplevel) { AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask)); VBox master = new VBox (); master.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask)); Title = "Ribbons Sample"; AppPaintable = true; VariantsCombinaisonSwitcher page0 = new VariantsCombinaisonSwitcher (); RibbonGroup group0 = CreateGroup0 (); RibbonGroup group1 = CreateGroup1 (); RibbonGroup group2 = CreateGroup2 (); DropdownRibbonGroup dgroup0 = CreateDropdownGroup0 (); dgroup0.Group = group0; DropdownRibbonGroup dgroup1 = CreateDropdownGroup1 (); dgroup1.Group = group1; DropdownRibbonGroup dgroup2 = CreateDropdownGroup2 (); dgroup2.Group = group2; VariantsCombinaison combi0 = new VariantsCombinaison (); combi0.Append (group0); combi0.Append (group1); combi0.Append (group2); page0.AddCombinaison (combi0); VariantsCombinaison combi1 = new VariantsCombinaison (); combi1.Append (group0); combi1.Append (group1); combi1.Append (dgroup2); page0.AddCombinaison (combi1); VariantsCombinaison combi2 = new VariantsCombinaison (); combi2.Append (dgroup0); combi2.Append (dgroup1); combi2.Append (dgroup2); page0.AddCombinaison (combi2); HBox page1 = new HBox (false, 2); RibbonGroup group10 = new RibbonGroup (); group10.Label = "Welcome on the second page"; page1.PackStart (group10, false, false, 0); HBox page2 = new HBox (false, 2); Label pageLabel0 = new Label ("Page 1"); pageLabel1 = new Label ("Page 2"); Label pageLabel2 = new Label ("Page 3"); Ribbons.Button shortcuts = new Ribbons.Button ("Menu"); shortcuts.Child.ModifyFg (Gtk.StateType.Normal, new Gdk.Color(255, 255, 255)); Menu mainMenu = new Menu (); MenuItem mainMenu_quit = new MenuItem ("Quit"); mainMenu_quit.Activated += delegate (object Sender, EventArgs e) { Application.Quit (); }; mainMenu.Append (mainMenu_quit); shortcuts.Clicked += delegate (object Sender, EventArgs e) { mainMenu.Popup (); mainMenu.ShowAll (); }; QuickAccessToolbar qat = new QuickAccessToolbar (); Ribbons.Button qatNew, qatSave; qat.Append (qatNew = Ribbons.Button.FromStockIcon (Gtk.Stock.New, false)); qat.Append (qatSave = Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false)); ribbon = new Ribbon (); ribbon.ApplicationButton = new ApplicationButton (); ribbon.QuickAccessToolbar = qat; //ribbon.Shortcuts = shortcuts; ribbon.AppendPage (page0, pageLabel0); ribbon.AppendPage (page1, pageLabel1); ribbon.AppendPage (page2, pageLabel2); pageLabel1.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask)); pageLabel1.ButtonPressEvent += delegate (object sender, ButtonPressEventArgs e) { Console.WriteLine("label1 press"); }; pageLabel1.EnterNotifyEvent += delegate (object sender, EnterNotifyEventArgs e) { Console.WriteLine("label1 enter"); }; pageLabel1.LeaveNotifyEvent += delegate (object sender, LeaveNotifyEventArgs e) { Console.WriteLine("label1 leave"); }; ApplicationMenu appMenu = ribbon.ApplicationButton.Menu; TextView mnu = new TextView (); appMenu.DefaultMenu = mnu; mnu.Buffer.InsertAtCursor ("Default"); ApplicationMenuItem mi = new ApplicationMenuItem ("Test 1"); mnu = new TextView (); mi.Menu = mnu; mnu.Buffer.InsertAtCursor ("Test 1"); appMenu.Append (mi); mi = new ApplicationMenuItem ("Test 2"); appMenu.Append (mi); mi = new ApplicationMenuItem ("Test 3"); appMenu.Append (mi); appMenu.OptionsButton = new Ribbons.Button ("Options"); appMenu.ExitButton = new Ribbons.Button ("Exit"); TextView txt = new TextView (); master.PackStart (ribbon, false, false, 0); master.PackStart (txt, true, true, 0); Add (master); ribbon.ApplicationButton.KeyTip = new KeyTip (appMenu, "A"); qat.AddKeyTip (new KeyTip (qatNew, "B")); qat.AddKeyTip (new KeyTip (qatSave, "C")); ribbon.AddTabKeyTip (new KeyTip (pageLabel0, "D")); ribbon.AddTabKeyTip (new KeyTip (pageLabel1, "E")); ribbon.AddTabKeyTip (new KeyTip (pageLabel2, "F")); ScreenChanged += Window_OnScreenChanged; Window_OnScreenChanged (this, null); ExposeEvent += Window_OnExpose; DeleteEvent += Window_OnDelete; this.Resize (200, 200); this.ShowAll (); }
public PageEventArgs (Ribbon.RibbonPage page) { this.page = page; }
/// <summary>Draws a ribbon.</summary> public void DrawRibbon (Context cr, Gdk.Rectangle bodyAllocation, double roundSize, double lineWidth, Ribbon widget) { double lineWidth05 = lineWidth / 2; double lineWidth15 = 3 * lineWidth05; double x0, x1, y0, y1; LinearGradient linGrad; Ribbon.RibbonPage p = widget.CurrentPage; if(p != null) { //Color c = ColorScheme.GetColor(colorScheme.Bright, 0.92); Color c = colorScheme.Normal; if(bodyAllocation.Height > 0) { /*** PAGE ***/ x0 = bodyAllocation.X; x1 = bodyAllocation.X + bodyAllocation.Width; y0 = bodyAllocation.Y; y1 = bodyAllocation.Y + bodyAllocation.Height; cr.Arc (x0 + roundSize, y1 - roundSize, roundSize - lineWidth05, Math.PI/2, Math.PI); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.Arc (x1 - roundSize, y1 - roundSize, roundSize - lineWidth05, 0, Math.PI/2); cr.LineTo (x0 + roundSize, y1 - lineWidth05); /*** BACKGOUND ***/ cr.Color = c; cr.FillPreserve (); /*** DARK BORDER ***/ cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorAbsolute (colorScheme.Normal, 0.75); cr.Stroke (); /*** GLASS EFFECT ***/ double ymid = Math.Round(y0 + (y1 - y0) * 0.25); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth, ymid); cr.LineTo (x0 + lineWidth, ymid); cr.LineTo (x0 + lineWidth, y0 + roundSize); linGrad = new LinearGradient (0, y0, 0, ymid); linGrad.AddColorStop (0.0, new Color (0, 0, 0, 0.0)); linGrad.AddColorStop (1.0, new Color (0, 0, 0, 0.075)); cr.Pattern = linGrad; cr.Fill (); cr.Arc (x0 + roundSize, y1 - roundSize, roundSize - lineWidth, Math.PI/2, Math.PI); cr.LineTo (x0 + lineWidth, ymid); cr.LineTo (x1 - lineWidth, ymid); cr.Arc (x1 - roundSize, y1 - roundSize, roundSize - lineWidth, 0, Math.PI/2); cr.LineTo (x0 + roundSize, y1 - lineWidth); linGrad = new LinearGradient (0, ymid, 0, y1); linGrad.AddColorStop (0.0, new Color (0, 0, 0, 0.1)); linGrad.AddColorStop (0.5, new Color (0, 0, 0, 0.0)); cr.Pattern = linGrad; cr.Fill (); } /*** TAB ***/ Gdk.Rectangle r = p.LabelAllocation; x0 = r.X; x1 = r.X + r.Width; y0 = r.Y; y1 = r.Y + r.Height + lineWidth; /*** TAB :: BACKGROUND ***/ cr.MoveTo (x0 + lineWidth05, y1); cr.LineTo (x0 + lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth05, y1); linGrad = new LinearGradient (0, y0, 0, y1); linGrad.AddColorStop (0.0, colorScheme.PrettyBright); linGrad.AddColorStop (1.0, c); cr.Pattern = linGrad; cr.Fill (); /*** TAB :: DARK BORDER ***/ cr.MoveTo (x0 + lineWidth05, y1); cr.LineTo (x0 + lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorRelative (colorScheme.Bright, -0.1); cr.Stroke (); y1 -= 1.0; /*** TAB :: HIGHLIGHT ***/ cr.MoveTo (x0 + lineWidth15, y1); cr.LineTo (x0 + lineWidth15, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth15, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth15, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth15, y1); cr.LineWidth = lineWidth; linGrad = new LinearGradient (0, y0+lineWidth, 0, y1); linGrad.AddColorStop (0.0, colorScheme.PrettyBright); linGrad.AddColorStop (1.0, ColorScheme.SetAlphaChannel (colorScheme.Bright, 0)); cr.Pattern = linGrad; cr.Stroke (); /*** TAB :: SHADOW ***/ cr.MoveTo (x0 - lineWidth05, y1); cr.LineTo (x0 - lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize + lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize + lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 + lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = new Color (0, 0, 0, 0.2); cr.Stroke (); } }
public RibbonPage(Ribbon Parent, Widget Page, Widget Label) { this.parent = Parent; this.Label = Label; this.Page = Page; this.tabKeyTips = new List<KeyTip> (); }
/// <summary>Draws a ribbon.</summary> public void DrawRibbon(Context cr, Gdk.Rectangle menuBarAllocation, Gdk.Rectangle bodyAllocation, double roundSize, double lineWidth, Ribbon widget) { double lineWidth05 = lineWidth / 2; double lineWidth15 = 3 * lineWidth05; double x0, x1, y0, y1; LinearGradient linGrad; if(menuBarAllocation.Height > 0) { cr.Rectangle (menuBarAllocation.X, menuBarAllocation.Y, menuBarAllocation.Width, menuBarAllocation.Height - 1); linGrad = new LinearGradient (0, menuBarAllocation.Y, 0, menuBarAllocation.Y + menuBarAllocation.Height - 1); linGrad.AddColorStop (0.0, new Color (1, 1, 1, 0.5)); linGrad.AddColorStop (0.3, new Color (1, 1, 1, 0.2)); linGrad.AddColorStop (0.3, new Color (1, 1, 1, 0.0)); linGrad.AddColorStop (1.0, new Color (1, 1, 1, 0.5)); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); cr.MoveTo (menuBarAllocation.X, menuBarAllocation.Bottom + 0.5); cr.LineTo (menuBarAllocation.Right, menuBarAllocation.Bottom + 0.5); cr.Color = new Color (1, 1, 1, 0.5); cr.LineWidth = 1; cr.Stroke (); // Quick Access Toolbar background Gdk.Rectangle alloc = widget.QuickAccessToolbar.Allocation; x0 = alloc.X; x1 = alloc.Right - 1; y0 = alloc.Y; y1 = alloc.Bottom - 1; double radius = (y1 - y0) / 2; cr.LineWidth = 1; if(widget.ApplicationButton != null) { Gdk.Rectangle alloc2 = widget.ApplicationButton.Allocation; double cx = alloc2.X + alloc2.Width / 2; double cy = alloc2.Y + alloc2.Height / 2; double radius2 = x0 - cx; double alpha = Math.Asin ((y0 - cy) / radius2); double beta = Math.Asin ((y1 - cy) / radius2); double curveWidth0 = Math.Cos (Math.Abs (alpha)) * radius2; double curveWidth1 = Math.Cos (Math.Abs (beta)) * radius2; double curveWidth = Math.Min (curveWidth0, curveWidth1); cr.Save (); cr.Rectangle (cx + curveWidth, y0, x1 - cx - curveWidth, alloc.Height); cr.ClipPreserve (); cr.ArcNegative (cx, cy, radius2, -alpha, -beta); linGrad = new LinearGradient (0, y0, 0, y1); linGrad.AddColorStop (0.0, colorScheme.Bright); linGrad.AddColorStop (1.0, colorScheme.PrettyDark); cr.Pattern = linGrad; //cr.Color = new Color (1, 0, 0); cr.Fill (); cr.Restore (); cr.Arc (x1, y0 + radius, radius - 0.5, 1.5 * Math.PI, 0.5 * Math.PI); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); cr.Arc (cx, cy, radius2, alpha, beta); cr.Color = new Color (0, 0, 0, 0.6); cr.Stroke (); radius2 -= 1; cr.Arc (cx, cy, radius2, alpha, beta); cr.Color = new Color (1, 1, 1, 0.4); cr.Stroke (); cr.MoveTo (cx + curveWidth0, y0 - 0.5); cr.LineTo (x1, y0 - 0.5); cr.Color = new Color (1, 1, 1, 0.4); cr.Stroke (); cr.MoveTo (cx + curveWidth0, y0 + 0.5); cr.LineTo (x1, y0 + 0.5); cr.Color = new Color (0, 0, 0, 0.6); cr.Stroke (); cr.MoveTo (cx + curveWidth1, y1 - 0.5); cr.LineTo (x1, y1 - 0.5); cr.Color = new Color (0, 0, 0, 0.6); cr.Stroke (); cr.MoveTo (cx + curveWidth1, y1 + 0.5); cr.LineTo (x1, y1 + 0.5); cr.Color = new Color (1, 1, 1, 0.4); cr.Stroke (); } else { cr.Rectangle (x0, y0, x1 - x0, alloc.Height); linGrad = new LinearGradient (0, y0, 0, y1); linGrad.AddColorStop (0.0, colorScheme.Bright); linGrad.AddColorStop (1.0, colorScheme.PrettyDark); cr.Pattern = linGrad; cr.Fill (); cr.Arc (x1, y0 + radius, radius - 0.5, 1.5 * Math.PI, 0.5 * Math.PI); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); cr.MoveTo (x0 + 0.5, y0); cr.LineTo (x0 + 0.5, y1); cr.Color = new Color (1, 1, 1, 0.4); cr.Stroke (); cr.MoveTo (x0 + 1.5, y0); cr.LineTo (x0 + 1.5, y1); cr.Color = new Color (0, 0, 0, 0.6); cr.Stroke (); } cr.Arc (x1, y0 + radius, radius + 0.5, 1.5 * Math.PI, 0.5 * Math.PI); cr.Color = new Color (1, 1, 1, 0.4); cr.Stroke (); cr.Arc (x1, y0 + radius, radius - 0.5, 1.5 * Math.PI, 0.5 * Math.PI); cr.Color = new Color (0, 0, 0, 0.6); cr.Stroke (); } Ribbon.RibbonPage p = widget.CurrentPage; if(p != null) { //Color c = ColorScheme.GetColor(colorScheme.Bright, 0.92); Color c = colorScheme.Normal; if(bodyAllocation.Height > 0) { /*** PAGE ***/ x0 = bodyAllocation.X; x1 = bodyAllocation.X + bodyAllocation.Width; y0 = bodyAllocation.Y; y1 = bodyAllocation.Y + bodyAllocation.Height; cr.Arc (x0 + roundSize, y1 - roundSize, roundSize - lineWidth05, Math.PI/2, Math.PI); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.Arc (x1 - roundSize, y1 - roundSize, roundSize - lineWidth05, 0, Math.PI/2); cr.LineTo (x0 + roundSize, y1 - lineWidth05); /*** BACKGOUND ***/ cr.Color = c; cr.FillPreserve (); /*** DARK BORDER ***/ cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorAbsolute (colorScheme.Normal, 0.75); cr.Stroke (); /*** GLASS EFFECT ***/ double ymid = Math.Round (y0 + (y1 - y0) * 0.25); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth, ymid); cr.LineTo (x0 + lineWidth, ymid); cr.LineTo (x0 + lineWidth, y0 + roundSize); linGrad = new LinearGradient (0, y0, 0, ymid); linGrad.AddColorStop (0.0, new Color (0, 0, 0, 0.0)); linGrad.AddColorStop (1.0, new Color (0, 0, 0, 0.075)); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); cr.Arc (x0 + roundSize, y1 - roundSize, roundSize - lineWidth, Math.PI/2, Math.PI); cr.LineTo (x0 + lineWidth, ymid); cr.LineTo (x1 - lineWidth, ymid); cr.Arc (x1 - roundSize, y1 - roundSize, roundSize - lineWidth, 0, Math.PI/2); cr.LineTo (x0 + roundSize, y1 - lineWidth); linGrad = new LinearGradient (0, ymid, 0, y1); linGrad.AddColorStop (0.0, new Color (0, 0, 0, 0.1)); linGrad.AddColorStop (0.5, new Color (0, 0, 0, 0.0)); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); } /*** TAB ***/ Gdk.Rectangle r = p.LabelAllocation; x0 = r.X; x1 = r.X + r.Width; y0 = r.Y; y1 = r.Y + r.Height + lineWidth; /*** TAB :: BACKGROUND ***/ cr.MoveTo (x0 + lineWidth05, y1); cr.LineTo (x0 + lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth05, y1); linGrad = new LinearGradient (0, y0, 0, y1); linGrad.AddColorStop (0.0, colorScheme.PrettyBright); linGrad.AddColorStop (1.0, c); cr.Pattern = linGrad; cr.Fill (); linGrad.Destroy (); /*** TAB :: DARK BORDER ***/ cr.MoveTo (x0 + lineWidth05, y1); cr.LineTo (x0 + lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorRelative (colorScheme.Bright, -0.1); cr.Stroke (); y1 -= 1.0; /*** TAB :: HIGHLIGHT ***/ cr.MoveTo (x0 + lineWidth15, y1); cr.LineTo (x0 + lineWidth15, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize - lineWidth15, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize - lineWidth15, 3*Math.PI/2, 0); cr.LineTo (x1 - lineWidth15, y1); cr.LineWidth = lineWidth; linGrad = new LinearGradient (0, y0+lineWidth, 0, y1); linGrad.AddColorStop (0.0, colorScheme.PrettyBright); linGrad.AddColorStop (1.0, ColorScheme.SetAlphaChannel (colorScheme.Bright, 0)); cr.Pattern = linGrad; cr.Stroke (); linGrad.Destroy (); /*** TAB :: SHADOW ***/ cr.MoveTo (x0 - lineWidth05, y1); cr.LineTo (x0 - lineWidth05, y0 + roundSize); cr.Arc (x0 + roundSize, y0 + roundSize, roundSize + lineWidth05, Math.PI, 3*Math.PI/2); cr.Arc (x1 - roundSize, y0 + roundSize, roundSize + lineWidth05, 3*Math.PI/2, 0); cr.LineTo (x1 + lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = new Color (0, 0, 0, 0.2); cr.Stroke (); } }
public RibbonPage(Ribbon Parent, Widget Page, Widget Label) { parent = Parent; this.Label = Label; this.Page = Page; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { m_ribbon = animator.gameObject.GetComponent<Ribbons.Ribbon>(); m_ribbon.BreakeEnter(); }
/// <summary>Draws a ribbon.</summary> public void DrawRibbon(Context cr, Gdk.Rectangle bodyAllocation, double roundSize, double lineWidth, Ribbon widget) { double lineWidth05 = lineWidth / 2; double lineWidth15 = 3 * lineWidth05; double x0, x1, y0, y1; LinearGradient linGrad; Ribbon.RibbonPage p = widget.CurrentPage; if (p != null) { //Color c = ColorScheme.GetColor(colorScheme.Bright, 0.92); Color c = colorScheme.Normal; if (bodyAllocation.Height > 0) { /*** PAGE ***/ x0 = bodyAllocation.X; x1 = bodyAllocation.X + bodyAllocation.Width; y0 = bodyAllocation.Y; y1 = bodyAllocation.Y + bodyAllocation.Height; cr.Arc(x0 + roundSize, y1 - roundSize, roundSize - lineWidth05, Math.PI / 2, Math.PI); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3 * Math.PI / 2, 0); cr.Arc(x1 - roundSize, y1 - roundSize, roundSize - lineWidth05, 0, Math.PI / 2); cr.LineTo(x0 + roundSize, y1 - lineWidth05); /*** BACKGOUND ***/ cr.Color = c; cr.FillPreserve(); /*** DARK BORDER ***/ cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorAbsolute(colorScheme.Normal, 0.75); cr.Stroke(); /*** GLASS EFFECT ***/ double ymid = Math.Round(y0 + (y1 - y0) * 0.25); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize - lineWidth, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize - lineWidth, 3 * Math.PI / 2, 0); cr.LineTo(x1 - lineWidth, ymid); cr.LineTo(x0 + lineWidth, ymid); cr.LineTo(x0 + lineWidth, y0 + roundSize); linGrad = new LinearGradient(0, y0, 0, ymid); linGrad.AddColorStop(0.0, new Color(0, 0, 0, 0.0)); linGrad.AddColorStop(1.0, new Color(0, 0, 0, 0.075)); cr.Pattern = linGrad; cr.Fill(); cr.Arc(x0 + roundSize, y1 - roundSize, roundSize - lineWidth, Math.PI / 2, Math.PI); cr.LineTo(x0 + lineWidth, ymid); cr.LineTo(x1 - lineWidth, ymid); cr.Arc(x1 - roundSize, y1 - roundSize, roundSize - lineWidth, 0, Math.PI / 2); cr.LineTo(x0 + roundSize, y1 - lineWidth); linGrad = new LinearGradient(0, ymid, 0, y1); linGrad.AddColorStop(0.0, new Color(0, 0, 0, 0.1)); linGrad.AddColorStop(0.5, new Color(0, 0, 0, 0.0)); cr.Pattern = linGrad; cr.Fill(); } /*** TAB ***/ Gdk.Rectangle r = p.LabelAllocation; x0 = r.X; x1 = r.X + r.Width; y0 = r.Y; y1 = r.Y + r.Height + lineWidth; /*** TAB :: BACKGROUND ***/ cr.MoveTo(x0 + lineWidth05, y1); cr.LineTo(x0 + lineWidth05, y0 + roundSize); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3 * Math.PI / 2, 0); cr.LineTo(x1 - lineWidth05, y1); linGrad = new LinearGradient(0, y0, 0, y1); linGrad.AddColorStop(0.0, colorScheme.PrettyBright); linGrad.AddColorStop(1.0, c); cr.Pattern = linGrad; cr.Fill(); /*** TAB :: DARK BORDER ***/ cr.MoveTo(x0 + lineWidth05, y1); cr.LineTo(x0 + lineWidth05, y0 + roundSize); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize - lineWidth05, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize - lineWidth05, 3 * Math.PI / 2, 0); cr.LineTo(x1 - lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = ColorScheme.GetColorRelative(colorScheme.Bright, -0.1); cr.Stroke(); y1 -= 1.0; /*** TAB :: HIGHLIGHT ***/ cr.MoveTo(x0 + lineWidth15, y1); cr.LineTo(x0 + lineWidth15, y0 + roundSize); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize - lineWidth15, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize - lineWidth15, 3 * Math.PI / 2, 0); cr.LineTo(x1 - lineWidth15, y1); cr.LineWidth = lineWidth; linGrad = new LinearGradient(0, y0 + lineWidth, 0, y1); linGrad.AddColorStop(0.0, colorScheme.PrettyBright); linGrad.AddColorStop(1.0, ColorScheme.SetAlphaChannel(colorScheme.Bright, 0)); cr.Pattern = linGrad; cr.Stroke(); /*** TAB :: SHADOW ***/ cr.MoveTo(x0 - lineWidth05, y1); cr.LineTo(x0 - lineWidth05, y0 + roundSize); cr.Arc(x0 + roundSize, y0 + roundSize, roundSize + lineWidth05, Math.PI, 3 * Math.PI / 2); cr.Arc(x1 - roundSize, y0 + roundSize, roundSize + lineWidth05, 3 * Math.PI / 2, 0); cr.LineTo(x1 + lineWidth05, y1); cr.LineWidth = lineWidth; cr.Color = new Color(0, 0, 0, 0.2); cr.Stroke(); } }
public RibbonPage (Ribbon Parent, Widget Page, Widget Label) { parent = Parent; this.Label = Label; this.Page = Page; }