1/*
2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors.
3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com>
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#pragma once
10#include <libfoundation/Logger.h>
11#include <libg/Context.h>
12#include <libg/PixelBitmap.h>
13#include <libg/Point.h>
14#include <vector>
15
16namespace WinServer {
17
18class ControlBar {
19public:
20 inline static ControlBar& the()
21 {
22 extern ControlBar* s_WinServer_ControlBar_the;
23 return *s_WinServer_ControlBar_the;
24 }
25
26 ControlBar();
27
28 static constexpr size_t height() { return 20; }
29 static constexpr size_t padding() { return 4; }
30 static constexpr size_t menubar_content_offset() { return 20; }
31
32 size_t width() const { return m_bounds.width(); }
33 LG::Rect& bounds() { return m_bounds; }
34 const LG::Rect& bounds() const { return m_bounds; }
35 const LG::Rect& control_button_bounds() const { return m_button_bounds; }
36
37 [[gnu::always_inline]] inline void draw(LG::Context& ctx)
38 {
39 ctx.draw({ control_button_bounds().min_x(), control_button_bounds().min_y() }, m_menu_icon);
40 }
41
42private:
43 LG::Rect m_bounds;
44 LG::Rect m_button_bounds;
45 LG::PixelBitmap m_menu_icon;
46};
47
48} // namespace WinServer