| Index: ui/views/examples/anchor_example.h
|
| diff --git a/ui/views/examples/anchor_example.h b/ui/views/examples/anchor_example.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ce5fd6121c82441fb37f87489fd2f93b14b35fb7
|
| --- /dev/null
|
| +++ b/ui/views/examples/anchor_example.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_
|
| +#define UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/macros.h"
|
| +#include "ui/views/anchor_attribute.h"
|
| +#include "ui/views/controls/button/button.h"
|
| +#include "ui/views/controls/label.h"
|
| +#include "ui/views/examples/example_base.h"
|
| +#include "ui/views/view.h"
|
| +#include "ui/views/widget/widget.h"
|
| +
|
| +namespace views {
|
| +
|
| +class LabelButton;
|
| +
|
| +namespace examples {
|
| +
|
| +// AnchorExample demonstrates how to use anchors to handle size/position
|
| +// relative to the parent.
|
| +class VIEWS_EXAMPLES_EXPORT AnchorExample : public ExampleBase,
|
| + public ButtonListener {
|
| + public:
|
| + AnchorExample();
|
| + ~AnchorExample() override;
|
| +
|
| + // ExampleBase:
|
| + void CreateExampleView(View* container) override;
|
| +
|
| + private:
|
| + // ButtonListener:
|
| + void ButtonPressed(Button* sender, const ui::Event& event) override;
|
| + base::string16 FillText(Fill fill);
|
| + base::string16 AnchorText(Anchor anchor);
|
| + base::string16 AnchorsText(Anchors anchors);
|
| + void ClearAlignButtons(View *view);
|
| + void ReflectAnchors(View *view, AnchorAttribute *attribute);
|
| +
|
| + Label* anchored_view_label_ = nullptr;
|
| + View* work_panel_ = nullptr;
|
| + Anchors current_anchors_ = {Anchor::Left, Anchor::Top};
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AnchorExample);
|
| +};
|
| +
|
| +} // namespace examples
|
| +} // namespace views
|
| +
|
| +#endif // UI_VIEWS_EXAMPLES_ANCHOR_EXAMPLE_H_
|
|
|