Main Page - Header
Author: The Inti Development Team

Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# dialog.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00022
    00023 #ifndef INTI_GTK_DIALOG_H
    00024 #define INTI_GTK_DIALOG_H
    00025
    00026 #ifndef INTI_GTK_WINDOW_H
    00027 #include <inti/gtk/window.h>
    00028 #endif
    00029
    00030 #ifndef __GTK_DIALOG_H__
    00031 #include <gtk/gtkdialog.h>
    00032 #endif
    00033
    00034 namespace Inti {
    00035
    00036 namespace Gtk {
    00037
    00038 class Button;
    00039 class DialogClass;
    00040 class HButtonBox;
    00041 class VBox;
    00042
    00045
    00046 enum DialogFlags
    00047 {
    00048         DIALOG_MODAL = GTK_DIALOG_MODAL,
    00049         DIALOG_DESTROY_WITH_PARENT = GTK_DIALOG_DESTROY_WITH_PARENT,
    00050         DIALOG_NO_SEPARATOR = GTK_DIALOG_NO_SEPARATOR
    00051 };
    00052
    00054
    00055 typedef unsigned int DialogFlagsField;
    00056
    00059
    00060 enum ResponseType
    00061 {
    00062         RESPONSE_NONE = GTK_RESPONSE_NONE,
    00063         RESPONSE_REJECT = GTK_RESPONSE_REJECT,
    00064         RESPONSE_ACCEPT = GTK_RESPONSE_ACCEPT,
    00065         RESPONSE_DELETE_EVENT = GTK_RESPONSE_DELETE_EVENT,
    00066         RESPONSE_OK = GTK_RESPONSE_OK,
    00067         RESPONSE_CANCEL = GTK_RESPONSE_CANCEL,
    00068         RESPONSE_CLOSE = GTK_RESPONSE_CLOSE,
    00069         RESPONSE_YES = GTK_RESPONSE_YES,
    00070         RESPONSE_NO = GTK_RESPONSE_NO,
    00071         RESPONSE_APPLY = GTK_RESPONSE_APPLY,
    00072         RESPONSE_HELP = GTK_RESPONSE_HELP
    00073 };
    00074
    00123
    00124 class Dialog : public Window
    00125 {
    00126         friend class G::Object;
    00127         friend class DialogClass;
    00128
    00129         Dialog(const Dialog&);
    00130         Dialog& operator=(const Dialog&);
    00131
    00132 protected:
    00135
    00136         explicit Dialog(GtkDialog *dialog, bool reference = false);
    00143
    00147
    00148         virtual void on_response(int response_id);
    00155
    00156         virtual void on_close();
    00158
    00160 //  Properties
    00161
    00162         typedef G::Property<bool> HasSeparatorPropertyType;
    00163         typedef G::PropertyProxy<G::Object, HasSeparatorPropertyType> HasSeparatorPropertyProxy;
    00164         static const HasSeparatorPropertyType has_separator_property;
    00165
    00166 //  Signals
    00167
    00168         typedef G::Signal1<void, int> ResponseSignalType;
    00169         typedef G::SignalProxy<TypeInstance, ResponseSignalType> ResponseSignalProxy;
    00170         static const ResponseSignalType response_signal;
    00171
    00172         typedef G::Signal0<void> CloseSignalType;
    00173         typedef G::SignalProxy<TypeInstance, CloseSignalType> CloseSignalProxy;
    00174         static const CloseSignalType close_signal;
    00175
    00176 public:
    00179
    00180         Dialog();
    00185
    00186         Dialog(const String& title, Window *parent = 0, DialogFlagsField flags = DIALOG_DESTROY_WITH_PARENT);
    00196
    00197         Dialog(const String& title, Window *parent, DialogFlagsField flags, const char *first_button_text, ...);
    00219
    00220         virtual ~Dialog();
    00222
    00226
    00227         GtkDialog* gtk_dialog() const { return (GtkDialog*)instance; }
    00229
    00230         GtkDialogClass* gtk_dialog_class() const;
    00232
    00233         operator GtkDialog* () const;
    00235
    00236         VBox* client_area() const;
    00239
    00240         HButtonBox* action_area() const;
    00244
    00245         bool get_has_separator() const;
    00247
    00251
    00252         void add_action_widget(Widget& child, int response_id);
    00260
    00261         Button* add_button(const char *button_text, int response_id);
    00271
    00272         void add_buttons(const char *first_button_text, ...);
    00292
    00293         void set_response_sensitive(int response_id, bool setting);
    00300
    00301         void set_default_response(int response_id);
    00307
    00308         void response(int response_id);
    00314
    00315         int run();
    00347
    00348         void set_has_separator(bool setting);
    00351
    00355
    00356         const HasSeparatorPropertyProxy prop_has_separator()
    00357         {
    00358                 return HasSeparatorPropertyProxy(this, &has_separator_property);
    00359         }
    00361
    00365
    00366         const ResponseSignalProxy sig_response()
    00367         {
    00368                 return ResponseSignalProxy(this, &response_signal);
    00369         }
    00372
    00373         const CloseSignalProxy sig_close()
    00374         {
    00375                 return CloseSignalProxy(this, &close_signal);
    00376         }
    00379
    00381 };
    00382
    00383 } // namespace Gtk
    00384
    00385 } // namespace Inti
    00386
    00387 #endif // INTI_GTK_DIALOG_H
    00388

Main Page - Footer