This commit implements Phase 7 of the UIModule, adding advanced features that make the UI system production-ready. ## Phase 7.1 - UIScrollPanel New scrollable container widget with: - Vertical and horizontal scrolling (configurable) - Mouse wheel support with smooth scrolling - Drag-to-scroll functionality (drag content or scrollbar) - Interactive scrollbar with proportional thumb - Automatic content size calculation - Visibility culling for performance - Full styling support (colors, borders, scrollbar) Files added: - modules/UIModule/Widgets/UIScrollPanel.h - modules/UIModule/Widgets/UIScrollPanel.cpp - modules/UIModule/Core/UIContext.h (added mouseWheelDelta) - modules/UIModule/UIModule.cpp (mouse wheel event routing) ## Phase 7.2 - Tooltips Smart tooltip system with: - Hover delay (500ms default) - Automatic positioning with edge avoidance - Semi-transparent background with border - Per-widget tooltip text via JSON - Tooltip property on all UIWidget types - Renders on top of all UI elements Files added: - modules/UIModule/Core/UITooltip.h - modules/UIModule/Core/UITooltip.cpp - modules/UIModule/Core/UIWidget.h (added tooltip property) - modules/UIModule/Core/UITree.cpp (tooltip parsing) ## Tests Added comprehensive visual tests: - test_28_ui_scroll.cpp - ScrollPanel with 35+ items - test_29_ui_advanced.cpp - Tooltips on various widgets - assets/ui/test_scroll.json - ScrollPanel layout - assets/ui/test_tooltips.json - Tooltips layout ## Documentation - docs/UI_MODULE_PHASE7_COMPLETE.md - Complete Phase 7 docs - docs/PROMPT_UI_MODULE_PHASE6.md - Phase 6 & 7 prompt - Updated CMakeLists.txt for new files and tests ## UIModule Status UIModule is now feature-complete with: ✅ 9 widget types (Panel, Label, Button, Image, Slider, Checkbox, ProgressBar, TextInput, ScrollPanel) ✅ Flexible layout system (vertical, horizontal, stack, absolute) ✅ Theme and style system ✅ Complete event system ✅ Tooltips with smart positioning ✅ Hot-reload support ✅ Comprehensive tests (Phases 1-7) 🚀 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
286 lines
7.7 KiB
JSON
286 lines
7.7 KiB
JSON
{
|
|
"id": "widgets_showcase",
|
|
"type": "panel",
|
|
"x": 50,
|
|
"y": 50,
|
|
"width": 700,
|
|
"height": 500,
|
|
"style": {
|
|
"bgColor": "0x2c3e50FF"
|
|
},
|
|
"layout": {
|
|
"type": "vertical",
|
|
"padding": 20,
|
|
"spacing": 15,
|
|
"align": "stretch"
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "UIModule Phase 4 - All Widgets Showcase",
|
|
"height": 30,
|
|
"style": {
|
|
"fontSize": 20,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"height": 100,
|
|
"style": {
|
|
"bgColor": "0x34495eFF"
|
|
},
|
|
"layout": {
|
|
"type": "horizontal",
|
|
"padding": 10,
|
|
"spacing": 20,
|
|
"align": "center"
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "panel",
|
|
"flex": 1,
|
|
"layout": {
|
|
"type": "vertical",
|
|
"spacing": 5
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "Volume Slider",
|
|
"height": 25,
|
|
"style": {
|
|
"fontSize": 14,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "slider",
|
|
"id": "volume_slider",
|
|
"height": 30,
|
|
"min": 0,
|
|
"max": 100,
|
|
"value": 75,
|
|
"onChange": "settings:volume",
|
|
"style": {
|
|
"trackColor": "0x475569FF",
|
|
"fillColor": "0x3498dbFF",
|
|
"handleColor": "0xecf0f1FF",
|
|
"handleSize": 20
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"flex": 1,
|
|
"layout": {
|
|
"type": "vertical",
|
|
"spacing": 5
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "Brightness",
|
|
"height": 25,
|
|
"style": {
|
|
"fontSize": 14,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "slider",
|
|
"id": "brightness_slider",
|
|
"height": 30,
|
|
"min": 0,
|
|
"max": 10,
|
|
"value": 7,
|
|
"step": 1,
|
|
"onChange": "settings:brightness",
|
|
"style": {
|
|
"trackColor": "0x475569FF",
|
|
"fillColor": "0xf39c12FF",
|
|
"handleColor": "0xecf0f1FF"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"height": 120,
|
|
"style": {
|
|
"bgColor": "0x34495eFF"
|
|
},
|
|
"layout": {
|
|
"type": "vertical",
|
|
"padding": 10,
|
|
"spacing": 8
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "Settings",
|
|
"height": 25,
|
|
"style": {
|
|
"fontSize": 16,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "checkbox",
|
|
"id": "fullscreen_check",
|
|
"text": "Fullscreen Mode",
|
|
"height": 30,
|
|
"checked": false,
|
|
"onChange": "settings:fullscreen",
|
|
"style": {
|
|
"boxColor": "0x475569FF",
|
|
"checkColor": "0x2ecc71FF",
|
|
"textColor": "0xecf0f1FF",
|
|
"fontSize": 14
|
|
}
|
|
},
|
|
{
|
|
"type": "checkbox",
|
|
"id": "vsync_check",
|
|
"text": "Vertical Sync",
|
|
"height": 30,
|
|
"checked": true,
|
|
"onChange": "settings:vsync",
|
|
"style": {
|
|
"boxColor": "0x475569FF",
|
|
"checkColor": "0x2ecc71FF",
|
|
"textColor": "0xecf0f1FF",
|
|
"fontSize": 14
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"height": 100,
|
|
"style": {
|
|
"bgColor": "0x34495eFF"
|
|
},
|
|
"layout": {
|
|
"type": "horizontal",
|
|
"padding": 10,
|
|
"spacing": 15,
|
|
"align": "center"
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "panel",
|
|
"flex": 1,
|
|
"layout": {
|
|
"type": "vertical",
|
|
"spacing": 5
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "Loading Progress",
|
|
"height": 25,
|
|
"style": {
|
|
"fontSize": 14,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "progressbar",
|
|
"id": "loading_bar",
|
|
"height": 30,
|
|
"progress": 0.65,
|
|
"showText": true,
|
|
"style": {
|
|
"bgColor": "0x475569FF",
|
|
"fillColor": "0x2ecc71FF",
|
|
"textColor": "0xFFFFFFFF",
|
|
"fontSize": 12
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"flex": 1,
|
|
"layout": {
|
|
"type": "vertical",
|
|
"spacing": 5
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "label",
|
|
"text": "Health Bar",
|
|
"height": 25,
|
|
"style": {
|
|
"fontSize": 14,
|
|
"color": "0xecf0f1FF"
|
|
}
|
|
},
|
|
{
|
|
"type": "progressbar",
|
|
"id": "health_bar",
|
|
"height": 30,
|
|
"progress": 0.35,
|
|
"showText": true,
|
|
"style": {
|
|
"bgColor": "0x475569FF",
|
|
"fillColor": "0xe74c3cFF",
|
|
"textColor": "0xFFFFFFFF",
|
|
"fontSize": 12
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "panel",
|
|
"flex": 1,
|
|
"style": {
|
|
"bgColor": "0x34495eFF"
|
|
},
|
|
"layout": {
|
|
"type": "horizontal",
|
|
"padding": 10,
|
|
"spacing": 10,
|
|
"align": "center",
|
|
"justify": "center"
|
|
},
|
|
"children": [
|
|
{
|
|
"type": "button",
|
|
"id": "btn_apply",
|
|
"text": "Apply Settings",
|
|
"width": 150,
|
|
"height": 40,
|
|
"onClick": "settings:apply",
|
|
"style": {
|
|
"fontSize": 14,
|
|
"normal": { "bgColor": "0x27ae60FF", "textColor": "0xFFFFFFFF" },
|
|
"hover": { "bgColor": "0x2ecc71FF", "textColor": "0xFFFFFFFF" },
|
|
"pressed": { "bgColor": "0x229954FF", "textColor": "0xFFFFFFFF" }
|
|
}
|
|
},
|
|
{
|
|
"type": "button",
|
|
"id": "btn_reset",
|
|
"text": "Reset",
|
|
"width": 120,
|
|
"height": 40,
|
|
"onClick": "settings:reset",
|
|
"style": {
|
|
"fontSize": 14,
|
|
"normal": { "bgColor": "0x95a5a6FF", "textColor": "0xFFFFFFFF" },
|
|
"hover": { "bgColor": "0xbdc3c7FF", "textColor": "0xFFFFFFFF" },
|
|
"pressed": { "bgColor": "0x7f8c8dFF", "textColor": "0xFFFFFFFF" }
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|