mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
PaintBrush: Add a PaletteWidget to allow color selection.
Also use different colors for left/right mouse button. :^)
This commit is contained in:
parent
642c82fbff
commit
f86b1bdca1
6 changed files with 82 additions and 9 deletions
31
Applications/PaintBrush/PaletteWidget.cpp
Normal file
31
Applications/PaintBrush/PaletteWidget.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "PaletteWidget.h"
|
||||
#include "PaintableWidget.h"
|
||||
|
||||
PaletteWidget::PaletteWidget(PaintableWidget& paintable_widget, GWidget* parent)
|
||||
: GFrame(parent)
|
||||
{
|
||||
set_frame_shape(FrameShape::Panel);
|
||||
set_frame_shadow(FrameShadow::Raised);
|
||||
set_frame_thickness(1);
|
||||
set_fill_with_background_color(true);
|
||||
set_background_color(Color::LightGray);
|
||||
|
||||
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
set_preferred_size({ 0, 32 });
|
||||
|
||||
auto* secondary_color_widget = new GWidget(this);
|
||||
secondary_color_widget->set_relative_rect({ 2, 2, 60, 28 });
|
||||
secondary_color_widget->set_fill_with_background_color(true);
|
||||
secondary_color_widget->set_background_color(paintable_widget.secondary_color());
|
||||
|
||||
auto* primary_color_widget = new GWidget(this);
|
||||
Rect rect { 0, 0, 38, 14 };
|
||||
rect.center_within(secondary_color_widget->relative_rect());
|
||||
primary_color_widget->set_relative_rect(rect);
|
||||
primary_color_widget->set_fill_with_background_color(true);
|
||||
primary_color_widget->set_background_color(paintable_widget.primary_color());
|
||||
}
|
||||
|
||||
PaletteWidget::~PaletteWidget()
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue