source: trunk/src/gui/styles/qgtkstyle_p.h@ 764

Last change on this file since 764 was 651, checked in by Dmitry A. Kuminov, 16 years ago

trunk: Merged in qt 4.6.2 sources.

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