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..ef9e92133c2dd1c866dc5d54f57c307eec861d7c |
--- /dev/null |
+++ b/ui/views/color_chooser/color_chooser_view.h |
@@ -0,0 +1,68 @@ |
+// 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 "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. |
+class VIEWS_EXPORT ColorChooserView : public views::WidgetDelegateView, |
tfarina
2012/05/25 19:37:38
nit: remove views:: throughout in this file and in
Jun Mukai
2012/05/25 19:47:38
Done.
|
+ public views::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; |
+ |
+ // views::WidgetDelegate overrides: |
+ virtual ui::ModalType GetModalType() const OVERRIDE; |
tfarina
2012/05/25 19:37:38
nit: please include compiler_specific.h for OVERRI
Jun Mukai
2012/05/25 19:47:38
Done.
|
+ virtual void WindowClosing() OVERRIDE; |
+ virtual views::View* GetContentsView() OVERRIDE; |
+ |
+ // views::TextfieldController overrides: |
+ virtual void ContentsChanged(views::Textfield* sender, |
+ const string16& new_contents) OVERRIDE; |
+ virtual bool HandleKeyEvent(views::Textfield* sender, |
+ const views::KeyEvent& key_event) OVERRIDE; |
+ |
+ SkScalar hsv_[3]; |
+ ColorChooserListener* listener_; |
+ HueView* hue_; |
+ SaturationValueView* saturation_value_; |
+ views::Textfield* textfield_; |
+}; |
tfarina
2012/05/25 19:37:38
DISALLOW_COPY_AND_ASSIGN and basictypes.h
Jun Mukai
2012/05/25 19:47:38
Done.
|
+ |
+} // namespace views |
+ |
+#endif // UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ |