refactor(framework): clean up TU_WidgetLayoutView inline funcs (they're not useful)
This commit is contained in:
parent
557b2f1808
commit
06c0a4ad6f
@ -315,180 +315,6 @@ private:
|
||||
static int _uniqueId; // Static counter for unique names
|
||||
};
|
||||
|
||||
// Note: AC_ResponderTemplateWidget<T> is a template class defined in Toon Boom
|
||||
// DLLs that combines a QWidget subclass with AC_Responder capabilities. Memory
|
||||
// layout for AC_ResponderTemplateWidget<QWidget>:
|
||||
// - +0x00: vptr (QObject)
|
||||
// - +0x10: vptr (QPaintDevice)
|
||||
// - +0x18-0x27: QWidget members
|
||||
// - +0x28: vptr (AC_ResponderTemplateWidget)
|
||||
// - +0x30: AC_Manager* m_actionManager
|
||||
// - +0x38: QString m_responderIdentity
|
||||
// - +0x50: QString m_responderDescription
|
||||
// sizeof(AC_ResponderTemplateWidget<QWidget>) ≈ 0x68 (104 bytes) on x64
|
||||
|
||||
// =============================================================================
|
||||
// TUWidgetLayoutView
|
||||
// =============================================================================
|
||||
//
|
||||
// TUWidgetLayoutView is a concrete layout view class implemented in
|
||||
// ToonBoomLayout.dll. It combines a QWidget (for UI display) with both
|
||||
// AC_Responder capabilities (for action handling) and TULayoutView
|
||||
// functionality (for the layout system).
|
||||
//
|
||||
// INHERITANCE HIERARCHY:
|
||||
// QWidget
|
||||
// └── AC_ResponderTemplateWidget<QWidget> (multiple inheritance)
|
||||
// ├── QWidget base
|
||||
// └── AC_ResponderTemplate (mixin at +0x28)
|
||||
// └── TUWidgetLayoutView
|
||||
// └── TULayoutView (embedded at +0x68)
|
||||
//
|
||||
// VTABLE STRUCTURE (4 vtables due to multiple inheritance):
|
||||
// +0x00: vptr[0] - QObject vtable (includes QWidget virtuals)
|
||||
// +0x10: vptr[1] - QPaintDevice vtable
|
||||
// +0x28: vptr[2] - AC_ResponderTemplateWidget<QWidget> / AC_Responder vtable
|
||||
// +0x68: vptr[3] - TULayoutView vtable
|
||||
//
|
||||
// MEMORY LAYOUT (x64 MSVC, sizeof = 0x120 / 288 bytes):
|
||||
// +0x00: vptr (QObject)
|
||||
// +0x08: QObjectData* d_ptr (QObject)
|
||||
// +0x10: vptr (QPaintDevice)
|
||||
// +0x18: [QWidget internal data ~16 bytes]
|
||||
// +0x28: vptr (AC_ResponderTemplateWidget<QWidget>)
|
||||
// +0x30: AC_Manager* m_actionManager
|
||||
// +0x38: QString m_responderIdentity (24 bytes)
|
||||
// +0x50: QString m_responderDescription (24 bytes)
|
||||
// +0x68: vptr (TULayoutView) ─┐
|
||||
// +0x70: QString m_internalName │ TULayoutView
|
||||
// +0x88: LAY_ToolbarInfo m_toolbarInfo │ embedded
|
||||
// +0xF0: AC_Menu* m_menuByType[2] │ (184 bytes)
|
||||
// +0x100: bool m_initializedFromCopy │
|
||||
// +0x108: QString m_caption ─┘
|
||||
//
|
||||
// KEY VIRTUAL METHOD OVERRIDES IN TUWIDGETLAYOUTVIEW:
|
||||
// From TULayoutView:
|
||||
// - widget() - pure virtual, not implemented (returns _purecall)
|
||||
// - getWidget() const/non-const - returns (this - 104), i.e., the QWidget*
|
||||
// - triggerMenuChanged() - emits menuChanged() signal on QWidget
|
||||
// - isTULayoutView() - empty implementation (RTTI marker)
|
||||
// From QWidget:
|
||||
// - mousePressEvent() - accepts event and sets focus (Qt::MouseFocusReason)
|
||||
// - metaObject(), qt_metacast(), qt_metacall() - Qt meta-object support
|
||||
//
|
||||
// SIGNALS (Qt):
|
||||
// - menuChanged() - emitted by triggerMenuChanged()
|
||||
//
|
||||
// CONSTRUCTOR PARAMETERS:
|
||||
// TUWidgetLayoutView(AC_Manager* manager, const QString& objectName,
|
||||
// QWidget* parent, const char* className,
|
||||
// Qt::WindowFlags flags)
|
||||
//
|
||||
// CONSTRUCTION SEQUENCE:
|
||||
// 1. AC_ResponderTemplateWidget<QWidget> ctor (parent, flags, objectName)
|
||||
// 2. TULayoutView default ctor (at this+104)
|
||||
// 3. Set all 4 vtables to TUWidgetLayoutView vtables
|
||||
// 4. QWidget::setMinimumWidth(150)
|
||||
// 5. If parent and manager: call initActionManager(manager)
|
||||
// Else: store manager at +0x30
|
||||
//
|
||||
// DESTRUCTION SEQUENCE:
|
||||
// 1. Reset vtables
|
||||
// 2. Destroy TULayoutView::m_caption at +0x108
|
||||
// 3. Destroy TULayoutView::m_toolbarInfo at +0x88
|
||||
// 4. Destroy TULayoutView::m_internalName at +0x70
|
||||
// 5. Call AC_ResponderTemplateWidget<QWidget> dtor
|
||||
//
|
||||
// EXPORTED METHODS (ToonBoomLayout.dll):
|
||||
// - ??0TUWidgetLayoutView@@QEAA@... - Constructor
|
||||
// - ??1TUWidgetLayoutView@@UEAA@XZ - Destructor
|
||||
// - ?getWidget@TUWidgetLayoutView@@UEAA/UEBAPEAVQWidget@@XZ - Get QWidget*
|
||||
// - ?mousePressEvent@TUWidgetLayoutView@@MEAAXPEAVQMouseEvent@@@Z
|
||||
// - ?triggerMenuChanged@TUWidgetLayoutView@@MEAAXXZ
|
||||
// - ?menuChanged@TUWidgetLayoutView@@QEAAXXZ - Qt signal
|
||||
// - ?metaObject/qt_metacast/qt_metacall - Qt meta-object methods
|
||||
// - ?tr@TUWidgetLayoutView@@SA?AVQString@@PEBD0H@Z - Translation
|
||||
//
|
||||
// USAGE NOTES:
|
||||
// Since TUWidgetLayoutView has external base classes, you cannot directly
|
||||
// subclass it in user code. Instead:
|
||||
// 1. Obtain TUWidgetLayoutView* from the layout system
|
||||
// 2. Use helper functions to convert between pointer types
|
||||
// 3. Access TULayoutView virtuals through TULayoutView_getLayoutView()
|
||||
// 4. Access QWidget through TUWidgetLayoutView_getWidget()
|
||||
//
|
||||
// @see TULayoutView_getActionManager() for accessing AC_Manager*
|
||||
// @see docs/TUWidgetLayoutView_Analysis.md for detailed analysis
|
||||
// =============================================================================
|
||||
|
||||
// Forward declaration - implemented in ToonBoomLayout.dll
|
||||
// Use the helper functions below for pointer conversion
|
||||
class TUWidgetLayoutView;
|
||||
|
||||
/**
|
||||
* @brief Convert TUWidgetLayoutView* to its embedded TULayoutView*
|
||||
* @param widget Pointer to TUWidgetLayoutView
|
||||
* @return Pointer to embedded TULayoutView at offset +104
|
||||
*/
|
||||
inline TULayoutView *
|
||||
TUWidgetLayoutView_getLayoutView(TUWidgetLayoutView *widget) {
|
||||
return reinterpret_cast<TULayoutView *>(reinterpret_cast<char *>(widget) +
|
||||
104);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert TULayoutView* back to containing TUWidgetLayoutView*
|
||||
* @param view Pointer to TULayoutView (must be embedded in TUWidgetLayoutView)
|
||||
* @return Pointer to containing TUWidgetLayoutView at offset -104
|
||||
*/
|
||||
inline TUWidgetLayoutView *
|
||||
TULayoutView_getWidgetLayoutView(TULayoutView *view) {
|
||||
return reinterpret_cast<TUWidgetLayoutView *>(reinterpret_cast<char *>(view) -
|
||||
104);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the QWidget* from a TUWidgetLayoutView*
|
||||
* @param widget Pointer to TUWidgetLayoutView
|
||||
* @return The QWidget* (same address, different type)
|
||||
*/
|
||||
inline QWidget *TUWidgetLayoutView_getWidget(TUWidgetLayoutView *widget) {
|
||||
return reinterpret_cast<QWidget *>(widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get AC_Manager* from a TULayoutView* embedded in TUWidgetLayoutView
|
||||
*
|
||||
* This function provides access to the AC_Manager instance for views that
|
||||
* inherit from TUWidgetLayoutView. The AC_Manager is stored in the
|
||||
* AC_ResponderTemplateWidget<QWidget> base class at offset +48, which is
|
||||
* offset -56 from the embedded TULayoutView*.
|
||||
*
|
||||
* @note This only works for TULayoutView instances that are embedded in
|
||||
* TUWidgetLayoutView. Direct TULayoutView subclasses do NOT have
|
||||
* an AC_Manager member.
|
||||
*
|
||||
* @param view Pointer to TULayoutView (must be embedded in TUWidgetLayoutView)
|
||||
* @return AC_Manager* or nullptr if invalid
|
||||
*
|
||||
* @code
|
||||
* // Example usage in a toolbar() override:
|
||||
* QDomElement MyView::toolbar() {
|
||||
* AC_Manager* manager = TULayoutView_getActionManager(this);
|
||||
* if (manager) {
|
||||
* // Use manager->getToolbarElement(...) to get toolbar definition
|
||||
* }
|
||||
* return QDomElement();
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
inline AC_Manager *TULayoutView_getActionManager(TULayoutView *view) {
|
||||
// AC_Manager is at offset +48 in TUWidgetLayoutView
|
||||
// TULayoutView is embedded at offset +104 in TUWidgetLayoutView
|
||||
// So from TULayoutView*, AC_Manager** is at offset -56 (= 48 - 104)
|
||||
return *reinterpret_cast<AC_Manager **>(reinterpret_cast<char *>(view) - 56);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Container widget that holds 1-2 TULayoutView instances
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user