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

Side by Side Diff: chrome/browser/gtk/menu_gtk.cc

Issue 175004: Ellipsize long entries in bookmark menus and the back/forward menus.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/browser/gtk/menu_gtk.h" 5 #include "chrome/browser/gtk/menu_gtk.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/gfx/gtk_util.h" 8 #include "base/gfx/gtk_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 *y += widget->allocation.height; 285 *y += widget->allocation.height;
286 286
287 bool start_align = 287 bool start_align =
288 !!g_object_get_data(G_OBJECT(widget), "left-align-popup"); 288 !!g_object_get_data(G_OBJECT(widget), "left-align-popup");
289 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 289 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
290 start_align = !start_align; 290 start_align = !start_align;
291 291
292 if (!start_align) 292 if (!start_align)
293 *x += widget->allocation.width - menu_req.width; 293 *x += widget->allocation.width - menu_req.width;
294 294
295 if (*y + menu_req.height >= screen_rect.height) 295 // If the menu would run off the bottom of the screen, and there is more
296 // screen space up than down, then pop upwards.
297 if (*y + menu_req.height >= screen_rect.height &&
298 *y > screen_rect.height / 2) {
296 *y -= menu_req.height; 299 *y -= menu_req.height;
300 }
297 301
298 *push_in = FALSE; 302 *push_in = FALSE;
299 } 303 }
300 304
301 void MenuGtk::UpdateMenu() { 305 void MenuGtk::UpdateMenu() {
302 gtk_container_foreach(GTK_CONTAINER(menu_.get()), SetMenuItemInfo, this); 306 gtk_container_foreach(GTK_CONTAINER(menu_.get()), SetMenuItemInfo, this);
303 } 307 }
304 308
305 // static 309 // static
306 void MenuGtk::OnMenuShow(GtkWidget* widget, MenuGtk* menu) { 310 void MenuGtk::OnMenuShow(GtkWidget* widget, MenuGtk* menu) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 gtk_widget_set_sensitive( 359 gtk_widget_set_sensitive(
356 widget, menu->delegate_->IsCommandEnabled(id)); 360 widget, menu->delegate_->IsCommandEnabled(id));
357 361
358 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)); 362 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
359 if (submenu) { 363 if (submenu) {
360 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo, 364 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo,
361 userdata); 365 userdata);
362 } 366 }
363 } 367 }
364 } 368 }
OLDNEW
« chrome/browser/gtk/back_forward_menu_model_gtk.cc ('K') | « chrome/browser/gtk/go_button_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698