1 /* -*- Mode: c++ -*- */ 2 /*************************************************************************** 3 * dialog.h 4 * 5 * Sun Apr 16 10:31:04 CEST 2017 6 * Copyright 2017 Bent Bisballe Nyeng 7 * deva@aasimon.org 8 ****************************************************************************/ 9 10 /* 11 * This file is part of DrumGizmo. 12 * 13 * DrumGizmo is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU Lesser General Public License as published by 15 * the Free Software Foundation; either version 3 of the License, or 16 * (at your option) any later version. 17 * 18 * DrumGizmo is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU Lesser General Public License for more details. 22 * 23 * You should have received a copy of the GNU Lesser General Public License 24 * along with DrumGizmo; if not, write to the Free Software 25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 26 */ 27 #pragma once 28 29 #include "window.h" 30 31 namespace GUI 32 { 33 34 //! This class is used the base window for pop-up dialogs, such as a file 35 //! browser. 36 class Dialog 37 : public Window 38 { 39 public: 40 //! - The dialog is placed near the parent window. 41 //! - The parent window event handler will call the dialog event handler 42 //! - While the dialog is visible, all mouse click and keyboard events 43 //! are ignored by the parent event handler. 44 //! - The Dialog registers itself in the parent event handler when contructed 45 //! and removes itself when destructed. 46 //! - The parent event handler will delete all registered Dialogs when itself 47 //! deleted. 48 Dialog(Widget* parent, bool modal = false); 49 50 ~Dialog(); 51 52 //! Change modality. 53 void setModal(bool modal); 54 55 //! Get current modality state. 56 bool isModal() const; 57 58 private: 59 bool is_modal{false}; 60 Widget* parent{nullptr}; 61 }; 62 63 } // GUI:: 64