diff options
author | bcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-11 19:14:21 +0000 |
---|---|---|
committer | bcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-11 19:14:21 +0000 |
commit | f09aea144a06f650ec6531414b75fabd5bc0950f (patch) | |
tree | fdddeac8cf7e40fcc567fef23e13bb2c0d0806b0 /ui | |
parent | 4a7f068c13bc34a016423d18b4755c0d1b2e8239 (diff) | |
download | chromium_src-f09aea144a06f650ec6531414b75fabd5bc0950f.zip chromium_src-f09aea144a06f650ec6531414b75fabd5bc0950f.tar.gz chromium_src-f09aea144a06f650ec6531414b75fabd5bc0950f.tar.bz2 |
Support vertical separators
Separators are horizontal by default but sometimes vertical ones are useful.
BUG=239800
Review URL: https://chromiumcodereview.appspot.com/15001014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/separator.cc | 6 | ||||
-rw-r--r-- | ui/views/controls/separator.h | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc index 9f1dfc2..f8ce470 100644 --- a/ui/views/controls/separator.cc +++ b/ui/views/controls/separator.cc @@ -18,7 +18,7 @@ const int kSeparatorHeight = 1; // Default color of the separator. const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233); -Separator::Separator() { +Separator::Separator(Orientation orientation) : orientation_(orientation) { set_focusable(false); } @@ -29,7 +29,9 @@ Separator::~Separator() { // Separator, View overrides: gfx::Size Separator::GetPreferredSize() { - return gfx::Size(width(), kSeparatorHeight); + if (orientation_ == HORIZONTAL) + return gfx::Size(width(), kSeparatorHeight); + return gfx::Size(kSeparatorHeight, height()); } void Separator::GetAccessibleState(ui::AccessibleViewState* state) { diff --git a/ui/views/controls/separator.h b/ui/views/controls/separator.h index e4afcb8..53d1004 100644 --- a/ui/views/controls/separator.h +++ b/ui/views/controls/separator.h @@ -12,14 +12,19 @@ namespace views { // The Separator class is a view that shows a line used to visually separate -// other views. The current implementation is only horizontal. +// other views. class VIEWS_EXPORT Separator : public View { public: + enum Orientation { + HORIZONTAL, + VERTICAL + }; + // The separator's class name. static const char kViewClassName[]; - Separator(); + explicit Separator(Orientation orientation); virtual ~Separator(); // Overridden from View: @@ -29,6 +34,8 @@ class VIEWS_EXPORT Separator : public View { virtual const char* GetClassName() const OVERRIDE; private: + const Orientation orientation_; + DISALLOW_COPY_AND_ASSIGN(Separator); }; |