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

Side by Side Diff: ui/views/examples/box_layout_example.h

Issue 2836313002: BoxLayout now suports per-view margins. (Closed)
Patch Set: Added margin collapsing and a BoxLayout example Created 3 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
sky 2017/05/09 19:26:03 2017, and we don't use (c) in chromium.
kylix_rd 2017/05/09 20:07:06 Thanks. Copy-pasta error. Copied block from anoth
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_
6 #define UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_
7
8 #include "base/macros.h"
9 #include "ui/views/controls/button/button.h"
10 #include "ui/views/controls/button/label_button.h"
11 #include "ui/views/controls/combobox/combobox_listener.h"
12 #include "ui/views/controls/textfield/textfield_controller.h"
13 #include "ui/views/examples/example_base.h"
14 #include "ui/views/layout/box_layout.h"
15
16 namespace views {
17
18 class Checkbox;
19 class Combobox;
20 class Textfield;
21
22 namespace examples {
23
24 namespace {
25 class ViewListener {
sky 2017/05/09 19:26:03 This name is overly generic. How about a more spec
kylix_rd 2017/05/10 15:30:36 Upon further review, this isn't necessary at this
26 public:
27 virtual void ViewSelected(View* view) = 0;
28
29 protected:
30 virtual ~ViewListener() {}
31 };
32
33 class ChildPanel;
34 }
35
36 class VIEWS_EXAMPLES_EXPORT BoxLayoutExample : public ExampleBase,
37 public ButtonListener,
38 public ComboboxListener,
39 public ViewListener,
40 public TextfieldController {
41 public:
42 BoxLayoutExample();
43 ~BoxLayoutExample() override;
44
45 // ExampleBase
46 void CreateExampleView(View* container) override;
47
48 private:
49 friend class ChildPanel;
50 // ButtonListener
51 void ButtonPressed(Button* sender, const ui::Event& event) override;
52
53 // ComboboxListener
54 void OnPerformAction(Combobox* combobox) override;
55
56 // ViewListener
57 void ViewSelected(View* view) override;
58
59 // TextfieldController
60 void ContentsChanged(Textfield* sender,
61 const base::string16& new_contents) override;
62
63 void RefreshLayoutPanel();
sky 2017/05/09 19:26:03 moooaaarrrr comments please!
kylix_rd 2017/05/10 15:30:37 Done.
64 void UpdateLayoutManager();
65
66 BoxLayout* layout_ = nullptr;
67 View* full_panel_ = nullptr;
68 View* box_layout_panel_ = nullptr;
69 View* control_panel_ = nullptr;
70 LabelButton* add_button_ = nullptr;
71 Combobox* orientation_ = nullptr;
72 Combobox* main_axis_alignment_ = nullptr;
73 Combobox* cross_axis_alignment_ = nullptr;
74 Textfield* between_child_spacing_ = nullptr;
75 Textfield* default_flex_ = nullptr;
76 Textfield* min_cross_axis_size_ = nullptr;
77 Checkbox* collapse_margins_ = nullptr;
78 int panel_count_ = 0;
79
80 DISALLOW_COPY_AND_ASSIGN(BoxLayoutExample);
81 };
82
83 } // namespace examples
84 } // namespace views
85 #endif // UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_
sky 2017/05/09 19:26:03 newline between 84/85
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698