summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-23 08:56:20 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-23 08:56:20 +0000
commit3a483454db080bfbc2d0a7ce4daa445ce9b3d2cd (patch)
tree202909ab5a600c78e94ad381e3e277ea1ea1a27a /views
parent654e5bbe0948dcb686d7ecb50def3a2a729e8ddb (diff)
downloadchromium_src-3a483454db080bfbc2d0a7ce4daa445ce9b3d2cd.zip
chromium_src-3a483454db080bfbc2d0a7ce4daa445ce9b3d2cd.tar.gz
chromium_src-3a483454db080bfbc2d0a7ce4daa445ce9b3d2cd.tar.bz2
Add GridLayout::SetInsets(const gfx::Insets& insets).
Per the style guide, function overloading like this is allowed. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Overloading#Function_Overloading I wanted this API so I could define and use a constant like: const gfx::Insets kSomeInsets(1, 2, 3, 4); layout->SetInsets(kSomeInsets); BUG=none TEST=try Review URL: http://codereview.chromium.org/509027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35209 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/grid_layout.cc5
-rw-r--r--views/grid_layout.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/views/grid_layout.cc b/views/grid_layout.cc
index d35f42f..9b44372 100644
--- a/views/grid_layout.cc
+++ b/views/grid_layout.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "app/gfx/insets.h"
#include "views/standard_layout.h"
#include "views/view.h"
@@ -690,6 +691,10 @@ void GridLayout::SetInsets(int top, int left, int bottom, int right) {
right_inset_ = right;
}
+void GridLayout::SetInsets(const gfx::Insets& insets) {
+ SetInsets(insets.top(), insets.left(), insets.bottom(), insets.right());
+}
+
ColumnSet* GridLayout::AddColumnSet(int id) {
DCHECK(GetColumnSet(id) == NULL);
ColumnSet* column_set = new ColumnSet(id);
diff --git a/views/grid_layout.h b/views/grid_layout.h
index cbd4129..499ee7b 100644
--- a/views/grid_layout.h
+++ b/views/grid_layout.h
@@ -11,6 +11,10 @@
#include "views/layout_manager.h"
#include "views/view.h"
+namespace gfx {
+class Insets;
+}
+
// GridLayout is a LayoutManager that positions child Views in a grid. You
// define the structure of the Grid first, then add the Views.
// The following creates a trivial grid with two columns separated by
@@ -102,6 +106,7 @@ class GridLayout : public LayoutManager {
// Sets the insets. All views are placed relative to these offsets.
void SetInsets(int top, int left, int bottom, int right);
+ void SetInsets(const gfx::Insets& insets);
// Creates a new column set with the specified id and returns it.
// The id is later used when starting a new row.