Width = 150;
Height = 150;
}
+FileDialog {
+ Focusable = true;
+ MinimumSize=50,50;
+ Width = 500;
+ Height = 300;
+}
Border {
Foreground = Gray;
}
<?xml version="1.0"?>
-<Window Caption="OpenFile" Height="300" Width="500">
- <VerticalStack Margin="5">
- <TextBox Margin="1" Width="0" Height="-1" Text="{CurrentPath}"/>
- <HorizontalStack >
- <ListBox Data="{Directories}" Width="-1" Height="0"
- Background="0.5,0.5,0.5,0.5"
- SelectedItemChanged="OnSelectedItemChanged"
- Template="#Crow.Templates.ScrollingListBox.goml"
- ItemTemplate="#Crow.Templates.tmpDirItem.goml" >
- </ListBox>
- <ListBox Data="{Files}" Width="0" Height="0"
- Background="0.5,0.5,0.5,0.5"
- SelectedItemChanged="onFileListItemChanged"
- Template="#Crow.Templates.ScrollingListBox.goml"
- ItemTemplate="#Crow.Templates.imgItemTemplate.goml">
- </ListBox>
- </HorizontalStack>
- <HorizontalStack Fit="true" HorizontalAlignment="Right">
- <Button Caption="Ok" MouseClick="onFileSelect"/>
- <Button Caption="Cancel"/>
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+ Background="{./Background}"
+ 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"
+ 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>
+ <Container Name="Content" MinimumSize="50,50" Background="Onyx">
+ <VerticalStack Margin="5">
+ <TextBox Text="{²./CurrentDirectory}"/>
+ <HorizontalStack>
+ <DirectoryView Name="dv" CurrentDirectory="{²./CurrentDirectory}" SelectedItemChanged="./Tv_SelectedItemChanged"
+ Width="50%" Margin="1" ShowFiles="false">
+ <Template>
+ <TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
+ SelectedItemChanged="./onSelectedItemChanged">
+ <ItemTemplate DataType="System.IO.FileInfo">
+ <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Background="{../Background}" >
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Images.Icons.file.svg"/>
+ <Label Text="{Name}" Width="Stretched"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetDirectories">
+ <Expandable Caption="{Name}" >
+ <Template>
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}">
+ <Image Margin="2" Width="12" Height="12"
+ Path="{./Image}"
+ SvgSub="{./IsExpanded}"/>
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Images.Icons.folder.svg"/>
+
+ <Label Text="{./Caption}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false"/>
+ </VerticalStack>
+ </Template>
+ <HorizontalStack Height="Fit">
+ <GraphicObject Width="12" Height="10"/>
+ <TreeView Name="List" Height="Fit"
+ Template="#Crow.Templates.treeList.crow" />
+ </HorizontalStack>
+ </Expandable>
+ </ItemTemplate>
+ </TreeView>
+ </Template>
+ </DirectoryView>
+ </HorizontalStack>
+ <HorizontalStack Fit="true" HorizontalAlignment="Right">
+ <Button Caption="Ok" MouseClick="onFileSelect"/>
+ <Button Caption="Cancel"/>
+ </HorizontalStack>
+ </VerticalStack>
+ </Container>
</VerticalStack>
-</Window>
+</Border>
--- /dev/null
+<?xml version="1.0"?>
+<FileDialog Title="Open File" />
+
+++ /dev/null
-<?xml version="1.0"?>
-<FileDialog Width="500" Height="300"/>
-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
- <None Include="Interfaces\Unsorted\testFileDialog.goml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\Unsorted\testTypeViewer.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Interfaces\Divers\test2WayBinding.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\Unsorted\testFileDialog.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
namespace Crow
{
- public class FileDialog: IValueChange
+ public class FileDialog: Window
{
- #region IValueChange implementation
- public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public virtual void NotifyValueChanged(string MemberName, object _value)
- {
- ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
- }
- #endregion
-
- Window window;
- DirectoryInfo currentDir;
- FileInfo selectedFile;
- string searchPattern = "*";
+ string searchPattern, curDirectory;
#region CTOR
- public FileDialog ()
+ public FileDialog () : base()
{
- currentDir = new DirectoryInfo (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
- //window = Interface..Load("#Crow.Templates.FileDialog.goml") as Window;
- window.DataSource = this;
}
#endregion
-
- public string CurrentPath {
- get { return currentDir.FullName; }
+ //[DefaultValue(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))]
+ [XmlAttributeAttribute][DefaultValue("/home")]
+ public virtual string CurrentDirectory {
+ get { return curDirectory; }
set {
- currentDir = new DirectoryInfo (value);
- NotifyValueChanged ("CurrentPath", CurrentPath);
+ if (curDirectory == value)
+ return;
+ curDirectory = value;
+ NotifyValueChanged ("CurrentDirectory", curDirectory);
+
}
- }
- public string SearchPattern {
+ }
+
+ [XmlAttributeAttribute()][DefaultValue("*")]
+ public virtual string SearchPattern {
get { return searchPattern; }
set {
- searchPattern = value;
- NotifyValueChanged ("Files", Files);
- }
- }
+ if (searchPattern == value)
+ return;
+ searchPattern = value;
+ NotifyValueChanged ("SearchPattern", searchPattern);
- public DirectoryInfo[] Directories
- {
- get {
- //currentDir.GetDirectories
- List<DirectoryInfo> tmp = currentDir.GetDirectories ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToList();
- if (currentDir.Parent != null)
- tmp.Insert (0, currentDir.Parent);
- return tmp.ToArray ();
}
- }
- public FileInfo[] Files
- {
- get {
- string[] exts = searchPattern.Replace("*","").Split ('|');
- //return currentDir.GetFiles (searchPattern).Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray();
- return currentDir.GetFiles().Where(f => exts.Any
- (x => f.Name.EndsWith (x, StringComparison.InvariantCultureIgnoreCase))).ToArray();
- }
- }
-
- public void Show(){
- //.AddWidget(window);
- }
-
- void OnSelectedItemChanged (object sender, SelectionChangeEventArgs e)
- {
- currentDir = e.NewValue as DirectoryInfo;
- NotifyValueChanged ("CurrentPath", CurrentPath);
- NotifyValueChanged ("Directories", Directories);
- NotifyValueChanged ("Files", Files);
-
- }
- void onFileListItemChanged (object sender, SelectionChangeEventArgs e)
- {
- selectedFile = e.NewValue as FileInfo;
- }
- void onFileSelect(object sender, MouseButtonEventArgs e){
- //OpenTKGameWindow.currentWindow.DeleteWidget(window);
- }
- }
- public class DirContainer: IValueChange
- {
- #region IValueChange implementation
- public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public void NotifyValueChanged(string name, object value)
- {
- ValueChanged.Raise (this, new ValueChangeEventArgs (name, value));
- }
- #endregion
+ }
- public DirectoryInfo CurDir;
- public DirContainer(DirectoryInfo _dir){
- CurDir = _dir;
- }
- public string Name {
- get { return CurDir.Name; }
- }
-
- void onDirUp(object sender, MouseButtonEventArgs e)
- {
-
- }
- public void onMouseDown(object sender, MouseButtonEventArgs e)
- {
- Debug.WriteLine (sender.ToString ());
- }
+// public DirectoryInfo[] Directories
+// {
+// get {
+// //currentDir.GetDirectories
+// List<DirectoryInfo> tmp = currentDir.GetDirectories ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToList();
+// if (currentDir.Parent != null)
+// tmp.Insert (0, currentDir.Parent);
+// return tmp.ToArray ();
+// }
+// }
+// public FileInfo[] Files
+// {
+// get {
+// string[] exts = searchPattern.Replace("*","").Split ('|');
+// //return currentDir.GetFiles (searchPattern).Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray();
+// return currentDir.GetFiles().Where(f => exts.Any
+// (x => f.Name.EndsWith (x, StringComparison.InvariantCultureIgnoreCase))).ToArray();
+// }
+// }
+// void OnSelectedItemChanged (object sender, SelectionChangeEventArgs e)
+// {
+// currentDir = e.NewValue as DirectoryInfo;
+// NotifyValueChanged ("CurrentPath", CurrentPath);
+// NotifyValueChanged ("Directories", Directories);
+// NotifyValueChanged ("Files", Files);
+//
+// }
+// void onFileListItemChanged (object sender, SelectionChangeEventArgs e)
+// {
+// selectedFile = e.NewValue as FileInfo;
+// }
+// void onFileSelect(object sender, MouseButtonEventArgs e){
+// //OpenTKGameWindow.currentWindow.DeleteWidget(window);
+// }
}
+// public class DirContainer: IValueChange
+// {
+// #region IValueChange implementation
+// public event EventHandler<ValueChangeEventArgs> ValueChanged;
+// public void NotifyValueChanged(string name, object value)
+// {
+// ValueChanged.Raise (this, new ValueChangeEventArgs (name, value));
+// }
+// #endregion
+//
+// public DirectoryInfo CurDir;
+// public DirContainer(DirectoryInfo _dir){
+// CurDir = _dir;
+// }
+// public string Name {
+// get { return CurDir.Name; }
+// }
+//
+// void onDirUp(object sender, MouseButtonEventArgs e)
+// {
+//
+// }
+// public void onMouseDown(object sender, MouseButtonEventArgs e)
+// {
+// Debug.WriteLine (sender.ToString ());
+// }
+//
+// }
}
Crow.Gradient grad = new Gradient (gt);
- grad.Stops.Add (new Gradient.ColorStop (0, new Color (1, 0, 0, 1)));
+ grad.Stops.Add (new Gradient.ColorStop (0, new Color (1, 0, 0, 1)));
grad.Stops.Add (new Gradient.ColorStop (0.167, new Color (1, 1, 0, 1)));
grad.Stops.Add (new Gradient.ColorStop (0.333, new Color (0, 1, 0, 1)));
- grad.Stops.Add (new Gradient.ColorStop (0.5, new Color (0, 1, 1, 1)));
+ grad.Stops.Add (new Gradient.ColorStop (0.5, new Color (0, 1, 1, 1)));
grad.Stops.Add (new Gradient.ColorStop (0.667, new Color (0, 0, 1, 1)));
grad.Stops.Add (new Gradient.ColorStop (0.833, new Color (1, 0, 1, 1)));
- grad.Stops.Add (new Gradient.ColorStop (1, new Color (1, 0, 0, 1)));
+ grad.Stops.Add (new Gradient.ColorStop (1, new Color (1, 0, 0, 1)));
grad.SetAsSource (gr, r);
CairoHelpers.CairoRectangle (gr, r, CornerRadius);
if (Layoutable.Parent == null) {//TODO:improve this
//cancel layouting for object without parent, maybe some were in queue when
//removed from a listbox
+ #if DEBUG_LAYOUTING
Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ());
+ #endif
return;
}
#if DEBUG_LAYOUTING