Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ui/views/controls/link.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/link.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef UI_VIEWS_CONTROLS_LINK_H_
6 #define UI_VIEWS_CONTROLS_LINK_H_
7
8 #include <string>
9
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/views/controls/label.h"
12
13 namespace views {
14
15 class LinkListener;
16
17 ////////////////////////////////////////////////////////////////////////////////
18 //
19 // Link class
20 //
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.
23 //
24 ////////////////////////////////////////////////////////////////////////////////
25 class VIEWS_EXPORT Link : public Label {
26 public:
27 Link();
28 explicit Link(const base::string16& title);
29 virtual ~Link();
30
31 static SkColor GetDefaultEnabledColor();
32
33 const LinkListener* listener() { return listener_; }
34 void set_listener(LinkListener* listener) { listener_ = listener; }
35
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;
55
56 void SetPressedColor(SkColor color);
57 void SetUnderline(bool underline);
58
59 static const char kViewClassName[];
60
61 private:
62 void Init();
63
64 void SetPressed(bool pressed);
65
66 void RecalculateFont();
67
68 LinkListener* listener_;
69
70 // Whether the link should be underlined when enabled.
71 bool underline_;
72
73 // Whether the link is currently pressed.
74 bool pressed_;
75
76 // The color when the link is neither pressed nor disabled.
77 SkColor requested_enabled_color_;
78
79 // The color when the link is pressed.
80 SkColor requested_pressed_color_;
81
82 DISALLOW_COPY_AND_ASSIGN(Link);
83 };
84
85 } // namespace views
86
87 #endif // UI_VIEWS_CONTROLS_LINK_H_
OLDNEW
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/link.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698