aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-14 23:15:31 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-14 23:15:31 +0200
commitb2bef2567b1fa60ec7f9f91ab475fd0e02dbc834 (patch)
tree40fadd94a017a62db86e42aef6b34b3f7bccf343
parent475b4dc3ea6354474349c9408fe03cc53b946d8a (diff)
Color.Clear to make it possible transparency with GroupBox Title
without the border over the text test0 to test the concept
-rw-r--r--Tests/GOLIBTests.cs3
-rwxr-xr-xTests/Interfaces/test0.goml25
-rwxr-xr-xTests/Interfaces/testWindow2.goml45
-rwxr-xr-xsrc/Colors.cs1
-rw-r--r--src/GraphicObjects/GraphicObject.cs7
5 files changed, 67 insertions, 14 deletions
diff --git a/Tests/GOLIBTests.cs b/Tests/GOLIBTests.cs
index 2f8eb036..38eaf869 100644
--- a/Tests/GOLIBTests.cs
+++ b/Tests/GOLIBTests.cs
@@ -31,6 +31,8 @@ namespace test
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "testWindow.goml",
+ "test0.goml",
"test1.goml",
"test1.1.goml",
"test1.2.goml",
@@ -41,7 +43,6 @@ namespace test
"testSpinner.goml",
"testPopper.goml",
"testExpandable.goml",
- "testWindow.goml",
"testMsgBox.goml",
"testGrid.goml",
"fps.goml",
diff --git a/Tests/Interfaces/test0.goml b/Tests/Interfaces/test0.goml
index b3b629b9..fb23bbcd 100755
--- a/Tests/Interfaces/test0.goml
+++ b/Tests/Interfaces/test0.goml
@@ -3,16 +3,15 @@
Width="100" Height="100"
Top="200" Left="200"
Margin="10" Background="Green"/>-->
-<Border CornerRadius="5" Margin="1" BorderWidth="1" Fit="True" Background="SteelBlue">
- <HorizontalStack Name="hstack" Margin="0" Spacing="5">
- <Label Name="labCpt" Text="55"/>
- <VerticalStack Spacing="1" Name="vstack">
- <Button Width="10" Height="8" MouseClick="onUp">
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>
- </Button>
- <Button Width="10" Height="8" MouseClick="onDown">
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>
- </Button>
- </VerticalStack>
- </HorizontalStack>
-</Border> \ No newline at end of file
+
+<Container Width="0" Height="0" Background="Transparent">
+ <Group >
+ <Border CornerRadius="5" BorderWidth="1" Margin="5"/>
+ <HorizontalStack Fit="true" Background="Clear"
+ VerticalAlignment="Top" Left="10">
+ <GraphicObject Width="5"/>
+ <Label Text="GroupBox"/>
+ <GraphicObject Width="5"/>
+ </HorizontalStack>
+ </Group>
+</Container>
diff --git a/Tests/Interfaces/testWindow2.goml b/Tests/Interfaces/testWindow2.goml
new file mode 100755
index 00000000..b336a9dc
--- /dev/null
+++ b/Tests/Interfaces/testWindow2.goml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--<Group>-->
+<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8"
+ Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
+ <Template>
+ <Border BorderWidth="1" BorderColor="White" Margin="0" CornerRadius="20">
+ <VerticalStack Margin="0">
+ <Border BorderWidth="1" BorderColor="White" Height="-1" Background="0,1;0,5;1,0;0,5">
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" Focusable="false" >
+ <GraphicObject Width="5" Height="0"/>
+ <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>
+ <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />
+ <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent" Height="12" Width="12"
+ MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"
+ MouseClick="butQuitPress"/>
+ </Border>
+ <GraphicObject Width="5" Height="0"/>
+ </HorizontalStack>
+ </Border>
+ <Container Name="Content" Margin="0" Width="0" Height="0"/>
+ </VerticalStack>
+ </Border>
+ </Template>
+ <VerticalStack Name="contentVSStack" Margin="10" Spacing="10">
+ <Slider Name="slider" Height="10" Width="0"/>
+
+ <HorizontalStack Width="-1" Height="-1" Margin="0" Background="Red">
+ <Checkbox Height="-1" Width="100"/>
+ <Checkbox Height="-1" Width="100"/>
+ </HorizontalStack>
+ <GroupBox Title="test" Height="-1" Width="-1" Margin="5">
+ <VerticalStack Height="-1" Width="-1">
+ <RadioButton Caption="Radio 1"/>
+ <RadioButton Caption="Radio 2" IsChecked="true"/>
+ <RadioButton Caption="Radio 3"/>
+ </VerticalStack>
+ </GroupBox>
+<!-- <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
+ </VerticalStack>
+</Window>
+<!--</Group>-->
+<!-- <Label Text="{fps}" Background="DarkRed"/>
+ <Label Text="{fpsMin}" />
+ <Label Text="{fpsMax}" />--> \ No newline at end of file
diff --git a/src/Colors.cs b/src/Colors.cs
index 96d17f2a..82f1dfb0 100755
--- a/src/Colors.cs
+++ b/src/Colors.cs
@@ -150,6 +150,7 @@ namespace go
#region Predefined colors
public static readonly Color Transparent = new Color(0, 0, 0, 0, "Transparent");
+ public static readonly Color Clear = new Color(-1, -1, -1, -1, "Clear");
public static readonly Color Green = new Color(0, 1.0, 0, 1.0, "Green");
public static readonly Color AirForceBlueRaf = new Color(0.364705882352941,0.541176470588235,0.658823529411765,1.0,"AirForceBlueRaf");
public static readonly Color AirForceBlueUsaf = new Color(0,0.188235294117647,0.56078431372549,1.0,"AirForceBlueUsaf");
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index c3c22e7b..6a146c64 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -664,6 +664,13 @@ namespace go
Rectangle rb = Parent.ContextCoordinates(Slot);
using (ImageSurface source = new ImageSurface(bmp, Format.Argb32, rb.Width, rb.Height, 4 * Slot.Width)) {
+ if (this.Background == Color.Clear) {
+ ctx.Save ();
+ ctx.Operator = Operator.Clear;
+ ctx.Rectangle(rb);
+ ctx.Fill ();
+ ctx.Restore ();
+ }
ctx.SetSourceSurface (source, rb.X, rb.Y);
ctx.Paint ();
}