diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-10-30 19:39:53 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-10-30 19:39:53 +0200 |
| commit | 882652abf66dadccbec62dfa478547f18b343fc8 (patch) | |
| tree | 8860eee422aeae37477306bdb1aa8598f8c287e4 /Samples | |
| parent | 2866fa7335eabc4371cb6909348a8db688c9f59d (diff) | |
| parent | a4367fb29faf7ee987b937e2397359a6020f25b9 (diff) | |
Merge branch 'FileDialogImprove'
Diffstat (limited to 'Samples')
33 files changed, 543 insertions, 51 deletions
diff --git a/Samples/BasicTests/BasicTests.cs b/Samples/BasicTests/BasicTests.cs index 3b4e6bb2..130171aa 100644 --- a/Samples/BasicTests/BasicTests.cs +++ b/Samples/BasicTests/BasicTests.cs @@ -38,7 +38,7 @@ namespace Samples //testFiles = new string [] { @"Interfaces/Stack/StretchedInFit4.crow" }; //testFiles = new string [] { @"Interfaces/TemplatedGroup/1.crow" }; //testFiles = new string [] { @"Interfaces/Divers/colorPicker2.crow" }; - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Widget", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); @@ -63,7 +63,7 @@ namespace Samples switch (key) { case Key.Escape: Quit (); - break; + break; case Key.F3: idx--; break; diff --git a/Samples/HelloWorld/HelloWorld.csproj b/Samples/HelloWorld/HelloWorld.csproj index 7ceb582d..178d4537 100644 --- a/Samples/HelloWorld/HelloWorld.csproj +++ b/Samples/HelloWorld/HelloWorld.csproj @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <TargetFramework>netcoreapp3.1</TargetFramework> + <OutputType>Exe</OutputType> + </PropertyGroup> <ItemGroup> - <EmbeddedResource Include="ui\**\*.*"> - <LogicalName>HelloWorld.%(Filename)%(Extension)</LogicalName> - </EmbeddedResource> + <PackageReference Include="Crow" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs index dc5e2a13..e60b9782 100644 --- a/Samples/HelloWorld/main.cs +++ b/Samples/HelloWorld/main.cs @@ -4,21 +4,10 @@ using Samples; namespace HelloWorld { - class Program : SampleBase { - public CommandGroup CMDTest = new CommandGroup ( - new ActionCommand("Action", ()=> Console.WriteLine ("Action executed")) - ); + class Program { static void Main (string[] args) { - DbgLogger.IncludedEvents.AddRange ( new DbgEvtType[] { - DbgEvtType.MouseEnter, - DbgEvtType.MouseLeave, - DbgEvtType.WidgetMouseDown, - DbgEvtType.WidgetMouseUp, - DbgEvtType.WidgetMouseClick, - DbgEvtType.HoverWidget - }); - using (Interface app = new Program ()) { - app.Initialized += (sender, e) => (sender as Interface).Load ("#HelloWorld.helloworld.crow").DataSource = sender; + using (Interface app = new Interface ()) { + app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Label Text='Hello World'/>"); app.Run (); } } diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs index 71556f01..9d257160 100644 --- a/Samples/ShowCase/ShowCase.cs +++ b/Samples/ShowCase/ShowCase.cs @@ -37,6 +37,8 @@ namespace ShowCase app.SetWindowIcon ("#Crow.Icons.crow.png"); //app.Theme = @"C:\Users\Jean-Philippe\source\Crow\Themes\TestTheme"; CurrentProgramInstance = app; + Interface.UPDATE_INTERVAL = 50; + Interface.POLLING_INTERVAL = 5; app.Run (); } diff --git a/Samples/common/src/MyNumericControl.cs b/Samples/common/src/MyNumericControl.cs new file mode 100644 index 00000000..38e162a3 --- /dev/null +++ b/Samples/common/src/MyNumericControl.cs @@ -0,0 +1,46 @@ +//Tutorial +using Crow; + +namespace MyNumericControl { + public class MyNumericControl : TemplatedControl { + protected double actualValue, minValue, maxValue; + public double Minimum { + get => minValue; + set { + if (minValue == value) + return; + minValue = value; + if (Value < minValue) + Value = minValue; + NotifyValueChangedAuto (minValue); + } + } + public double Maximum { + get => maxValue; + set { + if (maxValue == value) + return; + maxValue = value; + NotifyValueChangedAuto (maxValue); + + if (Value > maxValue) + Value = maxValue; + + } + } + public virtual double Value { + get => actualValue; + set { + if (actualValue == value) + return; + if (value < minValue) + actualValue = minValue; + else if (value > maxValue) + actualValue = maxValue; + else + actualValue = value; + NotifyValueChangedAuto (actualValue); + } + } + } +}
\ No newline at end of file diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 3e0ef714..ce043b37 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -11,31 +11,13 @@ using System.Runtime.InteropServices; using System.Threading; using Crow.Drawing; +using System.Diagnostics; namespace Samples { public class SampleBase : Interface { -#if NETCOREAPP - static IntPtr resolveUnmanaged(Assembly assembly, String libraryName) - { - switch (libraryName) - { - case "glfw3": - return NativeLibrary.Load("glfw", assembly, null); - case "rsvg-2.40": - return NativeLibrary.Load("rsvg-2", assembly, null); - } - Console.WriteLine($"[UNRESOLVE] {assembly} {libraryName}"); - return IntPtr.Zero; - } - - static SampleBase() - { - System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()).ResolvingUnmanagedDll += resolveUnmanaged; - } -#endif public SampleBase(IntPtr hWin) : base(800, 600, hWin) { } public SampleBase() : base(800, 600, true, true) { } public SampleBase(int width, int height, bool startUIThread, bool createSurface) : @@ -436,5 +418,63 @@ namespace Samples } return base.OnKeyDown(e); } + public IEnumerable<RandomProgress> RandomProgressList { + get { + for (int i=0; i< RandomProgressItemCount; i++) + yield return new RandomProgress (); + } + } + int randomProgressItemCount = 10; + public int RandomProgressItemCount { + get => randomProgressItemCount; + set { + if (randomProgressItemCount == value) + return; + randomProgressItemCount = value; + NotifyValueChanged (randomProgressItemCount); + NotifyValueChanged ("RandomProgressList", RandomProgressList); + } + } + + public class RandomProgress : IValueChange { + static Random rnd = new Random(); + public event EventHandler<ValueChangeEventArgs> ValueChanged; + public void NotifyValueChanged(object _value, [CallerMemberName] string caller = null) + => ValueChanged.Raise(this, new ValueChangeEventArgs(caller, _value)); + public void NotifyValueChanged(string membername, object _value) + => ValueChanged.Raise(this, new ValueChangeEventArgs(membername, _value)); + public RandomProgress () { + step = rnd.Next (10); + max = rnd.Next (100, 1000); + sleep = rnd.Next (2,200); + Thread t = new Thread(increment); + t.IsBackground = true; + t.Start (); + + NotifyValueChanged ("Maximum", max); + } + int val, step, max, sleep; + public int Value { + get => val; + set { + if (val == value) + return; + val = value; + NotifyValueChanged (val); + } + } + public int Maximum => max; + + void increment() { + Stopwatch sw = Stopwatch.StartNew(); + while (sw.ElapsedMilliseconds < 10000) { + Value += step; + if (Value > max) + Value = 0; + Thread.Sleep (sleep); + } + Value = max; + } + } } }
\ No newline at end of file diff --git a/Samples/common/src/TestWidget.cs b/Samples/common/src/TestWidget.cs new file mode 100644 index 00000000..bf2f6bd0 --- /dev/null +++ b/Samples/common/src/TestWidget.cs @@ -0,0 +1,26 @@ +//Tutorial +using Crow; +using Crow.Drawing; +using Glfw; + +namespace TestWidget { + public class TestWidget : Widget { + protected override void onDraw (Context gr) { + base.onDraw (gr); + gr.SetSource (myColor); + gr.Rectangle (ClientRectangle); + gr.Fill(); + } + Color myColor = Colors.Green; + public override void onMouseEnter(object sender, MouseMoveEventArgs e) { + base.onMouseEnter (sender, e); + myColor = Colors.Chartreuse; + RegisterForRedraw (); + } + public override void onMouseLeave(object sender, MouseMoveEventArgs e) { + base.onMouseLeave (sender, e); + myColor = Colors.Green; + RegisterForRedraw (); + } + } +}
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Container/3.crow b/Samples/common/ui/Interfaces/Container/3.crow index 4d6d1ec3..79df9e91 100644 --- a/Samples/common/ui/Interfaces/Container/3.crow +++ b/Samples/common/ui/Interfaces/Container/3.crow @@ -1,4 +1,10 @@ <?xml version="1.0"?> <Container Background="Blue" Margin="10" Fit="true"> - <Label Text="test" Margin="10" Fit="true" Background="SeaGreen"/> + <Label Multiline="true" Text="this is a test of a multiline textbox +and another line +and another line +and another line a little bit longuer +and another line +and another line +" Margin="10" Fit="true" Background="SeaGreen" TextAlignment="Center"/> </Container>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/0.crow b/Samples/common/ui/Interfaces/Divers/0.crow index d9ba0161..d282fade 100644 --- a/Samples/common/ui/Interfaces/Divers/0.crow +++ b/Samples/common/ui/Interfaces/Divers/0.crow @@ -87,7 +87,7 @@ </VerticalStack> <Splitter /> <VerticalStack Width="30%" Margin="5"> - <ListBox Focusable="true" Name="colorList" Data="{TestList}" Margin="5" ItemTemplate="Interfaces/colorItem.crow" /> + <ListBox Focusable="true" Name="colorList" Data="{TestList}" Margin="5" ItemTemplate="#ui.colorItem.crow" /> </VerticalStack> </HorizontalStack> </Window>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Divers/fitListWithStretchedItems.crow b/Samples/common/ui/Interfaces/Divers/fitListWithStretchedItems.crow index f159a6b2..73693535 100644 --- a/Samples/common/ui/Interfaces/Divers/fitListWithStretchedItems.crow +++ b/Samples/common/ui/Interfaces/Divers/fitListWithStretchedItems.crow @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<ListBox Data="{TestList}" Width="Fit" Focusable="true" > +<ListBox Data="{TestList}" Width="Fit" Focusable="true" Foreground="Red" > <Template> <Scroller Name="ItemsScroller" Height="Stretched" Background="Onyx" Margin="10"> <VerticalStack Name="ItemsContainer" Orientation="Horizontal" VerticalAlignment="Top" Height="Fit" Background="Grey" Margin="20"/> @@ -10,7 +10,7 @@ <ListItem Width="Stretched" Margin="1" CornerRadius="5" Selected="{Background=Yellow}" Unselected="{Background=Transparent}"> - <Label Text="{}" TextAlignment="Center" Font="mono, 9" Foreground="Black" Margin="6" Background="{}" Width="Stretched" /> + <Label Text="{}" TextAlignment="Center" Font="mono, 9" Foreground="{Foreground}" Margin="6" Background="{}" Width="Stretched" /> </ListItem> </ItemTemplate> diff --git a/Samples/common/ui/Interfaces/Divers/testFileDialogTemplate.crow b/Samples/common/ui/Interfaces/Divers/testFileDialogTemplate.crow new file mode 100644 index 00000000..7aed370f --- /dev/null +++ b/Samples/common/ui/Interfaces/Divers/testFileDialogTemplate.crow @@ -0,0 +1,91 @@ +<?xml version="1.0"?> +<FileDialog Caption="Open File" CurrentDirectory="/" SearchPattern="*.*"> + <Template> + <Border Name="SizeHandle" Style="winBorder" CornerRadius="{./CornerRadius}" Background="{./Background}"> + <VerticalStack Spacing="0"> + <HorizontalStack Background="${WindowTitleBarBackground}" Margin="0" Spacing="0" Height="Fit"> + <Widget Width="5"/> + <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> + <Label Name="MoveHandle" Width="Stretched" Foreground="${WindowTitleBarForeground" Margin="2" TextAlignment="Center" Text="{./Caption}" /> + <Border CornerRadius="0" 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.Icons.exit2.svg" + MouseClick="./onQuitPress"/> + </Border> + <Widget Width="5"/> + </HorizontalStack> + <Container Name="Content" MinimumSize="50,50" Background="Jet"> + <VerticalStack Margin="1"> + <HorizontalStack Height="Fit"> + <Button Fit="true" Caption="Up" MouseClick="./goUpDirClick"> + <Image Margin="2" Width="14" Height="14" + Path="#Crow.Icons.level-up.svg"/> + </Button> + <TextBox Style="TxtInFileDialog" Text="{²./CurrentDirectory}"/> + </HorizontalStack> + <DirectoryView ShowHidden="{²../cbShowHidden.IsChecked}" FileMask="{²../txtFileMask.Text}" ShowFiles="{²../cbShowFiles.IsChecked}" + Name="fv" CurrentDirectory="{./CurrentDirectory}" SelectedItemChanged="./onFVSelectedItemChanged" + Width="100%" Margin="0" MouseDoubleClick="./onFileSelectDblClick"> + <Template> + <ListBox Name="fileView" Data="{./FileSystemEntries}" + SelectedItemChanged="./onSelectedItemChanged"> + <Template> + <HorizontalStack> + <Scroller Name="scroller1"> + <VerticalStack Height="Fit" VerticalAlignment="Top" + Name="ItemsContainer" Margin="0" Spacing="1"/> + </Scroller> + <ScrollBar Name="scrollbar1" Orientation="Vertical" + Value="{²../scroller1.ScrollY}" Maximum="{../scroller1.MaxScrollY}" + CursorRatio="{../scroller1.ChildHeightRatio}" + LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" + Width="14" /> + </HorizontalStack> + </Template> + <ItemTemplate> + <Widget Height="16" Background="Red"/> + </ItemTemplate> + <ItemTemplate DataType="System.IO.FileInfo"> + <ListItem Height="Fit" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack> + <Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.file.svg"/> + <Label Text="{Name}" Width="Stretched"/> + </HorizontalStack> + </ListItem> + </ItemTemplate> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <ListItem Height="Fit" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack> + <Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.folder.svg"/> + <Label Text="{Name}" Width="Stretched"/> + <Label Text="{LastAccessTime}" /> + </HorizontalStack> + </ListItem> + </ItemTemplate> + </ListBox> + </Template> + </DirectoryView> + <HorizontalStack Height="Fit"> + <TextBox Style="TxtInFileDialog" Text="{²./SelectedFile}"/> + <TextBox Style="TxtInFileDialog" Width="50" Name="txtFileMask" Text="{²./SearchPattern}"/> + </HorizontalStack> + <HorizontalStack Margin="5" Fit="true" HorizontalAlignment="Right"> + <CheckBox Style="CheckBoxAlt" Name="cbShowFiles" Caption="Show Files" IsChecked="{²./ShowFiles}"/> + <CheckBox Style="CheckBoxAlt" Name="cbShowHidden" Caption="Show Hidden" IsChecked="{²./ShowHidden}"/> + </HorizontalStack> + <HorizontalStack Fit="true" HorizontalAlignment="Right" Margin="3" Spacing="3"> + <Button Caption="Ok" Command="{./CMDOk}"/> + <Button Caption="Cancel" Command="{./CMDCancel}"/> + </HorizontalStack> + </VerticalStack> + </Container> + </VerticalStack> + </Border> + + </Template> +</FileDialog> + diff --git a/Samples/common/ui/Interfaces/Experimental/directoryView2-dyn.crow b/Samples/common/ui/Interfaces/Experimental/directoryView2-dyn.crow new file mode 100644 index 00000000..811b3dba --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/directoryView2-dyn.crow @@ -0,0 +1,5 @@ +<VerticalStack> + <EnumSelector Caption="View Style" EnumValue="{²../dv.ViewStyle}"/> + <Spinner Value="{²../dv.IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <DirectoryView2 Name="dv" CurrentDirectory="/mnt/devel" MouseDoubleClick="./onFileSelectDblClick"/> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/directoryView2.crow b/Samples/common/ui/Interfaces/Experimental/directoryView2.crow new file mode 100644 index 00000000..9bfebe72 --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/directoryView2.crow @@ -0,0 +1,41 @@ +<VerticalStack> + <EnumSelector Caption="View Style" EnumValue="{²../dv.ViewStyle}"/> + <Spinner Value="{²../dv.IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <DirectoryView2 UseLoadingThread="false" Name="dv" CurrentDirectory="/mnt/devel" Data="{/FileSystemEntries}"> + <Template> + <HorizontalStack Background="Grey" Margin="5"> + <Scroller Name="scroller1"> + <Wrapper Orientation="Vertical" Height="Fit" VerticalAlignment="Top" + Name="ItemsContainer" Margin="0" Spacing="2"/> + </Scroller> + <ScrollBar Name="scrollbar1" Orientation="Vertical" + Value="{²../scroller1.ScrollY}" Maximum="{../scroller1.MaxScrollY}" + CursorRatio="{../scroller1.ChildHeightRatio}" + LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" + Width="14" /> + </HorizontalStack> + </Template> + <ItemTemplate DataType="System.IO.FileInfo"> + <ListItem Width="70" Height="60" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <VerticalStack> + <Image Margin="8" Width="Fit" Height="Stretched" Path="${FileIcon}" Scaled="true"/> + <Label Text="{Name}" Background="Jet" Width="Stretched" TextAlignment="Center" Multiline="true" Font="sans,9" /> + </VerticalStack> + </ListItem> + </ItemTemplate> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <ListItem Width="90" Height="60" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <VerticalStack> + <Image Margin="0" Width="Fit" Height="Stretched" Path="${FolderIcon}" Scaled="true"/> + <Label Text="{Name}" Background="Jet" Width="Stretched" TextAlignment="Center" Multiline="true" Font="sans,9"/> + </VerticalStack> + </ListItem> + </ItemTemplate> +</DirectoryView2> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/directoryView3.crow b/Samples/common/ui/Interfaces/Experimental/directoryView3.crow new file mode 100644 index 00000000..45d811a2 --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/directoryView3.crow @@ -0,0 +1,38 @@ +<VerticalStack> + <EnumSelector Caption="View Style" EnumValue="{²../dv.ViewStyle}"/> + <Spinner Value="{²../dv.IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <DirectoryView2 Name="dv" CurrentDirectory="/mnt/devel" Data="{/FileSystemEntries}"> + <Template> + <VerticalStack> + <VerticalStack Background="Grey" Margin="5"> + <Scroller Name="scroller1"> + <Wrapper Orientation="Horizontal" Height="Stretched" Width="Fit" HorizontalAlignment="Left" + Name="ItemsContainer" Margin="0" Spacing="2"/> + </Scroller> + </VerticalStack> + </VerticalStack> + </Template> + <ItemTemplate DataType="System.IO.FileInfo"> + <ListItem Width="Fit" Height="Fit" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Margin="0" Width="16" Height="16" Path="${FileIcon}" Scaled="true"/> + <Label Text="{Name}" Width="Fit" Font="sans,9" /> + </HorizontalStack> + </ListItem> + </ItemTemplate> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <ListItem Width="Fit" Height="Fit" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Margin="0" Width="16" Height="16" Path="${FolderIcon}" Scaled="true"/> + <Label Text="{Name}" Width="Fit" Font="sans,9"/> + </HorizontalStack> + </ListItem> + </ItemTemplate> + </DirectoryView2> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/directoryView4.crow b/Samples/common/ui/Interfaces/Experimental/directoryView4.crow new file mode 100644 index 00000000..ee3e8b1b --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/directoryView4.crow @@ -0,0 +1,40 @@ +<DirectoryView2 CurrentDirectory="/mnt/devel" Data="{/FileSystemEntries}"> + <Template> + <VerticalStack> + <Spinner Value="{²./IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <VerticalStack Background="Grey" Margin="5"> + <Scroller Name="scroller1"> + <VerticalStack Height="Fit" Width="Stretched" VerticalAlignment="Top" + Name="ItemsContainer" Margin="0" Spacing="2"/> + </Scroller> + </VerticalStack> + </VerticalStack> + </Template> + <ItemTemplate DataType="System.IO.FileInfo"> + <ListItem Width="Stretched" Height="Fit" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Margin="0" Width="16" Height="16" Path="${FileIcon}" Scaled="true"/> + <Label Text="{Name}" Width="Stretched" Font="sans,9" /> + <Label Text="{Length}" Width="Fit" Font="sans,9"/> + <Label Text="{Attributes}" Width="Fit" Font="sans,9"/> + <Label Text="{LastAccessTime}" Width="Fit" Font="sans,9"/> + </HorizontalStack> + </ListItem> + </ItemTemplate> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <ListItem Width="Stretched" Height="Fit" + BubbleEvents="All" Tooltip="{Name}" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Margin="0" Width="16" Height="16" Path="${FolderIcon}" Scaled="true"/> + <Label Text="{Name}" Width="Stretched" Font="sans,9"/> + <Label Text="{Attributes}" Width="Fit" Font="sans,9"/> + <Label Text="{LastAccessTime}" Width="Fit" Font="sans,9"/> + </HorizontalStack> + </ListItem> + </ItemTemplate> +</DirectoryView2>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/directoryView5.crow b/Samples/common/ui/Interfaces/Experimental/directoryView5.crow new file mode 100644 index 00000000..5b59a0f6 --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/directoryView5.crow @@ -0,0 +1,40 @@ +<VerticalStack> + <EnumSelector Caption="View Style" EnumValue="{²../dv.ViewStyle}"/> + <Spinner Value="{²../dv.IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <DirectoryView2 Name="dv" CurrentDirectory="/mnt/devel" Data="{/FileSystemEntries}"> + <Template> + <VerticalStack> + <Spinner Value="{²./IconSize}" SmallIncrement="1" LargeIncrement="1"/> + <VerticalStack Background="DarkGrey" Margin="0"> + <Scroller Name="scroller1"> + <Table Columns=",20;Name,Stretched;Size,100;Accessed,Fit" Height="Fit" Width="Stretched" VerticalAlignment="Top" + Name="ItemsContainer" Margin="0" Spacing="0" RowsMargin="0" ColumnSpacing="10" + HorizontalLineWidth="0" VerticalLineWidth="1" /> + </Scroller> + </VerticalStack> + </VerticalStack> + </Template> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <TableRow Width="Stretched" Height="Fit" Focusable="true" + BubbleEvents="All" Tooltip="{Name}" + Selected="{Background=${ControlHighlight}}" + Unselected="{Background=Transparent}"> + <Image Width="Stretched" Height="Stretched" Path="${FolderIcon}" Margin="0" /> + <Label Text="{Name}" Width="Fit" Font="sans,11" Margin="3"/> + <Label Text="" Font="sans,9"/> + <Label Text="{LastAccessTime}" Font="sans,9"/> + </TableRow> + </ItemTemplate> + <ItemTemplate DataType="System.IO.FileInfo"> + <TableRow Width="Stretched" Height="Fit" Focusable="true" + BubbleEvents="All" Tooltip="{Name}" + Selected="{Background=${ControlHighlight}}" + Unselected="{Background=Transparent}"> + <Image Width="Stretched" Height="Stretched" Path="${FileIcon}" Margin="2" /> + <Label Text="{Name}" Width="Fit" Font="sans,11" Margin="3"/> + <Label Text="{Length}" Font="sans,9" TextAlignment="Right"/> + <Label Text="{LastAccessTime}" Font="sans,9"/> + </TableRow> + </ItemTemplate> + </DirectoryView2> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/fileDialog.crow b/Samples/common/ui/Interfaces/Experimental/fileDialog.crow index 90f9c70c..c26e3a7a 100644 --- a/Samples/common/ui/Interfaces/Experimental/fileDialog.crow +++ b/Samples/common/ui/Interfaces/Experimental/fileDialog.crow @@ -12,6 +12,95 @@ <Label Text="{ActiveWidget}" Font="mono, 8"/> </HorizontalStack> <Container> - <FileDialog Focusable="true" Resizable="true"/> + <FileDialog Focusable="true" Resizable="true" Width="80%" Height="80%"> + <Template> + <Border Name="SizeHandle" Style="winBorder" CornerRadius="{./CornerRadius}" Background="{./Background}"> + <VerticalStack Spacing="0"> + <HorizontalStack Background="${WindowTitleBarBackground}" Margin="0" Spacing="0" Height="Fit"> + <Widget Width="5"/> + <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/> + <Label Name="MoveHandle" Width="Stretched" Foreground="${WindowTitleBarForeground" Margin="2" TextAlignment="Center" Text="{./Caption}" /> + <Border CornerRadius="0" 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.Icons.exit2.svg" + MouseClick="./onQuitPress"/> + </Border> + <Widget Width="5"/> + </HorizontalStack> + <Container Name="Content" MinimumSize="50,50" Background="Jet"> + <VerticalStack Spacing="2" Margin="1"> + <HorizontalStack Height="Fit" Margin="2"> + <Button MinimumSize="1,1" Fit="true" Caption="Up" MouseClick="./goUpDirClick"> + <Image Margin="2" Width="18" Height="18" + Path="#Crow.Icons.level-up.svg"/> + </Button> + <TextBox Style="TxtInFileDialog" Text="{²./CurrentDirectory}" Margin="3"/> + </HorizontalStack> + <DirectoryView ShowHidden="{²../cbShowHidden.IsChecked}" FileMask="{²../txtFileMask.Text}" + ShowFiles="{²../cbShowFiles.IsChecked}" Name="fv" CurrentDirectory="{./CurrentDirectory}" + SelectedItemChanged="./onFVSelectedItemChanged" + Width="100%" Margin="1" MouseDoubleClick="./onFileSelectDblClick"> + <Template> + <ListBox Name="fileView" Data="{./FileSystemEntries}" + SelectedItemChanged="./onSelectedItemChanged"> + <Template> + <HorizontalStack Background="Grey"> + <Scroller Name="scroller1"> + <VerticalStack Height="Fit" VerticalAlignment="Top" + Name="ItemsContainer" Margin="2" Spacing="1"/> + </Scroller> + <ScrollBar Name="scrollbar1" Orientation="Vertical" + Value="{²../scroller1.ScrollY}" Maximum="{../scroller1.MaxScrollY}" + CursorRatio="{../scroller1.ChildHeightRatio}" + LargeIncrement="{../scroller1.PageHeight}" SmallIncrement="30" + Width="14" /> + </HorizontalStack> + </Template> + <ItemTemplate> + <Widget Height="16" Background="Red"/> + </ItemTemplate> + <ItemTemplate DataType="System.IO.FileInfo"> + <ListItem Height="Fit" + BubbleEvents="All" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Width="16" Height="16" Path="#Crow.Icons.file.svg"/> + <Label Margin="2" Text="{Name}" Width="Stretched"/> + </HorizontalStack> + </ListItem> + </ItemTemplate> + <ItemTemplate DataType="System.IO.DirectoryInfo"> + <ListItem Height="Fit" + BubbleEvents="All" + Selected = "{Background=${ControlHighlight}}" + Unselected = "{Background=Transparent}"> + <HorizontalStack Spacing="5"> + <Image Width="16" Height="16" Path="#Crow.Icons.folder.svg"/> + <Label Margin="2" Text="{Name}" Width="Stretched"/> + <Label Margin="2" Text="{LastAccessTime}" /> + </HorizontalStack> + </ListItem> + </ItemTemplate> + </ListBox> + </Template> + </DirectoryView> + <HorizontalStack Height="Fit"> + <TextBox Style="TxtInFileDialog" Text="{²./SelectedFile}"/> + <TextBox Style="TxtInFileDialog" Width="50" Name="txtFileMask" Text="{²./SearchPattern}"/> + </HorizontalStack> + <HorizontalStack Height="Fit" Margin="2" Spacing="2"> + <CheckBox Style="CheckBoxAlt" Name="cbShowFiles" Caption="Show Files" IsChecked="{²./ShowFiles}" Width="Fit"/> + <CheckBox Style="CheckBoxAlt" Name="cbShowHidden" Caption="Show Hidden" IsChecked="{²./ShowHidden}" Width="Fit"/> + <Widget Width="Stretched"/> + <Button Caption="Ok" Command="{./CMDOk}"/> + <Button Caption="Cancel" Command="{./CMDCancel}"/> + </HorizontalStack> + </VerticalStack> + </Container> + </VerticalStack> + </Border> + </Template> + </FileDialog> </Container> </VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/randomProgress.crow b/Samples/common/ui/Interfaces/Experimental/randomProgress.crow new file mode 100644 index 00000000..9b63b81a --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/randomProgress.crow @@ -0,0 +1,18 @@ +<VerticalStack> + <VerticalStack Width="Fit" Background="DarkSlateGrey" Margin="10" Height="Fit"> + <HorizontalStack Height="Fit" Spacing="10"> + <Label Text="Value:"/> + <Label Text="{../../slider.Value}" Background="Onyx" Margin="1" Width="40" TextAlignment="Right"/> + </HorizontalStack> + <Slider Name="slider" Height="10" Width="200" Background="DarkGrey" LargeIncrement="20" SmallIncrement="5" + Minimum="10" Maximum="1000" Value="{²RandomProgressItemCount}"/> + </VerticalStack> + <ListBox UseLoadingThread="false" Data="{RandomProgressList}"> + <Template> + <Wrapper Name="ItemsContainer"/> + </Template> + <ItemTemplate> + <ProgressBar Maximum="{Maximum}" Value="{Value}" Height="10" Width="50"/> + </ItemTemplate> + </ListBox> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/tabView1.crow b/Samples/common/ui/Interfaces/Experimental/tabView1.crow index 773ec4fe..7dfcede8 100644 --- a/Samples/common/ui/Interfaces/Experimental/tabView1.crow +++ b/Samples/common/ui/Interfaces/Experimental/tabView1.crow @@ -1,4 +1,4 @@ <TabView> - <GroupBox Caption="test" Background="Red"/> - <GroupBox Caption="test" Background="Blue"/> + <GroupBox Name="test" Background="Red"/> + <GroupBox Name="test2" Background="Blue"/> </TabView>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/tabviewWithScrollTabName.crow b/Samples/common/ui/Interfaces/Experimental/tabviewWithScrollTabName.crow index 4b29646e..6fc5ba47 100644 --- a/Samples/common/ui/Interfaces/Experimental/tabviewWithScrollTabName.crow +++ b/Samples/common/ui/Interfaces/Experimental/tabviewWithScrollTabName.crow @@ -1,12 +1,9 @@ <TabView Orientation="Horizontal"> <Template> - <GenericStack Orientation="{./OppositeOrientation}" Spacing="0" Background="{./Background}"> + <VerticalStack Spacing="0" Background="{./Background}"> <ListBox Data="{./Items}" Height="Fit" HorizontalAlignment="Left" VerticalAlignment="Top" SelectedItem="{²./SelectedItem}"> <Template> <VerticalStack Spacing="0" > - <Scroller Name="ItemsScroller" > - <GenericStack Orientation="{../../../../../Orientation}" Width="Fit" Name="ItemsContainer" HorizontalAlignment="Left"/> - </Scroller> <ScrollBar Orientation="Horizontal" Foreground="RoyalBlue" Height="6" Width="Stretched" CornerRadius="3" Value="{²../ItemsScroller.ScrollX}" LargeIncrement="{../ItemsScroller.PageWidth}" SmallIncrement="1" @@ -17,6 +14,9 @@ </Container> </Template> </ScrollBar> + <Scroller Name="ItemsScroller" > + <HorizontalStack Width="Fit" Name="ItemsContainer" HorizontalAlignment="Left"/> + </Scroller> </VerticalStack> </Template> <ItemTemplate> @@ -28,7 +28,7 @@ </ItemTemplate> </ListBox> <Group Name="ItemsContainer" /> - </GenericStack> + </VerticalStack> </Template> <GroupBox Name="item 1" Caption="item 1" IsVisible="true" Background="Violet"/> <GroupBox Name="item 2" Caption="item 2" IsVisible="false" Background="CornflowerBlue"/> diff --git a/Samples/common/ui/Interfaces/Totorials/myNumericControlTest.crow b/Samples/common/ui/Interfaces/Totorials/myNumericControlTest.crow new file mode 100644 index 00000000..fda9f400 --- /dev/null +++ b/Samples/common/ui/Interfaces/Totorials/myNumericControlTest.crow @@ -0,0 +1,16 @@ +<MyNumericControl Minimum="0" Maximum="100" Value="50" Background="Jet" > + <Template> + <VerticalStack Spacing="20" Height="Fit" Width="80%" Background="{./Background}" Margin="20"> + <HorizontalStack Spacing="5" Fit="true"> + <Label Text="min:"/> + <TextBox Text="{²./Minimum}" Width="60" TextAlignment="Right"/> + <Label Text="val:"/> + <TextBox Text="{²./Value}" Width="60" TextAlignment="Right"/> + <Label Text="max:"/> + <TextBox Text="{²./Maximum}" Width="60" TextAlignment="Right" /> + </HorizontalStack> + <Gauge Height="20" Minimum="{./Minimum}" Maximum="{./Maximum}" Value="{²./Value}" + Background="DarkGrey" Margin="5" Foreground="CornflowerBlue"/> + </VerticalStack> + </Template> +</MyNumericControl> diff --git a/Samples/common/ui/Interfaces/Totorials/testWidget.crow b/Samples/common/ui/Interfaces/Totorials/testWidget.crow new file mode 100644 index 00000000..2bd2c7ac --- /dev/null +++ b/Samples/common/ui/Interfaces/Totorials/testWidget.crow @@ -0,0 +1,3 @@ +<Container Margin="50" Background="SteelBlue" > + <TestWidget Background="DarkGrey" Margin="20"/> +</Container>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/GraphicObject/0.crow b/Samples/common/ui/Interfaces/Widget/0.crow index a58dcb8d..a58dcb8d 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/0.crow +++ b/Samples/common/ui/Interfaces/Widget/0.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/1.crow b/Samples/common/ui/Interfaces/Widget/1.crow index d74f4949..d74f4949 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/1.crow +++ b/Samples/common/ui/Interfaces/Widget/1.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/2.crow b/Samples/common/ui/Interfaces/Widget/2.crow index af2998ac..af2998ac 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/2.crow +++ b/Samples/common/ui/Interfaces/Widget/2.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/4.crow b/Samples/common/ui/Interfaces/Widget/4.crow index 81d386c9..81d386c9 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/4.crow +++ b/Samples/common/ui/Interfaces/Widget/4.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/5.crow b/Samples/common/ui/Interfaces/Widget/5.crow index 535623a3..535623a3 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/5.crow +++ b/Samples/common/ui/Interfaces/Widget/5.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/6.crow b/Samples/common/ui/Interfaces/Widget/6.crow index f537a71d..f537a71d 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/6.crow +++ b/Samples/common/ui/Interfaces/Widget/6.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/7.crow b/Samples/common/ui/Interfaces/Widget/7.crow index 0ac9b19f..0ac9b19f 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/7.crow +++ b/Samples/common/ui/Interfaces/Widget/7.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/blueLine.crow b/Samples/common/ui/Interfaces/Widget/blueLine.crow index 32d5c166..32d5c166 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/blueLine.crow +++ b/Samples/common/ui/Interfaces/Widget/blueLine.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/label.crow b/Samples/common/ui/Interfaces/Widget/label.crow index ad47ccf7..ad47ccf7 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/label.crow +++ b/Samples/common/ui/Interfaces/Widget/label.crow diff --git a/Samples/common/ui/Interfaces/GraphicObject/textBox.crow b/Samples/common/ui/Interfaces/Widget/textBox.crow index 2094de4b..2094de4b 100644 --- a/Samples/common/ui/Interfaces/GraphicObject/textBox.crow +++ b/Samples/common/ui/Interfaces/Widget/textBox.crow diff --git a/Samples/common/ui/templates/testWindow.goml.sav b/Samples/common/ui/templates/testWindow.goml.sav index 42b4b744..268f7af4 100644 --- a/Samples/common/ui/templates/testWindow.goml.sav +++ b/Samples/common/ui/templates/testWindow.goml.sav @@ -7,7 +7,7 @@ <HorizontalStack Width="0" Height="-1" Margin="10" Background="BlueCrayola"> <Checkbox Height="-1" Width="80"/> - <GraphicObject Width="0"/> + <Widget Width="0"/> <Checkbox Height="-1" Width="80"/> </HorizontalStack> <Groupbox Text="test" Height="-1" Width="-1" Margin="5"> |