more documentation in Plugin package

This commit is contained in:
Ioannis G 2023-06-18 22:53:01 +03:00
parent 6ebac4e4b1
commit bb5e1d3a19
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E
5 changed files with 62 additions and 6 deletions

View file

@ -2,18 +2,47 @@
namespace Flow.Launcher.Plugin
{
/// <summary>
/// Context provided as a parameter when invoking a
/// <see cref="Result.Action"/> or <see cref="Result.AsyncAction"/>
/// </summary>
public class ActionContext
{
/// <summary>
/// Contains the press state of certain special keys.
/// </summary>
public SpecialKeyState SpecialKeyState { get; set; }
}
/// <summary>
/// Contains the press state of certain special keys.
/// </summary>
public class SpecialKeyState
{
/// <summary>
/// True if the Ctrl key is pressed.
/// </summary>
public bool CtrlPressed { get; set; }
/// <summary>
/// True if the Shift key is pressed.
/// </summary>
public bool ShiftPressed { get; set; }
/// <summary>
/// True if the Alt key is pressed.
/// </summary>
public bool AltPressed { get; set; }
/// <summary>
/// True if the Windows key is pressed.
/// </summary>
public bool WinPressed { get; set; }
/// <summary>
/// Get this object represented as a <see cref="ModifierKeys"/> flag combination.
/// </summary>
/// <returns></returns>
public ModifierKeys ToModifierKeys()
{
return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) |

View file

@ -1,9 +1,18 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Flow.Launcher.Plugin
{
/// <summary>
/// Adds support for presenting additional options for a given <see cref="Result"/> from a context menu.
/// </summary>
public interface IContextMenu : IFeatures
{
/// <summary>
/// Load context menu items for the given result.
/// </summary>
/// <param name="selectedResult">
/// The <see cref="Result"/> for which the user has activated the context menu.
/// </param>
List<Result> LoadContextMenus(Result selectedResult);
}
}

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
namespace Flow.Launcher.Plugin
{
@ -7,8 +7,14 @@ namespace Flow.Launcher.Plugin
/// </summary>
public interface IPluginI18n : IFeatures
{
/// <summary>
/// Get a localised version of the plugin's title
/// </summary>
string GetTranslatedPluginTitle();
/// <summary>
/// Get a localised version of the plugin's description
/// </summary>
string GetTranslatedPluginDescription();
/// <summary>

View file

@ -1,12 +1,18 @@
namespace Flow.Launcher.Plugin
namespace Flow.Launcher.Plugin
{
/// <summary>
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved,
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
/// Inherit this interface if additional data e.g. cache needs to be saved.
/// </summary>
/// <remarks>
/// For storing plugin settings, prefer <see cref="IPublicAPI.LoadSettingJsonStorage{T}"/>
/// or <see cref="IPublicAPI.SaveSettingJsonStorage{T}"/>.
/// Once called, your settings will be automatically saved by Flow.
/// </remarks>
public interface ISavable : IFeatures
{
/// <summary>
/// Save additional plugin data, such as cache.
/// </summary>
void Save();
}
}

View file

@ -1,5 +1,8 @@
namespace Flow.Launcher.Plugin
{
/// <summary>
/// Carries data passed to a plugin when it gets initialized.
/// </summary>
public class PluginInitContext
{
public PluginInitContext()
@ -12,6 +15,9 @@
API = api;
}
/// <summary>
/// The metadata of the plugin being initialized.
/// </summary>
public PluginMetadata CurrentPluginMetadata { get; internal set; }
/// <summary>