2020-08-09 19:28:36 +02:00
|
|
|
/*
|
2020-08-10 20:44:36 +02:00
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
2020-08-09 19:28:36 +02:00
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
|
*
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
|
|
|
|
#include <LibGfx/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
|
|
|
|
|
class WindowTheme {
|
|
|
|
|
public:
|
|
|
|
|
enum class WindowType {
|
|
|
|
|
Normal,
|
2021-02-16 16:10:39 +01:00
|
|
|
ToolWindow,
|
2020-08-09 19:28:36 +02:00
|
|
|
Notification,
|
2020-08-10 13:03:44 +02:00
|
|
|
Other,
|
2020-08-09 19:28:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class WindowState {
|
|
|
|
|
Active,
|
|
|
|
|
Inactive,
|
|
|
|
|
Highlighted,
|
|
|
|
|
Moving,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual ~WindowTheme();
|
|
|
|
|
|
|
|
|
|
static WindowTheme& current();
|
|
|
|
|
|
2021-03-25 21:01:19 +01:00
|
|
|
virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect, int menu_row_count) const = 0;
|
2021-02-16 16:10:39 +01:00
|
|
|
virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Palette&, const IntRect& leftmost_button_rect) const = 0;
|
2020-08-23 13:17:34 +02:00
|
|
|
virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const = 0;
|
2020-08-09 19:28:36 +02:00
|
|
|
|
2021-04-18 15:35:57 +02:00
|
|
|
virtual int titlebar_height(WindowType, const Palette&) const = 0;
|
|
|
|
|
virtual IntRect titlebar_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
|
|
|
|
|
virtual IntRect titlebar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
|
|
|
|
|
virtual IntRect titlebar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
|
2020-08-09 19:28:36 +02:00
|
|
|
|
2021-03-31 23:26:32 +02:00
|
|
|
virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0;
|
2021-03-25 21:01:19 +01:00
|
|
|
|
|
|
|
|
virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0;
|
2020-08-10 13:03:44 +02:00
|
|
|
|
2020-08-25 18:13:32 -04:00
|
|
|
virtual Vector<IntRect> layout_buttons(WindowType, const IntRect& window_rect, const Palette&, size_t buttons) const = 0;
|
2021-02-08 17:27:51 -07:00
|
|
|
virtual bool is_simple_rect_frame() const = 0;
|
2021-02-12 14:25:08 -07:00
|
|
|
virtual bool frame_uses_alpha(WindowState, const Palette&) const = 0;
|
2021-02-14 16:42:37 -07:00
|
|
|
virtual float frame_alpha_hit_threshold(WindowState) const = 0;
|
2020-08-25 18:13:32 -04:00
|
|
|
|
2020-08-09 19:28:36 +02:00
|
|
|
protected:
|
|
|
|
|
WindowTheme() { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|