core/vgui/impl/gtk/vgui_gtk_dialog_impl.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/gtk/vgui_gtk_dialog_impl.h
00002 #ifndef vgui_gtk_dialog_impl_h_
00003 #define vgui_gtk_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_gtk_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 // \endverbatim
00026 
00027 #include <vgui/internals/vgui_dialog_impl.h>
00028 #include <gtk/gtk.h>
00029 struct vgui_tableau_sptr;
00030 
00031 //: Specialization of vgui_dialog_impl for GTK. Creates a GTK dialog box.
00032 class vgui_gtk_dialog_impl : public vgui_dialog_impl
00033 {
00034  public:
00035   vgui_gtk_dialog_impl(const char* name);
00036   ~vgui_gtk_dialog_impl();
00037 
00038   void* choice_field_widget(const char*, const vcl_vector<vcl_string>&, int&);
00039   void* inline_tableau_widget(const vgui_tableau_sptr tab, unsigned width, unsigned height);
00040 
00041   //--------------------------------------------------------------------------------
00042   //: Changes the modality of the dialog.
00043   //  True makes the dialog modal (i.e. the dialog 'grabs' all events), this is the default.
00044   //  False makes the dialog non-modal.
00045   void modal(bool m);
00046 
00047   void set_ok_button(const char* txt);
00048   void set_cancel_button(const char* txt);
00049 
00050   bool ask();
00051 
00052  public:
00053   // Status of this dialog box.
00054   enum status_type { BUSY,     // user is doing stuff
00055                      OK,       // okay button pressed
00056                      CANCEL,   // cancel button pressed
00057                      CLOSE }; // dialog window closed
00058 
00059  private:
00060   GtkWidget* dialog_window;
00061   GtkWidget* vbox;
00062 
00063   status_type dialog_status_;
00064 
00065   vcl_string ok_text;
00066   vcl_string cancel_text;
00067   vcl_string title;
00068 };
00069 
00070 #endif // vgui_gtk_dialog_impl_h_