diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-19 02:53:52 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-19 02:53:52 +0000 |
commit | 94a5414c7b3366cf894af40079d5ede1c6e17518 (patch) | |
tree | 88fd89e703fc1659abeee7522e6177751e7bc28a /src/qt_theme_draw.c | |
parent | 2ce5b382990085bcce1ba3ec48536ae16fa2e4bc (diff) | |
download | gtk-qt-engine-94a5414c7b3366cf894af40079d5ede1c6e17518.tar.gz gtk-qt-engine-94a5414c7b3366cf894af40079d5ede1c6e17518.zip |
Fix up a number of GTK/Qt theme engine problems
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gtk-qt-engine@1259595 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/qt_theme_draw.c')
-rw-r--r-- | src/qt_theme_draw.c | 96 |
1 files changed, 90 insertions, 6 deletions
diff --git a/src/qt_theme_draw.c b/src/qt_theme_draw.c index b95bcda..2ccdaf8 100644 --- a/src/qt_theme_draw.c +++ b/src/qt_theme_draw.c @@ -26,6 +26,11 @@ #define min(x,y) ((x)<=(y)?(x):(y)) #endif +extern gboolean tde_showIconsOnPushButtons; + +static GdkPixbuf * (*stockRenderIcon)() = NULL; +static void * (*stockDrawString)() = NULL; + static void qtengine_style_init (QtEngineStyle *style); static void qtengine_style_class_init (QtEngineStyleClass *klass); @@ -70,6 +75,48 @@ static void sanitize_size(GdkWindow* window, gint* width, gint* height) } +static GdkPixbuf * +draw_icon (GtkStyle *style, + const GtkIconSource *source, + GtkTextDirection direction, + GtkStateType state, + GtkIconSize size, + GtkWidget *widget, + const gchar *detail) +{ + gboolean paint_icon = TRUE; + + if (gtkQtDebug) + printf("ICON Widget: %s Detail: %s\n",gtk_widget_get_name(widget),detail); + + GtkWidget* parent; + parent = gtk_widget_get_parent(widget); + int level = 1; + while (parent) { + if (gtkQtDebug) + printf("ICON Parent: %s\n",gtk_widget_get_name(parent)); + if (strcmp("GtkButton", gtk_widget_get_name(parent)) == 0) { + if (level == 3) { +#ifdef USE_NATIVE_GTK_BUTTON_DRAWING + paint_icon = tde_showIconsOnPushButtons; +#else + paint_icon = FALSE; +#endif + } + } + parent = gtk_widget_get_parent(parent); + level++; + } + + if (paint_icon) { + return stockRenderIcon(style, source, direction, state, size, widget, detail); + } + else { + // FIXME + return NULL; + } +} + static void draw_hline(GtkStyle* style, GdkWindow* window, @@ -594,7 +641,20 @@ draw_diamond(GtkStyle * style, { } - +static void +draw_string(GtkStyle *style, + GdkWindow *window, + GtkStateType state_type, + GdkRectangle *area, + GtkWidget *widget, + const gchar *detail, + gint x, + gint y, + const gchar *string) +{ + if (gtkQtDebug) + printf("STRING Widget: %s Detail: %s\n",gtk_widget_get_name(widget),detail); +} static void draw_box(GtkStyle * style, @@ -769,7 +829,7 @@ draw_box(GtkStyle * style, if (toplevel && toplevel->default_widget == widget) defaultButton = 1; - drawButton(window,style,state_type,defaultButton,x,y,width,height); + drawButton(window,style,state_type,defaultButton,x,y,width,height,GTK_BUTTON(widget)); } return; } @@ -800,8 +860,9 @@ draw_box(GtkStyle * style, checkout drawTabFrame() for drawing tabbarbase. */ drawTabNG(window,style,state_type,x, y, width - 2, height, nb ); } - else + else { drawTab(window,style,state_type,x,y,width-2,height); + } return; } if (DETAIL("optionmenu")) @@ -1272,7 +1333,7 @@ draw_handle(GtkStyle * style, sanitize_size(window, &width, &height); if (gtkQtDebug) - printf("Handle (%d,%d,%d,%d) Widget: %s Detail: %s \n",x,y,width,height,gtk_widget_get_name(widget),detail, state_type); + printf("Handle (%d,%d,%d,%d) Widget: %s Detail: %s State Type: %d\n",x,y,width,height,gtk_widget_get_name(widget),detail, state_type); drawSplitter(window,style,state_type,orientation,x,y,width,height); return; @@ -1290,13 +1351,31 @@ void draw_layout (GtkStyle *style, gint y, PangoLayout *tqlayout) { + gboolean paint_layout = TRUE; GdkColor color; GdkGC *gc; getTextColor(&color, state_type); if (gtkQtDebug) - printf("Layout (%d,%d) Widget: %s Detail: %s %d \n",x,y,gtk_widget_get_name(widget),detail, state_type); + printf("Layout (%d,%d) Widget: %s Detail: %s State Type: %d use_text: %d\n",x,y,gtk_widget_get_name(widget),detail, state_type, use_text); + +#ifdef USE_NATIVE_GTK_BUTTON_DRAWING +#else + GtkWidget* parent; + parent = gtk_widget_get_parent(widget); + while (parent) { + if (gtkQtDebug) + printf("Layout Parent: %s\n",gtk_widget_get_name(parent)); + if (strcmp("GtkButton", gtk_widget_get_name(parent)) == 0) { + paint_layout = FALSE; + } + parent = gtk_widget_get_parent(parent); + } +#endif + + if (!paint_layout) + return; if (DETAIL("accellabel") || DETAIL("label") || DETAIL("cellrenderertext")) { @@ -1886,6 +1965,11 @@ qtengine_style_class_init (QtEngineStyleClass *klass) GtkStyleClass *style_class = GTK_STYLE_CLASS (klass); parent_class = g_type_class_peek_parent (klass); + + stockRenderIcon = style_class->render_icon; + stockDrawString = style_class->draw_string; + + style_class->render_icon = draw_icon; style_class->draw_hline = draw_hline; style_class->draw_vline = draw_vline; @@ -1893,7 +1977,7 @@ qtengine_style_class_init (QtEngineStyleClass *klass) style_class->draw_polygon = draw_polygon; style_class->draw_arrow = draw_arrow; style_class->draw_diamond = draw_diamond; - /*style_class->draw_string = draw_string;*/ +// style_class->draw_string = draw_string; style_class->draw_box = draw_box; style_class->draw_flat_box = draw_flat_box; style_class->draw_check = draw_check; |