Index: views/examples/double_split_view_example.cc |
diff --git a/views/examples/double_split_view_example.cc b/views/examples/double_split_view_example.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4cc3225385efddfec8b66e7490a0005344e97cb |
--- /dev/null |
+++ b/views/examples/double_split_view_example.cc |
@@ -0,0 +1,73 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "views/examples/double_split_view_example.h" |
+ |
+#include "views/layout/grid_layout.h" |
+ |
+namespace examples { |
+ |
+DoubleSplitViewExample::DoubleSplitViewExample(ExamplesMain* main) |
+ : ExampleBase(main) { |
+} |
+ |
+DoubleSplitViewExample::~DoubleSplitViewExample() { |
+} |
+ |
+std::wstring DoubleSplitViewExample::GetExampleTitle() { |
+ return L"Double Split View"; |
+} |
+ |
+void DoubleSplitViewExample::CreateExampleView(views::View* container) { |
+ SplittedView* splitted_view_1 = new SplittedView(); |
+ SplittedView* splitted_view_2 = new SplittedView(); |
+ SplittedView* splitted_view_3 = new SplittedView(); |
+ |
+ inner_single_split_view_ = new views::SingleSplitView( |
+ splitted_view_1, splitted_view_2, |
+ views::SingleSplitView::HORIZONTAL_SPLIT, |
+ NULL); |
+ |
+ outer_single_split_view_ = new views::SingleSplitView( |
+ inner_single_split_view_, splitted_view_3, |
+ views::SingleSplitView::HORIZONTAL_SPLIT, |
+ NULL); |
+ |
+ views::GridLayout* layout = new views::GridLayout(container); |
+ container->SetLayoutManager(layout); |
+ |
+ // Add scroll view. |
+ views::ColumnSet* column_set = layout->AddColumnSet(0); |
+ column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
+ views::GridLayout::USE_PREF, 0, 0); |
+ layout->StartRow(1, 0); |
+ layout->AddView(outer_single_split_view_); |
+} |
+ |
sky
2011/09/08 14:27:11
remove one of these lines.
Gajen
2011/09/09 13:58:02
Done.
|
+ |
+DoubleSplitViewExample::SplittedView::SplittedView() { |
+ SetColor(SK_ColorRED, SK_ColorGREEN); |
+} |
+ |
+DoubleSplitViewExample::SplittedView::~SplittedView() { |
+} |
+ |
+void DoubleSplitViewExample::SplittedView::SetColor(SkColor from, SkColor to) { |
+ set_background( |
+ views::Background::CreateVerticalGradientBackground(from, to)); |
+} |
+ |
+gfx::Size DoubleSplitViewExample::SplittedView::GetPreferredSize() { |
+ return gfx::Size(width(), height()); |
+} |
+ |
+gfx::Size DoubleSplitViewExample::SplittedView::GetMinimumSize() { |
+ return gfx::Size(10, 10); |
+} |
+ |
+void DoubleSplitViewExample::SplittedView::Layout() { |
+ SizeToPreferredSize(); |
sky
2011/09/08 14:27:11
Is this really necessary? Layout is mean to size y
Gajen
2011/09/09 13:58:02
Right, will remove this
|
+} |
+ |
+} // namespace examples |