Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: ui/views/examples/widget_example.cc

Issue 993253002: MacViews: Implement Window-modal dialogs using sheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update isolate Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/examples/widget_example.cc
diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc
index d7a1b020d921164ab3fe5415e2833028d74e03e1..3a9506f52722b66397c68ce504025daa8f46a5ff 100644
--- a/ui/views/examples/widget_example.cc
+++ b/ui/views/examples/widget_example.cc
@@ -30,6 +30,17 @@ class DialogExample : public DialogDelegateView {
View* CreateFootnoteView() override;
};
+class ModalDialogExample : public DialogExample {
+ public:
+ ModalDialogExample() {}
+
+ // WidgetDelegate:
+ ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ModalDialogExample);
+};
+
DialogExample::DialogExample() {
set_background(Background::CreateSolidBackground(SK_ColorGRAY));
SetLayoutManager(new BoxLayout(BoxLayout::kVertical, 10, 10, 10));
@@ -70,6 +81,7 @@ void WidgetExample::CreateExampleView(View* container) {
container->SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, 10));
BuildButton(container, "Popup widget", POPUP);
BuildButton(container, "Dialog widget", DIALOG);
+ BuildButton(container, "Modal Dialog", MODAL_DIALOG);
#if defined(OS_LINUX)
// Windows does not support TYPE_CONTROL top-level widgets.
BuildButton(container, "Child widget", CHILD);
@@ -116,6 +128,11 @@ void WidgetExample::ButtonPressed(Button* sender, const ui::Event& event) {
sender->GetWidget()->GetNativeView())->Show();
break;
}
+ case MODAL_DIALOG: {
+ DialogDelegate::CreateDialogWidget(new ModalDialogExample(), NULL,
+ sender->GetWidget()->GetNativeView())->Show();
+ break;
+ }
case CHILD:
ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL));
break;

Powered by Google App Engine
This is Rietveld 408576698