/* Copyright (C) 2002/2004 Kai Sterker Part of the Adonthell Project Dlgedit is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Dlgedit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Dlgedit. If not, see . */ /** * @file gui_modal_dialog.h * * @author Kai Sterker * @brief Base class for modal dialog windows */ #ifndef GUI_MODAL_DIALOG_H #define GUI_MODAL_DIALOG_H #include /** * Encapsulates the most basic functionality a modal/transient dialog window needs. */ class GuiModalDialog { public: /** * Initialize the dialog window. * @param p parent of the dialog. * @param m whether the dialog is model or just transient. */ GuiModalDialog (GtkWindow *p, const bool & m = true); /* * Destroy the dialog window. */ virtual ~GuiModalDialog (); /** * Displays the dialog window and sets it transient for the dlgedit main window. * @return the state of pressedOK. This should be set to true if the dialog * was closed via the OK button. By default it is false. */ virtual bool run (); /** * Indicate whether the OK button of the dialog has been pressed. * @param button Set this to true if the OK button has been pressed, * otherwise to false */ void okButtonPressed (bool button) { pressedOK = button; } /** * Get the dialog window. * @return the dialog window. */ GtkWidget *getWindow () { return window; } protected: /// whether the Cancel or OK button has been pushed bool pressedOK; /// whether the dialog is truly modal or merely transient bool modal; /// the dialog window GtkWidget *window; /// parent of the dialog. GtkWindow *parent; }; #endif // GUI_MODAL_DIALOG_H