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 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 public class ActionContext
{ {
/// <summary>
/// Contains the press state of certain special keys.
/// </summary>
public SpecialKeyState SpecialKeyState { get; set; } public SpecialKeyState SpecialKeyState { get; set; }
} }
/// <summary>
/// Contains the press state of certain special keys.
/// </summary>
public class SpecialKeyState public class SpecialKeyState
{ {
/// <summary>
/// True if the Ctrl key is pressed.
/// </summary>
public bool CtrlPressed { get; set; } public bool CtrlPressed { get; set; }
/// <summary>
/// True if the Shift key is pressed.
/// </summary>
public bool ShiftPressed { get; set; } public bool ShiftPressed { get; set; }
/// <summary>
/// True if the Alt key is pressed.
/// </summary>
public bool AltPressed { get; set; } public bool AltPressed { get; set; }
/// <summary>
/// True if the Windows key is pressed.
/// </summary>
public bool WinPressed { get; set; } public bool WinPressed { get; set; }
/// <summary>
/// Get this object represented as a <see cref="ModifierKeys"/> flag combination.
/// </summary>
/// <returns></returns>
public ModifierKeys ToModifierKeys() public ModifierKeys ToModifierKeys()
{ {
return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) | return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) |

View file

@ -1,9 +1,18 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Flow.Launcher.Plugin 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 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); List<Result> LoadContextMenus(Result selectedResult);
} }
} }

View file

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

View file

@ -1,12 +1,18 @@
namespace Flow.Launcher.Plugin namespace Flow.Launcher.Plugin
{ {
/// <summary> /// <summary>
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved, /// 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
/// </summary> /// </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 public interface ISavable : IFeatures
{ {
/// <summary>
/// Save additional plugin data, such as cache.
/// </summary>
void Save(); void Save();
} }
} }

View file

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