| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "views/accelerator.h" | 9 #include "views/accelerator.h" |
| 10 #include "views/controls/menu/menu_2.h" | 10 #include "views/controls/menu/menu_2.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 void NativeMenuGtk::AddSeparatorAt(int index) { | 108 void NativeMenuGtk::AddSeparatorAt(int index) { |
| 109 GtkWidget* separator = gtk_separator_menu_item_new(); | 109 GtkWidget* separator = gtk_separator_menu_item_new(); |
| 110 gtk_widget_show(separator); | 110 gtk_widget_show(separator); |
| 111 gtk_menu_append(menu_, separator); | 111 gtk_menu_append(menu_, separator); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void NativeMenuGtk::AddMenuItemAt(int index, | 114 void NativeMenuGtk::AddMenuItemAt(int index, |
| 115 GtkRadioMenuItem** last_radio_item) { | 115 GtkRadioMenuItem** last_radio_item) { |
| 116 GtkWidget* menu_item = NULL; | 116 GtkWidget* menu_item = NULL; |
| 117 std::string label = ConvertAcceleratorsFromWindowsStyle(WideToUTF8( | 117 std::string label = ConvertAcceleratorsFromWindowsStyle(UTF16ToUTF8( |
| 118 model_->GetLabelAt(index))); | 118 model_->GetLabelAt(index))); |
| 119 | 119 |
| 120 Menu2Model::ItemType type = model_->GetTypeAt(index); | 120 Menu2Model::ItemType type = model_->GetTypeAt(index); |
| 121 switch (type) { | 121 switch (type) { |
| 122 case Menu2Model::TYPE_CHECK: | 122 case Menu2Model::TYPE_CHECK: |
| 123 menu_item = gtk_check_menu_item_new_with_mnemonic(label.c_str()); | 123 menu_item = gtk_check_menu_item_new_with_mnemonic(label.c_str()); |
| 124 break; | 124 break; |
| 125 case Menu2Model::TYPE_RADIO: | 125 case Menu2Model::TYPE_RADIO: |
| 126 if (*last_radio_item) { | 126 if (*last_radio_item) { |
| 127 menu_item = gtk_radio_menu_item_new_with_mnemonic_from_widget( | 127 menu_item = gtk_radio_menu_item_new_with_mnemonic_from_widget( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 //////////////////////////////////////////////////////////////////////////////// | 225 //////////////////////////////////////////////////////////////////////////////// |
| 226 // MenuWrapper, public: | 226 // MenuWrapper, public: |
| 227 | 227 |
| 228 // static | 228 // static |
| 229 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 229 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
| 230 return new NativeMenuGtk(menu->model()); | 230 return new NativeMenuGtk(menu->model()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace views | 233 } // namespace views |
| OLD | NEW |