120 Commits
Author SHA1 Message Date
Liu 47014c5dbb feat(widgets): add popover widget 2026-10-28 23:40:31 +08:00
Liu 2ac38a6ca6 feat(widgets): add tooltip widget
Add Tooltip/TooltipTrigger/TooltipContent, data-tooltip attributes, Portal placement with border arrow, C attach helpers, docs, and tests.
2026-10-28 23:40:30 +08:00
Liu e80b997c45 feat(widgets): update field style 2026-10-18 15:42:33 +08:00
Liu 323b641bbc feat(widgets): add groups, scrolling, alignment and checkmark to select 2026-10-18 15:42:25 +08:00
Liu a1078ff201 feat(widgets): add spinner and shimmer widgets 2026-10-18 15:42:23 +08:00
Liu 8876c70f93 feat(widgets): add dialog and alert-dialog widgets 2026-10-18 15:42:21 +08:00
Liu 20ac4484b9 feat(widgets): add empty widget 2026-10-18 15:42:19 +08:00
Liu a805852558 feat(widgets): add item widget 2026-10-18 15:42:18 +08:00
Liu b674004673 feat(widgets): add alert widget 2026-10-17 21:16:54 +08:00
Liu 6b7a4d41de feat(widgets): add badge widget 2026-10-17 21:16:53 +08:00
Liu 7154337944 feat(widgets): add button variants, sizes and themed styles with docs 2026-10-17 21:16:51 +08:00
Liu 92b46eee10 feat(widgets): add icon widget 2026-10-17 21:16:50 +08:00
Liu de31a3bc74 feat(widgets): restyle scrollbar with a slim rounded thumb 2026-10-17 21:16:49 +08:00
Liu 708611a727 feat(ui-server): sync system cursor with hovered widget style
Expose ui_get_mouseover() and, at the end of ui_server_update(), resolve
the first non-auto cursor up the hover ancestor chain (emulating CSS
inheritance), then apply it to the owning window. Runs after style
recomputation so :hover and dynamic changes take effect in the same
frame; resets to auto when the hovered widget is destroyed.
2026-10-17 21:16:47 +08:00
Liu 251bf2fa54 feat(ui): propagate inherited CSS values to dependent children 2026-10-17 21:16:45 +08:00
Liu 916aac4850 feat(ui): render text underlines with offset and thickness control 2026-10-17 21:16:42 +08:00
Liu 10b3665071 feat(widgets): add portal and select widget 2026-10-17 21:16:38 +08:00
Liu 4801465d93 fix(ui): calculate widget offsets without duplicate padding 2026-10-17 21:16:37 +08:00
Liu 8cb5bd7c32 fix(ui): percentage flex items should wrap within intrinsic size 2026-10-17 21:16:36 +08:00
Liu d819822db1 test(ui): cover percentage wrapping in content-sized flex layouts 2026-10-17 21:16:35 +08:00
Liu b5e6bbf1c3 test(ui): add choice card reflow stability test and document event handler signature 2026-10-17 21:16:35 +08:00
Liu 13c32f98a3 feat(widgets): add field widget 2026-10-17 21:16:34 +08:00
Liu fd23dd079f feat(widgets): add radio-group widget 2026-10-17 21:16:28 +08:00
Liu 8f77b1f32e feat(widgets): add checkbox widget 2026-10-17 21:16:26 +08:00
Liu 38aab01ec6 feat(widgets): add label widget 2026-08-05 22:42:29 +08:00
Liu 3801fdc10f refactor(yutil): rename public APIs and migrate timer to ptk
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit

BREAKING CHANGE: all renamed yutil public APIs require downstream
  to update function names. Deleted APIs require code changes:
  - get_time_us: use y_gettime() for ms timestamps
  - get_time_delta: use y_gettime() - start instead
  - sleep_s: use y_sleep(ms) with millisecond argument
  - wcsreplace: no replacement, had zero callers
  - cmdsplit: WinMain now uses __argc/__argv from CRT
  - timer_list_*: migrated to ptk timer_scheduler_*;
    ptk_reset_timer still available for external use
