1 // This is core/vgui/vgui_dialog_extensions.h 2 #ifndef vgui_dialog_extensions_h_ 3 #define vgui_dialog_extensions_h_ 4 //: 5 // \file 6 // \author Gamze Tunali, LEMS, Brown University 7 // \date 16 Nov 2007 8 // \brief an extension to the vgui_dialog class. 9 // 10 // vgui_dialog_extensions has two new elements: directory browser and line break. 11 // 12 // \verbatim 13 // Modifications 14 // \endverbatim 15 16 #include <string> 17 #ifdef _MSC_VER 18 # include <vcl_msvc_warnings.h> 19 #endif 20 #include "vgui_dialog.h" 21 22 class vgui_dialog_extensions_impl; 23 24 //: Abstract dialog class 25 // 26 // vgui_dialog_extension allows the user to build a dialog from a collection 27 // of fields. It differs from vgui_dialog by two elements, directory browser 28 // to be able to choose folders in addition to the files, and line breaks. 29 // The tableau will be designed so that elements are placed on the same line 30 // until a line break element is inserted. This allows to create more versatile 31 // dialogs, by grouping elements on one line. 32 // 33 // A field in this context consists of a std::string label and a variable. 34 // The dialog is then posted using the ask() method. If ask returns true then 35 // any changes to the fields in the dialog are used to update the variables. 36 // Each vgui_dialog contains an instance of a concrete subclass of 37 // vgui_dialog_impl. The type of the subclass will be determined by the GUI 38 // being used. 39 // 40 // \par Example 41 // \code 42 // vgui_dialog_extensions params("My params"); 43 // params.field("Table number", the_table); 44 // params.line_break(); 45 // params.choice("Dressing", "French", "Thousand Island", the_dressing); 46 // params.checkbox("Mayo?", has_mayo); 47 // params.line_break(); 48 // params.message("No smoking is allowed in the restaurant!"); 49 // if (!params.ask()) 50 // return; // cancelled 51 // send_order(the_table, the_dressing, has_mayo); 52 // \endcode 53 54 class vgui_dialog_extensions: public vgui_dialog 55 { 56 public: 57 58 //: Constructor - takes the title of the dialog box. 59 vgui_dialog_extensions(const char* name); 60 virtual ~vgui_dialog_extensions(); 61 62 //: directory browsers 63 void dir (const char* label, std::string& regexp, std::string& dirpath); 64 65 bool ask(); 66 67 void line_break(); 68 69 protected: 70 71 //vgui_dialog_extensions_impl* impl; 72 }; 73 74 #endif // vgui_dialog_extensions_h_ 75