src/gui/styles/qgtkstyle_p.h
changeset 3 41300fa6a67c
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QGTKSTYLE_P_H
       
    43 #define QGTKSTYLE_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include <QtCore/qglobal.h>
       
    57 #if !defined(QT_NO_STYLE_GTK)
       
    58 
       
    59 #include <QtGui/QFileDialog>
       
    60 
       
    61 #include <QtGui/QGtkStyle>
       
    62 #include <private/qcleanlooksstyle_p.h>
       
    63 
       
    64 #undef signals // Collides with GTK stymbols
       
    65 #include <gtk/gtk.h>
       
    66 
       
    67 typedef unsigned long XID;
       
    68 
       
    69 #undef GTK_OBJECT_FLAGS
       
    70 #define GTK_OBJECT_FLAGS(obj)(((GtkObject*)(obj))->flags)
       
    71 #define Q_GTK_IS_WIDGET(widget) widget && GTK_CHECK_TYPE ((widget), QGtkStylePrivate::gtk_widget_get_type())
       
    72 
       
    73 #define QLS(x) QLatin1String(x)
       
    74 
       
    75 class GConf;
       
    76 class GConfClient;
       
    77 
       
    78 typedef GConfClient* (*Ptr_gconf_client_get_default)();
       
    79 typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
       
    80 typedef bool (*Ptr_gconf_client_get_bool)(GConfClient*, const char*, GError **);
       
    81 
       
    82 typedef void (*Ptr_gtk_init)(int *, char ***);
       
    83 typedef GtkWidget* (*Ptr_gtk_window_new) (GtkWindowType);
       
    84 typedef GtkStyle* (*Ptr_gtk_style_attach)(GtkStyle *, GdkWindow *);
       
    85 typedef void (*Ptr_gtk_widget_destroy) (GtkWidget *);
       
    86 typedef void (*Ptr_gtk_widget_realize) (GtkWidget *);
       
    87 typedef void (*Ptr_gtk_widget_set_default_direction) (GtkTextDirection);
       
    88 typedef void (*Ptr_gtk_widget_modify_color)(GtkWidget *widget, GtkStateType state, const GdkColor *color);
       
    89 typedef GtkWidget* (*Ptr_gtk_arrow_new)(GtkArrowType, GtkShadowType);
       
    90 typedef GtkWidget* (*Ptr_gtk_menu_item_new)(void);
       
    91 typedef GtkWidget* (*Ptr_gtk_separator_menu_item_new)(void);
       
    92 typedef GtkWidget* (*Ptr_gtk_check_menu_item_new)(void);
       
    93 typedef GtkWidget* (*Ptr_gtk_menu_bar_new)(void);
       
    94 typedef GtkWidget* (*Ptr_gtk_menu_new)(void);
       
    95 typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void);
       
    96 typedef GtkWidget* (*Ptr_gtk_toolbar_new)(void);
       
    97 typedef GtkWidget* (*Ptr_gtk_spin_button_new)(GtkAdjustment*, double, int);
       
    98 typedef GtkWidget* (*Ptr_gtk_button_new)(void);
       
    99 typedef GtkWidget* (*Ptr_gtk_tool_button_new)(GtkWidget *, const gchar *);
       
   100 typedef GtkWidget* (*Ptr_gtk_hbutton_box_new)(void);
       
   101 typedef GtkWidget* (*Ptr_gtk_check_button_new)(void);
       
   102 typedef GtkWidget* (*Ptr_gtk_radio_button_new)(GSList *);
       
   103 typedef GtkWidget* (*Ptr_gtk_notebook_new)(void);
       
   104 typedef GtkWidget* (*Ptr_gtk_progress_bar_new)(void);
       
   105 typedef GtkWidget* (*Ptr_gtk_hscale_new)(GtkAdjustment*);
       
   106 typedef GtkWidget* (*Ptr_gtk_vscale_new)(GtkAdjustment*);
       
   107 typedef GtkWidget* (*Ptr_gtk_hscrollbar_new)(GtkAdjustment*);
       
   108 typedef GtkWidget* (*Ptr_gtk_vscrollbar_new)(GtkAdjustment*);
       
   109 typedef GtkWidget* (*Ptr_gtk_scrolled_window_new)(GtkAdjustment*, GtkAdjustment*);
       
   110 typedef gchar* (*Ptr_gtk_check_version)(guint, guint, guint);
       
   111 typedef GtkToolItem* (*Ptr_gtk_separator_tool_item_new) (void);
       
   112 typedef GtkWidget* (*Ptr_gtk_entry_new)(void);
       
   113 typedef GtkWidget* (*Ptr_gtk_tree_view_new)(void);
       
   114 typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_get_column)(GtkTreeView *, gint);
       
   115 typedef GtkWidget* (*Ptr_gtk_combo_box_new)(void);
       
   116 typedef GtkWidget* (*Ptr_gtk_frame_new)(const gchar *);
       
   117 typedef GtkWidget* (*Ptr_gtk_expander_new)(const gchar*);
       
   118 typedef GtkWidget* (*Ptr_gtk_statusbar_new)(void);
       
   119 typedef GtkSettings* (*Ptr_gtk_settings_get_default)(void);
       
   120 typedef void (*Ptr_gtk_range_set_adjustment)(GtkRange *, GtkAdjustment *);
       
   121 typedef void (*Ptr_gtk_progress_set_adjustment)(GtkProgress *, GtkAdjustment *);
       
   122 typedef void (*Ptr_gtk_range_set_inverted)(GtkRange*, bool);
       
   123 typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget);
       
   124 typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*);
       
   125 typedef GtkIconTheme* (*Ptr_gtk_icon_theme_get_default) (void);
       
   126 typedef void (*Ptr_gtk_widget_style_get)(GtkWidget *, const gchar *first_property_name, ...);
       
   127 typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_column_new)(void);
       
   128 typedef GtkWidget* (*Ptr_gtk_fixed_new)(void);
       
   129 typedef GdkPixbuf* (*Ptr_gtk_icon_set_render_icon)(GtkIconSet *, GtkStyle *, GtkTextDirection, GtkStateType, GtkIconSize, GtkWidget *,const char *);
       
   130 typedef void (*Ptr_gtk_tree_view_append_column) (GtkTreeView*, GtkTreeViewColumn*);
       
   131 typedef void  (*Ptr_gtk_paint_check) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   132 typedef void  (*Ptr_gtk_paint_box) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   133 typedef void  (*Ptr_gtk_paint_box_gap) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint , gint, GtkPositionType, gint gap_x, gint gap_width);
       
   134 typedef void  (*Ptr_gtk_paint_resize_grip) (GtkStyle*,GdkWindow*, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, GdkWindowEdge, gint , gint , gint , gint);
       
   135 typedef void  (*Ptr_gtk_paint_focus) (GtkStyle*,GdkWindow*, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   136 typedef void  (*Ptr_gtk_paint_shadow) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   137 typedef void  (*Ptr_gtk_paint_slider) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint, GtkOrientation);
       
   138 typedef void  (*Ptr_gtk_paint_expander) (GtkStyle*,GdkWindow*, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , GtkExpanderStyle );
       
   139 typedef void  (*Ptr_gtk_paint_handle) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint, GtkOrientation);
       
   140 typedef void  (*Ptr_gtk_paint_arrow) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, GtkArrowType, gboolean, gint , gint , gint , gint);
       
   141 typedef void  (*Ptr_gtk_paint_option) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   142 typedef void  (*Ptr_gtk_paint_flat_box) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint);
       
   143 typedef void (*Ptr_gtk_paint_extension) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint, gint, GtkPositionType);
       
   144 typedef GtkObject* (*Ptr_gtk_adjustment_new) (double, double, double, double, double, double);
       
   145 typedef void   (*Ptr_gtk_paint_hline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint y);
       
   146 typedef void   (*Ptr_gtk_paint_vline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint);
       
   147 typedef void (*Ptr_gtk_menu_item_set_submenu) (GtkMenuItem *, GtkWidget *);
       
   148 typedef void (*Ptr_gtk_container_forall) (GtkContainer *, GtkCallback, gpointer);
       
   149 typedef void (*Ptr_gtk_widget_size_allocate) (GtkWidget *, GtkAllocation*);
       
   150 typedef void (*Ptr_gtk_widget_set_direction) (GtkWidget *, GtkTextDirection);
       
   151 typedef void (*Ptr_gtk_widget_path) (GtkWidget *, guint *, gchar **, gchar**);
       
   152 typedef void (*Ptr_gtk_toolbar_insert) (GtkToolbar *toolbar, GtkToolItem *item, int pos);
       
   153 typedef void (*Ptr_gtk_menu_shell_append)(GtkMenuShell *, GtkWidget *);
       
   154 typedef GtkType (*Ptr_gtk_container_get_type) (void);
       
   155 typedef GtkType (*Ptr_gtk_window_get_type) (void);
       
   156 typedef GtkType (*Ptr_gtk_widget_get_type) (void);
       
   157 typedef GtkStyle* (*Ptr_gtk_rc_get_style_by_paths) (GtkSettings *, const char *, const char *, GType);
       
   158 typedef gint (*Ptr_pango_font_description_get_size) (const PangoFontDescription *);
       
   159 typedef PangoWeight (*Ptr_pango_font_description_get_weight) (const PangoFontDescription *);
       
   160 typedef const char* (*Ptr_pango_font_description_get_family) (const PangoFontDescription *);
       
   161 typedef PangoStyle (*Ptr_pango_font_description_get_style) (const PangoFontDescription *desc);
       
   162 typedef gboolean (*Ptr_gtk_file_chooser_set_current_folder)(GtkFileChooser *, const gchar *);
       
   163 typedef GtkFileFilter* (*Ptr_gtk_file_filter_new)(void);
       
   164 typedef void (*Ptr_gtk_file_filter_set_name)(GtkFileFilter *, const gchar *);
       
   165 typedef void (*Ptr_gtk_file_filter_add_pattern)(GtkFileFilter *filter, const gchar *pattern);
       
   166 typedef void (*Ptr_gtk_file_chooser_add_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
       
   167 typedef void (*Ptr_gtk_file_chooser_set_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
       
   168 typedef GtkFileFilter* (*Ptr_gtk_file_chooser_get_filter)(GtkFileChooser *chooser);
       
   169 typedef gchar*  (*Ptr_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
       
   170 typedef GSList* (*Ptr_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
       
   171 typedef GtkWidget* (*Ptr_gtk_file_chooser_dialog_new)(const gchar *title,
       
   172                                                 GtkWindow *parent,
       
   173                                                 GtkFileChooserAction action,
       
   174                                                 const gchar *first_button_text,
       
   175                                                 ...);
       
   176 typedef void (*Ptr_gtk_file_chooser_set_current_name) (GtkFileChooser *, const gchar *);
       
   177 typedef gboolean (*Ptr_gtk_file_chooser_set_filename) (GtkFileChooser *chooser, const gchar *name);
       
   178 typedef gint (*Ptr_gtk_dialog_run) (GtkDialog*);
       
   179 typedef void (*Ptr_gtk_border_free)(GtkBorder *);
       
   180 
       
   181 typedef guchar* (*Ptr_gdk_pixbuf_get_pixels) (const GdkPixbuf *pixbuf);
       
   182 typedef int (*Ptr_gdk_pixbuf_get_width) (const GdkPixbuf *pixbuf);
       
   183 typedef void (*Ptr_gdk_color_free) (const GdkColor *);
       
   184 typedef int (*Ptr_gdk_pixbuf_get_height) (const GdkPixbuf *pixbuf);
       
   185 typedef GdkPixbuf* (*Ptr_gdk_pixbuf_get_from_drawable) (GdkPixbuf *dest, GdkDrawable *src,
       
   186                                                          GdkColormap *cmap, int src_x,
       
   187                                                          int src_y, int dest_x, int dest_y,
       
   188                                                          int width, int height);
       
   189 typedef GdkPixmap* (*Ptr_gdk_pixmap_new) (GdkDrawable *drawable, gint width, gint height, gint depth);
       
   190 typedef GdkPixbuf* (*Ptr_gdk_pixbuf_new) (GdkColorspace colorspace, gboolean has_alpha,
       
   191                                          int bits_per_sample, int width, int height);
       
   192 typedef void (*Ptr_gdk_draw_rectangle) (GdkDrawable *drawable, GdkGC *gc,
       
   193                                         gboolean filled, gint x, gint y, gint width, gint height);
       
   194 typedef void (*Ptr_gdk_pixbuf_unref)(GdkPixbuf *);
       
   195 typedef void (*Ptr_gdk_drawable_unref)(GdkDrawable *);
       
   196 typedef gint (*Ptr_gdk_drawable_get_depth)(GdkDrawable *);
       
   197 typedef void (*Ptr_gdk_x11_window_set_user_time) (GdkWindow *window, guint32);
       
   198 typedef XID  (*Ptr_gdk_x11_drawable_get_xid) (GdkDrawable *);
       
   199 typedef Display* (*Ptr_gdk_x11_drawable_get_xdisplay) ( GdkDrawable *);
       
   200 
       
   201 
       
   202 QT_BEGIN_NAMESPACE
       
   203 
       
   204 typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir,
       
   205                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
       
   206 typedef QString (*_qt_filedialog_open_filename_hook)     (QWidget * parent, const QString &caption, const QString &dir,
       
   207                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
       
   208 typedef QString (*_qt_filedialog_save_filename_hook)     (QWidget * parent, const QString &caption, const QString &dir,
       
   209                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
       
   210 typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir,
       
   211                                                           QFileDialog::Options options);
       
   212 
       
   213 extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook;
       
   214 extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook;
       
   215 extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook;
       
   216 extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook;
       
   217 
       
   218 class QGtkStylePrivate;
       
   219 
       
   220 class QGtkStyleFilter : public QObject
       
   221 {
       
   222 public:
       
   223     QGtkStyleFilter(QGtkStylePrivate* sp)
       
   224         : stylePrivate(sp)
       
   225     {}
       
   226 private:
       
   227     QGtkStylePrivate* stylePrivate;
       
   228     bool eventFilter(QObject *obj, QEvent *e);
       
   229 };
       
   230 
       
   231 typedef enum {
       
   232   GNOME_ICON_LOOKUP_FLAGS_NONE = 0,
       
   233   GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0,
       
   234   GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES = 1<<1,
       
   235   GNOME_ICON_LOOKUP_FLAGS_ALLOW_SVG_AS_THEMSELVES = 1<<2
       
   236 } GnomeIconLookupFlags;
       
   237 
       
   238 typedef enum {
       
   239   GNOME_ICON_LOOKUP_RESULT_FLAGS_NONE = 0,
       
   240   GNOME_ICON_LOOKUP_RESULT_FLAGS_THUMBNAIL = 1<<0
       
   241 } GnomeIconLookupResultFlags;
       
   242 
       
   243 struct GnomeThumbnailFactory;
       
   244 typedef gboolean (*Ptr_gnome_vfs_init) (void);
       
   245 typedef char* (*Ptr_gnome_icon_lookup_sync)  (
       
   246         GtkIconTheme *icon_theme,
       
   247         GnomeThumbnailFactory *,
       
   248         const char *file_uri,
       
   249         const char *custom_icon,
       
   250         GnomeIconLookupFlags flags,
       
   251         GnomeIconLookupResultFlags *result);
       
   252 
       
   253 
       
   254 class QGtkStylePrivate : public QCleanlooksStylePrivate
       
   255 {
       
   256     Q_DECLARE_PUBLIC(QGtkStyle)
       
   257 public:
       
   258     QGtkStylePrivate();
       
   259     ~QGtkStylePrivate();
       
   260 
       
   261     QGtkStyleFilter filter;
       
   262 
       
   263     static GtkWidget* gtkWidget(const QString &path);
       
   264     static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow"));
       
   265 
       
   266     virtual void resolveGtk() const;
       
   267     virtual void initGtkMenu() const;
       
   268     virtual void initGtkTreeview() const;
       
   269     virtual void initGtkWidgets() const;
       
   270 
       
   271     static void cleanupGtkWidgets();
       
   272 
       
   273     static bool isKDE4Session();
       
   274     void applyCustomPaletteHash();
       
   275     static QFont getThemeFont();
       
   276     static bool isThemeAvailable() { return gtkStyle() != 0; }
       
   277 
       
   278     static bool getGConfBool(const QString &key, bool fallback = 0);
       
   279     static QString getGConfString(const QString &key, const QString &fallback = QString());
       
   280 
       
   281     static QString getThemeName();
       
   282     virtual int getSpinboxArrowSize() const;
       
   283 
       
   284     static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
       
   285             const QString &dir, const QString &filter, QString *selectedFilter,
       
   286             QFileDialog::Options options, bool isSaveDialog = false,
       
   287             QMap<GtkFileFilter *, QString> *filterMap = 0);
       
   288 
       
   289     static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
       
   290                                 QString *selectedFilter, QFileDialog::Options options);
       
   291     static QString saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
       
   292                                 QString *selectedFilter, QFileDialog::Options options);
       
   293     static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options);
       
   294     static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
       
   295                                     QString *selectedFilter, QFileDialog::Options options);
       
   296     static QIcon getFilesystemIcon(const QFileInfo &);
       
   297 
       
   298     static Ptr_gtk_container_forall gtk_container_forall;
       
   299     static Ptr_gtk_init gtk_init;
       
   300     static Ptr_gtk_style_attach gtk_style_attach;
       
   301     static Ptr_gtk_window_new gtk_window_new;
       
   302     static Ptr_gtk_widget_destroy gtk_widget_destroy;
       
   303     static Ptr_gtk_widget_realize gtk_widget_realize;
       
   304     static Ptr_gtk_widget_set_default_direction gtk_widget_set_default_direction;
       
   305     static Ptr_gtk_widget_modify_color gtk_widget_modify_fg;
       
   306     static Ptr_gtk_widget_modify_color gtk_widget_modify_bg;
       
   307     static Ptr_gtk_menu_item_new gtk_menu_item_new;
       
   308     static Ptr_gtk_arrow_new gtk_arrow_new;
       
   309     static Ptr_gtk_check_menu_item_new gtk_check_menu_item_new;
       
   310     static Ptr_gtk_menu_bar_new gtk_menu_bar_new;
       
   311     static Ptr_gtk_menu_new gtk_menu_new;
       
   312     static Ptr_gtk_expander_new gtk_expander_new;
       
   313     static Ptr_gtk_button_new gtk_button_new;
       
   314     static Ptr_gtk_tool_button_new gtk_tool_button_new;
       
   315     static Ptr_gtk_hbutton_box_new gtk_hbutton_box_new;
       
   316     static Ptr_gtk_check_button_new gtk_check_button_new;
       
   317     static Ptr_gtk_radio_button_new gtk_radio_button_new;
       
   318     static Ptr_gtk_spin_button_new gtk_spin_button_new;
       
   319     static Ptr_gtk_separator_tool_item_new gtk_separator_tool_item_new;
       
   320     static Ptr_gtk_toolbar_insert gtk_toolbar_insert;
       
   321     static Ptr_gtk_frame_new gtk_frame_new;
       
   322     static Ptr_gtk_statusbar_new gtk_statusbar_new;
       
   323     static Ptr_gtk_entry_new gtk_entry_new;
       
   324     static Ptr_gtk_hscale_new gtk_hscale_new;
       
   325     static Ptr_gtk_vscale_new gtk_vscale_new;
       
   326     static Ptr_gtk_hscrollbar_new gtk_hscrollbar_new;
       
   327     static Ptr_gtk_vscrollbar_new gtk_vscrollbar_new;
       
   328     static Ptr_gtk_scrolled_window_new gtk_scrolled_window_new;
       
   329     static Ptr_gtk_notebook_new gtk_notebook_new;
       
   330     static Ptr_gtk_toolbar_new gtk_toolbar_new;
       
   331     static Ptr_gtk_tree_view_new gtk_tree_view_new;
       
   332     static Ptr_gtk_tree_view_get_column gtk_tree_view_get_column;
       
   333     static Ptr_gtk_combo_box_new gtk_combo_box_new;
       
   334     static Ptr_gtk_combo_box_entry_new gtk_combo_box_entry_new;
       
   335     static Ptr_gtk_progress_bar_new gtk_progress_bar_new;
       
   336     static Ptr_gtk_container_add gtk_container_add;
       
   337     static Ptr_gtk_menu_shell_append gtk_menu_shell_append;
       
   338     static Ptr_gtk_progress_set_adjustment gtk_progress_set_adjustment;
       
   339     static Ptr_gtk_range_set_adjustment gtk_range_set_adjustment;
       
   340     static Ptr_gtk_range_set_inverted gtk_range_set_inverted;
       
   341     static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default;
       
   342     static Ptr_gtk_icon_theme_get_default gtk_icon_theme_get_default;
       
   343     static Ptr_gtk_widget_style_get gtk_widget_style_get;
       
   344     static Ptr_gtk_icon_set_render_icon gtk_icon_set_render_icon;
       
   345     static Ptr_gtk_fixed_new gtk_fixed_new;
       
   346     static Ptr_gtk_tree_view_column_new gtk_tree_view_column_new;
       
   347     static Ptr_gtk_tree_view_append_column gtk_tree_view_append_column;
       
   348     static Ptr_gtk_paint_check gtk_paint_check;
       
   349     static Ptr_gtk_paint_box gtk_paint_box;
       
   350     static Ptr_gtk_paint_box_gap gtk_paint_box_gap;
       
   351     static Ptr_gtk_paint_flat_box gtk_paint_flat_box;
       
   352     static Ptr_gtk_paint_option gtk_paint_option;
       
   353     static Ptr_gtk_paint_extension gtk_paint_extension;
       
   354     static Ptr_gtk_paint_slider gtk_paint_slider;
       
   355     static Ptr_gtk_paint_shadow gtk_paint_shadow;
       
   356     static Ptr_gtk_paint_resize_grip gtk_paint_resize_grip;
       
   357     static Ptr_gtk_paint_focus gtk_paint_focus;
       
   358     static Ptr_gtk_paint_arrow gtk_paint_arrow;
       
   359     static Ptr_gtk_paint_handle gtk_paint_handle;
       
   360     static Ptr_gtk_paint_expander gtk_paint_expander;
       
   361     static Ptr_gtk_adjustment_new gtk_adjustment_new;
       
   362     static Ptr_gtk_paint_vline gtk_paint_vline;
       
   363     static Ptr_gtk_paint_hline gtk_paint_hline;
       
   364     static Ptr_gtk_menu_item_set_submenu gtk_menu_item_set_submenu;
       
   365     static Ptr_gtk_settings_get_default gtk_settings_get_default;
       
   366     static Ptr_gtk_separator_menu_item_new gtk_separator_menu_item_new;
       
   367     static Ptr_gtk_widget_size_allocate gtk_widget_size_allocate;
       
   368     static Ptr_gtk_widget_set_direction gtk_widget_set_direction;
       
   369     static Ptr_gtk_widget_path gtk_widget_path;
       
   370     static Ptr_gtk_container_get_type gtk_container_get_type;
       
   371     static Ptr_gtk_window_get_type gtk_window_get_type;
       
   372     static Ptr_gtk_widget_get_type gtk_widget_get_type;
       
   373     static Ptr_gtk_rc_get_style_by_paths gtk_rc_get_style_by_paths;
       
   374     static Ptr_gtk_check_version gtk_check_version;
       
   375     static Ptr_gtk_border_free gtk_border_free;
       
   376 
       
   377     static Ptr_pango_font_description_get_size pango_font_description_get_size;
       
   378     static Ptr_pango_font_description_get_weight pango_font_description_get_weight;
       
   379     static Ptr_pango_font_description_get_family pango_font_description_get_family;
       
   380     static Ptr_pango_font_description_get_style pango_font_description_get_style;
       
   381 
       
   382     static Ptr_gtk_file_filter_new gtk_file_filter_new;
       
   383     static Ptr_gtk_file_filter_set_name gtk_file_filter_set_name;
       
   384     static Ptr_gtk_file_filter_add_pattern gtk_file_filter_add_pattern;
       
   385     static Ptr_gtk_file_chooser_add_filter gtk_file_chooser_add_filter;
       
   386     static Ptr_gtk_file_chooser_set_filter gtk_file_chooser_set_filter;
       
   387     static Ptr_gtk_file_chooser_get_filter gtk_file_chooser_get_filter;
       
   388     static Ptr_gtk_file_chooser_dialog_new gtk_file_chooser_dialog_new;
       
   389     static Ptr_gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder;
       
   390     static Ptr_gtk_file_chooser_get_filename gtk_file_chooser_get_filename;
       
   391     static Ptr_gtk_file_chooser_get_filenames gtk_file_chooser_get_filenames;
       
   392     static Ptr_gtk_file_chooser_set_current_name gtk_file_chooser_set_current_name;
       
   393     static Ptr_gtk_dialog_run gtk_dialog_run;
       
   394     static Ptr_gtk_file_chooser_set_filename gtk_file_chooser_set_filename;
       
   395 
       
   396     static Ptr_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels;
       
   397     static Ptr_gdk_pixbuf_get_width gdk_pixbuf_get_width;
       
   398     static Ptr_gdk_pixbuf_get_height gdk_pixbuf_get_height;
       
   399     static Ptr_gdk_pixmap_new gdk_pixmap_new;
       
   400     static Ptr_gdk_pixbuf_new gdk_pixbuf_new;
       
   401     static Ptr_gdk_pixbuf_get_from_drawable gdk_pixbuf_get_from_drawable;
       
   402     static Ptr_gdk_draw_rectangle gdk_draw_rectangle;
       
   403     static Ptr_gdk_pixbuf_unref gdk_pixbuf_unref;
       
   404     static Ptr_gdk_drawable_unref gdk_drawable_unref;
       
   405     static Ptr_gdk_drawable_get_depth gdk_drawable_get_depth;
       
   406     static Ptr_gdk_color_free gdk_color_free;
       
   407     static Ptr_gdk_x11_window_set_user_time gdk_x11_window_set_user_time;
       
   408     static Ptr_gdk_x11_drawable_get_xid gdk_x11_drawable_get_xid;
       
   409     static Ptr_gdk_x11_drawable_get_xdisplay gdk_x11_drawable_get_xdisplay;
       
   410 
       
   411     static Ptr_gconf_client_get_default gconf_client_get_default;
       
   412     static Ptr_gconf_client_get_string gconf_client_get_string;
       
   413     static Ptr_gconf_client_get_bool gconf_client_get_bool;
       
   414 
       
   415     static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync;
       
   416     static Ptr_gnome_vfs_init gnome_vfs_init;
       
   417 
       
   418     virtual QPalette gtkWidgetPalette(const QString &gtkWidgetName) const;
       
   419 
       
   420 protected:
       
   421     typedef QHash<QString, GtkWidget*> WidgetMap;
       
   422 
       
   423     static inline WidgetMap *gtkWidgetMap()
       
   424     {
       
   425         static WidgetMap *map = 0;
       
   426         if (!map)
       
   427             map = new WidgetMap();
       
   428         return map;
       
   429     }
       
   430 
       
   431     static QStringList extract_filter(const QString &rawFilter);
       
   432 
       
   433     virtual GtkWidget* getTextColorWidget() const;
       
   434     static void setupGtkWidget(GtkWidget* widget);
       
   435     static void addWidgetToMap(GtkWidget* widget);
       
   436     static void addAllSubWidgets(GtkWidget *widget, gpointer v = 0);
       
   437     static void addWidget(GtkWidget *widget);
       
   438 
       
   439     virtual void init();
       
   440 
       
   441 private:
       
   442     static QList<QGtkStylePrivate *> instances;
       
   443     friend class QGtkStyleUpdateScheduler;
       
   444 };
       
   445 
       
   446 // Helper to ensure that we have polished all our gtk widgets
       
   447 // before updating our own palettes
       
   448 class QGtkStyleUpdateScheduler : public QObject
       
   449 {
       
   450     Q_OBJECT
       
   451 public slots:
       
   452     void updateTheme();
       
   453 };
       
   454 
       
   455 QT_END_NAMESPACE
       
   456 
       
   457 #endif // !QT_NO_STYLE_GTK
       
   458 #endif // QGTKSTYLE_P_H