Chromium Code Reviews| Index: ui/views/examples/box_layout_example.h |
| diff --git a/ui/views/examples/box_layout_example.h b/ui/views/examples/box_layout_example.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c78d8ca0b5cae6777cbd75361383f0c4f06ac599 |
| --- /dev/null |
| +++ b/ui/views/examples/box_layout_example.h |
| @@ -0,0 +1,85 @@ |
| +// 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
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_ |
| +#define UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_ |
| + |
| +#include "base/macros.h" |
| +#include "ui/views/controls/button/button.h" |
| +#include "ui/views/controls/button/label_button.h" |
| +#include "ui/views/controls/combobox/combobox_listener.h" |
| +#include "ui/views/controls/textfield/textfield_controller.h" |
| +#include "ui/views/examples/example_base.h" |
| +#include "ui/views/layout/box_layout.h" |
| + |
| +namespace views { |
| + |
| +class Checkbox; |
| +class Combobox; |
| +class Textfield; |
| + |
| +namespace examples { |
| + |
| +namespace { |
| +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
|
| + public: |
| + virtual void ViewSelected(View* view) = 0; |
| + |
| + protected: |
| + virtual ~ViewListener() {} |
| +}; |
| + |
| +class ChildPanel; |
| +} |
| + |
| +class VIEWS_EXAMPLES_EXPORT BoxLayoutExample : public ExampleBase, |
| + public ButtonListener, |
| + public ComboboxListener, |
| + public ViewListener, |
| + public TextfieldController { |
| + public: |
| + BoxLayoutExample(); |
| + ~BoxLayoutExample() override; |
| + |
| + // ExampleBase |
| + void CreateExampleView(View* container) override; |
| + |
| + private: |
| + friend class ChildPanel; |
| + // ButtonListener |
| + void ButtonPressed(Button* sender, const ui::Event& event) override; |
| + |
| + // ComboboxListener |
| + void OnPerformAction(Combobox* combobox) override; |
| + |
| + // ViewListener |
| + void ViewSelected(View* view) override; |
| + |
| + // TextfieldController |
| + void ContentsChanged(Textfield* sender, |
| + const base::string16& new_contents) override; |
| + |
| + void RefreshLayoutPanel(); |
|
sky
2017/05/09 19:26:03
moooaaarrrr comments please!
kylix_rd
2017/05/10 15:30:37
Done.
|
| + void UpdateLayoutManager(); |
| + |
| + BoxLayout* layout_ = nullptr; |
| + View* full_panel_ = nullptr; |
| + View* box_layout_panel_ = nullptr; |
| + View* control_panel_ = nullptr; |
| + LabelButton* add_button_ = nullptr; |
| + Combobox* orientation_ = nullptr; |
| + Combobox* main_axis_alignment_ = nullptr; |
| + Combobox* cross_axis_alignment_ = nullptr; |
| + Textfield* between_child_spacing_ = nullptr; |
| + Textfield* default_flex_ = nullptr; |
| + Textfield* min_cross_axis_size_ = nullptr; |
| + Checkbox* collapse_margins_ = nullptr; |
| + int panel_count_ = 0; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BoxLayoutExample); |
| +}; |
| + |
| +} // namespace examples |
| +} // namespace views |
| +#endif // UI_VIEWS_EXAMPLES_BOX_LAYOUT_EXAMPLE_H_ |
|
sky
2017/05/09 19:26:03
newline between 84/85
|