OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 39 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; |
40 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 40 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; |
41 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 41 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; |
42 virtual void OnMouseCaptureLost() OVERRIDE; | 42 virtual void OnMouseCaptureLost() OVERRIDE; |
43 virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; | 43 virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; |
44 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) OVERRIDE; | 44 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) OVERRIDE; |
45 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 45 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
46 | 46 |
47 // Overridden from Label: | 47 // Overridden from Label: |
48 virtual void SetFont(const gfx::Font& font) OVERRIDE; | 48 virtual void SetFont(const gfx::Font& font) OVERRIDE; |
49 virtual void MakeReadableOverBackgroundColor(const SkColor& color) OVERRIDE; | |
50 | 49 |
51 void SetHighlightedColor(const SkColor& color); | 50 virtual void SetEnabledColor(const SkColor& color) OVERRIDE; |
52 void SetDisabledColor(const SkColor& color); | 51 void SetPressedColor(const SkColor& color); |
53 void SetNormalColor(const SkColor& color); | |
54 | 52 |
55 static const char kViewClassName[]; | 53 static const char kViewClassName[]; |
56 | 54 |
57 private: | 55 private: |
58 // A highlighted link is clicked. | 56 void Init(); |
59 void SetHighlighted(bool f); | |
60 | 57 |
61 // Make sure the label style matched the current state. | 58 void SetPressed(bool pressed); |
62 void ValidateStyle(); | |
63 | 59 |
64 void Init(); | 60 void RecalculateFont(); |
65 | 61 |
66 LinkListener* listener_; | 62 LinkListener* listener_; |
67 | 63 |
68 // Whether the link is currently highlighted. | 64 // Whether the link is currently pressed. |
69 bool highlighted_; | 65 bool pressed_; |
70 | 66 |
71 // The color when the link is highlighted. | 67 // The color when the link is neither pressed nor disabled. |
72 SkColor highlighted_color_; | 68 SkColor requested_enabled_color_; |
73 | 69 |
74 // The color when the link is disabled. | 70 // The color when the link is pressed. |
75 SkColor disabled_color_; | 71 SkColor requested_pressed_color_; |
76 | |
77 // The color when the link is neither highlighted nor disabled. | |
78 SkColor normal_color_; | |
79 | 72 |
80 DISALLOW_COPY_AND_ASSIGN(Link); | 73 DISALLOW_COPY_AND_ASSIGN(Link); |
81 }; | 74 }; |
82 | 75 |
83 } // namespace views | 76 } // namespace views |
84 | 77 |
85 #endif // VIEWS_CONTROLS_LINK_H_ | 78 #endif // VIEWS_CONTROLS_LINK_H_ |
OLD | NEW |