#include "dl_ui_window.h" #ifndef DL_DISABLE_RENDER #include "dl_ui_manager.h" namespace dl::UI { void Window::_init() { _panel = g_ui->CreatePanel(); _panel->SetAutoRun(false); _panel->SetOrderMode(Panel::FORCE); } Window::~Window() { g_ui->DeletePanel(_panel, true); g_ui->_release_window(this); } void Window::SetBackground(UI::Background* bg, bool auto_size) { if (_bg) _panel->Del(_bg); _bg = bg; if (auto_size) { _bg->GetElementData()._bParentW = true; _bg->GetElementData()._bParentH = true; } _drag._bControlPanel = true; _bg->GetCpt()->PushBack(&_drag); _panel->Add(bg); _refresh_order_bg(_panel->GetOrder()); } void Window::SetButtonClose(UI::Button* btn) { if (_btnClose) _panel->Del(_btnClose); _panel->Add(btn); _btnClose = btn; _refresh_order_btn_close(_panel->GetOrder()); } void Window::SetVisible(bool visible) { _bVisible = visible; if(_bInManager) g_ui->_on_window_show_change(this, _bVisible); } } #endif