2026-08-05 22:42:26 +08:00
Liu 2ccb6aa151 feat: add progress widget 2026-08-05 22:42:20 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +08:00
Liu 4bb0d51cd5 feat(settings): schema-driven serialization and window state persistence
- Per-window state with [window.<id>] sections in settings.ini
- Settings module split into rendering and window_state subsystems
- Schema-driven (de)serialization with DEFINE_SETTING_INT/BOOL_FIELD macros
- Listener-based change notification via deserialize/serialize callbacks
- Integration tests for get/set, validation, and bind/restore lifecycle
2026-08-05 22:42:14 +08:00
Copilot cc0b79fccb feat: update settings APIs and add persistent configuration support (#329)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-08-05 22:42:03 +08:00
Liu 65022e9437 test(flex-layout): add gap example to preview fixture
Add a new "(18) gap" example block in tests/fixtures/test_flex_layout.xml
that exercises the gap shorthand and longhand variants:

- gap: 10px
- gap: 10px 5px with flex-wrap: wrap
- row-gap: 10px with flex-direction: column
- column-gap: 10px with justify-content: space-between

Define the corresponding utility classes (.gap-2, .gap-2-1, .row-gap-2,
.column-gap-2) in test_flex_layout.css so the example renders in
`xmake run preview-flex-layout`. The new block is appended after the
existing Browser Layout example to preserve the indices used by the
flex-layout integration tests.
2026-08-05 22:41:31 +08:00
Liu f54cd12539 feat(css): add gap, row-gap and column-gap support
Add the CSS gap shorthand and its row-gap/column-gap longhands for flex
containers.

- Register row-gap/column-gap as longhand properties and gap as a
  shorthand accepting [ normal | <length-percentage> ]{1,2}.
- Add css_gap_t (CSS_GAP_INHERIT/SET/NORMAL) and corresponding
  type/unit/value fields on css_computed_style_t.
- Implement cascade logic in lib/css/src/properties/gap.c, resolving
  normal to zero and rejecting auto.
- Apply gaps in ui_flexbox_layout: main-axis gap participates in line
  size, wrap detection, justify-content space and per-item positioning;
  cross-axis gap participates in cross-size accumulation and line
  positioning. The last item/line never gets a trailing gap. Percentage
  gaps resolve against the container content-box on the corresponding
  axis.
- Cover gap parsing/cascading in lib/css/tests (single/two values,
  axis-only, normal, percentage) and add a flex layout integration test
  exercising column-gap, row-gap, wrapped two-value gap and normal.
2026-08-05 22:41:30 +08:00
Liu 3a867040d1 build(xmake): fix package name, target naming and example install
- Remove per-lib set_project() calls that overrode the global lcui
  project name; xmake show now correctly reports the project as lcui.
- Move per-lib set_version() into the corresponding target() block so
  each sub-library keeps an independent version usable for standalone
  packaging.
- Add set_default(false) and set_group(examples) to all pandagl
  examples so they are no longer picked up by xmake package.
- Rename targets to use dashes for consistency:
    pandagl_cairo_example  -> pandagl-cairo-example
    preview_block_layout   -> preview-block-layout
    preview_flex_layout    -> preview-flex-layout
    preview_scrollbar      -> preview-scrollbar
    preview_widget_opacity -> preview-widget-opacity
- Bump yutil submodule to drop its set_project() call as well.
2026-08-05 22:41:23 +08:00
Liu d64fe6202b refactor(pandagl): rename font API to align with typeface/glyph concepts
The previous naming conflated multiple levels of the font model:
pd_font_t actually owned a single typeface resource (FT_Face), while
pd_font_bitmap_t represented a per-glyph bitmap. The pd_font_library_*
prefix was redundant under the pd_font_ namespace and resulted in
verbose call sites (up to 34 chars).

Type renames
- pd_font_t          -> pd_font_face_t
- pd_font_bitmap_t   -> pd_glyph_bitmap_t
- font_engine_t      -> pd_font_engine_t
- struct tags updated to match the typedef names.

API renames (grouped by sub-object)
- Face lifecycle:    pd_font_create/destroy -> pd_font_face_create/destroy
- Face registry:     pd_font_library_add_font     -> pd_font_register
                     pd_font_library_get_font     -> pd_font_get
                     pd_font_library_get_font_id  -> pd_font_get_id
                     pd_font_library_query        -> pd_font_query
                     pd_font_library_load_file    -> pd_font_load_file
                     pd_font_library_get_font_path-> pd_font_find_path
                     pd_font_library_get_default_font -> pd_font_get_default
                     pd_font_library_set_default_font -> pd_font_set_default
                     pd_font_library_set_font_family_alias
                                                  -> pd_font_family_set_alias
                     pd_font_library_update_font_weight
                                                  -> pd_font_replace_weight
                     pd_font_library_update_font_style
                                                  -> pd_font_replace_style
- Parsing helpers:   pd_font_library_detect_weight -> pd_font_parse_weight
                     pd_font_library_detect_style  -> pd_font_parse_style
- Glyph rendering:   pd_font_library_render_bitmap -> pd_font_render_glyph
                     pd_canvas_mix_font_bitmap     -> pd_canvas_mix_glyph_bitmap
                     pd_font_bitmap_init/destroy   -> pd_glyph_bitmap_init/destroy
- Glyph cache:       pd_font_library_add_bitmap    -> pd_font_cache_add_bitmap
                     pd_font_library_get_bitmap    -> pd_font_cache_get_bitmap

pd_font_library_init/destroy are kept as the module lifecycle entry
points, matching the FT_Init_FreeType / FT_Done_FreeType convention.

All call sites in lib/pandagl, lib/ui, lib/ui-xml, src/, tests/ and
examples/ are updated accordingly.
2026-08-05 22:41:19 +08:00
Liu 2404c535f3 refactor(ui-router): extract router widgets into a new lib
Create lib/ui-router/ as a thin UI binding layer between libui and librouter, exposing the router-link and router-view widgets under <ui_router/...>.

* Move src/widgets/router_{link,view}.c and the matching public headers into lib/ui-router/src and lib/ui-router/include.

* Drop include/LCUI/widgets/router_{link,view}.h and the corresponding entries in include/LCUI/widgets.h; src/lcui_widgets.c now pulls registrations from <ui_router.h>.

* Wire libui-router into the root xmake.lua add_includedirs and lcui add_deps chain; libui-router depends on yutil + libui + librouter only.

* tests/integration/test_router.c stays at the integration layer (router widgets exercise text inheritance and other libui internals); only its #include set is updated to use <ui_router.h>.

* Bump CHANGELOG and add bilingual lib/ui-router/README.
2026-08-05 22:41:13 +08:00
Liu 75dbca815d test: reorganize test suite with xmake test integration
Restructure the test infrastructure with these changes:

* Extend libctest with ctest_suite_t, ctest_parse_args, ctest_run_suites and CTEST_MAIN macro to standardize test entry points; support --grep / --grep= / --list / --interactive flags; add ctest-tests for self-tests.

* Regroup tests by lib boundary: sink unit tests into lib/<name>/tests/ with <lib>_<topic> entry function names, move fixtures into lib/<name>/tests/fixtures/, rename top-level tests/cases/ to tests/integration/ for cross-lib integration tests.

* Add tests/scenes/ for reusable widget tree builders shared by integration cases and visual preview binaries; add tests/previews/ with 4 diagnostic binaries (flex_layout, block_layout, widget_opacity, scrollbar).

* Rewrite all describe/equal description strings using 'should ...' style or noun topic names; drop redundant lcui_quit/lcui_main calls from integration cases.

* Integrate xmake test via add_tests(\default\) and a shared tests.runnable rule defined in the root xmake.lua; the rule wraps the test binary with drmemory (Windows) or valgrind (Linux) when option memcheck=y.

* Drop the lcui-tests aggregation: lcui-tests now contains only integration cases and scenes, not the union of lib tests. Use xmake test to run everything across libs.

* Fix .clang-format: InsertNewlineAtEndOfFile -> InsertNewlineAtEOF (correct key for clang-format 16+).

* Update AGENTS.md with the new test layout, naming rules, description style and run commands.

* Update CI to use xmake test and xmake f --memcheck=y instead of per-lib runs.
2026-08-05 22:41:12 +08:00
Liu 20b24cb9fc refactor(app): drop app_ prefix from public API
BREAKING CHANGE: lcui_app_get_fps -> lcui_get_fps,
lcui_app_set_frame_rate_cap -> lcui_set_fps_cap,
settings.frame_rate_cap -> settings.fps_cap.
lcui_app_init, lcui_app_destroy, lcui_app_process_events
removed from public header — use lcui_init, lcui_destroy,
lcui_run instead.
2026-08-05 22:41:07 +08:00
Liu e6506fca90 feat(app): add lcui_request_frame and animation timer driver 2026-08-05 22:40:07 +08:00
Liu a0a1669176 fix(ptk): initialize steptimer last_time to wall clock
The first call to ptk_steptimer_tick observed a huge delta because
last_time was zero-initialized. In fixed-step mode this caused the
handler to be invoked hundreds of times in a single tick.

- Set last_time to get_time_ms() in ptk_steptimer_init.
- Remove the duplicate is_fixed_time_step assignment.
- Drop the unused frequency field; LCUI uses millisecond time base
  and never read it.
- Document in the header that StepTimer is intended for
  animation/simulation timing, not render throttling.
- Add test_steptimer covering init timing, variable-step,
  fixed-step catch-up, and max_delta clamping.
2026-05-20 22:32:52 +08:00
Liu 53c5ce216f test: update function name 2025-04-16 00:16:30 +08:00
Liu 24f3192b9a refactor: update LCUI's dependencies on ui-widgets and ui-router 2024-12-29 23:37:24 +08:00
Liu 5314ea61ac test: update tests 2024-12-22 23:14:13 +08:00
Liu d1493e315d feat: new layout process 2024-12-22 23:14:13 +08:00
Liu 44ab3aeae6 feat(ui-widgets): add scrollarea 2024-12-07 13:30:31 +08:00
Liu bdd7cb5f75 feat: merge libtimer into libptk
BREAKING CHANGE: lcui_set_timeout -> ptk_set_timeout, lcui_set_interval -> ptk_set_interval
2024-12-07 13:30:29 +08:00
Liu 20ae97a1a2 feat: lib/platform -> lib/ptk
BREAKING CHANGE: lib/platform -> lib/ptk, and the naming style of
libplatform has changed to have a `ptk_` prefix.
2024-12-07 13:30:29 +08:00
Liu 0f21dc838b test: update mainloop tests 2024-12-07 13:30:29 +08:00
Liu 375e03bd36 feat: replace custom bool type with bool type in stdbool.h 2024-12-07 13:30:28 +08:00
Liu 68a0f0d828 feat: DPI awareness 2024-09-19 00:06:05 +08:00
Liu 1534e4b1c3 feat(pandagl): update image reader to support reading one row of data 2024-05-13 22:49:22 +08:00