| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/examples/double_split_view_example.h" | 5 #include "ui/views/examples/double_split_view_example.h" |
| 6 | 6 |
| 7 #include "ui/views/background.h" | 7 #include "ui/views/background.h" |
| 8 #include "ui/views/controls/single_split_view.h" | 8 #include "ui/views/controls/single_split_view.h" |
| 9 #include "ui/views/layout/grid_layout.h" | 9 #include "ui/views/layout/grid_layout.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 namespace examples { | 12 namespace examples { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // DoubleSplitViews's content, which draws gradient color on background. | 16 // DoubleSplitViews's content, which draws gradient color on background. |
| 17 class SplittedView : public View { | 17 class SplittedView : public View { |
| 18 public: | 18 public: |
| 19 SplittedView(); | 19 SplittedView(); |
| 20 virtual ~SplittedView(); | 20 virtual ~SplittedView(); |
| 21 | 21 |
| 22 void SetColor(SkColor from, SkColor to); | 22 void SetColor(SkColor from, SkColor to); |
| 23 | 23 |
| 24 // View: | 24 // View: |
| 25 virtual gfx::Size GetMinimumSize() OVERRIDE; | 25 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 DISALLOW_COPY_AND_ASSIGN(SplittedView); | 28 DISALLOW_COPY_AND_ASSIGN(SplittedView); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 SplittedView::SplittedView() { | 31 SplittedView::SplittedView() { |
| 32 SetColor(SK_ColorRED, SK_ColorGREEN); | 32 SetColor(SK_ColorRED, SK_ColorGREEN); |
| 33 } | 33 } |
| 34 | 34 |
| 35 SplittedView::~SplittedView() { | 35 SplittedView::~SplittedView() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void SplittedView::SetColor(SkColor from, SkColor to) { | 38 void SplittedView::SetColor(SkColor from, SkColor to) { |
| 39 set_background(Background::CreateVerticalGradientBackground(from, to)); | 39 set_background(Background::CreateVerticalGradientBackground(from, to)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 gfx::Size SplittedView::GetMinimumSize() { | 42 gfx::Size SplittedView::GetMinimumSize() const { |
| 43 return gfx::Size(10, 10); | 43 return gfx::Size(10, 10); |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 DoubleSplitViewExample::DoubleSplitViewExample() | 48 DoubleSplitViewExample::DoubleSplitViewExample() |
| 49 : ExampleBase("Double Split View") { | 49 : ExampleBase("Double Split View") { |
| 50 } | 50 } |
| 51 | 51 |
| 52 DoubleSplitViewExample::~DoubleSplitViewExample() { | 52 DoubleSplitViewExample::~DoubleSplitViewExample() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 73 // Add scroll view. | 73 // Add scroll view. |
| 74 ColumnSet* column_set = layout->AddColumnSet(0); | 74 ColumnSet* column_set = layout->AddColumnSet(0); |
| 75 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 75 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 76 GridLayout::USE_PREF, 0, 0); | 76 GridLayout::USE_PREF, 0, 0); |
| 77 layout->StartRow(1, 0); | 77 layout->StartRow(1, 0); |
| 78 layout->AddView(outer_single_split_view_); | 78 layout->AddView(outer_single_split_view_); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace examples | 81 } // namespace examples |
| 82 } // namespace views | 82 } // namespace views |
| OLD | NEW |