* 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
This commit is contained in:
Родитель
39280b8452
Коммит
ad68e0d172
|
@ -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>
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -86,8 +86,9 @@ namespace Ribbons
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -195,7 +195,79 @@ namespace Ribbons
|
|||
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;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-06-23 Laurent Debacker <debackerl@gmail.com>
|
||||
|
||||
* MainWindow.cs: Updated sample
|
||||
|
||||
2007-12-29 Laurent Debacker <debackerl@gmail.com>
|
||||
|
||||
|
||||
|
|
|
@ -129,8 +129,14 @@ namespace Sample
|
|||
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 @@ namespace Sample
|
|||
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 ();
|
||||
|
||||
|
|
|
@ -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" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче