// Copyright 2017 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/dialog_example.h" #include #include #include "base/macros.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/label.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/examples/examples_window.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/layout/grid_layout.h" #include "ui/views/layout/layout_provider.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" using base::ASCIIToUTF16; namespace views { namespace examples { namespace { constexpr int kFieldsColumnId = 0; constexpr int kButtonsColumnId = 1; constexpr int kFakeModeless = ui::MODAL_TYPE_SYSTEM + 1; } // namespace template class DialogExample::Delegate : public virtual DialogType { public: explicit Delegate(DialogExample* parent) : parent_(parent) { DialogDelegate::SetButtons(parent_->GetDialogButtons()); DialogDelegate::SetButtonLabel(ui::DIALOG_BUTTON_OK, parent_->ok_button_label_->GetText()); DialogDelegate::SetButtonLabel(ui::DIALOG_BUTTON_CANCEL, parent_->cancel_button_label_->GetText()); WidgetDelegate::SetModalType(parent_->GetModalType()); } void InitDelegate() { this->SetLayoutManager(std::make_unique()); auto body = std::make_unique