added interface ICEActionProvider

maybe as an alternative to ICEMainMenuProvider
This commit is contained in:
Basile Burg 2015-02-23 06:20:00 +01:00
parent 42a8cc8924
commit 9ea1608f74
1 changed files with 33 additions and 3 deletions

View File

@ -98,7 +98,7 @@ type
(** (**
* An implementer can add a mai nmenu entry. * An implementer can add a main menu entry.
*) *)
ICEMainMenuProvider = interface ICEMainMenuProvider = interface
['ICEMainMenuProvider'] ['ICEMainMenuProvider']
@ -108,7 +108,7 @@ type
procedure menuUpdate(item: TMenuItem); procedure menuUpdate(item: TMenuItem);
end; end;
(** (**
* An implementer agregates its observers menus. * An implementer collects and updates its observers menus.
*) *)
TCEMainMenuSubject = class(TCECustomSubject) TCEMainMenuSubject = class(TCECustomSubject)
protected 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. * 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; function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
// a TCEEditableShortCutSubject sends the possibly modified shortcut // a TCEEditableShortCutSubject sends the possibly modified shortcut
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut); procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
end; end;
(** (**
* An implementer manages its observers shortcuts. * An implementer manages its observers shortcuts.
@ -139,6 +163,7 @@ type
end; end;
// the option editor uses this value as a hint to cast and display an option container. // the option editor uses this value as a hint to cast and display an option container.
TOptionEditorKind = (oekGeneric, oekForm, oekControl); TOptionEditorKind = (oekGeneric, oekForm, oekControl);
// event generated by the option editor and passed to an ICEEditableOptions. // event generated by the option editor and passed to an ICEEditableOptions.
@ -400,6 +425,11 @@ function TCEEditableOptionsSubject.acceptObserver(aObject: TObject): boolean;
begin begin
exit(aObject is ICEEditableOptions); exit(aObject is ICEEditableOptions);
end; end;
function TCEActionProviderSubject.acceptObserver(aObject: TObject): boolean;
begin
exit(aObject is ICEActionProvider);
end;
{$ENDREGION} {$ENDREGION}
{$REGION ICESingleService getters ----------------------------------------------} {$REGION ICESingleService getters ----------------------------------------------}