// Copyright (c) 2012 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. #include "ui/views/examples/widget_example.h" #include #include #include "base/macros.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/background.h" #include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" using base::ASCIIToUTF16; namespace views { namespace examples { namespace { class WidgetDialogExample : public DialogDelegateView { public: WidgetDialogExample(); ~WidgetDialogExample() override; base::string16 GetWindowTitle() const override; }; class ModalDialogExample : public WidgetDialogExample { public: ModalDialogExample() = default; // WidgetDelegate: ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; } private: DISALLOW_COPY_AND_ASSIGN(ModalDialogExample); }; WidgetDialogExample::WidgetDialogExample() { SetBackground(CreateSolidBackground(SK_ColorGRAY)); SetLayoutManager(std::make_unique( BoxLayout::Orientation::kVertical, gfx::Insets(10), 10)); SetExtraView(MdTextButton::CreateSecondaryUiButton( nullptr, ASCIIToUTF16("Extra button!"))); SetFootnoteView(std::make_unique