/* OmniaFramework - A collection of useful functionality Copyright (C) 2025 OmniaX-Dev This file is part of OmniaFramework. OmniaFramework is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OmniaFramework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OmniaFramework. If not, see . */ #include "RootWidget.hpp" #include "../../render/BasicRenderer.hpp" #include "../Window.hpp" namespace ogfx { namespace gui { namespace widgets { RootWidget::RootWidget(WindowCore& window) : Widget({ 0, 0, 0, 0 }, window) { setRootChild(); setSize(cast(window.getWindowWidth()), cast(window.getWindowHeight())); setStylesheetCategoryName("window"); setTypeName("ogfx::gui::widgets::RootWidget"); } void RootWidget::onWindowResized(const Event& event) { setSize(cast(event.windowResized->new_width), cast(event.windowResized->new_height)); } void RootWidget::applyTheme(const ostd::Stylesheet& theme) { m_color = getThemeValue(theme, "backgroundColor", getWindow().getClearColor()); } void RootWidget::onDraw(ogfx::BasicRenderer2D& gfx) { gfx.fillRect({ 0, 0, cast(getWindow().getWindowWidth()), cast(getWindow().getWindowHeight()) }, m_color); } } } }