Unit avoraiser.utils

Description

Avoraiser UI Framework - High-Performance WinAPI UI for Avocado Avoraiser is a framework for creating modern user interfaces for the Polish programming language Avocado. Copyright (c) 2025-2026 Dymitr Wygowski (Programista Art) Project Created: 23.12.2025

Author: Dymitr Wygowski (Programista Art) Contact: programista.art@gmail.com GitHub: https://github.com/Programista-Art/Avoraiser Version: 1.0 License: Dual-Licensed: Avoraiser Community / Commercial See LICENSE.md for terms and conditions.

Module: avoraiser.utils Description:

Uses

Overview

Functions and Procedures

function av_adjust_line_breaks(const s: UnicodeString): UnicodeString;
procedure calculate_aspect_ratio(OrigW, OrigH, MaxW, MaxH: Integer; out NewW, NewH: Integer);
function color_to_argb(WinColor: DWORD): DWORD;
function create_panel(Parent: HWND; X, Y, W, H: Integer; Color: DWORD): HWND;
function create_ui_font(const font_name: PWideChar; size: Integer): HFONT;
function DefSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; external 'comctl32.dll' name 'DefSubclassProc';
procedure destroy_window(Handle: HWND);
function extract_file_ext(const file_name: UnicodeString): UnicodeString;
function file_exists_win(const filename: UnicodeString): Boolean;
function GetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; pdwRefData: PDWORD_PTR): BOOL; stdcall; external 'comctl32.dll' name 'GetWindowSubclass';
function get_app_path: UnicodeString;
function get_file_extension(const file_path: UnicodeString): UnicodeString;
function get_file_name_only(const file_path: UnicodeString): UnicodeString;
function get_prop_color(hWnd: HWND; const PropName: string; DefaultCol: DWORD): DWORD;
function get_text(Handle: HWND): string;
function get_window_height(Handle: HWND): Integer;
function get_window_int(hWnd: HWND): Integer;
function get_window_monitor_info(Handle: HWND): TAvocadoMonitorInfo;
function get_window_text_length(Handle: HWND): Integer;
function get_window_title(Handle: HWND): string;
function get_window_width(Handle: HWND): Integer;
function get_window_x(Handle: HWND): Integer;
function get_window_y(Handle: HWND): Integer;
procedure int_to_pchar(Value: Integer; Buffer: PChar);
function int_to_str(value: Integer): string; inline;
function int_to_wide(value: Integer): UnicodeString; inline;
function make_wparam(Low, High: Word): WPARAM; inline;
procedure open_url(const url: UnicodeString);
function pchar_to_int(Str: PChar; Default: Integer = 0): Integer;
procedure process_messages;
function read_file_to_string(const file_path: UnicodeString): UnicodeString;
function RemoveWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR): BOOL; stdcall; external 'comctl32.dll' name 'RemoveWindowSubclass';
function rgb(R, G, B: Byte): DWORD; inline;
function same_text(const s1, s2: UnicodeString): Boolean;
function SetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL; stdcall; external 'comctl32.dll' name 'SetWindowSubclass';
procedure set_component_auto_font(Handle: HWND; Height: Integer);
procedure set_component_color(h_wnd: HWND; text_color, background_color: DWORD);
procedure set_component_size_font(hComponent: HWND; FontName: PWideChar; Size: Integer);
procedure set_component_text_color(Handle: HWND; Color: DWORD);
procedure set_component_transparent(h_wnd: HWND; text_color: DWORD);
procedure set_control_color(Control: HWND; TextColor, BgColor: DWORD);
procedure set_dark_mode(Handle: HWND; Enable: Boolean);
procedure set_listbox_color(Handle: HWND; TextColor, BgColor: DWORD);
procedure set_on_end_session(Handle: HWND; Event: TAvocadoEndSessionEvent);
procedure set_on_query_end_session(Handle: HWND; Event: TAvocadoQueryEndSessionEvent);
procedure set_text(Handle: HWND; const AText: string);
procedure set_title(Handle: HWND; const NewTitle: string);
procedure set_window_int(hWnd: HWND; Value: Integer);
procedure set_window_shadow(Handle: HWND; Enable: Boolean);
procedure show_component(hComponent: HWND; Visible: Boolean);
procedure show_toggle_component(hComponent: HWND);
function start_timer(Handle: HWND; TimerID: UINT_PTR; Interval: UINT): UINT_PTR;
function stop_timer(Handle: HWND; TimerID: UINT_PTR): BOOL;
function str_to_int(const s: UnicodeString; default_val: Integer): Integer;
procedure track_mouse_leave(Handle: HWND);

Types

SUBCLASSPROC = function(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;

Description

Functions and Procedures

function av_adjust_line_breaks(const s: UnicodeString): UnicodeString;

This item has no description.

procedure calculate_aspect_ratio(OrigW, OrigH, MaxW, MaxH: Integer; out NewW, NewH: Integer);

Oblicza nowe wymiary tak, by obraz o wymiarach

function color_to_argb(WinColor: DWORD): DWORD;

This item has no description.

function create_panel(Parent: HWND; X, Y, W, H: Integer; Color: DWORD): HWND;

This item has no description.

function create_ui_font(const font_name: PWideChar; size: Integer): HFONT;

Uniwersalna funkcja pomocnicz do tworzenia fontow

function DefSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; external 'comctl32.dll' name 'DefSubclassProc';

This item has no description.

procedure destroy_window(Handle: HWND);

Bezpiecznie niszczy dowolną kontrolkę lub okno

function extract_file_ext(const file_name: UnicodeString): UnicodeString;

This item has no description.

function file_exists_win(const filename: UnicodeString): Boolean;

Zamiennik FileExists - sprawdza atrybuty pliku

function GetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; pdwRefData: PDWORD_PTR): BOOL; stdcall; external 'comctl32.dll' name 'GetWindowSubclass';

