GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

dialog.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00021 00022 #ifndef GFC_GTK_DIALOG_HH 00023 #define GFC_GTK_DIALOG_HH 00024 00025 #ifndef GFC_GTK_WINDOW_HH 00026 #include <gfc/gtk/window.hh> 00027 #endif 00028 00029 #ifndef __GTK_DIALOG_H__ 00030 #include <gtk/gtkdialog.h> 00031 #endif 00032 00033 namespace GFC { 00034 00035 namespace Gtk { 00036 00037 class Button; 00038 class HButtonBox; 00039 class VBox; 00040 00043 00044 enum DialogFlags 00045 { 00046 DIALOG_MODAL = GTK_DIALOG_MODAL, 00047 DIALOG_DESTROY_WITH_PARENT = GTK_DIALOG_DESTROY_WITH_PARENT, 00048 DIALOG_NO_SEPARATOR = GTK_DIALOG_NO_SEPARATOR 00049 }; 00050 00052 00053 typedef unsigned int DialogFlagsField; 00054 00057 00058 enum ResponseType 00059 { 00060 RESPONSE_NONE = GTK_RESPONSE_NONE, 00061 RESPONSE_REJECT = GTK_RESPONSE_REJECT, 00062 RESPONSE_ACCEPT = GTK_RESPONSE_ACCEPT, 00063 RESPONSE_DELETE_EVENT = GTK_RESPONSE_DELETE_EVENT, 00064 RESPONSE_OK = GTK_RESPONSE_OK, 00065 RESPONSE_CANCEL = GTK_RESPONSE_CANCEL, 00066 RESPONSE_CLOSE = GTK_RESPONSE_CLOSE, 00067 RESPONSE_YES = GTK_RESPONSE_YES, 00068 RESPONSE_NO = GTK_RESPONSE_NO, 00069 RESPONSE_APPLY = GTK_RESPONSE_APPLY, 00070 RESPONSE_HELP = GTK_RESPONSE_HELP 00071 }; 00072 00075 00076 enum StockButtonType 00077 { 00078 STOCK_BUTTON_OK, 00079 STOCK_BUTTON_CANCEL, 00080 STOCK_BUTTON_CLOSE, 00081 STOCK_BUTTON_YES, 00082 STOCK_BUTTON_NO, 00083 STOCK_BUTTON_APPLY, 00084 STOCK_BUTTON_HELP 00085 }; 00086 00135 00136 class Dialog : public Window 00137 { 00138 friend class G::Object; 00139 00140 Dialog(const Dialog&); 00141 Dialog& operator=(const Dialog&); 00142 00143 protected: 00146 00147 explicit Dialog(GtkDialog *dialog, bool owns_reference = false); 00154 00158 00159 void construct(const char *title, Gtk::Window *parent, Gtk::DialogFlagsField flags); 00168 00172 00173 typedef G::Signal<void, int> ResponseSignalType; 00174 typedef G::SignalProxy<TypeInstance, ResponseSignalType> ResponseSignalProxy; 00175 static const ResponseSignalType response_signal; 00181 00182 typedef G::Signal<void> CloseSignalType; 00183 typedef G::SignalProxy<TypeInstance, CloseSignalType> CloseSignalProxy; 00184 static const CloseSignalType close_signal; 00189 00191 00192 public: 00195 00196 Dialog(); 00201 00202 Dialog(const char *title, Window *parent = 0, DialogFlagsField flags = DIALOG_DESTROY_WITH_PARENT); 00203 Dialog(const String& title, Window *parent = 0, DialogFlagsField flags = DIALOG_DESTROY_WITH_PARENT); 00213 00214 virtual ~Dialog(); 00216 00220 00221 GtkDialog* gtk_dialog() const; 00223 00224 operator GtkDialog* () const; 00226 00227 VBox* client_area() const; 00230 00231 HButtonBox* action_area() const; 00235 00236 bool get_has_separator() const; 00238 00242 00243 void add_action_widget(Widget& child, int response_id); 00251 00252 Button* add_button(const char *button_text, int response_id); 00253 Button* add_button(const String& button_text, int response_id); 00262 00263 Button* add_button(const StockId& stock_id, int response_id); 00272 00273 Button* add_button(StockButtonType button_type); 00281 00282 void set_response_sensitive(int response_id, bool setting); 00289 00290 void set_default_response(int response_id); 00296 00297 void response(int response_id); 00303 00304 int run(); 00336 00337 void set_has_separator(bool setting); 00340 00344 00345 const ResponseSignalProxy sig_response(); 00348 00349 const CloseSignalProxy sig_close(); 00352 00354 }; 00355 00356 } // namespace Gtk 00357 00358 } // namespace GFC 00359 00360 #include <gfc/gtk/inline/dialog.inl> 00361 00362 #endif // GFC_GTK_DIALOG_HH 00363

Generated on Tue Aug 24 00:34:30 2004 for GFC-UI by doxygen 1.3.8