diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 20:26:58 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 20:26:58 +0000 |
commit | e133f95e6e64a5d9bf8bf0d1a435958efbe94cce (patch) | |
tree | 4f1ba3f7dc4c06faf28ef730ac4787b75f10e1dc /views | |
parent | b059d497ff6d968640617f9b998c38aa788275f3 (diff) | |
download | chromium_src-e133f95e6e64a5d9bf8bf0d1a435958efbe94cce.zip chromium_src-e133f95e6e64a5d9bf8bf0d1a435958efbe94cce.tar.gz chromium_src-e133f95e6e64a5d9bf8bf0d1a435958efbe94cce.tar.bz2 |
Makes MenuButton compile and fixes bug in GtkWidget I happened upon.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/115826
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/menu_button.cc | 14 | ||||
-rw-r--r-- | views/views.gyp | 1 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 5 |
3 files changed, 15 insertions, 5 deletions
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index b7e1f8f..9a8d3d2 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -8,7 +8,6 @@ #include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/win_util.h" #include "grit/app_strings.h" #include "grit/app_resources.h" #include "views/controls/button/button.h" @@ -17,6 +16,10 @@ #include "views/widget/root_view.h" #include "views/widget/widget.h" +#if defined(OS_WIN) +#include "app/win_util.h" +#endif + using base::Time; using base::TimeDelta; @@ -109,6 +112,7 @@ int MenuButton::GetMaximumScreenXCoordinate() { return 0; } +#if defined(OS_WIN) HWND hwnd = widget->GetNativeView(); RECT t; ::GetWindowRect(hwnd, &t); @@ -116,6 +120,10 @@ int MenuButton::GetMaximumScreenXCoordinate() { gfx::Rect r(t); gfx::Rect monitor_rect = win_util::GetMonitorBoundsForRect(r); return monitor_rect.x() + monitor_rect.width() - 1; +#else + NOTIMPLEMENTED(); + return 1000000; +#endif } bool MenuButton::Activate() { @@ -205,9 +213,13 @@ void MenuButton::OnMouseReleased(const MouseEvent& e, // When the space bar or the enter key is pressed we need to show the menu. bool MenuButton::OnKeyReleased(const KeyEvent& e) { +#if defined(OS_WIN) if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { return Activate(); } +#else + NOTIMPLEMENTED(); +#endif return true; } diff --git a/views/views.gyp b/views/views.gyp index 9c86b89..e1a04cc 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -232,7 +232,6 @@ 'accessibility/view_accessibility_wrapper.cc', 'controls/scrollbar/bitmap_scroll_bar.cc', 'controls/button/button_dropdown.cc', - 'controls/button/menu_button.cc', 'controls/button/radio_button.cc', 'controls/combo_box.cc', 'controls/hwnd_view.cc', diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 64558ed..96a2ad3 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -13,8 +13,7 @@ namespace views { // Returns the position of a widget on screen. static void GetWidgetPositionOnScreen(GtkWidget* widget, int* x, int *y) { - GtkWidget* parent = widget; - while (parent) { + while (widget) { if (GTK_IS_WINDOW(widget)) { int window_x, window_y; gtk_window_get_position(GTK_WINDOW(widget), &window_x, &window_y); @@ -25,7 +24,7 @@ static void GetWidgetPositionOnScreen(GtkWidget* widget, int* x, int *y) { // Not a window. *x += widget->allocation.x; *y += widget->allocation.y; - parent = gtk_widget_get_parent(parent); + widget = gtk_widget_get_parent(widget); } } |