Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Unified Diff: ui/views/controls/separator.cc

Issue 736613002: Makes Separator more configurable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REmoves changes from try_chrome_dialog_view.cc Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/separator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/separator.cc
diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc
index a8fe6da7ef3f95fd3724735a35e98cafe3736663..4cca609e85057457967625b2320c4f22ec4de6f7 100644
--- a/ui/views/controls/separator.cc
+++ b/ui/views/controls/separator.cc
@@ -12,26 +12,41 @@ namespace views {
// static
const char Separator::kViewClassName[] = "Separator";
-// The separator height in pixels.
-const int kSeparatorHeight = 1;
+// The separator size in pixels.
+const int kSeparatorSize = 1;
// Default color of the separator.
const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
-Separator::Separator(Orientation orientation) : orientation_(orientation) {
+Separator::Separator(Orientation orientation)
+ : orientation_(orientation),
+ color_(kDefaultColor),
+ size_(kSeparatorSize) {
SetFocusable(false);
}
Separator::~Separator() {
}
+void Separator::SetColor(SkColor color) {
+ color_ = color;
+ SchedulePaint();
+}
+
+void Separator::SetPreferredSize(int size) {
+ if (size != size_) {
+ size_ = size;
+ PreferredSizeChanged();
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Separator, View overrides:
gfx::Size Separator::GetPreferredSize() const {
if (orientation_ == HORIZONTAL)
- return gfx::Size(width(), kSeparatorHeight);
- return gfx::Size(kSeparatorHeight, height());
+ return gfx::Size(width(), size_);
+ return gfx::Size(size_, height());
}
void Separator::GetAccessibleState(ui::AXViewState* state) {
@@ -39,7 +54,7 @@ void Separator::GetAccessibleState(ui::AXViewState* state) {
}
void Separator::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) {
- canvas->FillRect(bounds(), kDefaultColor);
+ canvas->FillRect(bounds(), color_);
}
const char* Separator::GetClassName() const {
« no previous file with comments | « ui/views/controls/separator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698