// 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/base/l10n/l10n_util.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/examples/grit/views_examples_resources.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 l10n_util::GetStringUTF16; using l10n_util::GetStringUTF8; 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::Create(nullptr, GetStringUTF16(IDS_WIDGET_EXTRA_BUTTON))); SetFootnoteView( std::make_unique