[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / views / controls / link.h
blob4d5cf6b7afa684f26d2a97aba304948bc05038fc
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.
5 #ifndef UI_VIEWS_CONTROLS_LINK_H_
6 #define UI_VIEWS_CONTROLS_LINK_H_
8 #include <string>
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/views/controls/label.h"
13 namespace views {
15 class LinkListener;
17 ////////////////////////////////////////////////////////////////////////////////
19 // Link class
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.
24 ////////////////////////////////////////////////////////////////////////////////
25 class VIEWS_EXPORT Link : public Label {
26 public:
27 Link();
28 explicit Link(const base::string16& title);
29 virtual ~Link();
31 static SkColor GetDefaultEnabledColor();
33 const LinkListener* listener() { return listener_; }
34 void set_listener(LinkListener* listener) { listener_ = listener; }
36 // Label:
37 virtual const char* GetClassName() const OVERRIDE;
38 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
39 virtual bool CanProcessEventsWithinSubtree() const OVERRIDE;
40 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
41 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
42 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
43 virtual void OnMouseCaptureLost() OVERRIDE;
44 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
45 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
46 virtual bool SkipDefaultKeyEventProcessing(
47 const ui::KeyEvent& event) OVERRIDE;
48 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
49 virtual void OnEnabledChanged() OVERRIDE;
50 virtual void OnFocus() OVERRIDE;
51 virtual void OnBlur() OVERRIDE;
52 virtual void SetFontList(const gfx::FontList& font_list) OVERRIDE;
53 virtual void SetText(const base::string16& text) OVERRIDE;
54 virtual void SetEnabledColor(SkColor color) OVERRIDE;
56 void SetPressedColor(SkColor color);
57 void SetUnderline(bool underline);
59 static const char kViewClassName[];
61 private:
62 void Init();
64 void SetPressed(bool pressed);
66 void RecalculateFont();
68 LinkListener* listener_;
70 // Whether the link should be underlined when enabled.
71 bool underline_;
73 // Whether the link is currently pressed.
74 bool pressed_;
76 // The color when the link is neither pressed nor disabled.
77 SkColor requested_enabled_color_;
79 // The color when the link is pressed.
80 SkColor requested_pressed_color_;
82 DISALLOW_COPY_AND_ASSIGN(Link);
85 } // namespace views
87 #endif // UI_VIEWS_CONTROLS_LINK_H_