<Compile Include="src\GraphicObjects\GraphicObject.cs" />\r
<Compile Include="src\GraphicObjects\Container.cs" />\r
<Compile Include="src\GraphicObjects\Group.cs" />\r
- <Compile Include="src\GraphicObjects\GroupBox.cs" />\r
<Compile Include="src\GraphicObjects\HorizontalStack.cs" />\r
<Compile Include="src\GraphicObjects\Image.cs" />\r
<Compile Include="src\GraphicObjects\Label.cs" />\r
<Compile Include="src\GraphicObjects\Grid.cs" />\r
<Compile Include="src\GraphicObjects\TextRun.cs" />\r
<Compile Include="src\GraphicObjects\MessageBox.cs" />\r
+ <Compile Include="src\GraphicObjects\Groupbox.cs" />\r
</ItemGroup>\r
<ItemGroup>\r
<Reference Include="System" />\r
<EmbeddedResource Include="Images\button.svg" />\r
<EmbeddedResource Include="Templates\MessageBox.goml" />\r
<EmbeddedResource Include="Images\Icons\iconInfo.svg" />\r
+ <EmbeddedResource Include="Templates\Groupbox.goml" />\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="Images\Icons\Cursors\hand" />\r
--- /dev/null
+<?xml version="1.0"?>
+<Group Height="{TemplatedHeight}" Width="{TemplatedWidth}">
+ <Border CornerRadius="5" BorderWidth="1" Margin="6"
+ Height="{TemplatedHeight}" Width="{TemplatedWidth}">
+ <Container Name="Content" Margin="10"
+ Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+ </Border>
+ <Label Text="{Title}" VerticalAlignment="Top" Left="15"
+ Background="Clear" Margin="1"/>
+</Group>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+<GroupBox Width="-1" Height="-1" Background="Red">\r
+ <VerticalStack Margin="0">\r
+ <Checkbox />\r
+\r
+ </VerticalStack>\r
+</GroupBox>\r
--- /dev/null
+<?xml version="1.0"?>\r
+<Expandable Title="Test expandable" Width="150" Background="DimGray">\r
+ <VerticalStack Width="100" Height="-1">\r
+ <Checkbox Name="chk1"/>\r
+ <Checkbox Name="chk2" IsChecked="true"/>\r
+ <Checkbox Name="chk3"/>\r
+ <Checkbox Name="chk4"/>\r
+ </VerticalStack> \r
+</Expandable>\r
<GraphicObject Width="0"/>\r
<Checkbox Height="-1" Width="80"/>\r
</HorizontalStack>\r
- <GroupBox Text="test" Height="-1" Width="0" Margin="5">\r
+ <Groupbox Text="test" Height="-1" Width="-1" Margin="5">\r
<VerticalStack Height="-1" Width="0" >\r
<RadioButton Caption="Radio 1" Background="Red" />\r
<RadioButton Caption="Radio 2" IsChecked="true" />\r
<RadioButton Caption="Radio 3" />\r
</VerticalStack>\r
- </GroupBox>\r
+ </Groupbox>\r
<!-- <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->\r
</VerticalStack>\r
</Window>\r
using System;
using System.Xml.Serialization;
using System.ComponentModel;
+using System.Diagnostics;
namespace go
{
+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using System.ComponentModel;\r
-using System.Text;\r
-using System.Xml.Serialization;\r
-using Cairo;\r
-\r
-namespace go\r
-{\r
-\r
- public class GroupBox : Border\r
- {\r
- #region CTOR\r
- public GroupBox() : base (){\r
- }\r
- public GroupBox(string _title = "GroupBox")\r
- : base()\r
- {\r
- Text = _title; \r
- }\r
- #endregion\r
-\r
- #region private fields\r
- string _title;\r
- Font _font;\r
- #endregion\r
-\r
- #region public properties\r
- [XmlAttributeAttribute][DefaultValue("GroupBox")]\r
- public string Text\r
- {\r
- get { return _title; }\r
- set\r
- {\r
- _title = value;\r
- NotifyValueChanged ("Text", _title);\r
- registerForGraphicUpdate();\r
- }\r
- } \r
- #endregion\r
-\r
- Size titleSize {\r
- get {\r
-#if _WIN32 || _WIN64\r
- byte[] txt = System.Text.UTF8Encoding.UTF8.GetBytes(_title);\r
-#endif\r
-\r
- Size s;\r
-\r
- using (ImageSurface img = new ImageSurface (Format.Argb32, 1, 1)) {\r
- using (Context gr = new Context (img)) {\r
- gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);\r
- gr.SetFontSize (Font.Size);\r
- TextExtents te;\r
-#if _WIN32 || _WIN64\r
- te = gr.TextExtents(txt);\r
-#elif __linux__\r
- te = gr.TextExtents (Text);\r
-#endif\r
- FontExtents fe = gr.FontExtents;\r
- s = new Size ((int)Math.Ceiling (te.XAdvance), (int)Math.Ceiling (fe.Height));\r
- }\r
- }\r
- return s;// +borderWidth;\r
- }\r
- }\r
-\r
- #region GraphicObject overrides\r
- public override Rectangle ClientRectangle {\r
- get {\r
- Size ts = titleSize;\r
- Rectangle cb = Slot.Size;\r
- cb.Y = ts.Height;\r
- cb.Height -= ts.Height;\r
- cb.Inflate ( - Margin);\r
- return cb;\r
- }\r
- } \r
- protected override Size measureRawSize ()\r
- {\r
- Size raw = base.measureRawSize ();\r
- return raw > 0 ? raw + titleSize : raw;\r
- }\r
- protected override void onDraw (Context gr)\r
- {\r
- //base.onDraw (gr);\r
-\r
- byte[] txt = System.Text.UTF8Encoding.UTF8.GetBytes(Text);\r
- Rectangle r = new Rectangle(Slot.Size);\r
- if (BorderWidth > 0) \r
- r.Inflate (-BorderWidth / 2);\r
-\r
- //gr.Rotate(Math.PI);\r
- gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);\r
- gr.SetFontSize (Font.Size);\r
- FontExtents fe = gr.FontExtents;\r
- TextExtents te = gr.TextExtents(Text);\r
-\r
- gr.Antialias = Antialias.Subpixel;\r
- gr.LineWidth = BorderWidth;\r
- gr.Color = Background;\r
-\r
-\r
-\r
- Rectangle rTitle = r;\r
-\r
- int th = (int)Math.Ceiling(fe.Height / 2);\r
- r.Y += th;\r
- r.Height -= th;\r
-\r
- CairoHelpers.CairoRectangle (gr, r, CornerRadius);\r
- gr.Fill();\r
-\r
- const int titleGap = 5;\r
-\r
- if (BorderWidth > 0)\r
- {\r
- gr.Color = BorderColor;\r
-\r
- rTitle.X = r.X + titleGap;\r
- rTitle.Width = (int)Math.Ceiling(te.XAdvance) + 2 * titleGap;\r
- rTitle.Height = (int)Math.Ceiling(fe.Height);\r
- gr.Save();\r
- gr.FillRule = FillRule.EvenOdd;\r
- gr.Rectangle(new Rectangle(Slot.Size));\r
- gr.Rectangle(rTitle);\r
- gr.Clip();\r
-\r
- CairoHelpers.CairoRectangle (gr, r, CornerRadius);\r
-\r
- gr.Stroke();\r
- gr.Restore();\r
- }\r
-\r
- gr.MoveTo(rTitle.X + titleGap, rTitle.Y + (int)Math.Ceiling(fe.Height - fe.Descent));\r
-\r
- #if _WIN32 || _WIN64\r
- gr.ShowText(txt);\r
- #elif __linux__\r
- gr.ShowText(Text);\r
- #endif\r
- gr.Color = Foreground;\r
- gr.Fill();\r
- }\r
- #endregion\r
-\r
- public override string ToString()\r
- {\r
- return base.ToString() + ": " + this.Text;\r
- }\r
- }\r
-}\r
-\r
--- /dev/null
+using System;\r
+\r
+\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+//using OpenTK.Graphics.OpenGL;\r
+\r
+using Cairo;\r
+\r
+using winColors = System.Drawing.Color;\r
+using System.Diagnostics;\r
+using System.Xml.Serialization;\r
+using OpenTK.Input;\r
+using System.ComponentModel;\r
+using System.Xml;\r
+using System.IO;\r
+\r
+namespace go\r
+{\r
+ [DefaultTemplate("#go.Templates.Groupbox.goml")]\r
+ public class Groupbox : TemplatedContainer\r
+ { \r
+ string title;\r
+ Container _contentContainer;\r
+\r
+ #region CTOR\r
+ public Groupbox() : base(){} \r
+ #endregion\r
+\r
+ #region Template overrides\r
+ public override GraphicObject Content {\r
+ get {\r
+ return _contentContainer == null ? null : _contentContainer.Child;\r
+ }\r
+ set {\r
+ _contentContainer.SetChild(value);\r
+ }\r
+ }\r
+ protected override void loadTemplate(GraphicObject template = null)\r
+ {\r
+ base.loadTemplate (template);\r
+\r
+ _contentContainer = this.child.FindByName ("Content") as Container;\r
+ }\r
+ #endregion\r
+\r
+ #region GraphicObject overrides\r
+ [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true\r
+ public override bool Focusable\r
+ {\r
+ get { return base.Focusable; }\r
+ set { base.Focusable = value; }\r
+ }\r
+ #endregion\r
+\r
+ [XmlAttributeAttribute()][DefaultValue("Groupbox")]\r
+ public string Title {\r
+ get { return title; } \r
+ set {\r
+ if (title == value)\r
+ return;\r
+ title = value; \r
+ NotifyValueChanged ("Title", title);\r
+ }\r
+ } \r
+ }\r
+}\r