<EmbeddedResource Include="Templates\imgItem.template" />
<EmbeddedResource Include="Templates\ArrowBut.template" />
<EmbeddedResource Include="Templates\treeList.template" />
+ <EmbeddedResource Include="Templates\CheckBox2.template" />
</ItemGroup>
<ItemGroup>
<None Include="Crow.dll.config">
Minimum = 0;
Maximum = 1;
SmallIncrement = 0.01;
+}
+TxtInFileDialog {
+ Margine = 1;
+ Font = droid, 12;
+}
+CheckBoxAlt {
+ Template= #Crow.Templates.CheckBox2.template;
+ Background = Transparent;
+ Checked={Background=DarkSlateGray;Foreground=LightGray;};
+ Unchecked = {Background=Transparent;Foreground=DimGray;};
}
\ No newline at end of file
--- /dev/null
+<Border Foreground="Transparent" MouseEnter="{Foreground=Gray}" MouseLeave="{Foreground=Transparent}">
+ <Label Font="{./Font}" Text="{./Caption}"
+ Margin="1"
+ Background="{./Background}"
+ Foreground="{./Foreground}"
+ TextAlignment="Center"/>
+</Border>
\ No newline at end of file
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
<VerticalStack Spacing="0">
- <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
+ <HorizontalStack Background="{./TitleBarBackground}"
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}" />
+ <Label Width="Stretched" Foreground="{./TitleBarForeground}" Margin="1" 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.Images.Icons.exit2.svg"
<Image Margin="2" Width="14" Height="14"
Path="#Crow.Icons.level-up.svg"/>
</Button>
- <TextBox Text="{²./CurrentDirectory}"/>
+ <TextBox Style="TxtInFileDialog" Text="{²./CurrentDirectory}"/>
</HorizontalStack>
- <DirectoryView ShowFiles="true" Name="fv" CurrentDirectory="{./CurrentDirectory}" SelectedItemChanged="./onFVSelectedItemChanged"
+ <DirectoryView ShowHidden="{²../cbShowHidden.IsChecked}" FileMask="{²../txtFileMask.Text}" ShowFiles="{²../cbShowFiles.IsChecked}" Name="fv" CurrentDirectory="{./CurrentDirectory}" SelectedItemChanged="./onFVSelectedItemChanged"
Width="100%" Margin="0" MouseDoubleClick="./onFileSelect">
- <Template>
- <ListBox ItemTemplate="#Crow.Templates.FileItems.template" Name="fileView" Data="{./FileSystemEntries}"
- SelectedItemChanged="./onSelectedItemChanged">
- <Template>
- <HorizontalStack>
- <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
- VerticalScrolling="true" HorizontalScrolling="false">
- <VerticalStack Height="Fit" VerticalAlignment="Top"
- Name="ItemsContainer" Margin="0" Spacing="1"/>
- </Scroller>
- <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" />
- </HorizontalStack>
- </Template>
- </ListBox>
- </Template>
- </DirectoryView>
- <TextBox Text="{./SelectedDirectory}"/>
- <TextBox Text="{²./SelectedFile}"/>
+ <Template>
+ <ListBox ItemTemplate="#Crow.Templates.FileItems.template" Name="fileView" Data="{./FileSystemEntries}"
+ SelectedItemChanged="./onSelectedItemChanged">
+ <Template>
+ <HorizontalStack>
+ <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
+ VerticalScrolling="true" HorizontalScrolling="false">
+ <VerticalStack Height="Fit" VerticalAlignment="Top"
+ Name="ItemsContainer" Margin="0" Spacing="1"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ Width="14" />
+ </HorizontalStack>
+ </Template>
+ </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">
<Button Caption="Ok" MouseClick="./onFileSelect"/>
<Button Caption="Cancel" MouseClick="./onCancel"/>
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">
+ Background="{./TitleBarBackground}">
<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}" />
+ <Label Width="Stretched" Foreground="{./TitleBarForeground}" 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"
<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"
+ <HorizontalStack Background="{./TitleBarBackground}"
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}" />
+ <Label Width="Stretched" Foreground="{./TitleBarForeground}" 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"
<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"
+ <HorizontalStack Background="{./TitleBarBackground}"
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}" />
+ <Label Width="Stretched" Foreground="{./TitleBarForeground}" 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"
<Splitter/>-->
<ListBox Name="colorList" Data="{TestList}" Margin="5"
ItemTemplate="#Tests.Interfaces.colorItem.crow"
- Template="#Crow.Templates.ScrollingListBox.templat"
+ Template="#Crow.Templates.ScrollingListBox.template"
/>
</VerticalStack>
</HorizontalStack>
<?xml version="1.0"?>
-<FileDialog Caption="Open File" CurrentDirectory="/"/>
+<FileDialog Caption="Open File" CurrentDirectory="/" SearchPattern="*.*"/>
using System.Xml.Serialization;
using System.ComponentModel;
using System.IO;
+using System.Collections.Generic;
+using System.Linq;
namespace Crow
{
#endregion
string currentDirectory = "/";
- bool showFiles;
+ bool showFiles, showHidden;
+ string fileMask = "*.*";
object _selectedItem;
[XmlIgnore]public object SelectedItem {
NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
}
}
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public virtual bool ShowHidden {
+ get { return showHidden; }
+ set {
+ if (showHidden == value)
+ return;
+ showHidden = value;
+ NotifyValueChanged ("ShowHidden", showHidden);
+ NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
+ }
+ }
+ [XmlAttributeAttribute][DefaultValue("*.*")]
+ public virtual string FileMask {
+ get { return fileMask; }
+ set {
+ if (fileMask == value)
+ return;
+ fileMask = value;
+ NotifyValueChanged ("FileMask", fileMask);
+ NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
+ }
+ }
[XmlAttributeAttribute][DefaultValue("/")]
public virtual string CurrentDirectory {
get { return currentDirectory; }
}
}
[XmlIgnore]public FileSystemInfo[] FileSystemEntries {
- get {
- return string.IsNullOrEmpty(CurrentDirectory) ? null :
- showFiles ?
- new DirectoryInfo (CurrentDirectory).GetFileSystemInfos () :
- new DirectoryInfo(CurrentDirectory).GetDirectories();
+ get {
+ try {
+ if (string.IsNullOrEmpty(CurrentDirectory))
+ return null;
+ DirectoryInfo di = new DirectoryInfo(CurrentDirectory);
+ List<FileSystemInfo> fi = new List<FileSystemInfo> (di.GetDirectories());
+ if (showFiles && !string.IsNullOrEmpty(fileMask))
+ fi.AddRange(di.GetFiles(fileMask));
+ return showHidden ?
+ fi.ToArray() :
+ fi.Where(f=>!f.Attributes.HasFlag (FileAttributes.Hidden)).ToArray();
+ } catch (Exception ex) {
+ Console.WriteLine (ex.ToString ());
+ return null;
+ }
}
}
public void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){
#endregion
string searchPattern, curDir, _selectedFile, _selectedDir;
+ bool showHidden, showFiles;
#region events
public event EventHandler OkClicked;
}
}
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public virtual bool ShowHidden {
+ get { return showHidden; }
+ set {
+ if (showHidden == value)
+ return;
+ showHidden = value;
+ NotifyValueChanged ("ShowHidden", showHidden);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public virtual bool ShowFiles {
+ get { return showFiles; }
+ set {
+ if (showFiles == value)
+ return;
+ showFiles = value;
+ NotifyValueChanged ("ShowFiles", showFiles);
+ }
+ }
[XmlAttributeAttribute]public string SelectedFile {
get { return _selectedFile; }
set {
CurrentDirectory = SelectedDirectory;
else {
OkClicked.Raise (this, null);
- unloadDialog ((sender as GraphicObject).CurrentInterface);
+ CurrentInterface.DeleteWidget (this);
}
}
void onCancel(object sender, MouseButtonEventArgs e){
- unloadDialog ((sender as GraphicObject).CurrentInterface);
- }
- void unloadDialog(Interface host){
- host.DeleteWidget (this);
+ CurrentInterface.DeleteWidget (this);
}
}
}
bool _movable;
protected bool hoverBorder = false;
bool alwaysOnTop = false;
+ Fill titleBarBackground = Color.UnitedNationsBlue;
+ Fill titleBarForeground = Color.White;
Rectangle savedBounds;
bool _minimized = false;
NotifyValueChanged ("Icon", _icon);
}
}
+ /// <summary>
+ /// Background of the title bar if any.
+ /// </summary>
+ [XmlAttributeAttribute][DefaultValue("vgradient|0:Onyx|1:UnitedNationsBlue")]
+ public virtual Fill TitleBarBackground {
+ get { return titleBarBackground; }
+ set {
+ if (titleBarBackground == value)
+ return;
+ titleBarBackground = value;
+ NotifyValueChanged ("TitleBarBackground", titleBarBackground);
+ RegisterForRedraw ();
+ }
+ }
+ /// <summary>
+ /// Foreground of the title bar, usualy used for the window caption color.
+ /// </summary>
+ [XmlAttributeAttribute][DefaultValue("White")]
+ public virtual Fill TitleBarForeground {
+ get { return titleBarForeground; }
+ set {
+ if (titleBarForeground == value)
+ return;
+ titleBarForeground = value;
+ NotifyValueChanged ("TitleBarForeground", titleBarForeground);
+ RegisterForRedraw ();
+ }
+ }
[XmlAttributeAttribute][DefaultValue(true)]
public bool Resizable {
get {
namespace Crow
{
+ /// <summary>
+ /// Parser for style files.
+ /// </summary>
+ //TODO: style key shared by different class may use only first encouneter class setter, which can cause bug.
public class StyleReader : StreamReader
{
enum readerState { classNames, propertyName, expression }