Commit Graph
89 Commits
Author SHA1 Message Date
Liu f760db2176 fix(ui): ui_widget_render should re-anchor offscreen captures in logical units 2026-10-18 15:42:22 +08:00
Liu 7154337944 feat(widgets): add button variants, sizes and themed styles with docs 2026-10-17 21:16:51 +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 53ef6ac477 fix(ui): destroy temporary string style values 2026-10-17 21:16:39 +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 3c6a592e98 fix(ui): incorporate children intrinsic width into cross size calculation 2026-10-17 21:16:35 +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 6cd01b468e chore: update copyright comment 2026-08-05 22:42:22 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +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
CopilotandLiu 01a0d11be3 refactor(ui): consolidate flexbox row/column axis logic
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Liu <lc-soft@live.cn>
2026-08-05 22:41:27 +08:00
Liu 3f49931cb6 fix(ui): avoid mbstowcs assertion in ui_print_tree on Windows
The %ls format in logger_error went through UCRT's wide-to-multibyte path, which triggered a debug assertion in mbstowcs.cpp under non-UTF-8 locales and also produced unreadable output when the console code page was GBK.

Switch the tree drawing to UTF-8 byte literals so the log path stays purely narrow, and temporarily set the console output code page to CP_UTF8 around the dump so the box-drawing characters render correctly.
2026-08-05 22:41:24 +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 e873c47216 refactor(ui): change image event listener return types to bool 2026-03-31 21:20:28 +08:00
Liu ded5f84022 fix(ui): memory leak and division by zero error 2026-03-31 21:20:28 +08:00
Liu c4895a3efb fix(ui): cannot set css shorthand property 2026-03-31 21:20:28 +08:00
Liu 06a958eda4 fix(ui): clear implicit conversion warnings 2025-08-16 11:22:29 +08:00
Liu 1de2dfd62c fix: delay refresh window to use the latest size of widget 2025-04-16 00:16:38 +08:00
Liu 9510e2c2ef style: format code and delete unused files 2025-01-06 23:14:33 +08:00
Liu 940a0fc33a chore: update copyright 2025-01-05 23:29:56 +08:00
Liu 24f3192b9a refactor: update LCUI's dependencies on ui-widgets and ui-router 2024-12-29 23:37:24 +08:00
Liu 6851e9aef3 refactor: change type naming style 2024-12-22 23:14:13 +08:00
Liu 4f19df5c7a fix(ui): incorrect line-height calculation 2024-12-22 23:14:13 +08:00
Liu d1493e315d feat: new layout process 2024-12-22 23:14:13 +08:00
Liu bd1129f7b0 fix(ui): flex-basis was not recalculated during layout 2024-12-07 13:30:30 +08:00
Liu fcff153784 fix(ui): correct width calculation 2024-12-07 13:30:30 +08:00
Liu 9435396de5 feat(ui): add ui_widget_set_background_image_url() 2024-12-07 13:30:30 +08:00
Liu 1f35451526 feat(ui): add css background-clip property 2024-12-07 13:30:30 +08:00
Liu 5efe7f3ae9 fix(ui): the class change of ancestor widgets did not trigger style refresh 2024-12-07 13:30:29 +08:00
Liu 68a0f0d828 feat: DPI awareness 2024-09-19 00:06:05 +08:00
Liu e4b0eb4d8d feat: DPI awareness 2024-09-19 00:06:04 +08:00
Liu fe6efbdd8f feat: window fullscreen 2024-09-19 00:06:04 +08:00
Liu d3d36fa19d Revert "feat: replace decode_utf8 with mbstowcs"
This reverts commit 9e225e9d27.
2024-09-19 00:06:04 +08:00
Liu 16002e0846 fix(ui): the widgets created in the ready event handler aren't updated 2024-05-13 22:49:22 +08:00
Liu 9e225e9d27 feat: replace decode_utf8 with mbstowcs 2024-05-13 22:49:22 +08:00
Liu f8e32821a7 feat(ui): improve the event and loading logic of image loader 2024-05-13 22:49:22 +08:00
Liu 1534e4b1c3 feat(pandagl): update image reader to support reading one row of data 2024-05-13 22:49:22 +08:00
Liu a6dea4de1a fix(css): CONVER -> COVER 2024-05-13 22:49:22 +08:00
Liu d60ec9227d chore: update copyright year 2024-05-13 22:49:22 +08:00
Liu 26641aa0b3 fix(ui): window title mutation not applied 2024-05-13 22:49:21 +08:00
Liu 023b35e245 chore: add copyright header 2024-05-13 22:49:20 +08:00
Liu 5c8186faad refactor: clear compiler warnings 2024-05-13 22:49:19 +08:00
Liu 3d1531df3e fix(ui): correct the width calculation when max width is valid 2024-05-13 22:49:19 +08:00
Liu f8d3f17cb9 fix(ui): correct the calculation of % unit size within the block layout 2024-05-13 22:49:19 +08:00
Liu 02c306c685 fix(ui): request reflow after self size change 2024-05-13 22:49:18 +08:00
Liu 261ee1b993 fix(ui): some dirty rectangles are not collected 2024-05-13 22:49:18 +08:00
Liu d6f0f8e98f feat(ui): add css_load event 2024-05-13 22:49:18 +08:00