From 532f7de1f84c5b747229016577c081f87b76cfa4 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Fri, 3 Jan 2025 10:07:04 +0100 Subject: [PATCH] Codechange: make direct access to tooltip/widget_data protected --- src/widget.cpp | 2 +- src/widget_type.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index 1ecfd25e86..9dfe2b9e9d 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -3142,7 +3142,7 @@ static bool IsAttributeWidgetPartType(WidgetType tp) * @param dest NWidget to apply attribute to. * @pre NWidgetPart must be an attribute NWidgetPart. */ -static void ApplyNWidgetPartAttribute(const NWidgetPart &nwid, NWidgetBase *dest) +void ApplyNWidgetPartAttribute(const NWidgetPart &nwid, NWidgetBase *dest) { switch (nwid.type) { case WPT_RESIZE: { diff --git a/src/widget_type.h b/src/widget_type.h index 6385c6153d..15530259d4 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -400,14 +400,18 @@ public: NWidgetDisplay disp_flags; ///< Flags that affect display and interaction with the widget. Colours colour; ///< Colour of this widget. +protected: const WidgetID index; ///< Index of the nested widget (\c -1 means 'not used'). WidgetData widget_data; ///< Data of the widget. @see Widget::data - StringID tool_tip; ///< Tooltip of the widget. @see Widget::tootips + StringID tool_tip; ///< Tooltip of the widget. @see Widget::tool_tips WidgetID scrollbar_index; ///< Index of an attached scrollbar. TextColour highlight_colour; ///< Colour of highlight. TextColour text_colour; ///< Colour of text within widget. FontSize text_size; ///< Size of text within widget. StringAlignment align; ///< Alignment of text/image within widget. + + /* This function constructs the widgets, so it should be able to write the variables. */ + friend void ApplyNWidgetPartAttribute(const struct NWidgetPart &nwid, NWidgetBase *dest); }; /**