Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "views/examples/double_split_view_example.h" | |
| 6 | |
| 7 #include "views/layout/grid_layout.h" | |
| 8 | |
| 9 namespace examples { | |
| 10 | |
| 11 DoubleSplitViewExample::DoubleSplitViewExample(ExamplesMain* main) | |
| 12 : ExampleBase(main) { | |
| 13 } | |
| 14 | |
| 15 DoubleSplitViewExample::~DoubleSplitViewExample() { | |
| 16 } | |
| 17 | |
| 18 std::wstring DoubleSplitViewExample::GetExampleTitle() { | |
| 19 return L"Double Split View"; | |
| 20 } | |
| 21 | |
| 22 void DoubleSplitViewExample::CreateExampleView(views::View* container) { | |
| 23 SplittedView* splitted_view_1 = new SplittedView(); | |
| 24 SplittedView* splitted_view_2 = new SplittedView(); | |
| 25 SplittedView* splitted_view_3 = new SplittedView(); | |
| 26 | |
| 27 inner_single_split_view_ = new views::SingleSplitView( | |
| 28 splitted_view_1, splitted_view_2, | |
| 29 views::SingleSplitView::HORIZONTAL_SPLIT, | |
| 30 NULL); | |
| 31 | |
| 32 outer_single_split_view_ = new views::SingleSplitView( | |
| 33 inner_single_split_view_, splitted_view_3, | |
| 34 views::SingleSplitView::HORIZONTAL_SPLIT, | |
| 35 NULL); | |
| 36 | |
| 37 views::GridLayout* layout = new views::GridLayout(container); | |
| 38 container->SetLayoutManager(layout); | |
| 39 | |
| 40 // Add scroll view. | |
| 41 views::ColumnSet* column_set = layout->AddColumnSet(0); | |
| 42 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | |
| 43 views::GridLayout::USE_PREF, 0, 0); | |
| 44 layout->StartRow(1, 0); | |
| 45 layout->AddView(outer_single_split_view_); | |
| 46 } | |
| 47 | |
|
sky
2011/09/08 14:27:11
remove one of these lines.
Gajen
2011/09/09 13:58:02
Done.
| |
| 48 | |
| 49 DoubleSplitViewExample::SplittedView::SplittedView() { | |
| 50 SetColor(SK_ColorRED, SK_ColorGREEN); | |
| 51 } | |
| 52 | |
| 53 DoubleSplitViewExample::SplittedView::~SplittedView() { | |
| 54 } | |
| 55 | |
| 56 void DoubleSplitViewExample::SplittedView::SetColor(SkColor from, SkColor to) { | |
| 57 set_background( | |
| 58 views::Background::CreateVerticalGradientBackground(from, to)); | |
| 59 } | |
| 60 | |
| 61 gfx::Size DoubleSplitViewExample::SplittedView::GetPreferredSize() { | |
| 62 return gfx::Size(width(), height()); | |
| 63 } | |
| 64 | |
| 65 gfx::Size DoubleSplitViewExample::SplittedView::GetMinimumSize() { | |
| 66 return gfx::Size(10, 10); | |
| 67 } | |
| 68 | |
| 69 void DoubleSplitViewExample::SplittedView::Layout() { | |
| 70 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
| |
| 71 } | |
| 72 | |
| 73 } // namespace examples | |
| OLD | NEW |