Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Sample/MainWindow.cs: Updated sample

* Ribbons/Theme.cs: Quick Access Toolbar background
* Ribbons/ApplicationMenu.cs: Initial stub API for application menu.
* Ribbons/QuickAccessToolbar.cs: Take care of height requests from
  children widgets

svn path=/trunk/gtk-sharp-ribbon/; revision=106936
  • Loading branch information...
commit ad68e0d172e3073c3ad8d2e02bfc9d5b82dc5bfa 1 parent 39280b8
Laurent Debacker authored
View
4 Ribbons.mds
@@ -14,7 +14,7 @@
<Execute type="None" entry="Sample" />
</StartMode>
<Entries>
- <Entry filename="./Ribbons/Ribbons.mdp" />
- <Entry filename="./Sample/Sample.mdp" />
+ <Entry filename="Ribbons/Ribbons.mdp" />
+ <Entry filename="Sample/Sample.mdp" />
</Entries>
</Combine>
View
70 Ribbons/ApplicationMenu.cs
@@ -0,0 +1,70 @@
+using System;
+using Gtk;
+
+namespace Ribbons
+{
+ public class ApplicationMenu : Window
+ {
+ public void Prepend (MenuItem i)
+ {
+
+ }
+
+ public void Append (MenuItem i)
+ {
+
+ }
+
+ public void Insert (MenuItem i, int ItemIndex)
+ {
+
+ }
+
+ public void Remove (int ItemIndex)
+ {
+
+ }
+
+ public ApplicationMenu (Gtk.WindowType type) : base (type)
+ {
+
+ }
+
+ public class MenuItem
+ {
+ private Image mIcon;
+ private string mLabel;
+ private Container mContainer;
+
+ [GLib.Signal("action")]
+ public event EventHandler Action;
+
+ public Image Icon
+ {
+ get { return mIcon; }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public string Label
+ {
+ get { return mLabel; }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public Container Container
+ {
+ get { return mContainer; }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+ }
+}
View
6 Ribbons/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-23 Laurent Debacker <debackerl@gmail.com>
+
+ * Theme.cs: Quick Access Toolbar background
+ * ApplicationMenu.cs: Initial stub API for application menu.
+ * QuickAccessToolbar.cs: Take care of height requests from children widgets
+
2008-06-22 Laurent Debacker <debackerl@gmail.com>
* Theme.cs: Title bar's background is not compliant
View
3  Ribbons/QuickAccessToolbar.cs
@@ -86,8 +86,9 @@ protected override void OnSizeRequested (ref Requisition requisition)
int i = 0;
foreach(BaseButton b in widgets)
{
- b.HeightRequest = requisition.Height;
+ //b.HeightRequest = requisition.Height;
Gtk.Requisition req = b.SizeRequest ();
+ if(req.Height > requisition.Height) requisition.Height = req.Height;
requisition.Width += req.Width;
widths[i++] = req.Width;
}
View
1  Ribbons/Ribbons.mdp
@@ -44,6 +44,7 @@
<File name="Position.cs" subtype="Code" buildaction="Compile" />
<File name="QuickAccessToolbar.cs" subtype="Code" buildaction="Compile" />
<File name="ApplicationButton.cs" subtype="Code" buildaction="Compile" />
+ <File name="ApplicationMenu.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
View
74 Ribbons/Theme.cs
@@ -195,7 +195,79 @@ public void DrawRibbon (Context cr, Gdk.Rectangle menuBarAllocation, Gdk.Rectang
cr.LineTo (menuBarAllocation.Right, menuBarAllocation.Bottom + 0.5);
cr.Color = new Color (1, 1, 1, 0.5);
cr.LineWidth = 1;
- cr.Stroke();
+ 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;
+
+ 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.LineWidth = 1;
+
+ cr.Save ();
+ cr.Rectangle (cx + curveWidth, y0, curveWidth + alloc.Width + 2, 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 ();
+
+ 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;
View
4 Sample/ChangeLog
@@ -1,3 +1,7 @@
+2008-06-23 Laurent Debacker <debackerl@gmail.com>
+
+ * MainWindow.cs: Updated sample
+
2007-12-29 Laurent Debacker <debackerl@gmail.com>
View
14 Sample/MainWindow.cs
@@ -129,8 +129,14 @@ public MainWindow() : base (WindowType.Toplevel)
mainMenu.ShowAll ();
};
+ QuickAccessToolbar qat = new QuickAccessToolbar ();
+ qat.Append (Ribbons.Button.FromStockIcon (Gtk.Stock.New, false));
+ qat.Append (Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false));
+
ribbon = new Ribbon ();
- ribbon.Shortcuts = shortcuts;
+ ribbon.ApplicationButton = new ApplicationButton ();
+ ribbon.QuickAccessToolbar = qat;
+ //ribbon.Shortcuts = shortcuts;
ribbon.AppendPage (page0, pageLabel0);
ribbon.AppendPage (page1, pageLabel1);
ribbon.AppendPage (page2, pageLabel2);
@@ -179,11 +185,13 @@ private void Window_OnExpose (object sender, ExposeEventArgs args)
Gdk.EventExpose evnt = args.Event;
Context cr = Gdk.CairoHelper.Create (GdkWindow);
- if(composeAvailable)
+ /*if(composeAvailable)
cr.SetSourceRGBA (0, 0, 0, 0.3);
- else
+ else*/
cr.SetSourceRGB (0.3, 0.3, 0.3);
+ //cr.SetSourceRGB (0.749, 0.859, 1.0);
+
cr.Operator = Operator.Source;
cr.Paint ();
View
12 Sample/Sample.mdp
@@ -1,23 +1,23 @@
<Project name="Sample" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
- <Output directory="./bin/Debug" assembly="Sample" />
+ <Output directory="bin/Debug" assembly="Sample" />
<Build debugmode="True" target="Exe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
- <Output directory="./bin/Release" assembly="Sample" />
+ <Output directory="bin/Release" assembly="Sample" />
<Build debugmode="False" target="Exe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
</Configurations>
<Contents>
- <File name="./Main.cs" subtype="Code" buildaction="Compile" />
- <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
- <File name="./MainWindow.cs" subtype="Code" buildaction="Compile" />
- <File name="./SampleTile.cs" subtype="Code" buildaction="Compile" />
+ <File name="Main.cs" subtype="Code" buildaction="Compile" />
+ <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
+ <File name="MainWindow.cs" subtype="Code" buildaction="Compile" />
+ <File name="SampleTile.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
Please sign in to comment.
Something went wrong with that request. Please try again.