core/vgui/impl/gtk2/vgui_gtk2_dialog_impl.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/gtk2/vgui_gtk2_dialog_impl.h
00002 #ifndef vgui_gtk2_dialog_impl_h_
00003 #define vgui_gtk2_dialog_impl_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief  The GTK implementation of vgui_dialog_impl.
00010 // \author Robotics Research Group, University of Oxford
00011 // \date   28 Dec 99
00012 //
00013 //  Contains class  vgui_gtk2_dialog_impl
00014 //
00015 // \verbatim
00016 //  Modifications
00017 //   K.Y.McGaul  25-JAN-00  Moved all field functions to vgui_dialog_impl.
00018 //                          Added choice_field_widget function.
00019 //   Marko Bacic 11-JUL-00  Added support for inline file dialog box
00020 //   Marko Bacic 12-JUL-00  Added support for inline color chooser box
00021 //   Marko Bacic 14-JUL-00  Fixed misalignment of entry boxes
00022 //   Marko Bacic 20-JUL-00  Fixed bug in inline file dialog box. Now returns
00023 //                          the full pathname
00024 //   K.Y.McGaul  31-MAY-01  Added set_ok/cancel_button.
00025 //   Lianqing Yu 07-JAN-11  Added line break and push button. A line break
00026 //                          is a format descriptor that indicates multiple
00027 //                          controls should be put in one row.
00028 // \endverbatim
00029 
00030 #include <vgui/internals/vgui_dialog_impl.h>
00031 #include <gtk/gtk.h>
00032 class vgui_tableau_sptr;
00033 
00034 //: Specialization of vgui_dialog_impl for GTK. Creates a GTK dialog box.
00035 class vgui_gtk2_dialog_impl : public vgui_dialog_impl
00036 {
00037  public:
00038   vgui_gtk2_dialog_impl(const char* name);
00039   ~vgui_gtk2_dialog_impl();
00040 
00041   void* pushbutton_field_widget(const char*, const void*);
00042   void* choice_field_widget(const char*, const vcl_vector<vcl_string>&, int&);
00043   void* inline_tableau_widget(const vgui_tableau_sptr tab, unsigned width, unsigned height);
00044 
00045   //--------------------------------------------------------------------------------
00046   //: Changes the modality of the dialog.
00047   //  True makes the dialog modal (i.e. the dialog 'grabs' all events), this is the default.
00048   //  False makes the dialog non-modal.
00049   void modal(bool m);
00050 
00051   void set_ok_button(const char* txt);
00052   void set_cancel_button(const char* txt);
00053 
00054   bool ask();
00055 
00056  public:
00057   // Status of this dialog box.
00058   enum status_type { BUSY,     // user is doing stuff
00059                      OK,       // okay button pressed
00060                      CANCEL,   // cancel button pressed
00061                      CLOSE }; // dialog window closed
00062 
00063  private:
00064   GtkWidget* dialog_window;
00065   GtkWidget* vbox;
00066 
00067   status_type dialog_status_;
00068 
00069   vcl_string ok_text;
00070   vcl_string cancel_text;
00071   vcl_string title;
00072 };
00073 
00074 #endif // vgui_gtk2_dialog_impl_h_