Unit statmach

Classes

TStateBoolean -
TStateConnector -
TStateControl -
TStateLink -
TStateLinkBase -
TStateMachine -
TStateNode -
TStateNodeBase - Yeah, I know!
TStateStart -
TStateStop -
TStateTransition -

Functions

Register - ****************************************************************************** ** ** Component Registration ** ****************************************************************************** (* type TConnectorProperty = class(TClassProperty) protected Connector: TStateConnector; public procedure GetProperties(Proc: TGetPropEditProc); override; function GetAttributes: TPropertyAttributes; override; procedure GetValues(Proc: TGetStrProc); override; function GetValue: string; override; procedure SetValue(const Value: string); override; end; function TConnectorProperty.

Types

TBooleanStateEvent
TChangeStateEvent
TConnectorLines
TDesignMove
TLinkDirection
TStateExceptionEvent
TStateMachineOption
TStateMachineOptions
TStatePath
TStatePathOwner
TTransitionDirection
TVisualElement

Constants

SM_STATE_TRANSITION

Variables


Functions


procedure Register;

****************************************************************************** ** ** Component Registration ** ****************************************************************************** (* type TConnectorProperty = class(TClassProperty) protected Connector: TStateConnector; public procedure GetProperties(Proc: TGetPropEditProc); override; function GetAttributes: TPropertyAttributes; override; procedure GetValues(Proc: TGetStrProc); override; function GetValue: string; override; procedure SetValue(const Value: string); override; end; function TConnectorProperty.GetAttributes: TPropertyAttributes; begin Result := [paSubProperties, paValueList, paSortList]; end; procedure TConnectorProperty.GetProperties(Proc: TGetPropEditProc); var I: Integer; Components: TComponentList; StateControl: TStateControl; begin Components := TComponentList.Create; try StateControl := TStateControl(GetOrdValue); // Find all properties of type function GetPropList(TypeInfo: PTypeInfo; TypeKinds: TTypeKinds; PropList: PPropList): Integer; Components.Add(TComponent(GetOrdValueAt(I))); GetComponentProperties(Components, tkProperties, Designer, Proc); finally Components.Free; end; end; procedure TConnectorProperty.GetValues(Proc: TGetStrProc); begin Designer.GetComponentNames(GetTypeData(TypeInfo(TStateControl)), Proc); end; function TConnectorProperty.GetValue: string; begin if (TStateConnector(GetOrdValue).PeerNode <> nil) then FmtStr(Result, '(%s)', [TStateControl(GetOrdValue).Name]) else Result := ''; end; procedure TConnectorProperty.SetValue(const Value: string); var Component: TComponent; begin if Value = '' then Component := nil else begin Component := Designer.GetComponent(Value); if not (Component is TStateControl) then raise EPropertyError.Create(SInvalidPropertyValue); end; SetOrdValue(LongInt(Component)); end;

Types


TBooleanStateEvent = procedure(Sender: TStateBoolean; var Result: Boolean) of Object

TChangeStateEvent = procedure(Sender: TStateMachine;
    FromState, ToState: TStateControl) of object
Type of the OnChangeState event
TConnectorLines = array[dmSource..dmDestination] of TPoint;

TDesignMove = (dmSource, dmFirstHandle, dmOffset, dmLastHandle, dmDestination, dmNone);

TLinkDirection = (ldIncoming, ldOutgoing);

TStateExceptionEvent = procedure(Sender: TStateMachine; Node: TStateControl;
    Error: Exception) of object
Type of the OnException event
TStateMachineOption = (soInteractive, soSingleStep, soVerifyTransitions);
Run-time options: // soInteractive If set, the TStateMachine will be visible at run-time. The current state will be painted in red and bold. // soSingleStep If set, the execution will stop after each transition. Use the Execute method to resume execution. // soVerifyTransitions If set, transitions (TStateTransition) will verify their source states when executed. An attempt to move through a transition from a state other than the one specified as the "FromState" will cause an exception to be raised. If the transition does not specify a "FromState", the transition will not be validated. //
TStateMachineOptions = set of TStateMachineOption

TStatePath = (spAuto, spDirect, spLeftRight, spTopBottom, spTopLeft, spRightBottom);

TStatePathOwner = (poOwnedBySource, poOwnedByDestination);

TTransitionDirection = (tdFrom, tdTo);

TVisualElement = (veShadow, veFrame, vePanel, veText, veConnector);

Constants

SM_STATE_TRANSITION = WM_USER

Windows message used to initiate state transitions

Variables