summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--views/controls/link.cc19
-rw-r--r--views/controls/link.h4
-rw-r--r--views/views.gyp1
3 files changed, 21 insertions, 3 deletions
diff --git a/views/controls/link.cc b/views/controls/link.cc
index cd506bf..a9b8d7e 100644
--- a/views/controls/link.cc
+++ b/views/controls/link.cc
@@ -5,11 +5,14 @@
#include "views/controls/link.h"
#include "app/gfx/font.h"
+#include "base/logging.h"
#include "views/event.h"
namespace views {
+#if defined(OS_WIN)
static HCURSOR g_hand_cursor = NULL;
+#endif
// Default colors used for links.
static const SkColor kHighlightedColor = SkColorSetRGB(255, 0x00, 0x00);
@@ -103,7 +106,14 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) {
}
bool Link::OnKeyPressed(const KeyEvent& e) {
- if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) {
+#if defined(OS_WIN)
+ bool activate = ((e.GetCharacter() == VK_SPACE) ||
+ (e.GetCharacter() == VK_RETURN));
+#else
+ bool activate = false;
+ NOTIMPLEMENTED();
+#endif
+ if (activate) {
SetHighlighted(false);
// Focus the link on key pressed.
@@ -118,8 +128,13 @@ bool Link::OnKeyPressed(const KeyEvent& e) {
}
bool Link::OverrideAccelerator(const Accelerator& accelerator) {
+#if defined(OS_WIN)
return (accelerator.GetKeyCode() == VK_SPACE) ||
(accelerator.GetKeyCode() == VK_RETURN);
+#else
+ NOTIMPLEMENTED();
+ return false;
+#endif
}
void Link::SetHighlighted(bool f) {
@@ -169,6 +184,7 @@ void Link::SetEnabled(bool f) {
}
}
+#if defined(OS_WIN)
HCURSOR Link::GetCursorForPoint(Event::EventType event_type, int x, int y) {
if (enabled_) {
if (!g_hand_cursor) {
@@ -179,5 +195,6 @@ HCURSOR Link::GetCursorForPoint(Event::EventType event_type, int x, int y) {
return NULL;
}
}
+#endif
} // namespace views
diff --git a/views/controls/link.h b/views/controls/link.h
index 4464f28..36c1f4f 100644
--- a/views/controls/link.h
+++ b/views/controls/link.h
@@ -32,7 +32,7 @@ class LinkController {
////////////////////////////////////////////////////////////////////////////////
class Link : public Label {
public:
- static const char Link::kViewClassName[];
+ static const char kViewClassName[];
Link();
Link(const std::wstring& title);
@@ -54,7 +54,9 @@ class Link : public Label {
// Set whether the link is enabled.
virtual void SetEnabled(bool f);
+#if defined(OS_WIN)
virtual HCURSOR GetCursorForPoint(Event::EventType event_type, int x, int y);
+#endif
virtual std::string GetClassName() const;
diff --git a/views/views.gyp b/views/views.gyp
index dff1b66..4d798d1 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -229,7 +229,6 @@
'controls/button/radio_button.cc',
'controls/combo_box.cc',
'controls/hwnd_view.cc',
- 'controls/link.cc',
'controls/menu/chrome_menu.cc',
'controls/menu/menu.cc',
'controls/message_box_view.cc',