diff options
Diffstat (limited to 'ui/gfx/size.h')
-rw-r--r-- | ui/gfx/size.h | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/ui/gfx/size.h b/ui/gfx/size.h index 5e288fe..670e67e 100644 --- a/ui/gfx/size.h +++ b/ui/gfx/size.h @@ -10,6 +10,7 @@ #include "build/build_config.h" #include "ui/base/ui_export.h" +#include "ui/gfx/size_base.h" #if defined(OS_WIN) typedef struct tagSIZE SIZE; @@ -20,7 +21,7 @@ typedef struct tagSIZE SIZE; namespace gfx { // A size has width and height values. -class UI_EXPORT Size { +class UI_EXPORT Size : public SizeBase<Size, int> { public: Size(); Size(int width, int height); @@ -28,43 +29,12 @@ class UI_EXPORT Size { explicit Size(const CGSize& s); #endif - ~Size(); + virtual ~Size(); #if defined(OS_MACOSX) Size& operator=(const CGSize& s); #endif - int width() const { return width_; } - int height() const { return height_; } - - int GetArea() const { return width_ * height_; } - - void SetSize(int width, int height) { - set_width(width); - set_height(height); - } - - void Enlarge(int width, int height) { - set_width(width_ + width); - set_height(height_ + height); - } - - void set_width(int width); - void set_height(int height); - - bool operator==(const Size& s) const { - return width_ == s.width_ && height_ == s.height_; - } - - bool operator!=(const Size& s) const { - return !(*this == s); - } - - bool IsEmpty() const { - // Size doesn't allow negative dimensions, so testing for 0 is enough. - return (width_ == 0) || (height_ == 0); - } - #if defined(OS_WIN) SIZE ToSIZE() const; #elif defined(OS_MACOSX) @@ -72,10 +42,6 @@ class UI_EXPORT Size { #endif std::string ToString() const; - - private: - int width_; - int height_; }; } // namespace gfx |