diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-07 07:43:48 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-07 07:43:48 +0100 |
| commit | 158bc472eff0771479d48e5bd74a8141d62ab60a (patch) | |
| tree | 492f2d255de49b5c04ebba237ecb40b265bd6534 /Crow.ControlsLib | |
| parent | a330b907a9c9252c480ea352606d961bdc7c3ecb (diff) | |
:book: , renames, move some controls to other project file
Diffstat (limited to 'Crow.ControlsLib')
26 files changed, 810 insertions, 0 deletions
diff --git a/Crow.ControlsLib/AnalogMeter.cs b/Crow.ControlsLib/AnalogMeter.cs new file mode 100644 index 00000000..ff23bd6b --- /dev/null +++ b/Crow.ControlsLib/AnalogMeter.cs @@ -0,0 +1,68 @@ +// +// AnalogMeter.cs +// +// Author: +// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Xml.Serialization; +using System.ComponentModel; +using Cairo; + +namespace Crow +{ + public class AnalogMeter : NumericControl + { + #region CTOR + protected AnalogMeter () : base(){} + public AnalogMeter (Interface iface) : base(iface){} + #endregion + + #region GraphicObject Overrides + protected override void onDraw (Context gr) + { + base.onDraw (gr); + + Rectangle r = ClientRectangle; + Point m = r.Center; + + gr.Save (); + + + double aUnit = Math.PI*2.0 / (Maximum - Minimum); + gr.Translate (m.X, r.Height *1.1); + gr.Rotate (Value/4.0 * aUnit - Math.PI/4.0); + gr.Translate (-m.X, -m.Y); + + gr.LineWidth = 2; + Foreground.SetAsSource (gr); + gr.MoveTo (m.X,0.0); + gr.LineTo (m.X, -m.Y*0.5); + gr.Stroke (); + + gr.Restore (); + } + #endregion + } +} + diff --git a/Crow.ControlsLib/Crow.ControlsLib.csproj b/Crow.ControlsLib/Crow.ControlsLib.csproj new file mode 100644 index 00000000..6309f88e --- /dev/null +++ b/Crow.ControlsLib/Crow.ControlsLib.csproj @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6E48BD3D-7B33-4368-AA8A-D878427DAC83}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Crow.ControlsLib</RootNamespace> + <AssemblyName>Crow.ControlsLib</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <EmbeddedResource Include="Default.style" /> + <EmbeddedResource Include="Templates\AnalogMeter0.goml" /> + <EmbeddedResource Include="Templates\Checkbox2.goml" /> + <EmbeddedResource Include="Templates\DockingView.template"> + <LogicalName>Crow.DockingView.template</LogicalName> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Folder Include="Templates\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AnalogMeter.cs" /> + <Compile Include="DockingView.cs" /> + <Compile Include="DocksView.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Crow.ControlsLib/Default.style b/Crow.ControlsLib/Default.style new file mode 100644 index 00000000..07689b50 --- /dev/null +++ b/Crow.ControlsLib/Default.style @@ -0,0 +1,139 @@ +Button, CheckBox, RadioButton, ComboBox, Expandable, +MessageBox, Popper, Slider, Spinner, TextBox { + Focusable = true; + Height = Fit; +} +Border { + Foreground = Gray; +} +CheckBox { Caption = CheckBox; } +RadioButton { Caption = RadioButton; } +Expandable { Caption = Expandable; } +Popper { Caption = Popper; } +GroupBox { Caption = Group Box; } +Wrapper { + Orientation = Vertical; +} +Button { + Caption = Button; + Width = Fit; +} +Label { + Height = Fit; + Width = Fit; + Margin = 0; +} +Menu { + Margin = 1; + Background = vgradient|0:DimGray|1:Onyx; + Height = Fit; + Width = Stretched; + VerticalAlignment = Top; +} +MenuItem { + Caption = MenuItem; + Width = Stretched; + Height = Fit; + Background = Transparent; + Foreground = LightGray; + MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;} + MouseLeave = {Foreground=LightGray;Background=Transparent;} +} +MessageBox { + Background = 0.3,0.3,0.3,0.3; + Width = Fit; + Title=MessageBox; + Font = serif, 12; + MinimumSize = 200,120; +} +Slider { + Background = vgradient|0:Black|0.1:Gray|0.9:Gray|1:LightGray; + Foreground = Gray; + Width = Fit; +} +Splitter { + Focusable = true; + Background = DimGray; +} +Spinner { + Foreground = DimGray; +} +TabView { + CacheEnabled = false; +} +TabItem { + Caption = TabItem; + Focusable = true; + CacheEnabled = false; +} +TextBox { + Background = White; + Foreground = Black; + Selectable = True; + Text = TextBox; + Margin = 1; +} +Window { + Caption = Window; + Focusable = true; + MinimumSize=5,5; + Width = 150; + Height = 150; +} +ToolWindow { + Caption = Window; + Template = #Crow.ToolWindow.template; + Focusable = true; + MinimumSize=50,50; + Width = 150; + Height = 150; +} +DocksView { + AllowDrop = true; +} +DockingView { + Focusable = true; + AllowDrag = true; +} +FileDialog { + Template = #Crow.FileDialog.template; + Focusable = true; + MinimumSize=50,50; + Width = 500; + Height = 300; +} +ProgressBar { + Foreground = vgradient|0:BlueCrayola|0.5:SkyBlue|1:BlueCrayola; +} +ScrollBar { + Maximum = 0; + Value = 0; +} +Scroller { + CacheEnabled = false; +} +Icon { + Margin=1; + Width=12; + Height=12; +} +Control { + Margin=0; + Spacing=3; +} +SaturationValueSelector { + Foreground=Red; +} +HueSelector { + ClipToClientRect=False; +} +ColorSpinner { + Minimum = 0; + Maximum = 255; + SmallIncrement = 1; +} +HSVSpinner { + Minimum = 0; + Maximum = 1; + SmallIncrement = 0.01; +}
\ No newline at end of file diff --git a/Crow.ControlsLib/DockingView.cs b/Crow.ControlsLib/DockingView.cs new file mode 100644 index 00000000..8d76d457 --- /dev/null +++ b/Crow.ControlsLib/DockingView.cs @@ -0,0 +1,166 @@ +// +// DockingView.cs +// +// Author: +// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; + +namespace Crow +{ + public class DockingView : Window + { + #region CTOR + protected DockingView() : base () + { + } + #endregion + + bool isDocked = false; + Alignment docking = Alignment.Center; + + Point lastMousePos; //last known mouse pos in this control + Point undockingMousePosOrig; //mouse pos when docking was donne, use for undocking on mouse move + Rectangle savedSlot; //last undocked slot recalled when view is undocked + bool wasResizable; + + public DocksView docker; + + public override void OnLayoutChanges (LayoutingType layoutType) + { + base.OnLayoutChanges (layoutType); + + if (isDocked) + return; + + if (docker == null) + return; + + Rectangle dvCliRect = docker.ClientRectangle; + + if (layoutType == LayoutingType.X) { + if (Slot.X < docker.DockingThreshold) + dock (Alignment.Left); + else if (Slot.Right > dvCliRect.Width - docker.DockingThreshold) + dock (Alignment.Right); + }else if (layoutType == LayoutingType.Y) { + if (Slot.Y < docker.DockingThreshold) + dock (Alignment.Top); + else if (Slot.Bottom > dvCliRect.Height - docker.DockingThreshold) + dock (Alignment.Bottom); + } + } + + public override void onMouseMove (object sender, MouseMoveEventArgs e) + { + lastMousePos = e.Position; + + if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && isDocked) { + if (docking == Alignment.Left) { + if (lastMousePos.X - undockingMousePosOrig.X > docker.DockingThreshold) + undock (); + } else if (docking == Alignment.Right) { + if (undockingMousePosOrig.X - lastMousePos.X > docker.DockingThreshold) + undock (); + } else if (docking == Alignment.Top) { + if (lastMousePos.Y - undockingMousePosOrig.Y > docker.DockingThreshold) + undock (); + } else if (docking == Alignment.Bottom) { + if (undockingMousePosOrig.Y - lastMousePos.Y > docker.DockingThreshold) + undock (); + } + return; + } + + base.onMouseMove (sender, e); + } + public override void onMouseDown (object sender, MouseButtonEventArgs e) + { + base.onMouseDown (sender, e); + + if (this.HasFocus && isDocked && e.Button == MouseButton.Left) + undockingMousePosOrig = lastMousePos; + } + +// protected override void onBorderMouseEnter (object sender, MouseMoveEventArgs e) +// { +// base.onBorderMouseEnter (sender, e); +// +// if (isDocked) { +// switch (docking) { +// case Alignment.Top: +// if (this.currentDirection != Window.Direction.S) +// onBorderMouseLeave (this, null); +// break; +// case Alignment.Left: +// if (this.currentDirection != Window.Direction.E) +// onBorderMouseLeave (this, null); +// break; +// case Alignment.TopLeft: +// break; +// case Alignment.Right: +// if (this.currentDirection != Window.Direction.W) +// onBorderMouseLeave (this, null); +// break; +// case Alignment.TopRight: +// break; +// case Alignment.Bottom: +// if (this.currentDirection != Window.Direction.N) +// onBorderMouseLeave (this, null); +// break; +// case Alignment.BottomLeft: +// break; +// case Alignment.BottomRight: +// break; +// case Alignment.Center: +// break; +// default: +// break; +// } +// } +// } + + void undock () { + docker.Undock(this); + + this.Left = savedSlot.Left; + this.Top = savedSlot.Top; + this.Width = savedSlot.Width; + this.Height = savedSlot.Height; + + isDocked = false; + Resizable = wasResizable; + } + void dock (Alignment align){ + this.Left = this.Top = 0; + isDocked = true; + docking = align; + undockingMousePosOrig = lastMousePos; + savedSlot = this.LastPaintedSlot; + wasResizable = Resizable; + Resizable = false; + + docker.Dock (this, align); + } + } +} + diff --git a/Crow.ControlsLib/DocksView.cs b/Crow.ControlsLib/DocksView.cs new file mode 100644 index 00000000..a93bdc78 --- /dev/null +++ b/Crow.ControlsLib/DocksView.cs @@ -0,0 +1,91 @@ +// +// DocksView.cs +// +// Author: +// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Xml.Serialization; +using System.ComponentModel; +using System.Collections.Generic; + +namespace Crow +{ + public class DocksView : Group + { + List<DockingView> childViews = new List<DockingView>(); + GenericStack rootStack = null; + + public override void AddChild (GraphicObject g) + { + DockingView dv = g as DockingView; + if (g == null) + throw new Exception ("DocksView accept only DockingView as child"); + base.AddChild (g); + childViews.Add (dv); + dv.docker = this; + } + public override void RemoveChild (GraphicObject child) + { + DockingView dv = child as DockingView; + if (child == null) + throw new Exception ("DocksView accept only DockingView as child"); + base.RemoveChild (child); + childViews.Remove (dv); + dv.docker = this; + } + public void Dock (DockingView dv, Alignment pos){ + switch (pos) { + case Alignment.Top: + if (rootStack?.Orientation != Orientation.Vertical) + this.Width = Measure.Stretched; + break; + case Alignment.Bottom: + this.Width = Measure.Stretched; + break; + case Alignment.Left: + this.Height = Measure.Stretched; + break; + case Alignment.Right: + this.Height = Measure.Stretched; + break; + } + } + public void Undock (DockingView dv){ + } + + int dockingThreshold; + + [XmlAttributeAttribute][DefaultValue(10)] + public virtual int DockingThreshold { + get { return dockingThreshold; } + set { + if (dockingThreshold == value) + return; + dockingThreshold = value; + NotifyValueChanged ("DockingThreshold", dockingThreshold); + + } + } + } +} + diff --git a/Crow.ControlsLib/Templates/AnalogMeter0.goml b/Crow.ControlsLib/Templates/AnalogMeter0.goml new file mode 100755 index 00000000..8187aac4 --- /dev/null +++ b/Crow.ControlsLib/Templates/AnalogMeter0.goml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<Group Margin="0" Width="-1" Height="-1" Focusable="false"> + <Image Name="Image" Path="#go.Images.meter.svg" SvgSub="background"/> +<!-- <Image Name="Image" Path="#go.Images.meter.svg" SvgSub="gauge"/>--> +</Group>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/Checkbox2.goml b/Crow.ControlsLib/Templates/Checkbox2.goml new file mode 100755 index 00000000..0a67fce7 --- /dev/null +++ b/Crow.ControlsLib/Templates/Checkbox2.goml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<HorizontalStack Margin="0" Spacing="1" Focusable="false"> + <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.checkbox.svg"/> + <Label Name="Caption" Background="Red"/> +</HorizontalStack>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/DockingView.template b/Crow.ControlsLib/Templates/DockingView.template new file mode 100755 index 00000000..0a3b4e01 --- /dev/null +++ b/Crow.ControlsLib/Templates/DockingView.template @@ -0,0 +1,24 @@ +<?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.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7" + 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="{./Caption}" /> + <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> diff --git a/Crow.ControlsLib/Templates/ListBox.template b/Crow.ControlsLib/Templates/ListBox.template new file mode 100755 index 00000000..f6d6214d --- /dev/null +++ b/Crow.ControlsLib/Templates/ListBox.template @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<Border BorderWidth="1" Margin="1" MinimumSize="10,10"> + <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"> + <VerticalStack + Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> + </Scroller> +</Border> diff --git a/Crow.ControlsLib/Templates/Menu.template b/Crow.ControlsLib/Templates/Menu.template new file mode 100644 index 00000000..c560043c --- /dev/null +++ b/Crow.ControlsLib/Templates/Menu.template @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"/> diff --git a/Crow.ControlsLib/Templates/MenuItem.template b/Crow.ControlsLib/Templates/MenuItem.template new file mode 100644 index 00000000..0f93b20c --- /dev/null +++ b/Crow.ControlsLib/Templates/MenuItem.template @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<Popper Font="{./Font}" Caption="{./Caption}" Background="{./Background}" PopDirection="{./PopDirection}" + Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseClick="./onMI_Click" + IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}"> + <Template> + <Border Name="border1" + MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}" + MouseLeave="{Foreground=Transparent}" + MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}" + MouseUp="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}" + MinimumSize = "60,0" + Foreground="Transparent" + Background="{./Background}"> + <Label Text="{./Caption}" + Foreground="{./Foreground}" + Margin="1" HorizontalAlignment="Left" + Font="{./Font}" /> + </Border> + </Template> + <Border Foreground="DimGray" Width="{../PopWidth}" Height="{../PopHeight}" Background="Onyx"> + <VerticalStack Name="ItemsContainer"/> + </Border> +</Popper> diff --git a/Crow.ControlsLib/Templates/MessageBox.template b/Crow.ControlsLib/Templates/MessageBox.template new file mode 100644 index 00000000..c33eb869 --- /dev/null +++ b/Crow.ControlsLib/Templates/MessageBox.template @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<Border CornerRadius="0" + MouseEnter="./onBorderMouseEnter" + MouseLeave="./onBorderMouseLeave"> + <VerticalStack Background="{./Background}"> + <Border BorderWidth="0" Foreground="White" Height="Fit" Width="Stretched" MinimumSize="200,0" + Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"> + <HorizontalStack Name="hs" Margin="2" Spacing="1" Height="Fit" > + <GraphicObject Width="5" Height="5"/> + <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> + <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" /> + <Border CornerRadius="3" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" + MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> + <Image Focusable="true" Name="Image" Path="#Crow.Images.Icons.exit2.svg" + MouseClick="./butQuitPress"/> + </Border> + <GraphicObject Width="5" Height="5"/> + </HorizontalStack> + </Border> + <HorizontalStack Margin="5"> + <Image Name="Image" Width="20%" Height="30" Path="{./MsgIcon}" /> + <Label Margin="5" Font="{./Font}" Width="Fit" Text="{./Message}" + TextAlignment="Left" + Multiline="true" /> + </HorizontalStack> + <HorizontalStack Margin="1" Spacing="0" Height="Fit" Width="60%" HorizontalAlignment="Right"> + <Button Width="50%" Caption="{./OkMessage}" MouseClick="./onOkButtonClick" /> + <Button Width="50%" Caption="{./CancelMessage}" MouseClick="./onCancelButtonClick" /> + </HorizontalStack> + </VerticalStack> +</Border> diff --git a/Crow.ControlsLib/Templates/Popper.template b/Crow.ControlsLib/Templates/Popper.template new file mode 100755 index 00000000..0bc7c741 --- /dev/null +++ b/Crow.ControlsLib/Templates/Popper.template @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit"> + <HorizontalStack Spacing="1" Height="Fit"> + <Image Style="Icon" Margin="1" Width="9" Height="9" + Path="#Crow.Images.Icons.expandable.svg" SvgSub="{./IsPopped}"/> + <Label Text="{./Caption}" /> + </HorizontalStack> +</Border>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/RadioButton.template b/Crow.ControlsLib/Templates/RadioButton.template new file mode 100755 index 00000000..b96eec2c --- /dev/null +++ b/Crow.ControlsLib/Templates/RadioButton.template @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<HorizontalStack Style="Control" Background="{./Background}"> + <Image Style="Icon" Path="#Crow.Images.Icons.radiobutton.svg" + SvgSub="{./IsChecked}"/> + <Label Text="{./Caption}"/> +</HorizontalStack>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/ScrollBar.template b/Crow.ControlsLib/Templates/ScrollBar.template new file mode 100755 index 00000000..70dce93e --- /dev/null +++ b/Crow.ControlsLib/Templates/ScrollBar.template @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<Border BorderWidth="1" Foreground="LightGray"> + <GenericStack Orientation="{./Orientation}" Spacing="0"> + <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollBack" + Template="#Crow.Templates.ArrowButTemplate.crow"> + <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/> + </Button> + <Slider Name="Slider" + Orientation="{./Orientation}" + Value="{²./Value}" + Maximum="{./Maximum}" + Height="{./HeightPolicy}" Width="{./WidthPolicy}" + LargeIncrement="{./LargeIncrement}" + SmallIncrement="{./SmallIncrement}" + Background="hgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"/> + <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollForth" + Template="#Crow.Templates.ArrowButTemplate.crow"> + <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/> + </Button> + </GenericStack> +</Border>
\ No newline at end of file diff --git a/Crow.ControlsLib/Templates/ScrollingListBox.goml b/Crow.ControlsLib/Templates/ScrollingListBox.goml new file mode 100644 index 00000000..f294aea6 --- /dev/null +++ b/Crow.ControlsLib/Templates/ScrollingListBox.goml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<Border BorderWidth="1" Background="{./Background}"> + <HorizontalStack Margin="1"> + <Scroller Name="scroller1" + Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"> + <VerticalStack Height="Fit" MinimumSize="10,10" + Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> + </Scroller> + <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}" + Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" + Width="14" /> + </HorizontalStack> +</Border> diff --git a/Crow.ControlsLib/Templates/Slider.template b/Crow.ControlsLib/Templates/Slider.template new file mode 100755 index 00000000..9c7bb705 --- /dev/null +++ b/Crow.ControlsLib/Templates/Slider.template @@ -0,0 +1 @@ +<?xml version="1.0"?> diff --git a/Crow.ControlsLib/Templates/Spinner (copier).goml b/Crow.ControlsLib/Templates/Spinner (copier).goml new file mode 100755 index 00000000..fcb849c3 --- /dev/null +++ b/Crow.ControlsLib/Templates/Spinner (copier).goml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<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 diff --git a/Crow.ControlsLib/Templates/Spinner.template b/Crow.ControlsLib/Templates/Spinner.template new file mode 100755 index 00000000..4d3569bf --- /dev/null +++ b/Crow.ControlsLib/Templates/Spinner.template @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0"> + <Border BorderWidth="1" Width="80%" Background="White" + Foreground="{./Foreground}" Margin="0"> + <TextBox Foreground="{./Foreground}" Font="{./Font}" Width="Stretched" + Text="{²./Value}" TextAlignment="Right" Margin="0"/> + </Border> + <VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red"> + <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onUp" + Template="#Crow.Templates.ArrowButTemplate.crow"> + <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="up" Margin="0"/> + </Button> + <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onDown" + Template="#Crow.Templates.ArrowButTemplate.crow"> + <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="down" Margin="0"/> + </Button> + </VerticalStack> +</HorizontalStack> diff --git a/Crow.ControlsLib/Templates/TabItem.template b/Crow.ControlsLib/Templates/TabItem.template new file mode 100644 index 00000000..f82b79c9 --- /dev/null +++ b/Crow.ControlsLib/Templates/TabItem.template @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<GenericStack Orientation="Vertical" Spacing="0" + Background="Onyx" + MouseEnter="{caption.Foreground=White}" + MouseLeave="{caption.Foreground=Gray}"> + <HorizontalStack Margin="2" Left="{./TabOffset}" + Name="TabTitle" + HorizontalAlignment="Left" + Height="{./TabThickness}" + Width="Fit"> + <Label Name="caption" Text="{./Caption}" Foreground="Gray"/> + <Border CornerRadius="5" 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="./butCloseTabClick"/> + </Border> + </HorizontalStack> + <Container Name="Content"/> +</GenericStack> + diff --git a/Crow.ControlsLib/Templates/ToolWindow.template b/Crow.ControlsLib/Templates/ToolWindow.template new file mode 100755 index 00000000..f021f6ee --- /dev/null +++ b/Crow.ControlsLib/Templates/ToolWindow.template @@ -0,0 +1,24 @@ +<?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="{./Caption}" /> + <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> diff --git a/Crow.ControlsLib/Templates/TreeView.template b/Crow.ControlsLib/Templates/TreeView.template new file mode 100644 index 00000000..c29e34c5 --- /dev/null +++ b/Crow.ControlsLib/Templates/TreeView.template @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<HorizontalStack> + <Scroller Name="scroller1" Margin="1" VerticalScrolling="true" + Background="{./Background}" + ScrollY="{../scrollbar1.Value}"> + <VerticalStack + Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/> + </Scroller> + <ScrollBar + Name="scrollbar1" + Value="{../scroller1.ScrollY}" + Maximum="{../scroller1.MaximumScroll}" + Width="14" Orientation="Vertical"/> +</HorizontalStack> diff --git a/Crow.ControlsLib/Templates/Window.template b/Crow.ControlsLib/Templates/Window.template new file mode 100755 index 00000000..20b23147 --- /dev/null +++ b/Crow.ControlsLib/Templates/Window.template @@ -0,0 +1,39 @@ +<?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="2" TextAlignment="Center" Text="{./Caption}" /> + <Border Visible="{./ShowMinimize}" BorderWidth="1" Foreground="Transparent" Height="12" Width="12" + MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}"> + <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="0,0" Background="0.5,0.5,0.5,0.5"/> + </VerticalStack> +</Border> diff --git a/Crow.ControlsLib/Templates/imgItemTemplate.goml b/Crow.ControlsLib/Templates/imgItemTemplate.goml new file mode 100755 index 00000000..c08f390e --- /dev/null +++ b/Crow.ControlsLib/Templates/imgItemTemplate.goml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + <VerticalStack Width="0" Height="-1" Focusable="true" + MouseEnter="{Background=BlueCrayola}" + MouseLeave="{Background=Transparent}"> + <Image Width="-1" Height="-1" Path="{FullName}" MaximumSize="80,80"/> + <Label Text="{Name}" Width="-1" Height="-1" Margin="0" MaximumSize="100,0"/> + </VerticalStack> + diff --git a/Crow.ControlsLib/Templates/tmpDirItem.goml b/Crow.ControlsLib/Templates/tmpDirItem.goml new file mode 100755 index 00000000..01aef1e6 --- /dev/null +++ b/Crow.ControlsLib/Templates/tmpDirItem.goml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> + <HorizontalStack Width="-1" Height="-1" Focusable="true" + HorizontalAlignment="Left" + MouseEnter="{Background=BlueCrayola}" + MouseLeave="{Background=Transparent}"> + <Image Width="16" Height="16" Path="#Tests.image.folder1.svg" SvgSub="{Attributes}"/> + <Label Text="{Name}" Width="-1" Height="-1" Margin="0"/> +<!-- <Label Text="{Attributes}" Width="-1" Height="-1" Margin="0"/> + <Label Text="{Extension}" Width="-1" Height="-1" Margin="0"/>--> + </HorizontalStack> + diff --git a/Crow.ControlsLib/Templates/treeList.crow b/Crow.ControlsLib/Templates/treeList.crow new file mode 100755 index 00000000..d47621af --- /dev/null +++ b/Crow.ControlsLib/Templates/treeList.crow @@ -0,0 +1,3 @@ +<?xml version="1.0"?> +<VerticalStack + Height="Fit" Name="ItemsContainer"/> |