StyleManager

Qualified name: delphifmx.StyleManager

class StyleManager

Bases: Object

TStyleManager handles styles-related operations. Use TStyleManager to:

Set and retrieve the active style. Load styles from files or streams.

Methods

ActiveStyle

Returns the style that is currently set.

ActiveStyleForScene

Embarcadero Technologies does not currently have any additional information.

EnumStyleResources

Enumetates all the registered style resource objects.

FindStyleDescriptor

Returns the style description of the specified style.

GetStyleDescriptionForControl

Embarcadero Technologies does not currently have any additional information.

GetStyleResource

Gets the style resource object.

RegisterPlatformStyleResource

Registers the style resource for the specified platform.

RegisterPlatformStyleSelection

Registers the style resource specified by selection.

RemoveStyleFromGlobalPool

Removes the specified Style from the pool of styles.

SetStyle

Sets the active style to the instance specified by the Style parameter.

SetStyleFromFile

Sets the style specified by FileName as the active style.

TrySetStyleFromResource

Loads the style from ResourceName and sets the style as the active style.

UnInitialize

Uninitializes data about styles.

UpdateScenes

Updates the style for all the registered scenes.

Attributes

ClassName

Returns the TObject.ClassName

static ActiveStyle(Context: FmxObject) FmxObject

Returns the style that is currently set.

static ActiveStyleForScene(AScene: IInterface) FmxObject

Embarcadero Technologies does not currently have any additional information.

EnumStyleResources(Proc: StyleResourceEnumProc) None

Enumetates all the registered style resource objects.

FindStyleDescriptor(AObject: FmxObject) StyleDescription

Returns the style description of the specified style. FindStyleDescriptor returns the TStyleDescription object associated with the style specified by AObject, if such a description is set. You can set the style description fields using the Tools > Bitmap Style Designer dialog.

GetStyleDescriptionForControl(AObject: FmxObject) StyleDescription

Embarcadero Technologies does not currently have any additional information.

GetStyleResource(ResourceName: str) FmxObject

Gets the style resource object. GetStyleResource returns the style resource if it exits in cache. Otherwise it loads the style resource. ResourceName specifies the style resource as per name.

RegisterPlatformStyleResource(APlatform: OSPlatform, ResourceName: str) None

Registers the style resource for the specified platform.

ResourceName specifies the resource style. APlatform specifies the target platform.

RegisterPlatformStyleSelection(APlatform: OSPlatform, ASelection: Callable[[OSPlatform], str]) None

Registers the style resource specified by selection.

APlatform specifies the target platform. ASelection specifies the style selection with type TPlatformStyleSelectionProc.

static RemoveStyleFromGlobalPool(Style: FmxObject) None

Removes the specified Style from the pool of styles.

SetStyle(Style: FmxObject) None

Sets the active style to the instance specified by the Style parameter. To set the active style to the native system style, for example Windows theme, pass nil as the Style parameter.

Note: If you call the SetStyle function in the initialization section of a unit on the main project file, before Application.Initialize, then it is applied to all forms. Sets the active style to the instance specified by the Style parameter. To set the active style to the native system style, for example Windows theme, pass nil as the Style parameter.

Note: If you call the SetStyle function in the initialization section of a unit on the main project file, before Application.Initialize, then it is applied to all forms.

SetStyleFromFile(FileName: str) bool

Sets the style specified by FileName as the active style. Do not place multiple lines calling SetStyleFromFile in a project, because you can have only one active style in the style manager. You can call SetStyleFromFile either in the project source code (before calling Application.Initialize) or in the initialization section of one of the form units:

If you call SetStyleFromFile in a form, the style is reapplied. If you call SetStyleFromFile before the form is created, the custom style fully replaces the platform style. Example This Delphi code demonstrates how to use the StyleManager:

Delphi:

procedure TForm1.FormCreate(Sender: TObject);
var

od : TOpenDialog;

begin

od := nil; try od := TOpenDialog.Create(self); od.Filter := ‘Style Files|*.style’; if od.Execute() then

TStyleManager.SetStyleFromFile(od.FileName);

finally

od.Free();

end;

end; Sets the style specified by FileName as the active style. Do not place multiple lines calling SetStyleFromFile in a project, because you can have only one active style in the style manager. You can call SetStyleFromFile either in the project source code (before calling Application.Initialize) or in the initialization section of one of the form units:

If you call SetStyleFromFile in a form, the style is reapplied. If you call SetStyleFromFile before the form is created, the custom style fully replaces the platform style. Example This Delphi code demonstrates how to use the StyleManager:

Delphi:

procedure TForm1.FormCreate(Sender: TObject);
var

od : TOpenDialog;

begin

od := nil; try od := TOpenDialog.Create(self); od.Filter := ‘Style Files|*.style’; if od.Execute() then

TStyleManager.SetStyleFromFile(od.FileName);

finally

od.Free();

end;

end;

TrySetStyleFromResource(ResourceName: str) bool

Loads the style from ResourceName and sets the style as the active style. TrySetStyleFromResource sets the style without raising exceptions.

UnInitialize()

Uninitializes data about styles.

Note: This function is reserved for internal use only. Do not call it directly.

static UpdateScenes()

Updates the style for all the registered scenes.