aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/common/ui/Interfaces/Experimental/fileDialog.crow
blob: 977cbf311f9c98d91e83afc496129cdf256c83c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<VerticalStack> 
	<HorizontalStack Height="Fit">
		<Label Text="Hover:" Width="50" Foreground="Grey"/>
		<Label Text="{HoverWidget}" Font="mono, 8"/>
	</HorizontalStack>
	<HorizontalStack Height="Fit">
		<Label Text="Focus:" Width="50" Foreground="Grey"/>
		<Label Text="{FocusedWidget}" Font="mono, 8"/>
	</HorizontalStack>
	<HorizontalStack Height="Fit">
		<Label Text="Active:" Width="50" Foreground="Grey"/>
		<Label Text="{ActiveWidget}" Font="mono, 8"/>
	</HorizontalStack>
	<Container>
	<FileDialog Focusable="true" Resizable="true">
		<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="20" Height="20" 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="20" Height="20" 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>