OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 VIEWS_CONTROLS_LINK_H_ | 5 #ifndef VIEWS_CONTROLS_LINK_H_ |
6 #define VIEWS_CONTROLS_LINK_H_ | 6 #define VIEWS_CONTROLS_LINK_H_ |
7 | 7 |
8 #include "views/controls/label.h" | 8 #include "views/controls/label.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
11 | 11 |
(...skipping 13 matching lines...) Expand all Loading... |
25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
26 // | 26 // |
27 // Link class | 27 // Link class |
28 // | 28 // |
29 // A Link is a label subclass that looks like an HTML link. It has a | 29 // A Link is a label subclass that looks like an HTML link. It has a |
30 // controller which is notified when a click occurs. | 30 // controller which is notified when a click occurs. |
31 // | 31 // |
32 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
33 class Link : public Label { | 33 class Link : public Label { |
34 public: | 34 public: |
35 static const char kViewClassName[]; | |
36 | |
37 Link(); | 35 Link(); |
38 Link(const std::wstring& title); | 36 Link(const std::wstring& title); |
39 virtual ~Link(); | 37 virtual ~Link(); |
40 | 38 |
41 void SetController(LinkController* controller); | 39 void SetController(LinkController* controller); |
42 const LinkController* GetController(); | 40 const LinkController* GetController(); |
43 | 41 |
44 // Overridden from View: | 42 // Overridden from View: |
45 virtual bool OnMousePressed(const MouseEvent& event); | 43 virtual bool OnMousePressed(const MouseEvent& event); |
46 virtual bool OnMouseDragged(const MouseEvent& event); | 44 virtual bool OnMouseDragged(const MouseEvent& event); |
47 virtual void OnMouseReleased(const MouseEvent& event, | 45 virtual void OnMouseReleased(const MouseEvent& event, |
48 bool canceled); | 46 bool canceled); |
49 virtual bool OnKeyPressed(const KeyEvent& e); | 47 virtual bool OnKeyPressed(const KeyEvent& e); |
50 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); | 48 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); |
51 | 49 |
52 virtual void SetFont(const gfx::Font& font); | 50 virtual void SetFont(const gfx::Font& font); |
53 | 51 |
54 // Set whether the link is enabled. | 52 // Set whether the link is enabled. |
55 virtual void SetEnabled(bool f); | 53 virtual void SetEnabled(bool f); |
56 | 54 |
57 virtual gfx::NativeCursor GetCursorForPoint(Event::EventType event_type, | 55 virtual gfx::NativeCursor GetCursorForPoint(Event::EventType event_type, |
58 int x, int y); | 56 int x, int y); |
59 | 57 |
60 virtual std::string GetClassName() const; | 58 virtual std::string GetClassName() const; |
61 | 59 |
62 void SetHighlightedColor(const SkColor& color); | 60 void SetHighlightedColor(const SkColor& color); |
63 void SetDisabledColor(const SkColor& color); | 61 void SetDisabledColor(const SkColor& color); |
64 void SetNormalColor(const SkColor& color); | 62 void SetNormalColor(const SkColor& color); |
65 | 63 |
| 64 static const char kViewClassName[]; |
| 65 |
66 private: | 66 private: |
67 | 67 |
68 // A highlighted link is clicked. | 68 // A highlighted link is clicked. |
69 void SetHighlighted(bool f); | 69 void SetHighlighted(bool f); |
70 | 70 |
71 // Make sure the label style matched the current state. | 71 // Make sure the label style matched the current state. |
72 void ValidateStyle(); | 72 void ValidateStyle(); |
73 | 73 |
74 void Init(); | 74 void Init(); |
75 | 75 |
(...skipping 10 matching lines...) Expand all Loading... |
86 | 86 |
87 // The color when the link is neither highlighted nor disabled. | 87 // The color when the link is neither highlighted nor disabled. |
88 SkColor normal_color_; | 88 SkColor normal_color_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(Link); | 90 DISALLOW_COPY_AND_ASSIGN(Link); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace views | 93 } // namespace views |
94 | 94 |
95 #endif // VIEWS_CONTROLS_LINK_H_ | 95 #endif // VIEWS_CONTROLS_LINK_H_ |
OLD | NEW |