| 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 "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Overridden from View: | 33 // Overridden from View: |
| 34 virtual void OnEnabledChanged() OVERRIDE; | 34 virtual void OnEnabledChanged() OVERRIDE; |
| 35 virtual std::string GetClassName() const OVERRIDE; | 35 virtual std::string GetClassName() const OVERRIDE; |
| 36 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; | 36 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
| 37 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 37 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 38 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 38 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 39 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 39 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 40 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 40 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 41 virtual void OnMouseCaptureLost() OVERRIDE; | 41 virtual void OnMouseCaptureLost() OVERRIDE; |
| 42 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 43 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 44 |
| 42 virtual ui::EventResult OnGestureEvent( | 45 virtual ui::EventResult OnGestureEvent( |
| 43 const ui::GestureEvent& event) OVERRIDE; | 46 const ui::GestureEvent& event) OVERRIDE; |
| 44 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 47 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 45 virtual bool SkipDefaultKeyEventProcessing( | 48 virtual bool SkipDefaultKeyEventProcessing( |
| 46 const ui::KeyEvent& event) OVERRIDE; | 49 const ui::KeyEvent& event) OVERRIDE; |
| 47 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 50 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 48 | 51 |
| 49 // Overridden from Label: | 52 // Overridden from Label: |
| 50 virtual void SetFont(const gfx::Font& font) OVERRIDE; | 53 virtual void SetFont(const gfx::Font& font) OVERRIDE; |
| 51 | 54 |
| 52 virtual void SetEnabledColor(SkColor color) OVERRIDE; | 55 virtual void SetEnabledColor(SkColor color) OVERRIDE; |
| 53 void SetPressedColor(SkColor color); | 56 void SetPressedColor(SkColor color); |
| 57 void SetUnderlineOnHover(bool underlineOnHover); |
| 54 | 58 |
| 55 static const char kViewClassName[]; | 59 static const char kViewClassName[]; |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 void Init(); | 62 void Init(); |
| 59 | 63 |
| 60 void SetPressed(bool pressed); | 64 void SetPressed(bool pressed); |
| 61 | 65 |
| 62 void RecalculateFont(); | 66 void RecalculateFont(); |
| 63 | 67 |
| 64 LinkListener* listener_; | 68 LinkListener* listener_; |
| 65 | 69 |
| 66 // Whether the link is currently pressed. | 70 // Whether the link is currently pressed. |
| 67 bool pressed_; | 71 bool pressed_; |
| 68 | 72 |
| 73 // Whether the link is underlined only on hover. |
| 74 bool underlineOnHover_; |
| 75 |
| 76 // Whether the mouse is hovering over the link. |
| 77 bool mouseIsInside_; |
| 78 |
| 69 // The color when the link is neither pressed nor disabled. | 79 // The color when the link is neither pressed nor disabled. |
| 70 SkColor requested_enabled_color_; | 80 SkColor requested_enabled_color_; |
| 71 | 81 |
| 72 // The color when the link is pressed. | 82 // The color when the link is pressed. |
| 73 SkColor requested_pressed_color_; | 83 SkColor requested_pressed_color_; |
| 74 | 84 |
| 75 DISALLOW_COPY_AND_ASSIGN(Link); | 85 DISALLOW_COPY_AND_ASSIGN(Link); |
| 76 }; | 86 }; |
| 77 | 87 |
| 78 } // namespace views | 88 } // namespace views |
| 79 | 89 |
| 80 #endif // UI_VIEWS_CONTROLS_LINK_H_ | 90 #endif // UI_VIEWS_CONTROLS_LINK_H_ |
| OLD | NEW |