Skip to content

Kitto.Html.Utils ​

Utility functions for KittoX HTML controllers. Same logic as Kitto.Ext.Utils, adapted for TKXControllerRegistry. Includes SVG icon support with Material Design Icons mapping.

Routines ​

pascal
function GetIconHTML(const AIconName: string;

Returns HTML for an icon. Looks for SVG in Resources/icons/ first (using icon name mapping for legacy Kitto names), falls back to PNG. SVG icons use CSS mask-image and adapt to light/dark themes automatically.

pascal
function GetTreeViewNodeImageName(const ANode: TKTreeViewNode;

Returns the icon/image name for a tree-view node (its own, or its view's).

pascal
function GetDisplayLabelFromNode(const ANode: TKTreeViewNode;

Computes and returns a display label based on the underlying view, if any, or the node itself (if no view is found).

pascal
function CallViewControllerStringMethod(const AView: TKView;

Invoke a method of a View's controller class that returns a string, using RTTI.

pascal
procedure DownloadThumbnailedStream(const AStream: TStream;

Serves an image stream as a download, first scaling it to the given thumbnail size.

pascal
procedure SetIconStyle(const AStyle: string);

Sets the icon style subdirectory (filled, outlined, round, sharp, two-tone). Called from TKWebApplication.ServeHomePage after reading Theme/IconStyle from Config.

pascal
function GetIconStyle: string;

Returns the current icon style subdirectory (filled, outlined, round, sharp, two-tone).

pascal
procedure SetDefaultIconSize(const ASize: string);

Sets the default icon size used when GetIconHTML is called with isDefault. Called from TKWebApplication.ServeHomePage after reading Theme/IconSize from Config.

pascal
function GetMenuActionVerb(const AControllerType, AViewName: string): string;

htmx verb+URL for a main-menu entry. A destructive action that must not be triggerable by a cross-site GET (today only Logout) is emitted as an hx-post to its canonical endpoint (kx/logout); every other entry stays an hx-get that renders the view. Centralized here so all menu renderers (ToolBar, TreePanel, TilePanel) make the same choice.

Released under Apache License, Version 2.0.