| 1 | /* ruserdialog.h |
|---|
| 2 | * |
|---|
| 3 | * Copyright (c) 2003 Conectiva S/A |
|---|
| 4 | * |
|---|
| 5 | * Author: Alfredo K. Kojima <kojima@conectiva.com.br> |
|---|
| 6 | * Michael Vogt <mvo@debian.org> |
|---|
| 7 | * |
|---|
| 8 | * This program is free software; you can redistribute it and/or |
|---|
| 9 | * modify it under the terms of the GNU General Public License as |
|---|
| 10 | * published by the Free Software Foundation; either version 2 of the |
|---|
| 11 | * License, or (at your option) any later version. |
|---|
| 12 | * |
|---|
| 13 | * This program is distributed in the hope that it will be useful, |
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | * GNU General Public License for more details. |
|---|
| 17 | * |
|---|
| 18 | * You should have received a copy of the GNU General Public License |
|---|
| 19 | * along with this program; if not, write to the Free Software |
|---|
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|---|
| 21 | * USA |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | #ifndef RUSERDIALOG_H |
|---|
| 25 | #define RUSERDIALOG_H |
|---|
| 26 | |
|---|
| 27 | class RUserDialog { |
|---|
| 28 | public: |
|---|
| 29 | enum ButtonsType { |
|---|
| 30 | ButtonsDefault, |
|---|
| 31 | ButtonsOk, |
|---|
| 32 | ButtonsOkCancel, |
|---|
| 33 | ButtonsYesNo |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | enum DialogType { |
|---|
| 37 | DialogInfo, |
|---|
| 38 | DialogWarning, |
|---|
| 39 | DialogQuestion, |
|---|
| 40 | DialogError |
|---|
| 41 | }; |
|---|
| 42 | |
|---|
| 43 | virtual bool message(const char *msg, |
|---|
| 44 | DialogType dialog = DialogInfo, |
|---|
| 45 | ButtonsType buttons = ButtonsDefault, |
|---|
| 46 | bool defres = true) = 0; |
|---|
| 47 | |
|---|
| 48 | virtual bool confirm(const char *msg, bool defres = true) { |
|---|
| 49 | return message(msg, DialogQuestion, ButtonsYesNo, defres); |
|---|
| 50 | }; |
|---|
| 51 | |
|---|
| 52 | virtual bool proceed(const char *msg, bool defres = true) { |
|---|
| 53 | return message(msg, DialogInfo, ButtonsOkCancel, defres); |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | virtual bool warning(const char *msg, bool nocancel = true) { |
|---|
| 57 | return nocancel ? message(msg, DialogWarning) |
|---|
| 58 | : message(msg, DialogWarning, ButtonsOkCancel, false); |
|---|
| 59 | }; |
|---|
| 60 | |
|---|
| 61 | virtual void error(const char *msg) { |
|---|
| 62 | message(msg, DialogError); |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | virtual bool showErrors(); |
|---|
| 66 | |
|---|
| 67 | virtual ~RUserDialog() {}; |
|---|
| 68 | }; |
|---|
| 69 | |
|---|
| 70 | #endif |
|---|
| 71 | |
|---|
| 72 | // vim:sts=4:sw=4 |
|---|