OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ | |
6 #define UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "third_party/skia/include/core/SkColor.h" | |
12 #include "third_party/skia/include/core/SkScalar.h" | |
13 #include "ui/views/controls/textfield/textfield_controller.h" | |
14 #include "ui/views/views_export.h" | |
15 #include "ui/views/widget/widget_delegate.h" | |
16 | |
17 namespace views { | |
18 | |
19 class ColorChooserListener; | |
20 class KeyEvent; | |
21 class Textfield; | |
22 | |
23 // 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.
| |
24 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
| |
25 public TextfieldController { | |
26 public: | |
27 ColorChooserView(ColorChooserListener* listener, SkColor initial_color); | |
28 virtual ~ColorChooserView(); | |
29 | |
30 // Called when its owning window is closed. | |
31 void OnOwningWindowClosed(); | |
32 | |
33 // Called when its color value is changed in the web contents. | |
34 void OnColorChanged(SkColor color); | |
35 | |
36 // Called when the user chooses a hue from the UI. | |
37 void OnHueChosen(float hue); | |
38 | |
39 // Called when the user chooses saturation/value from the UI. | |
40 void OnSaturationValueChosen(float saturation, float value); | |
41 | |
42 float hue() const { return hsv_[0]; } | |
43 float saturation() const { return hsv_[1]; } | |
44 float value() const { return hsv_[2]; } | |
45 | |
46 private: | |
47 class HueView; | |
48 class SaturationValueView; | |
49 | |
50 // WidgetDelegate overrides: | |
51 virtual ui::ModalType GetModalType() const OVERRIDE; | |
52 virtual void WindowClosing() OVERRIDE; | |
53 virtual View* GetContentsView() OVERRIDE; | |
54 | |
55 // TextfieldController overrides: | |
56 virtual void ContentsChanged(Textfield* sender, | |
57 const string16& new_contents) OVERRIDE; | |
58 virtual bool HandleKeyEvent(Textfield* sender, | |
59 const KeyEvent& key_event) OVERRIDE; | |
60 | |
61 SkScalar hsv_[3]; | |
62 ColorChooserListener* listener_; | |
63 HueView* hue_; | |
64 SaturationValueView* saturation_value_; | |
65 Textfield* textfield_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ColorChooserView); | |
68 }; | |
69 | |
70 } // namespace views | |
71 | |
72 #endif // UI_VIEWS_COLOR_CHOOSER_COLOR_CHOOSER_VIEW_H_ | |
OLD | NEW |