-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13153a9
commit bc6e854
Showing
17 changed files
with
326 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:OneWare.Essentials.Controls"> | ||
<Design.PreviewWith> | ||
<controls:SearchComboBox IsDropDownOpen="True" Margin="100 0 100 100"> | ||
<ComboBoxItem Content="Test"/> | ||
<ComboBoxItem Content="Test123"></ComboBoxItem> | ||
</controls:SearchComboBox> | ||
</Design.PreviewWith> | ||
|
||
<Styles.Resources> | ||
<ControlTheme x:Key="{x:Type controls:SearchComboBox}" TargetType="controls:SearchComboBox" | ||
BasedOn="{StaticResource {x:Type ComboBox}}"> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<Border Name="border" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}"> | ||
<Grid ColumnDefinitions="*,Auto"> | ||
<TextBlock Name="PlaceholderTextBlock" | ||
Grid.Column="0" | ||
Margin="{TemplateBinding Padding}" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Foreground="{TemplateBinding PlaceholderForeground}" | ||
IsVisible="{TemplateBinding SelectionBoxItem, | ||
Converter={x:Static ObjectConverters.IsNull}}" | ||
Text="{TemplateBinding PlaceholderText}" /> | ||
<ContentControl Margin="{TemplateBinding Padding}" | ||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Content="{TemplateBinding SelectionBoxItem}" | ||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"> | ||
</ContentControl> | ||
<ToggleButton Name="toggle" | ||
Grid.Column="1" | ||
Background="Transparent" | ||
BorderThickness="0" | ||
ClickMode="Press" | ||
Focusable="False" | ||
IsChecked="{TemplateBinding IsDropDownOpen, | ||
Mode=TwoWay}"> | ||
<Path Width="8" | ||
Height="4" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z" | ||
Fill="{DynamicResource ThemeForegroundBrush}" | ||
Stretch="Uniform" /> | ||
</ToggleButton> | ||
<Popup Name="PART_Popup" | ||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" | ||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | ||
IsLightDismissEnabled="True" | ||
IsOpen="{TemplateBinding IsDropDownOpen, | ||
Mode=TwoWay}" | ||
PlacementTarget="{TemplateBinding}" | ||
InheritsTransform="True"> | ||
<Border Background="{DynamicResource ThemeBackgroundBrush}" | ||
BorderBrush="{DynamicResource ThemeBorderMidBrush}" | ||
BorderThickness="1"> | ||
<Grid RowDefinitions="Auto, Auto, Auto"> | ||
<Border Padding="2 1"> | ||
<DockPanel> | ||
<Image DockPanel.Dock="Left" VerticalAlignment="Center" Height="14" Margin="2 0" Source="{DynamicResource VsImageLib.Search16XMd}"/> | ||
<TextBox DockPanel.Dock="Left" VerticalAlignment="Center" Watermark="Search..." BorderThickness="0" Name="PART_SearchBox"/> | ||
</DockPanel> | ||
</Border> | ||
<Border Grid.Row="1" Height="1" Margin="0 2" Background="{DynamicResource ThemeBorderLowBrush}"/> | ||
<ScrollViewer Grid.Row="2" | ||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" | ||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" | ||
IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"> | ||
<ItemsPresenter Name="PART_ItemsPresenter" | ||
ItemsPanel="{TemplateBinding ItemsPanel}" /> | ||
</ScrollViewer> | ||
</Grid> | ||
|
||
</Border> | ||
</Popup> | ||
</Grid> | ||
</Border> | ||
</ControlTemplate> | ||
</Setter> | ||
</ControlTheme> | ||
</Styles.Resources> | ||
</Styles> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Controls.Primitives; | ||
using Avalonia.Input; | ||
using Avalonia.Threading; | ||
|
||
namespace OneWare.Essentials.Controls; | ||
|
||
public class SearchComboBox : ComboBox | ||
{ | ||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) | ||
{ | ||
base.OnApplyTemplate(e); | ||
|
||
var searchBox = e.NameScope.Find<TextBox>("PART_SearchBox"); | ||
|
||
searchBox!.TextChanged += (sender, args) => | ||
{ | ||
SelectedItem = Items.FirstOrDefault(x => | ||
x?.ToString()?.StartsWith(searchBox.Text ?? string.Empty, StringComparison.OrdinalIgnoreCase) ?? false); | ||
|
||
searchBox.Focus(); | ||
}; | ||
|
||
|
||
this.DropDownOpened += (sender, args) => | ||
{ | ||
searchBox.Focus(); | ||
}; | ||
} | ||
|
||
protected override void OnKeyDown(KeyEventArgs e) | ||
{ | ||
if (e.Key == Key.Down) | ||
{ | ||
if (SelectedIndex < Items.Count - 1) | ||
SelectedIndex++; | ||
e.Handled = true; | ||
return; | ||
} | ||
if (e.Key == Key.Up) | ||
{ | ||
if (SelectedIndex > 0) | ||
SelectedIndex--; | ||
e.Handled = true; | ||
return; | ||
} | ||
|
||
base.OnKeyDown(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/OneWare.Settings/ViewModels/SettingTypes/ComboBoxSearchSettingViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace OneWare.Settings.ViewModels.SettingTypes; | ||
|
||
public class ComboBoxSearchSettingViewModel : SettingViewModel | ||
{ | ||
public ComboBoxSearchSettingViewModel(ComboBoxSetting setting) : base(setting) | ||
{ | ||
Setting = setting; | ||
} | ||
|
||
public new ComboBoxSetting Setting { get; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/OneWare.Settings/Views/SettingTypes/ComboBoxSearchSettingView.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:settingTypes="clr-namespace:OneWare.Settings.ViewModels.SettingTypes" | ||
xmlns:controls="clr-namespace:OneWare.Essentials.Controls;assembly=OneWare.Essentials" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="OneWare.Settings.Views.SettingTypes.ComboBoxSearchSettingView" | ||
x:DataType="settingTypes:ComboBoxSearchSettingViewModel"> | ||
<StackPanel Orientation="Vertical" Spacing="2"> | ||
<TextBlock Text="{Binding Setting.Title}" | ||
ToolTip.Tip="{Binding Setting.Description}" /> | ||
<controls:SearchComboBox ItemsSource="{Binding Setting.Options}" | ||
SelectedItem="{Binding Setting.Value, Mode=TwoWay}" /> | ||
</StackPanel> | ||
</UserControl> |
11 changes: 11 additions & 0 deletions
11
src/OneWare.Settings/Views/SettingTypes/ComboBoxSearchSettingView.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Avalonia.Controls; | ||
|
||
namespace OneWare.Settings.Views.SettingTypes; | ||
|
||
public partial class ComboBoxSearchSettingView : UserControl | ||
{ | ||
public ComboBoxSearchSettingView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/OneWare.Verilog/Assets/Templates/BlinkSimulationVerilog/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Quartus | ||
output_files/ | ||
incremental_db/ | ||
db/ | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# Python | ||
*__pycache__* | ||
|
||
# Clangd | ||
.clangd/ | ||
.cache/ | ||
obj/ | ||
mem_init/ |
31 changes: 31 additions & 0 deletions
31
src/OneWare.Verilog/Assets/Templates/BlinkVerilog/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Dump | ||
*.vcd | ||
*.fst | ||
*.ghw | ||
|
||
# IVerilog | ||
*.vvp | ||
|
||
# GHDL | ||
*.cf | ||
|
||
# Yosys | ||
build/ | ||
*.history | ||
|
||
# Quartus | ||
output_files/ | ||
incremental_db/ | ||
db/ | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# Python | ||
*__pycache__* | ||
|
||
# Clangd | ||
.clangd/ | ||
.cache/ | ||
obj/ | ||
mem_init/ |
Oops, something went wrong.