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)
```bash
# Generate and build Debug x64
# Generate and build (choose one)
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
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build/x64
# Build Debug or Release
cmake --build build/x64 --config Debug
cmake --build build/x64 --config Release
# Or use build.bat to build all configurations at once
@@ -69,9 +69,9 @@ Key demo projects in `demo/`:
Object
├── Control (base for all widgets)
│ ├── Window (top-level, owns HWND)
│ ├── BorderlessWindow
│ ├── LayeredWindow
│ ├── PopupWindow
│ ├── BorderlessWindow (frameless window)
│ ├── LayeredWindow (transparency support)
│ ├── PopupWindow (modal/popup dialogs)
│ ├── Label
│ ├── Button
│ ├── TextBox
@@ -87,7 +87,7 @@ Object
│ ├── TreeView
│ ├── TableView
│ └── TabLayout
└── IFrame (container frame)
└── IFrame (container frame for embedding)
```
### Event System
@@ -99,7 +99,7 @@ Events defined in [include/EzUI/EzUI.h](include/EzUI/EzUI.h):
- Paint: OnPaint
- 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
@@ -108,6 +108,10 @@ ControlState enum: None, Static, Disabled, Checked, Hover, Active
3. **Styling**: ControlStyle supports inheritance. Use SetStyleSheet() for CSS-like styling
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
- `include/EzUI/` - Public headers