Codechange: Use unified NWidgetContainer methods instead of duplicating.

Most NWidgetContainer derivatives implemented Draw() and GetWidgetFromPos()
the same way. Move this these to NWidgetContainer itself to avoid repeating.
This commit is contained in:
2023-10-19 19:58:43 +01:00
committed by Peter Nelson
parent af41c5cb4e
commit 59a2abd298
5 changed files with 22 additions and 69 deletions

View File

@@ -412,6 +412,9 @@ public:
void Add(NWidgetBase *wid);
void FillNestedArray(NWidgetBase **array, uint length) override;
void Draw(const Window *w) override;
NWidgetCore *GetWidgetFromPos(int x, int y) override;
/** Return whether the container is empty. */
inline bool IsEmpty() { return head == nullptr; }
@@ -480,9 +483,6 @@ public:
void AdjustPaddingForZoom() override;
void SetPIP(uint8_t pip_pre, uint8_t pip_inter, uint8_t pip_post);
void Draw(const Window *w) override;
NWidgetCore *GetWidgetFromPos(int x, int y) override;
protected:
NWidContainerFlags flags; ///< Flags of the container.
uint8_t pip_pre; ///< Amount of space before first widget.