Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: views/examples/double_split_view_example.cc

Issue 8555013: views: Move examples/ directory to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/examples/double_split_view_example.h ('k') | views/examples/example_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/controls/single_split_view.h"
8 #include "views/layout/grid_layout.h"
9
10 namespace {
11
12 // DoubleSplitViews's content, which draws gradient color on background.
13 class SplittedView : public views::View {
14 public:
15 SplittedView();
16 virtual ~SplittedView();
17
18 void SetColor(SkColor from, SkColor to);
19
20 // Overridden from views::View.
21 virtual gfx::Size GetMinimumSize() OVERRIDE;
22
23 private:
24 DISALLOW_COPY_AND_ASSIGN(SplittedView);
25 };
26
27 SplittedView::SplittedView() {
28 SetColor(SK_ColorRED, SK_ColorGREEN);
29 }
30
31 SplittedView::~SplittedView() {
32 }
33
34 void SplittedView::SetColor(SkColor from, SkColor to) {
35 set_background(
36 views::Background::CreateVerticalGradientBackground(from, to));
37 }
38
39 gfx::Size SplittedView::GetMinimumSize() {
40 return gfx::Size(10, 10);
41 }
42
43 } // namespace
44
45 namespace examples {
46
47 DoubleSplitViewExample::DoubleSplitViewExample(ExamplesMain* main)
48 : ExampleBase(main, "Double Split View") {
49 }
50
51 DoubleSplitViewExample::~DoubleSplitViewExample() {
52 }
53
54 void DoubleSplitViewExample::CreateExampleView(views::View* container) {
55 SplittedView* splitted_view_1 = new SplittedView();
56 SplittedView* splitted_view_2 = new SplittedView();
57 SplittedView* splitted_view_3 = new SplittedView();
58
59 inner_single_split_view_ = new views::SingleSplitView(
60 splitted_view_1, splitted_view_2,
61 views::SingleSplitView::HORIZONTAL_SPLIT,
62 NULL);
63
64 outer_single_split_view_ = new views::SingleSplitView(
65 inner_single_split_view_, splitted_view_3,
66 views::SingleSplitView::HORIZONTAL_SPLIT,
67 NULL);
68
69 views::GridLayout* layout = new views::GridLayout(container);
70 container->SetLayoutManager(layout);
71
72 // Add scroll view.
73 views::ColumnSet* column_set = layout->AddColumnSet(0);
74 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
75 views::GridLayout::USE_PREF, 0, 0);
76 layout->StartRow(1, 0);
77 layout->AddView(outer_single_split_view_);
78 }
79
80 } // namespace examples
OLDNEW
« no previous file with comments | « views/examples/double_split_view_example.h ('k') | views/examples/example_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698