aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/ShowCase/ui/showcase.crow
blob: c5b683dabbef087c2b0a11edb64b0ce4a94b7f24 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0"?>
<HorizontalStack Background="DarkGrey" >
	<VerticalStack  Width="25%">
		<HorizontalStack Height="Fit" Margin="3" Background="Onyx" Spacing="2">
			<TextBox Text="{²CurrentDir}" Margin="2" ClipToClientRect="true"/>
			<Image Margin="2" Width="20" Height="20" Path="#Crow.Icons.level-up.svg" MouseClick="./goUpDirClick" Focusable="true"
						 Background="Grey" MouseEnter="{Background=SeaGreen}" MouseLeave="{Background=Grey}" Tooltip="go the the parent directory" />
		</HorizontalStack>
		<DirectoryView Margin="1" Name="dv" CurrentDirectory="{CurrentDir}" SelectedItemChanged="Dv_SelectedItemChanged">
			<Template>
				<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}" Background="{./Background}"
						SelectedItemChanged="./onSelectedItemChanged">
					<ItemTemplate DataType="System.IO.FileInfo">
						<ListItem CornerRadius="2" Margin="0" Height="Fit" Width="Stretched"
								ContextCommands="{GetCommands}"
								Selected="{Background=${ControlHighlight}}"
								Unselected="{Background=Transparent}">
							<HorizontalStack>
								<Image Margin="1" Width="14" Height="14" Path="#Crow.Icons.file.svg"/>
								<Label Text="{Name}" Width="Stretched"/>
							</HorizontalStack>
						</ListItem>
					</ItemTemplate>
					<ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfosOrdered">
						<ListItem ContextCommands="{GetCommands}"
								Selected="{/exp.Background=${ControlHighlight}}"
								Unselected="{/exp.Background=Transparent}">
							<Expandable Name="exp" Caption="{Name}" MouseDoubleClick="/onClickForExpand" BubbleEvents="MouseWheel|Keyboard|MouseClick|ButtonDown">
								<Template>
									<VerticalStack>
										<Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand"
												Foreground="Transparent"
												MouseEnter="{Foreground=DimGrey}"
												MouseLeave="{Foreground=Transparent}">
											<HorizontalStack Background="{./Background}" Spacing="1">
												<Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand"
													Path="{./Image}"
													Visible="{./IsExpandable}"
													SvgSub="{./IsExpanded}"
													MouseEnter="{Background=LightGrey}"
													MouseLeave="{Background=Transparent}"/>
												<Image Margin="1" Width="16" Height="16"
													Path="#Crow.Icons.folder.svg" SvgSub="{./IsExpanded}"/>
												<Label Text="{./Caption}"/>
											</HorizontalStack>
										</Border>
										<Container Name="Content" Visible="false" BubbleEvents="MouseWheel|Keyboard"/>
									</VerticalStack>
								</Template>
								<HorizontalStack Height="Fit">
									<Widget Width="12" Height="10"/>
									<VerticalStack Height="Fit" Name="ItemsContainer"/>
								</HorizontalStack>
							</Expandable>
						</ListItem>
					</ItemTemplate>
				</TreeView>
			</Template>
		</DirectoryView>
	</VerticalStack>
	<Splitter Width="6" />
	<VerticalStack CacheEnabled="true">
		<!--<VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched">
			<HorizontalStack Height="Fit">
				<Label Style="smallLabel" Text="hover:" Width="50"/>
				<Label Style="smallLabel" Text="{HoverWidget}"/>
			</HorizontalStack>
			<HorizontalStack Height="Fit">
				<Label Style="smallLabel" Text="focus:" Width="50"/>
				<Label Style="smallLabel" Text="{FocusedWidget}"/>
			</HorizontalStack>
			<HorizontalStack Height="Fit">
				<Label Style="smallLabel" Text="active:" Width="50"/>
				<Label Style="smallLabel" Text="{ActiveWidget}"/>
			</HorizontalStack>
		</VerticalStack>-->
		<Container Name="CrowContainer" Height="60%" Background="Black"/>
		<Splitter/>
		<VerticalStack CacheEnabled="true">
			<Wrapper Orientation="Vertical" Height="Fit">
				<Button Style="IcoButton" Command="{CMDNew}" />
				<Button Style="IcoButton" Command="{CMDSave}" />
				<Button Style="IcoButton" Command="{CMDSaveAs}" />
				<Button Style="IcoButton" Command="{CMDUndo}" />
				<Button Style="IcoButton" Command="{CMDRedo}" />
				<Button Style="IcoButton" Command="{CMDCut}" />
				<Button Style="IcoButton" Command="{CMDCopy}" />
				<Button Style="IcoButton" Command="{CMDPaste}" />
				<Popper RootDataLevel="true" IsVisible="{DebugLoggingEnabled}" Fit="true">
					<Template>
						<CheckBox IsChecked="{²./IsPopped}">
							<Template>
								<HorizontalStack Background="Onyx" Margin="5" Spacing="10">
									<Widget Background="Red" IsVisible="{DebugLogRecording}" CornerRadius="10" Width="12" Height="12"/>
									<Label Text="Debug Logging" />
								</HorizontalStack>
							</Template>
						</CheckBox>
					</Template>
					<VerticalStack Fit="true" Background="Grey" MinimumSize="300,200" Margin="5">
						<CheckBox Name="cbFile" Caption="Record to file" IsChecked="{²DebugLogToFile}" Background="Onyx"/>
						<HorizontalStack Height="Fit" Width="Stretched" IsEnabled="{../cbFile.IsChecked}" Background="Onyx" Margin="5">
							<Label Text="Debug log output file:" Fit="true"/>
							<TextBox Text="{²DebugLogFilePath}"  />
						</HorizontalStack>
						<EnumSelector RadioButtonStyle="CheckBox2" EnumValue="{²RecordedEvents}" Width="Stretched" BitFieldExcludeMask="255"
									Caption="Recorded Events">
							<Template>
								<Popper >
									<Template>
										<HorizontalStack Background="{../../Background}" Margin="5" Spacing="10">
											<Label Text="{../../../Caption}" Width="Stretched"/>
											<Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/>
										</HorizontalStack>
									</Template>
									<Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
								</Popper>
							</Template>
						</EnumSelector>
						<EnumSelector RadioButtonStyle="CheckBox2" EnumValue="{²DiscardedEvents}" Width="Stretched" BitFieldExcludeMask="255"
									Caption="Discarded Events">
							<Template>
								<Popper >
									<Template>
										<HorizontalStack Background="{../../Background}" Margin="5" Spacing="10">
											<Label Text="{../../../Caption}" Width="Stretched"/>
											<Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/>
										</HorizontalStack>
									</Template>
									<Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
								</Popper>
							</Template>
						</EnumSelector>
						<Label Text="Press 'F6' to start/stop recording"/>
					</VerticalStack>
				</Popper>
				<Popper Caption="Template" Width="Fit" Background="Onyx">
					<Template>
						<Border Background="{./Background}" MinimumSize="50,20" Name="Content" Width="Stretched" Margin="0"
													Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
													MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}"
													MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}"
													MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}"
													MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}">
							<Label Font="{./Font}" Name="caption" Margin="2" Foreground="LightGrey" Text="{./Caption}"/>
						</Border>
					</Template>
					<VerticalStack Width="200" Height="200" Background="Jet" Margin="5">
						<CheckBox Caption="Embed source in template" IsChecked="{²EncloseInTemplatedControl}"/>
						<TextBox BubbleEvents="None" Text="{²TemplateContainerSource}" Width="Stretched" Height="Stretched" Multiline="true"
							Tooltip="Add '*source* where you want to load the source in the editor."/>
					</VerticalStack>
				</Popper>
			</Wrapper>
			<HorizontalStack>
				<Editor Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
						TextChanged="onTextChanged" KeyDown="textView_KeyDown" ContextCommands="{EditorCommands}"
						SelectionChanged="onEditorSelectionChanged"
						Foreground="DarkGrey" Background="White" MouseWheelSpeed="20"/>
				<ScrollBar Value="{²../tb.ScrollY}"
						LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
						CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
			</HorizontalStack>
			<ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
					LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
					CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
			<HorizontalStack Height="Fit" Spacing="10">
				<Widget Width="10" Height="10" Background="RoyalBlue" Visible="{IsDirty}"/>
				<Label Text="{CurrentFile}" Width="Stretched"/>
				<Widget Width="Stretched"/>
				<Label Text="Line:" Foreground="Grey"/>
				<Label Text="{../../tb.CurrentLine}"  Margin="2"/>
				<Label Text="Col:" Foreground="Grey"/>
				<Label Text="{../../tb.CurrentColumn}" Margin="2"/>
			</HorizontalStack>
			<Popper IsVisible="{ShowError}" Background="Red">
				<Template>
					<CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}">
						<Template>
							<Label DataSource="{ErrorMessage}" Text="{Message}" Background="Red" Foreground="White" Width="Stretched" Margin="2"
								Multiline="true"/>
						</Template>
					</CheckBox>
				</Template>
				<Label Text="{ErrorMessage}" Background="DarkRed" Foreground="White" Width="Stretched" Margin="2" Multiline="true"/>
			</Popper>
		</VerticalStack>
	</VerticalStack>
</HorizontalStack>