chromium/ui/views/color_chooser/color_chooser_view.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/color_chooser/color_chooser_view.h"

#include <stdint.h>

#include <algorithm>
#include <memory>
#include <string>
#include <utility>

#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_shader.h"
#include "skia/ext/skia_utils_base.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/native_theme/native_theme.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/color_chooser/color_chooser_listener.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"

namespace {

constexpr int kHueBarWidth =;
constexpr int kSaturationValueSize =;
constexpr int kMarginWidth =;
constexpr int kSaturationValueIndicatorSize =;
constexpr int kHueIndicatorSize =;
constexpr int kBorderWidth =;
constexpr int kTextfieldLengthInChars =;

std::u16string GetColorText(SkColor color) {}

bool GetColorFromText(const std::u16string& text, SkColor* result) {}

// A view that processes mouse events and gesture events using a common
// interface.
class LocatedEventHandlerView : public views::View {};

BEGIN_METADATA()

void DrawGradientRect(const gfx::Rect& rect,
                      SkColor start_color,
                      SkColor end_color,
                      bool is_horizontal,
                      gfx::Canvas* canvas) {}

}  // namespace

namespace views {

////////////////////////////////////////////////////////////////////////////////
// HueView
//
// The class to choose the hue of the color.  It draws a vertical bar and
// the indicator for the currently selected hue.
class HueView : public LocatedEventHandlerView {};

HueView::HueView(const HueChangedCallback& changed_callback)
    :{}

void HueView::OnThemeChanged() {}

void HueView::OnHueChanged(SkScalar hue) {}

void HueView::ProcessEventAtLocation(const gfx::Point& point) {}

gfx::Size HueView::CalculatePreferredSize(
    const SizeBounds& /*available_size*/) const {}

void HueView::OnPaint(gfx::Canvas* canvas) {}

BEGIN_METADATA()

////////////////////////////////////////////////////////////////////////////////
// SaturationValueView
//
// The class to choose the saturation and the value of the color.  It draws
// a square area and the indicator for the currently selected saturation and
// value.
class SaturationValueView : public LocatedEventHandlerView {};

SaturationValueView::SaturationValueView(
    const SaturationValueChangedCallback& changed_callback)
    :{}

void SaturationValueView::OnThemeChanged() {}

void SaturationValueView::OnHueChanged(SkScalar hue) {}

void SaturationValueView::OnSaturationValueChanged(SkScalar saturation,
                                                   SkScalar value) {}

void SaturationValueView::ProcessEventAtLocation(const gfx::Point& point) {}

gfx::Size SaturationValueView::CalculatePreferredSize(
    const SizeBounds& /*available_size*/) const {}

void SaturationValueView::OnPaint(gfx::Canvas* canvas) {}

void SaturationValueView::UpdateMarkerColor() {}

BEGIN_METADATA()

////////////////////////////////////////////////////////////////////////////////
// SelectedColorPatchView
//
// A view to simply show the selected color in a rectangle.
class SelectedColorPatchView : public views::View {};

SelectedColorPatchView::SelectedColorPatchView() {}

void SelectedColorPatchView::SetColor(SkColor color) {}

BEGIN_METADATA()

std::unique_ptr<View> ColorChooser::BuildView() {}

bool ColorChooser::IsViewAttached() const {}

void ColorChooser::OnColorChanged(SkColor color) {}

void ColorChooser::OnHueChosen(SkScalar hue) {}

void ColorChooser::OnSaturationValueChosen(SkScalar saturation,
                                           SkScalar value) {}

View* ColorChooser::hue_view_for_testing() {}

View* ColorChooser::saturation_value_view_for_testing() {}

Textfield* ColorChooser::textfield_for_testing() {}

View* ColorChooser::selected_color_patch_for_testing() {}

void ColorChooser::ContentsChanged(Textfield* sender,
                                   const std::u16string& new_contents) {}

bool ColorChooser::HandleKeyEvent(Textfield* sender,
                                  const ui::KeyEvent& key_event) {}

std::unique_ptr<WidgetDelegate> ColorChooser::MakeWidgetDelegate() {}

ColorChooser::ColorChooser(ColorChooserListener* listener, SkColor initial)
    :{}

ColorChooser::~ColorChooser() {}

void ColorChooser::SetColor(SkColor color) {}

void ColorChooser::SetHue(SkScalar hue) {}

void ColorChooser::SetSaturationValue(SkScalar saturation, SkScalar value) {}

SkColor ColorChooser::GetColor() const {}

void ColorChooser::OnViewClosing() {}

}  // namespace views