<?xml version="1.0"?>
<Container Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
<Group Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <Border CornerRadius="5" BorderWidth="1" Margin="6" Foreground="{./Foreground}"
+ <VerticalStack Spacing="0"
Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <Container Name="Content" Margin="10" MinimumSize="70,10"
- Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
- </Border>
- <Label Text="{./Caption}" VerticalAlignment="Top" Left="15"
+ <GraphicObject Height="6" Width="{./WidthPolicy}"/>
+ <Border CornerRadius="5" BorderWidth="1" Margin="10" Foreground="{./Foreground}"
+ Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+ <Container Name="Content" Margin="0" MinimumSize="70,10"
+ Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+ </Border>
+ </VerticalStack>
+ <Label Text="{./Caption}" VerticalAlignment="Top" Left="8"
Background="Clear" Margin="1"/>
</Group>
</Container>
\ No newline at end of file
ValueChanged="./_scroller_ValueChanged">
<TextBox Background="White" Height="Fit"
VerticalAlignment="Top"
- TextAlignment="TopLeft" Font="mono, 10"
+ TextAlignment="TopLeft" Font="mono, 12"
TextChanged="onImlSourceChanged"
Text="{CurSources}" Multiline="true"/>
</Scroller>
<?xml version="1.0"?>
-<Border Width="80%" Height="80%" Background="DarkRed">
- <TextBox Multiline="true" Font="mono, 12" Margin="0"
+<Group Background="SeaGreen" Fit="true" Margin="1">
+<Border Foreground="White" Margin="10" Width="Fit" Height="Fit" Background="DarkRed" BorderWidth="1">
+ <TextBox Multiline="true" Font="mono, 12" Margin="0"
Text="this is a test of double click\n and here a second line of text\n and again a third one"/>
</Border>
+</Group>
\ No newline at end of file
return arr[minp];
}
- public static void CairoRectangle(Cairo.Context gr, Rectangle r, double radius, bool stroke = false)
+ public static void CairoRectangle(Cairo.Context gr, Rectangle r, double radius, double stroke = 0.0)
{
if (radius > 0)
CairoHelpers.DrawRoundedRectangle (gr, r, radius, stroke);
{
gr.Arc(r.X + r.Width/2, r.Y + r.Height/2, Math.Min(r.Width,r.Height)/2, 0, 2*Math.PI);
}
- public static void DrawRoundedRectangle(Cairo.Context gr, Rectangle r, double radius, bool stroke = false)
+ public static void DrawRoundedRectangle(Cairo.Context gr, Rectangle r, double radius, double stroke = 0.0)
{
- if (stroke) {
- DrawRoundedRectangle (gr, r.X + 0.5, r.Y + 0.5, r.Width - 1.0, r.Height - 1.0, radius);
+ if (stroke>0.0) {
+ gr.LineWidth = stroke;
+ double hsw = stroke / 2.0;
+ DrawRoundedRectangle (gr, r.X + hsw, r.Y + hsw, r.Width - stroke, r.Height - stroke, radius);
gr.Stroke ();
}else
DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius);
public static class ExtensionsMethods
{
#region Cairo extensions
- public static void Rectangle(this Cairo.Context ctx, Rectangle r, bool stroke = false)
+ public static void Rectangle(this Cairo.Context ctx, Rectangle r, double stroke = 0.0)
{
- if (stroke) {
- ctx.Rectangle (r.X + 0.5, r.Y + 0.5, r.Width - 1.0, r.Height - 1.0);
+ if (stroke > 0.0) {
+ ctx.LineWidth = stroke;
+ double shw = stroke / 2.0;
+ ctx.Rectangle (r.X + shw, r.Y + shw, r.Width - stroke, r.Height - stroke);
ctx.Stroke ();
}else
ctx.Rectangle (r.X, r.Y, r.Width, r.Height);
{
Rectangle rBack = new Rectangle (Slot.Size);
- rBack.Inflate (-Margin);
- if (BorderWidth > 0)
- rBack.Inflate (-BorderWidth / 2);
+ //rBack.Inflate (-Margin);
+// if (BorderWidth > 0)
+// rBack.Inflate (-BorderWidth / 2);
Background.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
gr.Fill ();
- if (BorderWidth > 0) {
- gr.LineWidth = BorderWidth;
+ if (BorderWidth > 0) {
Foreground.SetAsSource (gr, rBack);
- CairoHelpers.CairoRectangle(gr, rBack, CornerRadius, true);
+ CairoHelpers.CairoRectangle(gr, rBack, CornerRadius, BorderWidth);
}
gr.Save ();
- //clip to client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+ if (ClipToClientRect) {
+ //clip to client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
if (child != null)
child.Paint (ref gr);
Size maximumSize = "0,0";
Size minimumSize = "0,0";
bool cacheEnabled = false;
+ bool clipToClientRect = true;
object dataSource;
string style;
#endregion
NotifyValueChanged ("CacheEnabled", cacheEnabled);
}
}
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public virtual bool ClipToClientRect {
+ get { return clipToClientRect; }
+ set {
+ if (clipToClientRect == value)
+ return;
+ clipToClientRect = value;
+ NotifyValueChanged ("ClipToClientRect", clipToClientRect);
+ this.RegisterForRedraw ();
+ }
+ }
[XmlAttributeAttribute()][DefaultValue("unamed")]
public virtual string Name {
get { return name; }
this.RegisterForLayouting (LayoutingType.Y);
}
}
+ /// <summary>
+ /// When set to True, the <see cref="T:Crow.GraphicObject"/>'s width and height will be set to Fit.
+ /// </summary>
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public virtual bool Fit {
+ get { return Width == Measure.Fit && Height == Measure.Fit ? true : false; }
+ set {
+ if (value == Fit)
+ return;
+
+ Width = Height = Measure.Fit;
+ }
+ }
[XmlAttributeAttribute()][DefaultValue("Stretched")]
public virtual Measure Width {
get { return width; }
[XmlIgnore]public virtual Measure HeightPolicy { get {
return Height.Units == Unit.Percent || Height.IsFixed ?
Measure.Stretched : Measure.Fit; } }
- /// <summary>
- /// When set to True, the <see cref="T:Crow.GraphicObject"/>'s width and height will be set to Fit.
- /// </summary>
- [XmlAttributeAttribute()][DefaultValue(false)]
- public virtual bool Fit {
- get { return Width == Measure.Fit && Height == Measure.Fit ? true : false; }
- set {
- if (value == Fit)
- return;
-
- Width = Height = Measure.Fit;
- }
- }
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool Focusable {
get { return focusable; }
base.onDraw (gr);
gr.Save ();
- //clip to client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+
+ if (ClipToClientRect) {
+ //clip to client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
+
lock (children) {
foreach (GraphicObject g in Children) {
g.Paint (ref gr);
base.onDraw (gr);
gr.Save ();
- //clip to client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+
+ if (ClipToClientRect) {
+ //clip to client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
if (child != null)
child.Paint (ref gr);
gr.Fill ();
gr.Save ();
- //clip to scrolled client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+ if (ClipToClientRect) {
+ //clip to scrolled client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
gr.Translate (-ScrollX, -ScrollY);
if (child != null)
protected override void onDraw (Cairo.Context gr)
{
int spacing = (Parent as TabView).Spacing;
- gr.MoveTo (0, TabTitle.Slot.Bottom);
- gr.LineTo (TabTitle.Slot.Left - spacing, TabTitle.Slot.Bottom);
+
+ gr.MoveTo (0, TabTitle.Slot.Bottom-0.5);
+ gr.LineTo (TabTitle.Slot.Left - spacing, TabTitle.Slot.Bottom-0.5);
gr.CurveTo (
- TabTitle.Slot.Left - spacing / 2, TabTitle.Slot.Bottom,
- TabTitle.Slot.Left - spacing / 2, 1,
- TabTitle.Slot.Left, 1);
- gr.LineTo (TabTitle.Slot.Right, 1);
+ TabTitle.Slot.Left - spacing / 2, TabTitle.Slot.Bottom-0.5,
+ TabTitle.Slot.Left - spacing / 2, 0.5,
+ TabTitle.Slot.Left, 0.5);
+ gr.LineTo (TabTitle.Slot.Right, 0.5);
gr.CurveTo (
- TabTitle.Slot.Right + spacing / 2, 1,
- TabTitle.Slot.Right + spacing / 2, TabTitle.Slot.Bottom,
- TabTitle.Slot.Right + spacing, TabTitle.Slot.Bottom);
- gr.LineTo (Slot.Width, TabTitle.Slot.Bottom);
+ TabTitle.Slot.Right + spacing / 2, 0.5,
+ TabTitle.Slot.Right + spacing / 2, TabTitle.Slot.Bottom-0.5,
+ TabTitle.Slot.Right + spacing, TabTitle.Slot.Bottom-0.5);
+ gr.LineTo (Slot.Width, TabTitle.Slot.Bottom-0.5);
gr.LineWidth = 1;
Foreground.SetAsSource (gr);
gr.Fill ();
gr.Save ();
- //clip to client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+
+ if (ClipToClientRect) {
+ //clip to client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
for (int i = 0; i < Children.Count; i++) {
if (i == SelectedTab)
protected override void onDraw (Cairo.Context gr)
{
gr.Save ();
- //clip to client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
+
+ if (ClipToClientRect) {
+ //clip to client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
if (child != null)
child.Paint (ref gr);