fix: update child class property overrides to use MCRF_PROPERTY macros

Fixes critical issue discovered in code review where PyDrawable property
docstrings were being overridden by child classes, making enhanced documentation
invisible to users.

Updated files:
- src/UIBase.h: UIDRAWABLE_GETSETTERS macro (visible, opacity)
- src/UIFrame.cpp: click and z_index properties
- src/UISprite.cpp: click and z_index properties
- src/UICaption.cpp: click and z_index properties
- src/UIGrid.cpp: click and z_index properties

All four UI class hierarchies (Frame, Sprite, Caption, Grid) now expose
consistent, enhanced property documentation to Python users.

Verification:
- tools/test_child_class_docstrings.py: All 16 property tests pass
- All 4 properties (click, z_index, visible, opacity) match across all 4 classes

Related: #92 (Inline C++ documentation system)
This commit is contained in:
John McCardle 2025-10-30 12:33:27 -04:00
commit cc80964835
8 changed files with 59 additions and 12 deletions

View file

@ -152,8 +152,14 @@ static int UIDrawable_set_opacity(T* self, PyObject* value, void* closure)
// Macro to add common UIDrawable properties to a getsetters array
#define UIDRAWABLE_GETSETTERS \
{"visible", (getter)UIDrawable_get_visible<PyObjectType>, (setter)UIDrawable_set_visible<PyObjectType>, \
"Visibility flag", NULL}, \
MCRF_PROPERTY(visible, \
"Whether the object is visible (bool). " \
"Invisible objects are not rendered or clickable." \
), NULL}, \
{"opacity", (getter)UIDrawable_get_opacity<PyObjectType>, (setter)UIDrawable_set_opacity<PyObjectType>, \
"Opacity (0.0 = transparent, 1.0 = opaque)", NULL}
MCRF_PROPERTY(opacity, \
"Opacity level (0.0 = transparent, 1.0 = opaque). " \
"Automatically clamped to valid range [0.0, 1.0]." \
), NULL}
// UIEntity specializations are defined in UIEntity.cpp after UIEntity class is complete