diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-21 16:14:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-21 16:14:40 +0200 |
commit | 6048e245ee807f5520685d0e4751059676e24ed1 (patch) | |
tree | 36d20a2c232b39b08a64262f5d99ffa331aabe01 /Userland/Applications/3DFileViewer | |
parent | 8a3e6225382f90b633dd4079b16c66d4d98f5646 (diff) | |
download | serenity-6048e245ee807f5520685d0e4751059676e24ed1.zip |
3DFileViewer: Make the main widget a GUI::Frame
Diffstat (limited to 'Userland/Applications/3DFileViewer')
-rw-r--r-- | Userland/Applications/3DFileViewer/main.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index cb12a42431..75c1d8f591 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -27,8 +27,9 @@ static constexpr u16 RENDER_WIDTH = 640; static constexpr u16 RENDER_HEIGHT = 480; -class GLContextWidget final : public GUI::Widget { - C_OBJECT(GLContextWidget) +class GLContextWidget final : public GUI::Frame { + C_OBJECT(GLContextWidget); + public: bool load(const String& fname); @@ -74,9 +75,11 @@ private: void GLContextWidget::paint_event(GUI::PaintEvent& event) { + GUI::Frame::paint_event(event); + GUI::Painter painter(*this); painter.add_clip_rect(event.rect()); - painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect()); + painter.draw_scaled_bitmap(frame_inner_rect(), *m_bitmap, m_bitmap->rect()); } void GLContextWidget::timer_event(Core::TimerEvent&) @@ -151,10 +154,9 @@ int main(int argc, char** argv) // Construct the main window auto window = GUI::Window::construct(); auto app_icon = GUI::Icon::default_icon("app-3d-file-viewer"); - window->set_icon(app_icon.bitmap_for_size(16)); window->set_title("3D File Viewer"); - window->resize(640, 480); + window->resize(640 + 4, 480 + 4); window->set_resizable(false); window->set_double_buffering_enabled(true); auto& widget = window->set_main_widget<GLContextWidget>(); |