Expert guidance for wxUI, a C++ header-only library providing a declarative layer over wxWidgets with method-chaining controllers and runtime layout composition.
Expert guidance for working with wxUI, a modern C++ header-only library that provides a declarative programming model over wxWidgets.
This skill provides comprehensive knowledge for developing with wxUI, including:
**Project:** wxUI - C++ header-only declarative UI library for wxWidgets
**Source:** rmpowell77/wxUI
**Public API:** `include/wxUI/*.hpp`
**CMake Target:** `wxUI` (INTERFACE library)
1. **Header-Only INTERFACE Library**
- All public API in `include/wxUI/*.hpp`
- CMake INTERFACE target declared in `CMakeLists.txt`
- Maintains header-only semantics with include guards
2. **Runtime Behavior**
- Builds tree of Layouts (VSizer/HSizer/FlexGrid)
- Composed of Controllers (Button, TextCtrl, Choice, etc.)
- Instantiates wxWidgets objects when `.fitTo(...)` is called
3. **Key Flow**
- Layout → Controller → wxWindow/wxSizer creation at fit time
- Proxy objects attach to named Controllers for post-creation access
Follow this pattern for controller customization:
```cpp
TextCtrl{"controlName"}
.withStyle(wxTE_MULTILINE)
.withProxy(myProxy)
.bind([](auto& event) { /* handler */ })
```
**CRITICAL:** Proxy objects are references to runtime-created controls.
```bash
-DWXUI_WITH_TESTS=ON
-DWXUI_WITH_EXAMPLE=ON
-DENABLE_ASAN=ON
```
```bash
cmake -B build -S . -DWXUI_WITH_TESTS=ON -DWXUI_WITH_EXAMPLE=ON
cmake --build build
cd build && ctest
```
1. Create header in `include/wxUI/` (e.g., `MyControl.hpp`)
2. Follow method-chaining pattern from `include/wxUI/TextCtrl.hpp`
3. Implement `.withProxy()` semantics if needed
4. Add example usage to `examples/`
5. Write unit tests in `tests/`
1. Edit headers under `include/wxUI/`
2. Update examples in `examples/` for smoke testing
3. Reference patterns in `examples/HelloWorld/HelloWorld.cpp`
4. Validate with unit tests
1. Edit `CMakeLists.txt` for project-level changes
2. Modify `cmake/dependencies.cmake` for dependencies
3. Update `cmake/compiler.cmake` for compiler flags
4. Test both `WXUI_WITH_TESTS=ON` and `WXUI_WITH_EXAMPLE=ON`
```cpp
// Full example from HelloWorld.cpp
VSizer {
Menu {
SubMenu {
"File",
MenuItem { "Open", [](auto&) { /* handler */ } },
MenuItem { "Exit", [](auto&) { wxExit(); } }
}
},
HSizer {
Button { "Click Me" }.bind([](auto&) { /* handler */ }),
TextCtrl { "input" }.withProxy(myProxy)
}
}.fitTo(frame);
```
1. Study `include/wxUI/TextCtrl.hpp` and `include/wxUI/Widget.hpp`
2. Implement method-chaining builder pattern
3. Add `.withProxy()` if runtime access needed
4. Update `examples/` with usage example
5. Add unit tests in `tests/`
1. Check for collapsed empty sizers
2. Verify `.fitTo(...)` is called at correct time
3. Use `examples/HelloWorld/HelloWorld.cpp` as reference
4. Build with AddressSanitizer: `-DENABLE_ASAN=ON`
1. Edit `docs/ProgrammersGuide.md` for patterns
2. Update inline header comments
3. Add runnable example to `examples/`
4. Validate code examples compile
When working with wxUI code:
1. **Read Context First**
- Check `docs/ProgrammersGuide.md` for patterns
- Review `examples/HelloWorld/HelloWorld.cpp` for usage
- Study relevant headers in `include/wxUI/`
2. **Understand the Request**
- Is this a controller change, layout modification, or build update?
- Which files need modification?
- Are tests or examples needed?
3. **Implement Changes**
- Follow method-chaining conventions
- Preserve header-only semantics
- Respect Proxy lifetime rules
- Keep API stable
4. **Validate Changes**
- Build with tests: `cmake -B build -DWXUI_WITH_TESTS=ON`
- Run unit tests: `ctest`
- Build examples: `-DWXUI_WITH_EXAMPLE=ON`
- Test with AddressSanitizer in Debug builds
5. **Document Changes**
- Update header comments
- Add example usage if new feature
- Write unit tests following Catch2 style
- Update `docs/ProgrammersGuide.md` if pattern changes
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/wxui-c-declarative-ui-library/raw