Index: ui/views/controls/separator.cc |
diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc |
index a8fe6da7ef3f95fd3724735a35e98cafe3736663..b207cab1b8d8e824ce7b815070969a51a84aed14 100644 |
--- a/ui/views/controls/separator.cc |
+++ b/ui/views/controls/separator.cc |
@@ -12,26 +12,37 @@ 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; |
sky
2014/11/18 20:05:33
SchedulePaint.
melandory
2014/11/18 20:22:40
Done.
|
+} |
+ |
+void Separator::SetSize(int size) { |
+ size_ = size; |
sky
2014/11/18 20:05:32
If size != size_ this should call PreferredSizeCha
melandory
2014/11/18 20:22:40
Done. Should't SchedulePaint be called also here?
sky
2014/11/18 22:05:26
No, you only care about once the bounds actually c
|
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// 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 +50,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 { |