core/vgui/impl/qt4/vgui_qt_dialog_impl.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/qt4/vgui_qt_dialog_impl.h
00002 #ifndef vgui_qt_dialog_impl_h_
00003 #define vgui_qt_dialog_impl_h_
00004 //:
00005 // \file
00006 // \brief QT Dialog wrapper
00007 // \author Joris Schouteden, ESAT, K.U.Leuven
00008 //
00009 // \verbatim
00010 //  Modifications
00011 //   27.03.2000 JS  Initial Version, adapted from vgui_Fl_dialog_impl
00012 //   26.10.2000 JS  Added file browser and text message
00013 //   09.11.2000 JS  Added colour browser
00014 //   14.11.2005 Chanop Silpa-Anan  adapted to QT 3.3.5 for X11/Mac
00015 //   02.05.2007 Christoph_John@gmx.de ported to QT 4.2.2
00016 //   23.05.2007 Matt Leotta  converted to QT3 compatibility functions to native QT4
00017 // \endverbatim
00018 
00019 #include <vgui/internals/vgui_dialog_impl.h>
00020 
00021 #include <QDialog>
00022 #include <QObject>
00023 #include <QGroupBox>
00024 #include <QLineEdit>
00025 #include <QSpinBox>
00026 
00027 
00028 
00029 //: QT implementation of vgui_dialog_impl.
00030 class vgui_qt_dialog_impl :
00031    public QDialog,
00032    public vgui_dialog_impl
00033 {
00034    Q_OBJECT
00035  public:
00036     vgui_qt_dialog_impl(const char* name);
00037    ~vgui_qt_dialog_impl() {}
00038 
00039    void* bool_field_widget(const char*, bool&);
00040    void* int_field_widget(const char*, int&);
00041    void* long_field_widget(const char*, long&);
00042    void* float_field_widget(const char*, float&);
00043    void* double_field_widget(const char*, double&);
00044    void* string_field_widget(const char*, vcl_string&);
00045    void* choice_field_widget(const char*, const vcl_vector<vcl_string>&, int&);
00046 
00047    void* text_message_widget(const char*);
00048    void* file_browser_widget(const char*, vcl_string&, vcl_string&);
00049    void* inline_file_browser_widget(const char *,vcl_string&, vcl_string&);
00050    void* color_chooser_widget(const char *,vcl_string&);//, vcl_string&);
00051    void* inline_color_chooser_widget(const char *,vcl_string&);//, vcl_string&);
00052    void* inline_tableau_widget(const vgui_tableau_sptr tab,
00053                                unsigned int width, unsigned int height);
00054    void  modal(bool m);
00055 
00056    bool  ask();
00057 };
00058 
00059 
00060 
00061 class vgui_qt_filebrowser_impl : public QGroupBox
00062 {
00063    Q_OBJECT
00064  public:
00065    vgui_qt_filebrowser_impl(QWidget* parent, const vcl_string& t, const vcl_string& f, const vcl_string& s);
00066   ~vgui_qt_filebrowser_impl() {}
00067 
00068   vcl_string  file() const { return vcl_string(edit_->text().toLatin1()); }
00069 
00070  public slots:
00071    void get_a_file();
00072 
00073  private:
00074    vcl_string title_;
00075    vcl_string filter_;
00076    QLineEdit*  edit_;
00077 };
00078 
00079 class vgui_qt_colorchooser_impl : public QGroupBox
00080 {
00081    Q_OBJECT
00082  public:
00083    vgui_qt_colorchooser_impl(QWidget* parent, const char*, vcl_string&);
00084   ~vgui_qt_colorchooser_impl() {}
00085 
00086   vcl_string  color() const { return value_; }
00087   
00088  private:
00089   void update_color_string();
00090 
00091  public slots:
00092   void get_a_color();
00093   void change_red(int);
00094   void change_green(int);
00095   void change_blue(int);
00096   void change_alpha(int);
00097 
00098  private:
00099    vcl_string& value_;
00100    QColor      color_;
00101    QFrame*     frame_;
00102    QSpinBox   *rbox_, *gbox_, *bbox_, *abox_;
00103 };
00104 
00105 
00106 class vgui_qt_tableau_impl : public QWidget
00107 {
00108    Q_OBJECT
00109  public:
00110    vgui_qt_tableau_impl(QWidget* parent, const vgui_tableau_sptr tab,
00111                         unsigned int width, unsigned int height);
00112   ~vgui_qt_tableau_impl() {}
00113 };
00114 
00115 #endif // vgui_qt_dialog_impl_h_