Control基类指南

This commit is contained in:
2026-02-20 21:58:42 +08:00
parent b71f601088
commit 88d331c757
2 changed files with 1089 additions and 9 deletions

View File

@@ -13,12 +13,12 @@ The project uses CMake for building. Prebuilt libraries exist in `lib/` for both
### Build Static Library (EzUI) ### Build Static Library (EzUI)
```bash ```bash
# Generate and build Debug x64 # Generate and build (choose one)
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build/x64 cmake -G "Visual Studio 17 2022" -A x64 -S . -B build/x64
cmake --build build/x64 --config Debug cmake -G "Visual Studio 17 2022" -A Win32 -S . -B build/x86
# Generate and build Release x64 # Build Debug or Release
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build/x64 cmake --build build/x64 --config Debug
cmake --build build/x64 --config Release cmake --build build/x64 --config Release
# Or use build.bat to build all configurations at once # Or use build.bat to build all configurations at once
@@ -69,9 +69,9 @@ Key demo projects in `demo/`:
Object Object
├── Control (base for all widgets) ├── Control (base for all widgets)
│ ├── Window (top-level, owns HWND) │ ├── Window (top-level, owns HWND)
│ ├── BorderlessWindow │ ├── BorderlessWindow (frameless window)
│ ├── LayeredWindow │ ├── LayeredWindow (transparency support)
│ ├── PopupWindow │ ├── PopupWindow (modal/popup dialogs)
│ ├── Label │ ├── Label
│ ├── Button │ ├── Button
│ ├── TextBox │ ├── TextBox
@@ -87,7 +87,7 @@ Object
│ ├── TreeView │ ├── TreeView
│ ├── TableView │ ├── TableView
│ └── TabLayout │ └── TabLayout
└── IFrame (container frame) └── IFrame (container frame for embedding)
``` ```
### Event System ### Event System
@@ -99,7 +99,7 @@ Events defined in [include/EzUI/EzUI.h](include/EzUI/EzUI.h):
- Paint: OnPaint - Paint: OnPaint
- Layout: OnMove, OnSize - Layout: OnMove, OnSize
ControlState enum: None, Static, Disabled, Checked, Hover, Active ControlState enum (bit flags): None(1), Static(2), Disabled(4), Checked(8), Hover(16), Active(32)
### Key Patterns ### Key Patterns
@@ -108,6 +108,10 @@ ControlState enum: None, Static, Disabled, Checked, Hover, Active
3. **Styling**: ControlStyle supports inheritance. Use SetStyleSheet() for CSS-like styling 3. **Styling**: ControlStyle supports inheritance. Use SetStyleSheet() for CSS-like styling
4. **XML Loading**: Window::LoadXml() loads UI from XML files 4. **XML Loading**: Window::LoadXml() loads UI from XML files
### Additional Resources
- [doc/Control_Guide.md](doc/Control_Guide.md) - Comprehensive guide for the Control class, including CSS property mapping, event handling, and best practices
### File Organization ### File Organization
- `include/EzUI/` - Public headers - `include/EzUI/` - Public headers

1076
doc/Control_Guide.md Normal file

File diff suppressed because it is too large Load Diff