OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_CONTROLS_LINK_H_ | 5 #ifndef UI_VIEWS_CONTROLS_LINK_H_ |
6 #define UI_VIEWS_CONTROLS_LINK_H_ | 6 #define UI_VIEWS_CONTROLS_LINK_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 #include "ui/views/controls/label.h" | 11 #include "ui/views/controls/label.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 class LinkListener; | 15 class LinkListener; |
16 | 16 |
17 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
18 // | 18 // |
19 // Link class | 19 // Link class |
20 // | 20 // |
21 // A Link is a label subclass that looks like an HTML link. It has a | 21 // A Link is a label subclass that looks like an HTML link. It has a |
22 // controller which is notified when a click occurs. | 22 // controller which is notified when a click occurs. |
23 // | 23 // |
24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
25 class VIEWS_EXPORT Link : public Label { | 25 class VIEWS_EXPORT Link : public Label { |
26 public: | 26 public: |
27 Link(); | 27 Link(); |
28 explicit Link(const base::string16& title); | 28 explicit Link(const base::string16& title); |
29 virtual ~Link(); | 29 ~Link() override; |
30 | 30 |
31 static SkColor GetDefaultEnabledColor(); | 31 static SkColor GetDefaultEnabledColor(); |
32 | 32 |
33 const LinkListener* listener() { return listener_; } | 33 const LinkListener* listener() { return listener_; } |
34 void set_listener(LinkListener* listener) { listener_ = listener; } | 34 void set_listener(LinkListener* listener) { listener_ = listener; } |
35 | 35 |
36 // Label: | 36 // Label: |
37 virtual const char* GetClassName() const override; | 37 const char* GetClassName() const override; |
38 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 38 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
39 virtual bool CanProcessEventsWithinSubtree() const override; | 39 bool CanProcessEventsWithinSubtree() const override; |
40 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 40 bool OnMousePressed(const ui::MouseEvent& event) override; |
41 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; | 41 bool OnMouseDragged(const ui::MouseEvent& event) override; |
42 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 42 void OnMouseReleased(const ui::MouseEvent& event) override; |
43 virtual void OnMouseCaptureLost() override; | 43 void OnMouseCaptureLost() override; |
44 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 44 bool OnKeyPressed(const ui::KeyEvent& event) override; |
45 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 45 void OnGestureEvent(ui::GestureEvent* event) override; |
46 virtual bool SkipDefaultKeyEventProcessing( | 46 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; |
47 const ui::KeyEvent& event) override; | 47 void GetAccessibleState(ui::AXViewState* state) override; |
48 virtual void GetAccessibleState(ui::AXViewState* state) override; | 48 void OnEnabledChanged() override; |
49 virtual void OnEnabledChanged() override; | 49 void OnFocus() override; |
50 virtual void OnFocus() override; | 50 void OnBlur() override; |
51 virtual void OnBlur() override; | 51 void SetFontList(const gfx::FontList& font_list) override; |
52 virtual void SetFontList(const gfx::FontList& font_list) override; | 52 void SetText(const base::string16& text) override; |
53 virtual void SetText(const base::string16& text) override; | 53 void SetEnabledColor(SkColor color) override; |
54 virtual void SetEnabledColor(SkColor color) override; | |
55 | 54 |
56 void SetPressedColor(SkColor color); | 55 void SetPressedColor(SkColor color); |
57 void SetUnderline(bool underline); | 56 void SetUnderline(bool underline); |
58 | 57 |
59 static const char kViewClassName[]; | 58 static const char kViewClassName[]; |
60 | 59 |
61 private: | 60 private: |
62 void Init(); | 61 void Init(); |
63 | 62 |
64 void SetPressed(bool pressed); | 63 void SetPressed(bool pressed); |
(...skipping 13 matching lines...) Expand all Loading... |
78 | 77 |
79 // The color when the link is pressed. | 78 // The color when the link is pressed. |
80 SkColor requested_pressed_color_; | 79 SkColor requested_pressed_color_; |
81 | 80 |
82 DISALLOW_COPY_AND_ASSIGN(Link); | 81 DISALLOW_COPY_AND_ASSIGN(Link); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace views | 84 } // namespace views |
86 | 85 |
87 #endif // UI_VIEWS_CONTROLS_LINK_H_ | 86 #endif // UI_VIEWS_CONTROLS_LINK_H_ |
OLD | NEW |