From 65e831256756b9cec2ab18a2fc772bad4d8f74ad Mon Sep 17 00:00:00 2001 From: "satorux@chromium.org" Date: Thu, 1 Apr 2010 06:49:21 +0000 Subject: Fix a bug that caused the add language dialog to have a huge combobox button. With this change, the add language dialog will look just like the hangul configuration dialog. There should be a better UI design, but this is at least much nicer than having the huge combobox. BUG=crosbug.com/2166 TEST=manually on netbook Review URL: http://codereview.chromium.org/1572010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43321 0039d316-1c4b-4281-b951-d872f2087c98 --- .../chromeos/options/language_config_view.cc | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'chrome/browser/chromeos') diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc index a442a6b..e00e109 100644 --- a/chrome/browser/chromeos/options/language_config_view.cc +++ b/chrome/browser/chromeos/options/language_config_view.cc @@ -38,6 +38,7 @@ class AddLanguageView : public views::View, explicit AddLanguageView(LanguageConfigView* parent_view) : parent_view_(parent_view), language_combobox_(NULL), + contents_(NULL), selected_index_(0) { } @@ -66,8 +67,17 @@ class AddLanguageView : public views::View, } // views::View overrides: + gfx::Size GetPreferredSize() { + // TODO(satorux): Create our own localized content size once the UI is + // done. + return gfx::Size(views::Window::GetLocalizedContentsSize( + IDS_FONTSLANG_DIALOG_WIDTH_CHARS, + IDS_FONTSLANG_DIALOG_HEIGHT_LINES)); + } + virtual void Layout() { - language_combobox_->SetBounds(0, 0, width(), height()); + // Not sure why but this is needed to show contents in the dialog. + contents_->SetBounds(0, 0, width(), height()); } virtual void ViewHierarchyChanged(bool is_add, views::View* parent, @@ -78,12 +88,26 @@ class AddLanguageView : public views::View, private: void Init() { + contents_ = new views::View; + AddChildView(contents_); + + GridLayout* layout = new GridLayout(contents_); + contents_->SetLayoutManager(layout); + layout->SetInsets(kPanelVertMargin, kPanelHorizMargin, + kPanelVertMargin, kPanelHorizMargin); + + // Set up column sets for the grid layout. + const int kColumnSetId = 1; + ColumnSet* column_set = layout->AddColumnSet(kColumnSetId); + column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, + GridLayout::USE_PREF, 0, 0); + language_combobox_model_.reset(CreateLanguageComboboxModel()); language_combobox_ = new views::Combobox(language_combobox_model_.get()); language_combobox_->SetSelectedItem(selected_index_); language_combobox_->set_listener(this); - SetLayoutManager(new views::FillLayout); - AddChildView(language_combobox_); + layout->StartRow(0, kColumnSetId); + layout->AddView(language_combobox_); } // Creates the language combobox model from the supported languages. @@ -108,6 +132,7 @@ class AddLanguageView : public views::View, // Combobox and its corresponding model. scoped_ptr language_combobox_model_; views::Combobox* language_combobox_; + views::View* contents_; // The index of the selected item in the combobox. int selected_index_; -- cgit v1.1