Add close/delete window function aliases for upstream

pull/562/head
Jonathan G Rennison 11 months ago
parent 01c6705339
commit 87ee18b6b9

@ -1172,6 +1172,11 @@ Window::~Window()
const_cast<volatile WindowClass &>(this->window_class) = WC_INVALID;
}
void Window::Close()
{
if (this->window_class != WC_INVALID) delete this;
}
/**
* Find a window by its class and window number
* @param cls Window class

@ -45,6 +45,10 @@ void DeleteNetworkClientWindows();
void HideVitalWindows();
void ShowVitalWindows();
inline void CloseNonVitalWindows() { DeleteNonVitalWindows(); }
inline void CloseAllNonVitalWindows() { DeleteAllNonVitalWindows(); }
inline void CloseConstructionWindows() { DeleteConstructionWindows(); }
/**
* Re-initialize all windows.
* @param zoom_changed Set if windows are being re-initialized due to a zoom level changed.
@ -59,6 +63,9 @@ void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true);
void DeleteAllWindowsById(WindowClass cls, WindowNumber number, bool force = true);
void DeleteWindowByClass(WindowClass cls);
inline void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true) { DeleteWindowById(cls, number, force); }
inline void CloseWindowByClass(WindowClass cls) { DeleteWindowByClass(cls); }
bool FocusWindowById(WindowClass cls, WindowNumber number);
bool EditBoxInGlobalFocus();

@ -289,6 +289,8 @@ public:
virtual ~Window();
virtual void Close();
/**
* Helper allocation function to disallow something.
* Don't allow arrays; arrays of Windows are pointless as you need
@ -520,6 +522,7 @@ public:
static int SortButtonWidth();
void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
inline void CloseChildWindows(WindowClass wc = WC_INVALID) const { this->DeleteChildWindows(wc); }
void SetDirty();
void SetDirtyAsBlocks();

Loading…
Cancel
Save