From beb8adf263fc48b76da0eccba506daa657a16fe3 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 30 Nov 2012 13:14:41 -0600 Subject: Set GTK event passthrough on startup Fix menu item text highlight color --- tdegtk/tdegtk-draw.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'tdegtk/tdegtk-draw.cpp') diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index 9d4e8e2..1829289 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -114,6 +114,20 @@ static TQPalette::ColorGroup gtkToTQPaletteColorGroup(GtkThemingEngine* engine, return cg; } +// Keep this in sync with gtkToTQtColorGroup() above +static TQColorGroup gtkToTQColorGroup(GtkThemingEngine* engine, GtkStateFlags state, TQPalette &basePalette) { + TQColorGroup cg = basePalette.active(); + + if (state & GTK_STATE_FLAG_INSENSITIVE) { + cg = basePalette.disabled(); + } + else { + cg = basePalette.active(); + } + + return cg; +} + static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlags state, TQt3WidgetType wt, GtkWidget* widget) { TQStyle::SFlags sflags = TQStyle::Style_Default; @@ -1141,7 +1155,21 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, else { pe = TQStyle::PE_ArrowRight; } - tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); + + TQt3WidgetType tqt3WidgetType = TQT3WT_NONE; + TQStringList objectTypes; + objectTypes.append(TQWIDGET_OBJECT_NAME_STRING); + if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))) { + GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); + if (!GTK_IS_MENU_BAR(parent)) { + objectTypes.clear(); + objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING); + tqt3WidgetType = TQT3WT_TQMenuItem; + } + } + TQPalette objectPalette = tqApp->palette(objectTypes); + + tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQColorGroup(engine, state, objectPalette), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); } if (p) { -- cgit v1.2.1