mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:52:44 +00:00 
			
		
		
		
	 02d94a303c
			
		
	
	
		02d94a303c
		
	
	
	
	
		
			
			Corrects a slew of titles, buttons, labels, menu items and status bars for capitalization, ellipses and punctuation. Rewords a few actions and dialogs to use uniform language and punctuation.
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | ||
|  * Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
 | ||
|  * Copyright (c) 2022, the SerenityOS developers.
 | ||
|  *
 | ||
|  * 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 = default;
 | ||
| 
 | ||
|     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, AllowCallback = AllowCallback::Yes);
 | ||
|     Color color() { return m_color; }
 | ||
| 
 | ||
|     void set_color_picker_title(DeprecatedString title) { m_color_picker_title = move(title); }
 | ||
|     DeprecatedString 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_internal(Color, AllowCallback, bool change_text);
 | ||
| 
 | ||
|     Color m_color;
 | ||
|     DeprecatedString m_color_picker_title { "Color Picker" };
 | ||
|     bool m_color_has_alpha_channel { true };
 | ||
|     bool m_may_be_color_rect_click { false };
 | ||
| };
 | ||
| 
 | ||
| }
 |