OLD | NEW |
(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 #ifndef UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_ |
| 6 #define UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "ui/views/anchor_attribute.h" |
| 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/examples/example_base.h" |
| 15 #include "ui/views/view.h" |
| 16 #include "ui/views/widget/widget.h" |
| 17 |
| 18 namespace views { |
| 19 |
| 20 class LabelButton; |
| 21 |
| 22 namespace examples { |
| 23 |
| 24 // AnchorExample demonstrates how to use anchors to handle size/position |
| 25 // relative to the parent. |
| 26 class VIEWS_EXAMPLES_EXPORT AnchorExample : public ExampleBase, |
| 27 public ButtonListener { |
| 28 public: |
| 29 AnchorExample(); |
| 30 ~AnchorExample() override; |
| 31 |
| 32 // ExampleBase: |
| 33 void CreateExampleView(View* container) override; |
| 34 |
| 35 private: |
| 36 // ButtonListener: |
| 37 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 38 base::string16 FillText(Fill fill); |
| 39 base::string16 AnchorText(Anchor anchor); |
| 40 base::string16 AnchorsText(Anchors anchors); |
| 41 void ClearAlignButtons(View *view); |
| 42 void ReflectAnchors(View *view, AnchorAttribute *attribute); |
| 43 |
| 44 Label* anchored_view_label_ = nullptr; |
| 45 View* work_panel_ = nullptr; |
| 46 Anchors current_anchors_ = {Anchor::Left, Anchor::Top}; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(AnchorExample); |
| 49 }; |
| 50 |
| 51 } // namespace examples |
| 52 } // namespace views |
| 53 |
| 54 #endif // UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_ |
OLD | NEW |