<EmbeddedResource Include="Templates\ColorPicker.template">
<LogicalName>Crow.ColorPicker.template</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="Templates\ToolWindow.template">
+ <LogicalName>Crow.ToolWindow.template</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Images\Icons\maximize.svg" />
+ <EmbeddedResource Include="Images\Icons\minimize.svg" />
+ <EmbeddedResource Include="Images\Icons\normalize.svg" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
Margin = 1;
}
Window {
+ Focusable = true;
+ MinimumSize=5,5;
+ Width = 150;
+ Height = 150;
+}
+ToolWindow {
+ Template = #Crow.ToolWindow.template;
Focusable = true;
MinimumSize=50,50;
Width = 150;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
- viewBox="0 0 64 64.000002"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="exit.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="2.6992188"
- inkscape:cx="-13.949137"
- inkscape:cy="63.946457"
- inkscape:document-units="px"
- inkscape:current-layer="svg2"
- showgrid="false"
- units="px"
- inkscape:window-width="1280"
- inkscape:window-height="984"
- inkscape:window-x="0"
- inkscape:window-y="16"
- inkscape:window-maximized="1" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <rect
- style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:8.89073467;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1"
- id="rect4136"
- width="55.122551"
- height="55.122551"
- x="4.4468598"
- y="4.3914709"
- ry="8.8907347" />
+ viewBox="0 0 64 64">
<path
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:9;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 13.884262,15.143117 c 24.231966,13.49131 34.18672,34.186719 34.18672,34.186719"
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="14"
+ height="14"
+ viewBox="0 0 14 14">
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:2"
+ d="m 2,2 10,0 0,10 -10,0 z"/>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64"
+ height="64"
+ viewBox="0 0 14 14">
+ <path
+ style="fill:#ffffff;stroke:none"
+ d="m 1,6 12,0 0,4 -12,0 z"/>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="14"
+ height="14"
+ viewBox="0 0 14 14">
+<!-- <rect y="7" x="7" height="40" width="40"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-opacity:1" />
+ <rect y="7" x="7" height="10" width="40"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-opacity:1" />
+ <rect y="17" x="17" height="40" width="40"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-opacity:1" />
+ <rect y="17" x="17" height="10" width="40"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-opacity:1" />-->
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:1"
+ d="m 1,1 8,0 0,8 -8,0 z"/>
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:1"
+ d="m 4,4 8,0 0,8 -8,0 z"/>
+</svg>
--- /dev/null
+<?xml version="1.0"?>
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+ Background="{./Background}"
+ MouseEnter="./onBorderMouseEnter"
+ MouseLeave="./onBorderMouseLeave">
+ <VerticalStack Spacing="0">
+<!-- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit"
+ Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">-->
+ <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
+ Name="hs" Margin="2" Spacing="0" Height="Fit">
+ <GraphicObject Width="5"/>
+ <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
+ <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Title}" />
+ <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
+ MouseClick="./butQuitPress"/>
+ </Border>
+ <GraphicObject Width="5"/>
+ </HorizontalStack>
+<!-- </Border>-->
+ <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
+ </VerticalStack>
+</Border>
Name="hs" Margin="2" Spacing="0" Height="Fit">
<GraphicObject Width="5"/>
<Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
- <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Title}" />
- <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ <Label Width="Stretched" Foreground="White" Margin="2" TextAlignment="Center" Text="{./Title}" />
+ <Border Visible="{./ShowMinimize}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
- <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
+ <Image Focusable="true" Path="#Crow.Images.Icons.minimize.svg"
+ MouseClick="./onMinimized"/>
+ </Border>
+ <Border Visible="{./ShowNormal}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Path="#Crow.Images.Icons.normalize.svg"
+ MouseClick="./onUnmaximized"/>
+ </Border>
+ <Border Visible="{./ShowMaximize}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Path="#Crow.Images.Icons.maximize.svg"
+ MouseClick="./onMaximized"/>
+ </Border>
+ <Border BorderWidth="1" Foreground="Transparent" Height="14" Width="14"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Path="#Crow.Images.Icons.exit2.svg"
MouseClick="./butQuitPress"/>
</Border>
<GraphicObject Width="5"/>
</HorizontalStack>
<!-- </Border>-->
- <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
+ <Container Name="Content" MinimumSize="0,0" Background="0.5,0.5,0.5,0.5"/>
</VerticalStack>
</Border>
bool _resizable;
bool _movable;
bool hoverBorder = false;
- bool isMaximized = false;
- Measure savedH, savedW;
+
+ Rectangle savedBounds;
+ bool _minimized = false;
Container _contentContainer;
Direction currentDirection = Direction.None;
+ #region Events
public event EventHandler Closing;
public event EventHandler Maximized;
public event EventHandler Unmaximized;
+ public event EventHandler Minimize;
+ #endregion
#region CTOR
public Window () : base() {
#region TemplatedContainer overrides
public override GraphicObject Content {
- get {
- return _contentContainer == null ? null : _contentContainer.Child;
- }
- set {
- _contentContainer.SetChild(value);
- }
+ get { return _contentContainer == null ? null : _contentContainer.Child; }
+ set { _contentContainer.SetChild(value); }
}
protected override void loadTemplate(GraphicObject template = null)
{
base.loadTemplate (template);
_contentContainer = this.child.FindByName ("Content") as Container;
+
+ NotifyValueChanged ("ShowNormal", false);
+ NotifyValueChanged ("ShowMinimize", true);
+ NotifyValueChanged ("ShowMaximize", true);
}
#endregion
#region public properties
- [XmlAttributeAttribute()][DefaultValue("Window")]
+ [XmlAttributeAttribute][DefaultValue("Window")]
public string Title {
get { return _title; }
set {
+ if (_title == value)
+ return;
_title = value;
NotifyValueChanged ("Title", _title);
}
}
- [XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.crow.png")]
+ [XmlAttributeAttribute][DefaultValue("#Crow.Images.Icons.crow.png")]
public string Icon {
get { return _icon; }
set {
+ if (_icon == value)
+ return;
_icon = value;
NotifyValueChanged ("Icon", _icon);
}
}
- [XmlAttributeAttribute()][DefaultValue(true)]
+ [XmlAttributeAttribute][DefaultValue(true)]
public bool Resizable {
get {
return _resizable;
}
set {
+ if (_resizable == value)
+ return;
_resizable = value;
NotifyValueChanged ("Resizable", _resizable);
}
}
- [XmlAttributeAttribute()][DefaultValue(true)]
+ [XmlAttributeAttribute][DefaultValue(true)]
public bool Movable {
get {
return _movable;
}
set {
+ if (_movable == value)
+ return;
_movable = value;
NotifyValueChanged ("Movable", _movable);
}
}
- [XmlAttributeAttribute()][DefaultValue(false)]
- public bool IsMaximized {
- get { return isMaximized; }
+ [XmlAttributeAttribute][DefaultValue(false)]
+ public bool IsMinimized {
+ get { return _minimized; }
set{
- if (value == isMaximized)
+ if (value == IsMinimized)
return;
- isMaximized = value;
- if (isMaximized)
- onMaximized (this, null);
- else
- onUnmaximized (this, null);
+ _minimized = value;
+ _contentContainer.Visible = !_minimized;
- NotifyValueChanged ("IsMaximized", isMaximized);
+ NotifyValueChanged ("IsMinimized", _minimized);
}
}
+ [XmlIgnore]public bool IsMaximized {
+ get { return Width == Measure.Stretched & Height == Measure.Stretched & !_minimized; }
+ }
+ [XmlIgnore]public bool IsNormal {
+ get { return !(IsMaximized|_minimized); }
+ }
+// [XmlAttributeAttribute()][DefaultValue(WindowState.Normal)]
+// public virtual WindowState State {
+// get { return _state; }
+// set {
+// if (_state == value)
+// return;
+// _state = value;
+// NotifyValueChanged ("State", _state);
+// NotifyValueChanged ("IsNormal", IsNormal);
+// NotifyValueChanged ("IsMaximized", IsMaximized);
+// NotifyValueChanged ("IsMinimized", IsMinimized);
+// NotifyValueChanged ("IsNotMinimized", IsNotMinimized);
+// }
+// }
#endregion
#region GraphicObject Overrides
return;
}
}
-// GraphicObject firstFocusableAncestor = otkgw.hoverWidget;
-// while (firstFocusableAncestor != this) {
-// if (firstFocusableAncestor == null)
-// return;
-// if (firstFocusableAncestor.Focusable)
-// return;
-// firstFocusableAncestor = firstFocusableAncestor.Parent as GraphicObject;
-// }
if (Resizable) {
Direction lastDir = currentDirection;
base.onMouseDown (sender, e);
}
#endregion
+
protected void onMaximized (object sender, EventArgs e){
- savedW = this.Width;
- savedH = this.Height;
- this.Width = Measure.Stretched;
- this.Height = Measure.Stretched;
+ lock (CurrentInterface.LayoutMutex) {
+ if (!IsMinimized)
+ savedBounds = this.LastPaintedSlot;
+ this.Left = this.Top = 0;
+ this.RegisterForLayouting (LayoutingType.Positioning);
+ this.Width = this.Height = Measure.Stretched;
+ IsMinimized = false;
+ Resizable = false;
+ NotifyValueChanged ("ShowNormal", true);
+ NotifyValueChanged ("ShowMinimize", true);
+ NotifyValueChanged ("ShowMaximize", false);
+ }
Maximized.Raise (sender, e);
+
+
+
}
protected void onUnmaximized (object sender, EventArgs e){
- this.Width = savedW;
- this.Height = savedH;
+ lock (CurrentInterface.LayoutMutex) {
+ this.Left = savedBounds.Left;
+ this.Top = savedBounds.Top;
+ this.Width = savedBounds.Width;
+ this.Height = savedBounds.Height;
+ IsMinimized = false;
+ Resizable = true;
+ NotifyValueChanged ("ShowNormal", false);
+ NotifyValueChanged ("ShowMinimize", true);
+ NotifyValueChanged ("ShowMaximize", true);
+ }
Unmaximized.Raise (sender, e);
}
+ protected void onMinimized (object sender, EventArgs e){
+ lock (CurrentInterface.LayoutMutex) {
+ if (IsNormal)
+ savedBounds = this.LastPaintedSlot;
+ Width = 200;
+ Height = 20;
+ Resizable = false;
+ IsMinimized = true;
+ NotifyValueChanged ("ShowNormal", true);
+ NotifyValueChanged ("ShowMinimize", false);
+ NotifyValueChanged ("ShowMaximize", true);
+ }
+ Minimize.Raise (sender, e);
+ }
protected void onBorderMouseLeave (object sender, MouseMoveEventArgs e)
{
hoverBorder = false;
}
- protected void butMaximizePress (object sender, MouseButtonEventArgs e){
- IsMaximized = !IsMaximized;
- }
protected void butQuitPress (object sender, MouseButtonEventArgs e)
{
CurrentInterface.MouseCursor = XCursor.Default;