This major refactoring standardizes how position, size, and other arguments are parsed across all UI components. PyArgHelpers provides consistent handling for various argument patterns: - Position as (x, y) tuple or separate x, y args - Size as (w, h) tuple or separate width, height args - Grid position and size with proper validation - Color parsing with PyColorObject support Changes across UI components: - UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support - UIFrame: Uses standardized position parsing - UISprite: Consistent position handling - UIGrid: Grid-specific position/size helpers - UIEntity: Unified argument parsing Also includes: - Improved error messages for type mismatches (int or float accepted) - Reduced code duplication across constructors - Better handling of keyword/positional argument conflicts - Maintains backward compatibility with existing API This addresses the inconsistent argument handling patterns discovered during the inheritance hierarchy work and prepares for Phase 7 documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
15 lines
No EOL
339 B
C++
15 lines
No EOL
339 B
C++
#pragma once
|
|
#include "Common.h"
|
|
#include "Python.h"
|
|
#include "UIDrawable.h"
|
|
|
|
// Python object structure for UIDrawable base class
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
std::shared_ptr<UIDrawable> data;
|
|
} PyDrawableObject;
|
|
|
|
// Declare the Python type for Drawable base class
|
|
namespace mcrfpydef {
|
|
extern PyTypeObject PyDrawableType;
|
|
} |