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

Side by Side Diff: ui/views/examples/single_split_view_example.cc

Issue 2144753002: Remove views::SingleSplitView as it's presently unused. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix includes Created 4 years, 5 months 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
« no previous file with comments | « ui/views/examples/single_split_view_example.h ('k') | ui/views/views.gyp » ('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 "ui/views/examples/single_split_view_example.h"
6
7 #include "base/macros.h"
8 #include "ui/views/background.h"
9 #include "ui/views/controls/single_split_view.h"
10 #include "ui/views/layout/grid_layout.h"
11
12 namespace views {
13 namespace examples {
14 namespace {
15
16 // SingleSplitView's content, which draws gradient color on background.
17 class SplittedView : public View {
18 public:
19 SplittedView();
20 ~SplittedView() override;
21
22 void SetColor(SkColor from, SkColor to);
23
24 private:
25 // View:
26 gfx::Size GetPreferredSize() const override;
27 gfx::Size GetMinimumSize() const override;
28 void Layout() override;
29
30 DISALLOW_COPY_AND_ASSIGN(SplittedView);
31 };
32
33 SplittedView::SplittedView() {
34 SetColor(SK_ColorRED, SK_ColorGREEN);
35 }
36
37 SplittedView::~SplittedView() {
38 }
39
40 void SplittedView::SetColor(SkColor from, SkColor to) {
41 set_background(Background::CreateVerticalGradientBackground(from, to));
42 }
43
44 gfx::Size SplittedView::GetPreferredSize() const {
45 return gfx::Size(width(), height());
46 }
47
48 gfx::Size SplittedView::GetMinimumSize() const {
49 return gfx::Size(10, 10);
50 }
51
52 void SplittedView::Layout() {
53 SizeToPreferredSize();
54 }
55
56 } // namespace
57
58 SingleSplitViewExample::SingleSplitViewExample()
59 : ExampleBase("Single Split View") {
60 }
61
62 SingleSplitViewExample::~SingleSplitViewExample() {
63 }
64
65 void SingleSplitViewExample::CreateExampleView(View* container) {
66 SplittedView* splitted_view_1 = new SplittedView;
67 SplittedView* splitted_view_2 = new SplittedView;
68
69 splitted_view_1->SetColor(SK_ColorYELLOW, SK_ColorCYAN);
70
71 single_split_view_ = new SingleSplitView(
72 splitted_view_1, splitted_view_2,
73 SingleSplitView::HORIZONTAL_SPLIT,
74 this);
75
76 GridLayout* layout = new GridLayout(container);
77 container->SetLayoutManager(layout);
78
79 ColumnSet* column_set = layout->AddColumnSet(0);
80 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
81 GridLayout::USE_PREF, 0, 0);
82 layout->StartRow(1, 0);
83 layout->AddView(single_split_view_);
84 }
85
86 bool SingleSplitViewExample::SplitHandleMoved(SingleSplitView* sender) {
87 PrintStatus("Splitter moved");
88 return true;
89 }
90
91 } // namespace examples
92 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/single_split_view_example.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698