From 2130807c62b16adb20a02e5db1f8f02951658fac Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Feb 2015 13:57:40 +0100 Subject: [PATCH] added interface for the editable options --- src/ce_interfaces.pas | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/ce_interfaces.pas b/src/ce_interfaces.pas index 92ada5a0..4e694446 100644 --- a/src/ce_interfaces.pas +++ b/src/ce_interfaces.pas @@ -141,6 +141,32 @@ type + TOptionEditorKind = (oekAbstract, oekForm); + TOptionEditorEvent = (oeeCancel, oeeAccept, oeeChange); + (** + * An implementer can expose some options to be edited in a dedicated widget. + *) + ICEEditableOptions = interface + ['ICEEditableOptions'] + // the widget wants the category + function optionedWantCategory(): string; + // the widget wants to know if the options will use a generic editor or a custom form + function optionedWantEditorKind: TOptionEditorKind; + // the widget wants the custom option editor form or the TPersistent containing the options + function optionedWantContainer: TPersistent; + // the option editor informs that something has happened + procedure optionedEvent(anEvent: TOptionEditorEvent); + end; + (** + * An implementer displays its observers editable options. + *) + TCEEditableOptionsSubject = class(TCECustomSubject) + protected + function acceptObserver(aObject: TObject): boolean; override; + end; + + + /// describes the message kind, when Auto implies that a ICELogMessageObserver guess the kind. TCEAppMessageKind = (amkAuto, amkBub, amkInf, amkHint, amkWarn, amkErr); /// describes the message context. Used by a ICELogMessageObserver to filter the messages. @@ -366,11 +392,16 @@ begin end; {$ENDREGION} -{$REGION TCEEditableShortCutSubject --------------------------------------------} +{$REGION Misc subjects ---------------------------------------------------------} function TCEEditableShortCutSubject.acceptObserver(aObject: TObject): boolean; begin exit(aObject is ICEEditableShortCut); end; + +function TCEEditableOptionsSubject.acceptObserver(aObject: TObject): boolean; +begin + exit(aObject is ICEEditableOptions); +end; {$ENDREGION} {$REGION ICESingleService assignators ------------------------------------------}