00001 // This is core/vgui/vgui_dialog_extensions.h 00002 #ifndef vgui_dialog_extensions_h_ 00003 #define vgui_dialog_extensions_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \author Gamze Tunali, LEMS, Brown University 00010 // \date 16 Nov 2007 00011 // \brief an extension to the vgui_dialog class. 00012 // 00013 // vgui_dialog_extensions has two new elements: directory browser and line break. 00014 // 00015 // \verbatim 00016 // Modifications 00017 // \endverbatim 00018 00019 #include <vcl_string.h> 00020 #include <vgui/vgui_dialog.h> 00021 00022 class vgui_dialog_extensions_impl; 00023 00024 //: Abstract dialog class 00025 // 00026 // vgui_dialog_extension allows the user to build a dialog from a collection 00027 // of fields. It differs from vgui_dialog by two elements, directory browser 00028 // to be able to choose folders in addition to the files, and line breaks. 00029 // The tableau will be designed so that elements are placed on the same line 00030 // until a line break element is inserted. This allows to create more versatile 00031 // dialogs, by grouping elements on one line. 00032 // 00033 // A field in this context consists of a vcl_string label and a variable. 00034 // The dialog is then posted using the ask() method. If ask returns true then 00035 // any changes to the fields in the dialog are used to update the variables. 00036 // Each vgui_dialog contains an instance of a concrete subclass of 00037 // vgui_dialog_impl. The type of the subclass will be determined by the GUI 00038 // being used. 00039 // 00040 // \par Example 00041 // \code 00042 // vgui_dialog_extensions params("My params"); 00043 // params.field("Table number", the_table); 00044 // params.line_break(); 00045 // params.choice("Dressing", "French", "Thousand Island", the_dressing); 00046 // params.checkbox("Mayo?", has_mayo); 00047 // params.line_break(); 00048 // params.message("No smoking is allowed in the restaurant!"); 00049 // if (!params.ask()) 00050 // return; // cancelled 00051 // send_order(the_table, the_dressing, has_mayo); 00052 // \endcode 00053 00054 class vgui_dialog_extensions: public vgui_dialog 00055 { 00056 public: 00057 00058 //: Constructor - takes the title of the dialog box. 00059 vgui_dialog_extensions(const char* name); 00060 virtual ~vgui_dialog_extensions(); 00061 00062 //: directory browsers 00063 void dir (const char* label, vcl_string& regexp, vcl_string& dirpath); 00064 00065 bool ask(); 00066 00067 void line_break(); 00068 00069 protected: 00070 00071 //vgui_dialog_extensions_impl* impl; 00072 }; 00073 00074 #endif // vgui_dialog_extensions_h_