This item has no description.

function get_app_path: UnicodeString;

Zamiennik ExtractFilePath - wycina ścieżkę z pełnej nazwy modułu

function get_file_extension(const file_path: UnicodeString): UnicodeString;

This item has no description.

function get_file_name_only(const file_path: UnicodeString): UnicodeString;

This item has no description.

function get_prop_color(hWnd: HWND; const PropName: string; DefaultCol: DWORD): DWORD;

This item has no description.

function get_text(Handle: HWND): string;

Pobiera tekst z dowolnej kontrolki

function get_window_height(Handle: HWND): Integer;

This item has no description.

function get_window_int(hWnd: HWND): Integer;

Pobiera liczbę bezpośrednio z kontrolki (np. z Edit)

function get_window_monitor_info(Handle: HWND): TAvocadoMonitorInfo;

Pobiera informacje o monitorze, na którym znajduje się okno

function get_window_text_length(Handle: HWND): Integer;

Zwraca długość tekstu w oknie lub kontrolce (liczba znaków)

function get_window_title(Handle: HWND): string;

This item has no description.

function get_window_width(Handle: HWND): Integer;

This item has no description.

function get_window_x(Handle: HWND): Integer;

geometria okna / kontrolki

function get_window_y(Handle: HWND): Integer;

This item has no description.

procedure int_to_pchar(Value: Integer; Buffer: PChar);

This item has no description.

function int_to_str(value: Integer): string; inline;

Konwersje (Zastępują SysUtils) Zamienia liczbę na zwykły string

function int_to_wide(value: Integer): UnicodeString; inline;

Zamienia liczbę na UnicodeString (Do kontrolek WinAPI, np. SetWindowTextW)

function make_wparam(Low, High: Word): WPARAM; inline;

This item has no description.

procedure open_url(const url: UnicodeString);

This item has no description.

function pchar_to_int(Str: PChar; Default: Integer = 0): Integer;

Zamienia PChar na liczbę. W razie błędu zwraca Default

procedure process_messages;

Wstawiaj to wewnątrz długich pętli (np. while).

function read_file_to_string(const file_path: UnicodeString): UnicodeString;

This item has no description.

function RemoveWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR): BOOL; stdcall; external 'comctl32.dll' name 'RemoveWindowSubclass';

This item has no description.

function rgb(R, G, B: Byte): DWORD; inline;

POMOCNICZE FUNKCJE

function same_text(const s1, s2: UnicodeString): Boolean;

This item has no description.

function SetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL; stdcall; external 'comctl32.dll' name 'SetWindowSubclass';

This item has no description.

procedure set_component_auto_font(Handle: HWND; Height: Integer);

Uniwersalne skalowanie czcionki

procedure set_component_color(h_wnd: HWND; text_color, background_color: DWORD);

Pozwala systemowi "odetchnąć" i obsłużyć kliknięcia/odświeżanie

procedure set_component_size_font(hComponent: HWND; FontName: PWideChar; Size: Integer);

ustawienie czcionki

procedure set_component_text_color(Handle: HWND; Color: DWORD);

This item has no description.

procedure set_component_transparent(h_wnd: HWND; text_color: DWORD);

This item has no description.

procedure set_control_color(Control: HWND; TextColor, BgColor: DWORD);

Ustawia kolor kontrolkam (Edit, Memo, itp)

procedure set_dark_mode(Handle: HWND; Enable: Boolean);

This item has no description.

procedure set_listbox_color(Handle: HWND; TextColor, BgColor: DWORD);

ustawia kolor tla listboxa

procedure set_on_end_session(Handle: HWND; Event: TAvocadoEndSessionEvent);

This item has no description.

procedure set_on_query_end_session(Handle: HWND; Event: TAvocadoQueryEndSessionEvent);

This item has no description.

procedure set_text(Handle: HWND; const AText: string);

Ustawia tekst dowolnej kontrolki (Button, Label, Window, Edit)

procedure set_title(Handle: HWND; const NewTitle: string);

aby móc zmieniać napis na pasku tytułu "w locie", np. pokazując postęp ładowania lub nazwę otwartego pliku?

procedure set_window_int(hWnd: HWND; Value: Integer);

Wpisuje liczbę bezpośrednio do kontrolki

procedure set_window_shadow(Handle: HWND; Enable: Boolean);

Cień pod oknem (szczególnie dla Frameless)

procedure show_component(hComponent: HWND; Visible: Boolean);

Pokazuje (True) lub ukrywa (False) dowolny komponent/obiekt

procedure show_toggle_component(hComponent: HWND);

Przełącza widoczność (jak jest widoczny to ukrywa, jak ukryty to pokazuje)

function start_timer(Handle: HWND; TimerID: UINT_PTR; Interval: UINT): UINT_PTR;

Uruchamia timer. Jeśli TimerID = 0, system stworzy nowy ID. Interval w milisekundach.

function stop_timer(Handle: HWND; TimerID: UINT_PTR): BOOL;

Zatrzymuje timer.

function str_to_int(const s: UnicodeString; default_val: Integer): Integer;

This item has no description.

procedure track_mouse_leave(Handle: HWND);

This item has no description.

Types

SUBCLASSPROC = function(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;

avoraiser.events,


Generated by PasDoc 1.0.4.