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

TStyleManager.ActiveStyle(Context: FmxObject) -> FmxObject Returns the style that is currently set.

ActiveStyleForScene

TStyleManager.ActiveStyleForScene(AScene: IInterface) -> FmxObject Embarcadero Technologies does not currently have any additional information.

EnumStyleResources

TStyleManager.EnumStyleResources(Proc: StyleResourceEnumProc) -> None Enumetates all the registered style resource objects.

FindStyleDescriptor

TStyleManager.FindStyleDescriptor(AObject: FmxObject) -> StyleDescription Returns the style description of the specified style.

GetStyleDescriptionForControl

TStyleManager.GetStyleDescriptionForControl(AObject: FmxObject) -> StyleDescription Embarcadero Technologies does not currently have any additional information.

GetStyleResource

TStyleManager.GetStyleResource(ResourceName: str) -> FmxObject Gets the style resource object.

RegisterPlatformStyleResource

TStyleManager.RegisterPlatformStyleResource(APlatform: OSPlatform, ResourceName: str) -> None Registers the style resource for the specified platform.

RegisterPlatformStyleSelection

TStyleManager.RegisterPlatformStyleSelection(APlatform: OSPlatform, ASelection: Callable[[OSPlatform], str]) -> None Registers the style resource specified by selection.

RemoveStyleFromGlobalPool

TStyleManager.RemoveStyleFromGlobalPool(Style: FmxObject) -> None Removes the specified Style from the pool of styles.

SetStyle

TStyleManager.SetStyle(Style: FmxObject) -> None Sets the active style to the instance specified by the Style parameter.

SetStyleFromFile

TStyleManager.SetStyleFromFile(FileName: str) -> bool Sets the style specified by FileName as the active style.

TrySetStyleFromResource

TStyleManager.TrySetStyleFromResource(ResourceName: str) -> bool 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.

classmethod EnumStyleResources(Proc: StyleResourceEnumProc) None

Enumetates all the registered style resource objects.

classmethod 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.

classmethod GetStyleDescriptionForControl(AObject: FmxObject) StyleDescription

Embarcadero Technologies does not currently have any additional information.

classmethod 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.

classmethod RegisterPlatformStyleResource(APlatform: OSPlatform, ResourceName: str) None

Registers the style resource for the specified platform.

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

classmethod 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.

classmethod 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.

classmethod 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;

classmethod TrySetStyleFromResource(ResourceName: str) bool

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

classmethod 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.