mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
1682f0b760
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
/*
|
||
* Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
|
||
*
|
||
* SPDX-License-Identifier: BSD-2-Clause
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#include <AK/Function.h>
|
||
#include <LibGUI/TextEditor.h>
|
||
|
||
namespace GUI {
|
||
|
||
class ColorInput final : public TextEditor {
|
||
C_OBJECT(ColorInput);
|
||
|
||
public:
|
||
virtual ~ColorInput() override;
|
||
|
||
bool has_alpha_channel() const { return m_color_has_alpha_channel; }
|
||
void set_color_has_alpha_channel(bool has_alpha) { m_color_has_alpha_channel = has_alpha; }
|
||
|
||
void set_color(Color);
|
||
Color color() { return m_color; }
|
||
|
||
void set_color_picker_title(String title) { m_color_picker_title = move(title); }
|
||
String color_picker_title() { return m_color_picker_title; }
|
||
|
||
Function<void()> on_change;
|
||
|
||
protected:
|
||
virtual void mousedown_event(MouseEvent&) override;
|
||
virtual void mouseup_event(MouseEvent&) override;
|
||
virtual void mousemove_event(MouseEvent&) override;
|
||
virtual void paint_event(PaintEvent&) override;
|
||
|
||
private:
|
||
ColorInput();
|
||
|
||
Gfx::IntRect color_rect() const;
|
||
void set_color_without_changing_text(Color);
|
||
|
||
Color m_color;
|
||
String m_color_picker_title { "Select color" };
|
||
bool m_color_has_alpha_channel { true };
|
||
bool m_may_be_color_rect_click { false };
|
||
};
|
||
|
||
}
|