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

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

Issue 2675983003: views::Separator cleanup. (Closed)
Patch Set: fix another callsite Created 3 years, 10 months 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
Index: ui/views/controls/separator.h
diff --git a/ui/views/controls/separator.h b/ui/views/controls/separator.h
index d4689fe209748b9241bebf63b616d9227a4ccf91..57857ca352c97cdc18470b9d48453b29be18cfbb 100644
--- a/ui/views/controls/separator.h
+++ b/ui/views/controls/separator.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/macros.h"
+#include "base/optional.h"
#include "ui/views/view.h"
namespace views {
@@ -17,39 +18,32 @@ namespace views {
class VIEWS_EXPORT Separator : public View {
public:
- enum Orientation {
- HORIZONTAL,
- VERTICAL
- };
-
// The separator's class name.
static const char kViewClassName[];
- explicit Separator(Orientation orientation);
+ // The separator's thickness in dip.
sky 2017/02/09 03:16:09 optional: Generally values are assumed to be dip u
Evan Stade 2017/02/09 15:46:11 Yea, you're right, my desire for extra clarity her
+ static const int kThickness;
+
+ // Constructs a separator that is ambivalent to orientation. To be used in the
+ // common case where sizing will be controlled by the layout manager.
sky 2017/02/09 03:16:09 Please document the preferred size is kThickness i
Evan Stade 2017/02/09 15:46:11 will do
+ Separator();
~Separator() override;
- SkColor color() const { return color_; }
void SetColor(SkColor color);
- int size() const { return size_; }
- // Preferred size of one axis: height for horizontal separator
- // and width for vertical separator
- void SetPreferredSize(int size);
+ void SetPreferredHeight(int height);
+
+ void SetPreferredWidth(int width);
// Overridden from View:
gfx::Size GetPreferredSize() const override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void OnPaint(gfx::Canvas* canvas) override;
- void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
const char* GetClassName() const override;
private:
- void SetColorFromNativeTheme();
-
- const Orientation orientation_;
- SkColor color_;
- bool color_overridden_;
- int size_;
+ gfx::Size preferred_size_;
+ base::Optional<SkColor> overridden_color_;
DISALLOW_COPY_AND_ASSIGN(Separator);
};

Powered by Google App Engine
This is Rietveld 408576698