Chromium Code Reviews| Index: ui/views/color_chooser/color_chooser_view.h |
| diff --git a/ui/views/color_chooser/color_chooser_view.h b/ui/views/color_chooser/color_chooser_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..844898f1ae8338e5c7a2389739a40c89eab7bf8b |
| --- /dev/null |
| +++ b/ui/views/color_chooser/color_chooser_view.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ |
| +#define UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "third_party/skia/include/core/SkColor.h" |
| +#include "third_party/skia/include/core/SkScalar.h" |
| +#include "ui/views/controls/textfield/textfield_controller.h" |
| +#include "ui/views/views_export.h" |
| +#include "ui/views/widget/widget_delegate.h" |
| + |
| +namespace views { |
| + |
| +class ColorChooserListener; |
| +class KeyEvent; |
| +class Textfield; |
| + |
| +// Pure views implementation of color chooser UI. |
|
Peter Kasting
2012/06/18 21:24:03
More comments would be nice, especially something
Jun Mukai
2012/06/19 08:40:01
Done.
|
| +class VIEWS_EXPORT ColorChooserView : public WidgetDelegateView, |
|
Peter Kasting
2012/06/18 21:24:03
Nit: Alphabetical order
tfarina
2012/06/18 21:45:41
I know the order doesn't matter, but I tend to thi
Peter Kasting
2012/06/19 00:48:40
It IS-A TextfieldController too. That's what inhe
Jun Mukai
2012/06/19 08:40:01
Either is fine to me. As far as I see in the disc
|
| + public TextfieldController { |
| + public: |
| + ColorChooserView(ColorChooserListener* listener, SkColor initial_color); |
| + virtual ~ColorChooserView(); |
| + |
| + // Called when its owning window is closed. |
| + void OnOwningWindowClosed(); |
| + |
| + // Called when its color value is changed in the web contents. |
| + void OnColorChanged(SkColor color); |
| + |
| + // Called when the user chooses a hue from the UI. |
| + void OnHueChosen(float hue); |
| + |
| + // Called when the user chooses saturation/value from the UI. |
| + void OnSaturationValueChosen(float saturation, float value); |
| + |
| + float hue() const { return hsv_[0]; } |
| + float saturation() const { return hsv_[1]; } |
| + float value() const { return hsv_[2]; } |
| + |
| + private: |
| + class HueView; |
| + class SaturationValueView; |
| + |
| + // WidgetDelegate overrides: |
| + virtual ui::ModalType GetModalType() const OVERRIDE; |
| + virtual void WindowClosing() OVERRIDE; |
| + virtual View* GetContentsView() OVERRIDE; |
| + |
| + // TextfieldController overrides: |
| + virtual void ContentsChanged(Textfield* sender, |
| + const string16& new_contents) OVERRIDE; |
| + virtual bool HandleKeyEvent(Textfield* sender, |
| + const KeyEvent& key_event) OVERRIDE; |
| + |
| + SkScalar hsv_[3]; |
| + ColorChooserListener* listener_; |
| + HueView* hue_; |
| + SaturationValueView* saturation_value_; |
| + Textfield* textfield_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ColorChooserView); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ |