OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/menu/native_menu_gtk.h" | 5 #include "views/controls/menu/native_menu_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 NOTREACHED(); | 309 NOTREACHED(); |
310 break; | 310 break; |
311 } | 311 } |
312 | 312 |
313 // Label font. | 313 // Label font. |
314 const gfx::Font* font = model_->GetLabelFontAt(index); | 314 const gfx::Font* font = model_->GetLabelFontAt(index); |
315 if (font) { | 315 if (font) { |
316 // The label item is the first child of the menu item. | 316 // The label item is the first child of the menu item. |
317 GtkWidget* label_widget = GTK_BIN(menu_item)->child; | 317 GtkWidget* label_widget = GTK_BIN(menu_item)->child; |
318 DCHECK(label_widget && GTK_IS_LABEL(label_widget)); | 318 DCHECK(label_widget && GTK_IS_LABEL(label_widget)); |
319 gtk_widget_modify_font(label_widget, | 319 PangoFontDescription* pfd = font->GetNativeFont(); |
320 gfx::Font::PangoFontFromGfxFont(*font)); | 320 gtk_widget_modify_font(label_widget, pfd); |
| 321 pango_font_description_free(pfd); |
321 } | 322 } |
322 | 323 |
323 if (type == menus::MenuModel::TYPE_SUBMENU) { | 324 if (type == menus::MenuModel::TYPE_SUBMENU) { |
324 Menu2* submenu = new Menu2(model_->GetSubmenuModelAt(index)); | 325 Menu2* submenu = new Menu2(model_->GetSubmenuModelAt(index)); |
325 static_cast<NativeMenuGtk*>(submenu->wrapper_.get())->set_parent(this); | 326 static_cast<NativeMenuGtk*>(submenu->wrapper_.get())->set_parent(this); |
326 g_object_set_data(G_OBJECT(menu_item), "submenu", submenu); | 327 g_object_set_data(G_OBJECT(menu_item), "submenu", submenu); |
327 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), | 328 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), |
328 submenu->GetNativeMenu()); | 329 submenu->GetNativeMenu()); |
329 } | 330 } |
330 | 331 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 493 |
493 //////////////////////////////////////////////////////////////////////////////// | 494 //////////////////////////////////////////////////////////////////////////////// |
494 // MenuWrapper, public: | 495 // MenuWrapper, public: |
495 | 496 |
496 // static | 497 // static |
497 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 498 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
498 return new NativeMenuGtk(menu); | 499 return new NativeMenuGtk(menu); |
499 } | 500 } |
500 | 501 |
501 } // namespace views | 502 } // namespace views |
OLD | NEW |