diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:21:17 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:21:17 +0000 |
commit | a5176dafb70d5ea7567b18917d85c4cddc937dc4 (patch) | |
tree | 45a3a875cb48ee3b54a536ba9a4a7a5902138650 /views | |
parent | 8e12ae06a009107635e2045db802907fd4ae2df1 (diff) | |
download | chromium_src-a5176dafb70d5ea7567b18917d85c4cddc937dc4.zip chromium_src-a5176dafb70d5ea7567b18917d85c4cddc937dc4.tar.gz chromium_src-a5176dafb70d5ea7567b18917d85c4cddc937dc4.tar.bz2 |
Convert menu strings to UTF16, fix some views-GTK build errors.
Review URL: http://codereview.chromium.org/150171
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/menu_2.h | 5 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.cc | 2 | ||||
-rw-r--r-- | views/controls/menu/simple_menu_model.cc | 20 | ||||
-rw-r--r-- | views/controls/menu/simple_menu_model.h | 17 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 5 | ||||
-rw-r--r-- | views/widget/widget_gtk.h | 3 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 2 |
7 files changed, 25 insertions, 29 deletions
diff --git a/views/controls/menu/menu_2.h b/views/controls/menu/menu_2.h index 665b807..045309e 100644 --- a/views/controls/menu/menu_2.h +++ b/views/controls/menu/menu_2.h @@ -5,9 +5,8 @@ #ifndef CONTROLS_MENU_VIEWS_MENU_2_H_ #define CONTROLS_MENU_VIEWS_MENU_2_H_ -#include <string> - #include "base/gfx/native_widget_types.h" +#include "base/string16.h" namespace gfx { class Point; @@ -58,7 +57,7 @@ class Menu2Model { virtual int GetCommandIdAt(int index) const = 0; // Returns the label of the item at the specified index. - virtual std::wstring GetLabelAt(int index) const = 0; + virtual string16 GetLabelAt(int index) const = 0; // Returns true if the label at the specified index can change over the course // of the menu's lifetime. If this function returns true, the label of the diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index c81f04b..b0d8065 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -114,7 +114,7 @@ void NativeMenuGtk::AddSeparatorAt(int index) { void NativeMenuGtk::AddMenuItemAt(int index, GtkRadioMenuItem** last_radio_item) { GtkWidget* menu_item = NULL; - std::string label = ConvertAcceleratorsFromWindowsStyle(WideToUTF8( + std::string label = ConvertAcceleratorsFromWindowsStyle(UTF16ToUTF8( model_->GetLabelAt(index))); Menu2Model::ItemType type = model_->GetTypeAt(index); diff --git a/views/controls/menu/simple_menu_model.cc b/views/controls/menu/simple_menu_model.cc index 1ddc092..de86bce 100644 --- a/views/controls/menu/simple_menu_model.cc +++ b/views/controls/menu/simple_menu_model.cc @@ -17,30 +17,30 @@ SimpleMenuModel::SimpleMenuModel(Delegate* delegate) : delegate_(delegate) { SimpleMenuModel::~SimpleMenuModel() { } -void SimpleMenuModel::AddItem(int command_id, const std::wstring& label) { +void SimpleMenuModel::AddItem(int command_id, const string16& label) { Item item = { command_id, label, TYPE_COMMAND, -1, NULL }; items_.push_back(item); } void SimpleMenuModel::AddItemWithStringId(int command_id, int string_id) { - AddItem(command_id, l10n_util::GetString(string_id)); + AddItem(command_id, l10n_util::GetStringUTF16(string_id)); } void SimpleMenuModel::AddSeparator() { - Item item = { -1, std::wstring(), TYPE_SEPARATOR, -1, NULL }; + Item item = { -1, string16(), TYPE_SEPARATOR, -1, NULL }; items_.push_back(item); } -void SimpleMenuModel::AddCheckItem(int command_id, const std::wstring& label) { +void SimpleMenuModel::AddCheckItem(int command_id, const string16& label) { Item item = { command_id, label, TYPE_CHECK, -1, NULL }; items_.push_back(item); } void SimpleMenuModel::AddCheckItemWithStringId(int command_id, int string_id) { - AddCheckItem(command_id, l10n_util::GetString(string_id)); + AddCheckItem(command_id, l10n_util::GetStringUTF16(string_id)); } -void SimpleMenuModel::AddRadioItem(int command_id, const std::wstring& label, +void SimpleMenuModel::AddRadioItem(int command_id, const string16& label, int group_id) { Item item = { command_id, label, TYPE_RADIO, group_id, NULL }; items_.push_back(item); @@ -48,16 +48,16 @@ void SimpleMenuModel::AddRadioItem(int command_id, const std::wstring& label, void SimpleMenuModel::AddRadioItemWithStringId(int command_id, int string_id, int group_id) { - AddRadioItem(command_id, l10n_util::GetString(string_id), group_id); + AddRadioItem(command_id, l10n_util::GetStringUTF16(string_id), group_id); } -void SimpleMenuModel::AddSubMenu(const std::wstring& label, Menu2Model* model) { +void SimpleMenuModel::AddSubMenu(const string16& label, Menu2Model* model) { Item item = { -1, label, TYPE_SUBMENU, -1, model }; items_.push_back(item); } void SimpleMenuModel::AddSubMenuWithStringId(int string_id, Menu2Model* model) { - AddSubMenu(l10n_util::GetString(string_id), model); + AddSubMenu(l10n_util::GetStringUTF16(string_id), model); } //////////////////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ int SimpleMenuModel::GetCommandIdAt(int index) const { return items_.at(FlipIndex(index)).command_id; } -std::wstring SimpleMenuModel::GetLabelAt(int index) const { +string16 SimpleMenuModel::GetLabelAt(int index) const { if (IsLabelDynamicAt(index)) return delegate_->GetLabelForCommandId(GetCommandIdAt(index)); return items_.at(FlipIndex(index)).label; diff --git a/views/controls/menu/simple_menu_model.h b/views/controls/menu/simple_menu_model.h index 051de76..2be2cbc 100644 --- a/views/controls/menu/simple_menu_model.h +++ b/views/controls/menu/simple_menu_model.h @@ -7,6 +7,7 @@ #include <vector> +#include "base/string16.h" #include "views/controls/menu/menu_2.h" namespace views { @@ -33,8 +34,8 @@ class SimpleMenuModel : public Menu2Model { virtual bool IsLabelForCommandIdDynamic(int command_id) const { return false; } - virtual std::wstring GetLabelForCommandId(int command_id) const { - return std::wstring(); + virtual string16 GetLabelForCommandId(int command_id) const { + return string16(); } // Notifies the delegate that the item with the specified command id was @@ -51,14 +52,14 @@ class SimpleMenuModel : public Menu2Model { virtual ~SimpleMenuModel(); // Methods for adding items to the model. - void AddItem(int command_id, const std::wstring& label); + void AddItem(int command_id, const string16& label); void AddItemWithStringId(int command_id, int string_id); void AddSeparator(); - void AddCheckItem(int command_id, const std::wstring& label); + void AddCheckItem(int command_id, const string16& label); void AddCheckItemWithStringId(int command_id, int string_id); - void AddRadioItem(int command_id, const std::wstring& label, int group_id); + void AddRadioItem(int command_id, const string16& label, int group_id); void AddRadioItemWithStringId(int command_id, int string_id, int group_id); - void AddSubMenu(const std::wstring& label, Menu2Model* model); + void AddSubMenu(const string16& label, Menu2Model* model); void AddSubMenuWithStringId(int string_id, Menu2Model* model); // Overridden from Menu2Model: @@ -66,7 +67,7 @@ class SimpleMenuModel : public Menu2Model { virtual int GetItemCount() const; virtual ItemType GetTypeAt(int index) const; virtual int GetCommandIdAt(int index) const; - virtual std::wstring GetLabelAt(int index) const; + virtual string16 GetLabelAt(int index) const; virtual bool IsLabelDynamicAt(int index) const; virtual bool GetAcceleratorAt(int index, views::Accelerator* accelerator) const; @@ -89,7 +90,7 @@ class SimpleMenuModel : public Menu2Model { private: struct Item { int command_id; - std::wstring label; + string16 label; ItemType type; int group_id; Menu2Model* submenu; diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 64493c4..3bec281 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -77,8 +77,7 @@ WidgetGtk::~WidgetGtk() { } void WidgetGtk::Init(GtkWidget* parent, - const gfx::Rect& bounds, - bool has_own_focus_manager) { + const gfx::Rect& bounds) { // Force creation of the RootView if it hasn't been created yet. GetRootView(); @@ -106,8 +105,6 @@ void WidgetGtk::Init(GtkWidget* parent, root_view_->OnWidgetCreated(); - // TODO(port): if(has_own_focus_manager) block - SetRootViewForWidget(widget_, root_view_.get()); MessageLoopForUI::current()->AddObserver(this); diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 0034f01..58d8895 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -40,8 +40,7 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { // Initializes this widget. void Init(GtkWidget* parent, - const gfx::Rect& bounds, - bool has_own_focus_manager); + const gfx::Rect& bounds); // Makes the background of the window totally transparent. This must be // invoked before Init. This does a couple of checks and returns true if diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index b90aa6f..5608cb9 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -348,7 +348,7 @@ void WindowGtk::Init(const gfx::Rect& bounds) { // BecomeModal(); } - WidgetGtk::Init(NULL, bounds, true); + WidgetGtk::Init(NULL, bounds); g_signal_connect(G_OBJECT(GetNativeWindow()), "configure-event", G_CALLBACK(CallConfigureEvent), this); |