summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 15:50:18 +0000
committerglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 15:50:18 +0000
commit55e1877c229cf69cb1fa38020d8c766b88e2cc7e (patch)
treeab1de9a95b2fde69c24f3dc5da907dc24b7026c0
parente64a1f7a8e899394cc4b599d933b7eb326cb36a2 (diff)
downloadchromium_src-55e1877c229cf69cb1fa38020d8c766b88e2cc7e.zip
chromium_src-55e1877c229cf69cb1fa38020d8c766b88e2cc7e.tar.gz
chromium_src-55e1877c229cf69cb1fa38020d8c766b88e2cc7e.tar.bz2
Merge 79671 - Fixing truncated label text of the checkbox
BUG=chromium-os:13451 TEST=manual Review URL: http://codereview.chromium.org/6749006 TBR=glotov@google.com Review URL: http://codereview.chromium.org/6728025 git-svn-id: svn://svn.chromium.org/chrome/branches/696/src@80003 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/eula_view.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index 7cea343..072eb53 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -39,6 +39,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/button/checkbox.h"
+#include "views/controls/button/native_button_gtk.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
#include "views/layout/grid_layout.h"
@@ -70,6 +71,35 @@ enum kLayoutColumnsets {
LAST_ROW
};
+// Helper class that disables using native label for subclassed GTK control.
+class EULANativeCheckboxGtk : public views::NativeCheckboxGtk {
+ public:
+ explicit EULANativeCheckboxGtk(views::Checkbox* checkbox)
+ : views::NativeCheckboxGtk(checkbox) {
+ set_fast_resize(true);
+ }
+ virtual ~EULANativeCheckboxGtk() { }
+ virtual bool UsesNativeLabel() const { return false; }
+ virtual void UpdateLabel() { }
+};
+
+// views::Checkbox specialization that uses its internal views::Label
+// instead of native one. We need this because native label does not
+// support multiline property and we need it for certain languages.
+class EULACheckbox : public views::Checkbox {
+ public:
+ EULACheckbox() { }
+ virtual ~EULACheckbox() { }
+
+ protected:
+ virtual views::NativeButtonWrapper* CreateWrapper() {
+ views::NativeButtonWrapper* native_wrapper =
+ new EULANativeCheckboxGtk(this);
+ native_wrapper->UpdateChecked();
+ return native_wrapper;
+ }
+};
+
// A simple LayoutManager that causes the associated view's one child to be
// sized to match the bounds of its parent except the bounds, if set.
struct FillLayoutWithBorder : public views::LayoutManager {
@@ -347,7 +377,7 @@ void EulaView::Init() {
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->StartRow(0, SINGLE_CONTROL_WITH_SHIFT_ROW);
- usage_statistics_checkbox_ = new views::Checkbox();
+ usage_statistics_checkbox_ = new EULACheckbox();
usage_statistics_checkbox_->SetMultiLine(true);
usage_statistics_checkbox_->SetChecked(true);
layout->AddView(usage_statistics_checkbox_);