mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add Type and Auto Size for context menu
This commit is contained in:
parent
ee64c259fc
commit
4c813301a7
4 changed files with 44 additions and 10 deletions
|
|
@ -246,6 +246,12 @@ namespace Flow.Launcher.Plugin
|
||||||
return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false);
|
return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Height Style. Null, Small(for OS Context), Author
|
||||||
|
/// </summary>
|
||||||
|
public string ItemType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result
|
/// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -62,13 +62,13 @@
|
||||||
<StackPanel
|
<StackPanel
|
||||||
x:Name="HotkeyArea"
|
x:Name="HotkeyArea"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="0,0,10,0"
|
Margin="0 0 10 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Visibility="{Binding ShowOpenResultHotkey}">
|
Visibility="{Binding ShowOpenResultHotkey}">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="Hotkey"
|
x:Name="Hotkey"
|
||||||
Margin="12,0,12,0"
|
Margin="12 0 12 0"
|
||||||
Padding="0,0,0,0"
|
Padding="0 0 0 0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{DynamicResource ItemHotkeyStyle}">
|
Style="{DynamicResource ItemHotkeyStyle}">
|
||||||
|
|
@ -97,12 +97,12 @@
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="9,0,0,0"
|
Margin="9 0 0 0"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="1">
|
BorderThickness="1">
|
||||||
<Image
|
<Image
|
||||||
x:Name="ImageIcon"
|
x:Name="ImageIcon"
|
||||||
Margin="0,0,0,0"
|
Margin="0 0 0 0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
RenderOptions.BitmapScalingMode="Fant"
|
RenderOptions.BitmapScalingMode="Fant"
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
</Border>
|
</Border>
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="9,0,0,0"
|
Margin="9 0 0 0"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="0">
|
BorderThickness="0">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="6,0,10,0"
|
Margin="6 0 10 0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|
@ -173,7 +173,7 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="Title"
|
x:Name="Title"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="0,0,0,1"
|
Margin="0 0 0 1"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
DockPanel.Dock="Left"
|
DockPanel.Dock="Left"
|
||||||
FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="SubTitle"
|
x:Name="SubTitle"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="0,1,0,0"
|
Margin="0 1 0 0"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
|
|
@ -222,9 +222,30 @@
|
||||||
<!-- http://stackoverflow.com/questions/16819577/setting-background-color-or-wpf-4-0-listbox-windows-8/#16820062 -->
|
<!-- http://stackoverflow.com/questions/16819577/setting-background-color-or-wpf-4-0-listbox-windows-8/#16820062 -->
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type ListBoxItem}">
|
<Style TargetType="{x:Type ListBoxItem}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<!-- Condition for Type being 'Small' -->
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding Result.ItemType}" Value="Small" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<MultiDataTrigger.Setters>
|
||||||
|
<Setter Property="Height" Value="{Binding SmallSize}" />
|
||||||
|
</MultiDataTrigger.Setters>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
<!-- Default condition for Type being other values or not set -->
|
||||||
|
<DataTrigger Binding="{Binding Result.ItemType}" Value="{x:Null}">
|
||||||
|
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding Result.ItemType}" Value="">
|
||||||
|
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding Result.ItemType}" Value="author">
|
||||||
|
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
<EventSetter Event="MouseEnter" Handler="OnMouseEnter" />
|
<EventSetter Event="MouseEnter" Handler="OnMouseEnter" />
|
||||||
<EventSetter Event="MouseMove" Handler="OnMouseMove" />
|
<EventSetter Event="MouseMove" Handler="OnMouseMove" />
|
||||||
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
<Setter Property="Margin" Value="0" />
|
<Setter Property="Margin" Value="0" />
|
||||||
<Setter Property="Padding" Value="0" />
|
<Setter Property="Padding" Value="0" />
|
||||||
<Setter Property="BorderThickness" Value="0" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
|
@ -256,5 +277,6 @@
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
@ -180,6 +180,11 @@ namespace Flow.Launcher.ViewModel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UseBigThumbnail => Result.Preview.IsMedia;
|
public bool UseBigThumbnail => Result.Preview.IsMedia;
|
||||||
|
|
||||||
|
public double SmallSize
|
||||||
|
{
|
||||||
|
get { return Settings.ItemHeightSize * 0.6; }
|
||||||
|
}
|
||||||
|
|
||||||
public GlyphInfo Glyph { get; set; }
|
public GlyphInfo Glyph { get; set; }
|
||||||
|
|
||||||
private async Task<ImageSource> LoadImageInternalAsync(string imagePath, Result.IconDelegate icon, bool loadFullImage)
|
private async Task<ImageSource> LoadImageInternalAsync(string imagePath, Result.IconDelegate icon, bool loadFullImage)
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
||||||
{
|
{
|
||||||
Title = menuItem.Label,
|
Title = menuItem.Label,
|
||||||
Icon = () => menuItem.Icon,
|
Icon = () => menuItem.Icon,
|
||||||
|
ItemType = "Small",
|
||||||
Action = _ =>
|
Action = _ =>
|
||||||
{
|
{
|
||||||
ShellContextMenuDisplayHelper.ExecuteContextMenuItem(record.FullPath, menuItem.CommandId);
|
ShellContextMenuDisplayHelper.ExecuteContextMenuItem(record.FullPath, menuItem.CommandId);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue