2020-01-18 03:38:21 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2019-04-05 09:54:56 -04:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-14 18:10:34 -05:00
|
|
|
#include <AK/Forward.h>
|
2019-07-24 03:04:57 -04:00
|
|
|
#include <AK/NonnullOwnPtrVector.h>
|
2020-02-14 18:10:34 -05:00
|
|
|
#include <LibGfx/Forward.h>
|
2020-08-09 13:29:15 -04:00
|
|
|
#include <LibGfx/WindowTheme.h>
|
2020-02-06 05:56:38 -05:00
|
|
|
|
2020-02-06 14:03:37 -05:00
|
|
|
namespace WindowServer {
|
2019-04-05 09:54:56 -04:00
|
|
|
|
2020-02-06 14:03:37 -05:00
|
|
|
class Button;
|
|
|
|
class MouseEvent;
|
|
|
|
class Window;
|
|
|
|
|
|
|
|
class WindowFrame {
|
2019-04-05 09:54:56 -04:00
|
|
|
public:
|
2020-02-06 14:03:37 -05:00
|
|
|
WindowFrame(Window&);
|
|
|
|
~WindowFrame();
|
2019-04-05 09:54:56 -04:00
|
|
|
|
2020-06-10 04:57:59 -04:00
|
|
|
Gfx::IntRect rect() const;
|
2020-02-06 05:56:38 -05:00
|
|
|
void paint(Gfx::Painter&);
|
2020-02-06 14:03:37 -05:00
|
|
|
void on_mouse_event(const MouseEvent&);
|
2020-06-10 04:57:59 -04:00
|
|
|
void notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect);
|
2019-04-05 15:53:45 -04:00
|
|
|
void invalidate_title_bar();
|
2020-08-18 00:45:10 -04:00
|
|
|
void invalidate(Gfx::IntRect relative_rect);
|
2019-04-05 09:54:56 -04:00
|
|
|
|
2020-06-10 04:57:59 -04:00
|
|
|
Gfx::IntRect title_bar_rect() const;
|
|
|
|
Gfx::IntRect title_bar_icon_rect() const;
|
|
|
|
Gfx::IntRect title_bar_text_rect() const;
|
2019-04-05 09:54:56 -04:00
|
|
|
|
2020-02-06 14:03:37 -05:00
|
|
|
void did_set_maximized(Badge<Window>, bool);
|
2019-06-02 09:35:00 -04:00
|
|
|
|
2020-07-25 07:34:43 -04:00
|
|
|
void layout_buttons();
|
2020-07-29 16:22:05 -04:00
|
|
|
void set_button_icons();
|
2020-07-25 07:34:43 -04:00
|
|
|
|
2019-05-12 15:32:02 -04:00
|
|
|
private:
|
2020-03-30 11:00:23 -04:00
|
|
|
void paint_notification_frame(Gfx::Painter&);
|
|
|
|
void paint_normal_frame(Gfx::Painter&);
|
|
|
|
|
2020-08-09 13:29:15 -04:00
|
|
|
Gfx::WindowTheme::WindowState window_state_for_theme() const;
|
2020-03-30 11:00:23 -04:00
|
|
|
|
2020-02-06 14:03:37 -05:00
|
|
|
Window& m_window;
|
|
|
|
NonnullOwnPtrVector<Button> m_buttons;
|
2020-07-29 16:22:05 -04:00
|
|
|
Button* m_close_button { nullptr };
|
2020-02-06 14:03:37 -05:00
|
|
|
Button* m_maximize_button { nullptr };
|
|
|
|
Button* m_minimize_button { nullptr };
|
2019-04-05 09:54:56 -04:00
|
|
|
};
|
2020-02-06 14:03:37 -05:00
|
|
|
|
|
|
|
}
|