1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:55:08 +00:00
serenity/Applications/Taskbar/TaskbarWindow.cpp
2019-04-03 21:04:16 +02:00

41 lines
960 B
C++

#include "TaskbarWindow.h"
#include "TaskbarWidget.h"
#include <LibGUI/GWindow.h>
#include <LibGUI/GDesktop.h>
#include <LibGUI/GEventLoop.h>
#include <WindowServer/WSAPITypes.h>
#include <stdio.h>
TaskbarWindow::TaskbarWindow()
{
set_window_type(GWindowType::Taskbar);
set_title("Taskbar");
set_should_exit_event_loop_on_close(true);
on_screen_rect_change(GDesktop::the().rect());
GDesktop::the().on_rect_change = [this] (const Rect& rect) { on_screen_rect_change(rect); };
auto* widget = new TaskbarWidget;
set_main_widget(widget);
}
TaskbarWindow::~TaskbarWindow()
{
}
void TaskbarWindow::on_screen_rect_change(const Rect& rect)
{
Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() };
set_rect(new_rect);
}
void TaskbarWindow::wm_event(GWMEvent& event)
{
#if 0
switch (event.type()) {
case GEvent::WM_WindowAdded:
m_window_list.append({})
}
#endif
}