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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Item Height Style. Null, Small(for OS Context), Author
|
||||
/// </summary>
|
||||
public string ItemType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@
|
|||
<StackPanel
|
||||
x:Name="HotkeyArea"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,10,0"
|
||||
Margin="0 0 10 0"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding ShowOpenResultHotkey}">
|
||||
<TextBlock
|
||||
x:Name="Hotkey"
|
||||
Margin="12,0,12,0"
|
||||
Padding="0,0,0,0"
|
||||
Margin="12 0 12 0"
|
||||
Padding="0 0 0 0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Style="{DynamicResource ItemHotkeyStyle}">
|
||||
|
|
@ -97,12 +97,12 @@
|
|||
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="9,0,0,0"
|
||||
Margin="9 0 0 0"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="1">
|
||||
<Image
|
||||
x:Name="ImageIcon"
|
||||
Margin="0,0,0,0"
|
||||
Margin="0 0 0 0"
|
||||
HorizontalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
RenderOptions.BitmapScalingMode="Fant"
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
</Border>
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="9,0,0,0"
|
||||
Margin="9 0 0 0"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0">
|
||||
<TextBlock
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
Margin="6,0,10,0"
|
||||
Margin="6 0 10 0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
<TextBlock
|
||||
x:Name="Title"
|
||||
Grid.Row="0"
|
||||
Margin="0,0,0,1"
|
||||
Margin="0 0 0 1"
|
||||
VerticalAlignment="Bottom"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
<TextBlock
|
||||
x:Name="SubTitle"
|
||||
Grid.Row="1"
|
||||
Margin="0,1,0,0"
|
||||
Margin="0 1 0 0"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEnabled="False"
|
||||
|
|
@ -222,9 +222,30 @@
|
|||
<!-- http://stackoverflow.com/questions/16819577/setting-background-color-or-wpf-4-0-listbox-windows-8/#16820062 -->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<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="MouseMove" Handler="OnMouseMove" />
|
||||
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
|
|
@ -256,5 +277,6 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
|
@ -180,6 +180,11 @@ namespace Flow.Launcher.ViewModel
|
|||
/// </summary>
|
||||
public bool UseBigThumbnail => Result.Preview.IsMedia;
|
||||
|
||||
public double SmallSize
|
||||
{
|
||||
get { return Settings.ItemHeightSize * 0.6; }
|
||||
}
|
||||
|
||||
public GlyphInfo Glyph { get; set; }
|
||||
|
||||
private async Task<ImageSource> LoadImageInternalAsync(string imagePath, Result.IconDelegate icon, bool loadFullImage)
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
Title = menuItem.Label,
|
||||
Icon = () => menuItem.Icon,
|
||||
ItemType = "Small",
|
||||
Action = _ =>
|
||||
{
|
||||
ShellContextMenuDisplayHelper.ExecuteContextMenuItem(record.FullPath, menuItem.CommandId);
|
||||
|
|
|
|||
Loading…
Reference in a new issue