From 9ea1608f74fbbdf2fc8150093d4eabe2efc16234 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 23 Feb 2015 06:20:00 +0100 Subject: [PATCH] added interface ICEActionProvider maybe as an alternative to ICEMainMenuProvider --- src/ce_interfaces.pas | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/ce_interfaces.pas b/src/ce_interfaces.pas index 217c6677..c40ec101 100644 --- a/src/ce_interfaces.pas +++ b/src/ce_interfaces.pas @@ -98,7 +98,7 @@ type (** - * An implementer can add a mai nmenu entry. + * An implementer can add a main menu entry. *) ICEMainMenuProvider = interface ['ICEMainMenuProvider'] @@ -108,7 +108,7 @@ type procedure menuUpdate(item: TMenuItem); end; (** - * An implementer agregates its observers menus. + * An implementer collects and updates its observers menus. *) TCEMainMenuSubject = class(TCECustomSubject) protected @@ -117,6 +117,31 @@ type + (** + * An implementer declares some actions which have their own main menu entry and + * whose shortcuts are automatically handled + *) + ICEActionProvider = interface + ['ICEActionProvider'] + // the action handler will clear the references to the actions collected previously and start collecting if result. + function actHandlerWantRecollect: boolean; + // the action handler starts to collect the actions if result. + function actHandlerWantFirst: boolean; + // the handler continue collecting action if result. + function actHandlerWantNext(out category: string; out action: TCustomAction): boolean; + // the handler update the state of a particular action. + procedure actHandleUpdater(action: TCustomAction); + end; + (** + * An implementer handles its observers actions. + *) + TCEActionProviderSubject = class(TCECustomSubject) + protected + function acceptObserver(aObject: TObject): boolean; override; + end; + + + (** * An implementer can expose some customizable shortcuts to be edited in a dedicated widget. *) @@ -128,7 +153,6 @@ type function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean; // a TCEEditableShortCutSubject sends the possibly modified shortcut procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut); - end; (** * An implementer manages its observers shortcuts. @@ -139,6 +163,7 @@ type end; + // the option editor uses this value as a hint to cast and display an option container. TOptionEditorKind = (oekGeneric, oekForm, oekControl); // event generated by the option editor and passed to an ICEEditableOptions. @@ -400,6 +425,11 @@ function TCEEditableOptionsSubject.acceptObserver(aObject: TObject): boolean; begin exit(aObject is ICEEditableOptions); end; + +function TCEActionProviderSubject.acceptObserver(aObject: TObject): boolean; +begin + exit(aObject is ICEActionProvider); +end; {$ENDREGION} {$REGION ICESingleService getters ----------------------------------------------}