diff options
author | Timothy Pearson <[email protected]> | 2012-11-08 01:35:06 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-08 01:35:06 -0600 |
commit | cf8d4ef895903edde76148ebf4ca9876bcf42d26 (patch) | |
tree | a11965ca7212baf2a3c90e8d9bd07f8148797fce /tdegtk/tdegtk-draw.cpp | |
parent | 76f5e2671f3a61225a730e3d9699833ae3bec6f2 (diff) | |
download | gtk3-tqt-engine-cf8d4ef895903edde76148ebf4ca9876bcf42d26.tar.gz gtk3-tqt-engine-cf8d4ef895903edde76148ebf4ca9876bcf42d26.zip |
Fix toolbar rendering
Diffstat (limited to 'tdegtk/tdegtk-draw.cpp')
-rw-r--r-- | tdegtk/tdegtk-draw.cpp | 501 |
1 files changed, 365 insertions, 136 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index 50e8eb3..79f9d47 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -46,15 +46,18 @@ #define DEBUG_FILL_BACKGROUND_WITH_COLOR(p,x,y,z) TQBrush brush2( TQColor(x,y,z), TQBrush::SolidPattern ); \ p.setBrush( brush2 ); \ p.setPen( TQt::NoPen ); \ - p.drawRect( 0,0, width*2,height*2 ); + p.drawRect( 0,0, width*2,height*2 ); \ + p.setBrush(TQt::NoBrush); #define DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p,x) p.setBrush(x); \ p.setPen(TQt::NoPen); \ - p.drawRect(0, 0, width, height); + p.drawRect(0, 0, width, height); \ + p.setBrush(TQt::NoBrush); #define DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p,b,x,y,w,h) p.setBrush(b); \ p.setPen(TQt::NoPen); \ - p.drawRect(x, y, w, h); + p.drawRect(x, y, w, h); \ + p.setBrush(TQt::NoBrush); extern int m_scrollBarSubLineWidth; @@ -105,10 +108,10 @@ static TQPalette::ColorGroup gtkToTQPaletteColorGroup(GtkThemingEngine* engine, return cg; } -static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlags state, TQt3WidgetType wt) { +static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlags state, TQt3WidgetType wt, GtkWidget* widget) { TQStyle::SFlags sflags = TQStyle::Style_Default; - gboolean active, inconsistent, mousedown, prelight, focused, disabled, in_menu; + gboolean active, inconsistent, mousedown, prelight, focused, disabled, in_menu, has_focus; in_menu = gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM); prelight = (state & GTK_STATE_FLAG_PRELIGHT) != 0; focused = (state & GTK_STATE_FLAG_FOCUSED) != 0; @@ -116,6 +119,7 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag inconsistent = (state & GTK_STATE_FLAG_INCONSISTENT) != 0; mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; active = (state & GTK_STATE_FLAG_ACTIVE) != 0; + has_focus = gtk_widget_has_visible_focus(widget); if ((wt == TQT3WT_TQRadioButton) || (wt == TQT3WT_TQCheckBox) || (wt == TQT3WT_TQPushButton)) { if (!inconsistent) { @@ -138,6 +142,35 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } + } + else if (wt == TQT3WT_TQToolButton) { + if (!inconsistent) { + if (active) { + sflags |= TQStyle::Style_On; + } + else { + sflags |= TQStyle::Style_Off; + } + } + if (mousedown) { + sflags |= TQStyle::Style_Down; + } + if (prelight) { + sflags |= TQStyle::Style_MouseOver; + sflags |= TQStyle::Style_Raised; + } + if (focused) { + sflags |= TQStyle::Style_HasFocus; + } + if (!disabled) { + sflags |= TQStyle::Style_Enabled; + } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } else if (wt == TQT3WT_GTKTreeViewCell) { if (!inconsistent) { @@ -157,6 +190,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } else if (wt == TQT3WT_TQGroupBox) { if (prelight) { @@ -168,6 +204,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } else if (wt == TQT3WT_TQMenuItem) { if (prelight) { @@ -179,6 +218,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } else if (wt == TQT3WT_TQSlider) { if (mousedown) { @@ -193,6 +235,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } else { if (active) { @@ -207,6 +252,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag if (!disabled) { sflags |= TQStyle::Style_Enabled; } + if (has_focus) { + sflags |= TQStyle::Style_HasFocus; + } } return sflags; @@ -268,14 +316,17 @@ static TQColorGroup::ColorRole backgroundModeToColorRole(TQt::BackgroundMode mod } void gtkRangeToCeData(GtkRange* rangeWidget, TQStyleControlElementData &ceData) { + gint slider_start_pos; + gint slider_end_pos; GtkAdjustment* adjustment = gtk_range_get_adjustment(rangeWidget); + gtk_range_get_slider_range(rangeWidget, &slider_start_pos, &slider_end_pos); ceData.minSteps = gtk_adjustment_get_lower(adjustment); ceData.maxSteps = gtk_adjustment_get_upper(adjustment); // ceData.tickMarkSetting = // ceData.tickInterval = ceData.currentStep = gtk_adjustment_get_value(adjustment); -// ceData.startStep = + ceData.startStep = slider_start_pos; ceData.lineStep = gtk_adjustment_get_step_increment(adjustment); ceData.pageStep = gtk_adjustment_get_page_increment(adjustment); } @@ -323,7 +374,7 @@ draw_combobox_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; @@ -333,8 +384,13 @@ draw_combobox_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G ceData.rect = boundingRect; + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ComboBoxFrame, TQStyle::SC_None); + //tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ComboBoxFrame, TQStyle::SC_None); + tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_All, TQStyle::SC_None); } cairo_restore(cr); @@ -361,7 +417,7 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; @@ -370,14 +426,31 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state gdouble gtkProgressBarFraction = gtk_progress_bar_get_fraction(progressBar); ceData.totalSteps = 8192; ceData.currentStep = gtkProgressBarFraction*8192; - - TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE); + + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget); sflags = sflags | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default); + TQRect progressBarGrooveRect; + TQRect progressBarContentsRect; + + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p2, brush) + + // Draw frame + progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); + progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); + + tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p2, ceData, elementFlags, progressBarGrooveRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); + + // Draw contents if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL)) { // If vertical, apply a 90 degree rotation matrix to the painter // This is required to make TQt draw a vertical progress bar - TQWMatrix m; // // Upside down @@ -394,23 +467,171 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state ceData.rect = boundingRect; } - TQRect progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); - TQRect progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); - - // Draw background - TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base); - DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p2, brush) - - // Draw frame - tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p2, ceData, elementFlags, progressBarGrooveRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); + progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); + progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); - // Draw contents tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p2, ceData, elementFlags, progressBarContentsRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); } cairo_restore(cr); } +static void +draw_slider_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget) { + cairo_save(cr); + + cairo_matrix_t gtk_matrix; + cairo_get_matrix(cr, >k_matrix); + gtk_matrix.x0 = 0; + gtk_matrix.y0 = 0; + cairo_set_matrix(cr, >k_matrix); + + if (GTK_IS_SCALE(widget)) { + const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); + + GdkRectangle rangeRect; + gtk_range_get_range_rect(GTK_RANGE(widget), &rangeRect); + + TQRect boundingRect(0, 0, allocation.width, allocation.height); + TQt3CairoPaintDevice pd2(NULL, allocation.x + rangeRect.x, allocation.y + rangeRect.y, rangeRect.width, rangeRect.height, cr); + TQPainter p2(&pd2); + + //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; + bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; + + GtkScale* scaleWidget = GTK_SCALE(widget); + + TQStringList objectTypes; + objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; + ceData.widgetObjectTypes = objectTypes; + ceData.rect = boundingRect; + ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; + + gtkScaleToSliderCeData(scaleWidget, ceData); + + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + + // Draw item + tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_All, ((mousedown)?TQStyle::SC_All:TQStyle::SC_None)); + } + + cairo_restore(cr); +} + +static void +draw_checkbox(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget, TQt3WidgetType tqt3WidgetType) { + TQStringList objectTypes; + objectTypes.append(TQCHECKBOX_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); + TQPainter p2(&pd2); + + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; + ceData.widgetObjectTypes = objectTypes; + ceData.rect = boundingRect; + + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + + // Draw item + tqApp->style().drawControl(TQStyle::CE_CheckBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); +} + +static void +draw_radiobutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget, TQt3WidgetType tqt3WidgetType) { + TQStringList objectTypes; + objectTypes.append(TQCHECKBOX_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); + TQPainter p2(&pd2); + + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; + ceData.widgetObjectTypes = objectTypes; + ceData.rect = boundingRect; + + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + + // Draw item + tqApp->style().drawControl(TQStyle::CE_RadioButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); +} + +static void +draw_pushbutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget, TQt3WidgetType tqt3WidgetType) { + TQStringList objectTypes; + objectTypes.append(TQCHECKBOX_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); + TQPainter p2(&pd2); + + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; + ceData.widgetObjectTypes = objectTypes; + ceData.rect = boundingRect; + + if (gtk_widget_has_default(widget)) { + elementFlags = elementFlags | TQStyle::CEF_IsDefault; + } + if (gtk_widget_has_visible_focus(widget)) { + elementFlags = elementFlags | TQStyle::CEF_HasFocus; + } + + // Draw item + tqApp->style().drawControl(TQStyle::CE_PushButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); +} + +static void +draw_toolbar_button(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget, TQt3WidgetType tqt3WidgetType) { + bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; + + TQStringList objectTypes; + objectTypes.append(TQTOOLBUTTON_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; + ceData.widgetObjectTypes = objectTypes; + ceData.colorGroup = ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()); + ceData.orientation = TQt::Horizontal; + + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); + TQPainter p2(&pd2); + + ceData.rect = boundingRect; + + GtkWidget* parent = (widget)?Gtk::gtk_widget_find_parent(widget, GTK_TYPE_TOOLBAR):0L; + if (parent) { + TQStringList parentObjectTypes; + parentObjectTypes.append(TQTOOLBAR_OBJECT_NAME_STRING); + TQPalette parentObjectPalette = tqApp->palette(parentObjectTypes); + const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(parent); + + ceData.parentWidgetData.widgetObjectTypes = parentObjectTypes; + ceData.parentWidgetData.rect = TQRect(0, 0, allocation.width, allocation.height); + ceData.parentWidgetData.colorGroup = ((state & GTK_STATE_FLAG_INSENSITIVE)?parentObjectPalette.disabled():parentObjectPalette.active()); + } + + // Draw item + tqApp->style().drawComplexControl(TQStyle::CC_ToolButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget), TQStyle::SC_ToolButton, ((mousedown)?TQStyle::SC_ToolButton:TQStyle::SC_None)); +} + /* draw a texture placed on the centroid */ static gboolean draw_centroid_texture (GtkThemingEngine *engine, @@ -480,12 +701,12 @@ tdegtk_draw_activity (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; - TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE); + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget); sflags = sflags | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default); TQRect progressBarRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); @@ -528,6 +749,8 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, state = gtk_theming_engine_get_state(engine); widget = m_widgetLookup.find(cr, path); + GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); + GtkArrowType arrow_direction; if ((angle <= ((G_PI/2)-(G_PI/4))) || (angle > ((3*(G_PI/2))+(G_PI/4)))) { @@ -558,7 +781,7 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, GtkRange* rangeWidget = GTK_RANGE(widget); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.orientation = ((arrow_direction == GTK_ARROW_UP) || (arrow_direction == GTK_ARROW_DOWN))?TQt::Vertical:TQt::Horizontal; bool subline = ((arrow_direction == GTK_ARROW_DOWN) || (arrow_direction == GTK_ARROW_RIGHT))?false:true; @@ -566,7 +789,7 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, bool combine_addlineregion_drawing_areas = tqApp->style().styleHint(TQStyle::SH_ScrollBar_CombineAddLineRegionDrawingAreas); const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); - TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE); + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget); sflags = sflags | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default); if (combine_addlineregion_drawing_areas) { @@ -624,7 +847,7 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, tqApp->style().drawPrimitive((subline)?TQStyle::PE_ScrollBarSubLine:TQStyle::PE_ScrollBarAddLine, p, scrollpagerect, gtkToTQtColorGroup(engine, state), sflags); } - else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX)) { + else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX) && (!(GTK_IS_MENU_ITEM(widget) || GTK_IS_MENU_ITEM(parent) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))))) { // Do nothing } @@ -646,7 +869,7 @@ tdegtk_draw_arrow (GtkThemingEngine *engine, else { pe = TQStyle::PE_ArrowRight; } - tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } if (p) { @@ -685,7 +908,7 @@ tdegtk_draw_cell_background (DRAW_ARGS, TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; if ((state & GTK_STATE_FLAG_SELECTED) != 0) { @@ -699,7 +922,7 @@ tdegtk_draw_cell_background (DRAW_ARGS, TQStyleOption listViewItemOpt(&tqt3ListViewItem); // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); + tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); } // FIXME @@ -739,7 +962,7 @@ tdegtk_draw_cell_frame (DRAW_ARGS, TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; if ((state & GTK_STATE_FLAG_SELECTED) != 0) { @@ -756,7 +979,7 @@ tdegtk_draw_cell_frame (DRAW_ARGS, TQRect backgroundRect; // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); + tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); } else { @@ -775,15 +998,19 @@ tdegtk_draw_check (DRAW_ARGS) TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); + const GtkWidgetPath* path; GtkStateFlags state; + GtkWidget* widget; + + path = gtk_theming_engine_get_path(engine); state = gtk_theming_engine_get_state(engine); - const GtkWidgetPath* path(gtk_theming_engine_get_path(engine)); + widget = m_widgetLookup.find(cr, path); if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) { - tqApp->style().drawPrimitive(TQStyle::PE_Indicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_GTKTreeViewCell)); + draw_checkbox(engine, cr, x, y, width, height, path, state, widget, TQT3WT_GTKTreeViewCell); } else { - tqApp->style().drawPrimitive(TQStyle::PE_Indicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQCheckBox)); + draw_checkbox(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQCheckBox); } p.end(); } @@ -799,7 +1026,7 @@ tdegtk_draw_common (DRAW_ARGS) GtkStateFlags state; state = gtk_theming_engine_get_state(engine); - //tqApp->style().drawPrimitive(TQStyle::PE_Indicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + //tqApp->style().drawPrimitive(TQStyle::PE_Indicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); p.end(); } @@ -830,7 +1057,7 @@ tdegtk_draw_common_background (DRAW_ARGS) GtkRange* rangeWidget = GTK_RANGE(widget); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; @@ -838,7 +1065,7 @@ tdegtk_draw_common_background (DRAW_ARGS) gtkRangeToCeData(rangeWidget, ceData); // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_FRAME) || gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY) || gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BUTTON)) && (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX))) { @@ -869,7 +1096,7 @@ tdegtk_draw_common_background (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; @@ -880,18 +1107,32 @@ tdegtk_draw_common_background (DRAW_ARGS) ceData.rect = boundingRect; // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ComboBoxEditField, TQStyle::SC_None); + tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ComboBoxEditField, TQStyle::SC_None); } #endif else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { +#if 0 TQStringList objectTypes; objectTypes.append(TQBUTTON_OBJECT_NAME_STRING); TQPalette objectPalette = tqApp->palette(objectTypes); - // Draw background - TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); - DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TOOLBAR)) { + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + } + else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TREE_VIEW)) { + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + } + else { + draw_pushbutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQPushButton); + } +#else + // Draw nothing! +#endif } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR)) { @@ -951,7 +1192,7 @@ tdegtk_draw_common_background (DRAW_ARGS) bool prelight = false; TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; @@ -966,7 +1207,7 @@ tdegtk_draw_common_background (DRAW_ARGS) TQRect backgroundRect; // Draw item - tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))?TQStyle::Style_Active:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), menuOpt); + tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))?TQStyle::Style_Active:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), menuOpt); } } @@ -1000,7 +1241,7 @@ tdegtk_draw_common_background (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; if ((state & GTK_STATE_FLAG_SELECTED) != 0) { @@ -1014,29 +1255,11 @@ tdegtk_draw_common_background (DRAW_ARGS) TQStyleOption listViewItemOpt(&tqt3ListViewItem); // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); + tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE) /*&& gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH)*/) { - //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; - bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; - - GtkScale* scaleWidget = GTK_SCALE(widget); - - TQStringList objectTypes; - objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); - TQPalette objectPalette = tqApp->palette(objectTypes); - - TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; - ceData.widgetObjectTypes = objectTypes; - ceData.rect = boundingRect; - ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; - - gtkScaleToSliderCeData(scaleWidget, ceData); - - // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_SliderGroove, ((mousedown)?TQStyle::SC_SliderGroove:TQStyle::SC_None)); + draw_slider_frame(engine, cr, x, y, width, height, path, state, widget); } else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) { @@ -1099,7 +1322,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) GtkRange* rangeWidget = GTK_RANGE(widget); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal); @@ -1110,7 +1333,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) // HACK // PE_ScrollBarAddPage and PE_ScrollBarSubPage are separate in TQt3 // Apparently there is no such distinction in GTK3! - TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarAddPage, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarAddPage, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); if (ceData.orientation == TQt::Vertical) { scrollpagerect.setY(ceData.rect.y()); scrollpagerect.setHeight(ceData.rect.height()); @@ -1119,7 +1342,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) scrollpagerect.setX(ceData.rect.x()); scrollpagerect.setWidth(ceData.rect.width()); } - tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarAddPage, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarAddPage, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } } @@ -1130,22 +1353,14 @@ tdegtk_draw_common_frame (DRAW_ARGS) else { if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TOOLBAR)) { - // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonTool, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); + draw_toolbar_button(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQToolButton); } else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TREE_VIEW)) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_HeaderSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_HeaderSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else { - if (gtk_widget_has_default(widget)) { - // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonDefault, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); - } - else { - // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonCommand, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); - } + draw_pushbutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQPushButton); } } @@ -1162,13 +1377,13 @@ tdegtk_draw_common_frame (DRAW_ARGS) bool prelight = false; TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonDropDown, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_ButtonDropDown, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default)); } } @@ -1178,29 +1393,29 @@ tdegtk_draw_common_frame (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else if (gtk_widget_path_is_type(path, GTK_TYPE_SPIN_BUTTON)) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); + tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton, widget)); } else if ((gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR)) ) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelDockWindow, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelDockWindow, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR)) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelMenuBar, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelMenuBar, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_STATUSBAR)) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_StatusBarSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_StatusBarSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) { @@ -1209,13 +1424,13 @@ tdegtk_draw_common_frame (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelPopup, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelPopup, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLTIP)) { @@ -1243,7 +1458,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) { // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); } else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND)) @@ -1347,7 +1562,7 @@ tdegtk_draw_extension (DRAW_ARGS, TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; @@ -1424,7 +1639,7 @@ tdegtk_draw_extension (DRAW_ARGS, DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p2, brush, backgroundRect.x(), backgroundRect.y(), backgroundRect.width(), backgroundRect.height()) // Draw tab - tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((selectedTab)?TQStyle::Style_Selected:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), tabOpt); + tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((selectedTab)?TQStyle::Style_Selected:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), tabOpt); cairo_restore(cr); } @@ -1498,7 +1713,7 @@ tdegtk_draw_focus (DRAW_ARGS) TQRect focusBoundingRect = boundingRect; TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { TQStringList objectTypes; @@ -1510,7 +1725,11 @@ tdegtk_draw_focus (DRAW_ARGS) } TQStyleOption opt(bgColor); - tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, focusBoundingRect, gtkToTQtColorGroup(engine, state), sflags, opt); + // FIXME + // There are only a few TQt3 widgets that draw a PE_FocusRect directly + // Those specific widgets need to be isolated and the draw routine added here + // All other widget should not trigger any drawing here! + //tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, focusBoundingRect, gtkToTQtColorGroup(engine, state), sflags, opt); } else if ((gtk_widget_path_is_type(path, GTK_TYPE_ENTRY)) @@ -1558,7 +1777,7 @@ tdegtk_draw_frame_gap (DRAW_ARGS, int lineWidth = 0; int midLineWidth = 0; - TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQGroupBox); + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQGroupBox, widget); if (gtkShadowType == GTK_SHADOW_NONE) { lineWidth = 0; @@ -1613,8 +1832,13 @@ tdegtk_draw_grip (DRAW_ARGS) TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); + const GtkWidgetPath* path; GtkStateFlags state; + GtkWidget* widget; + + path = gtk_theming_engine_get_path(engine); state = gtk_theming_engine_get_state(engine); + widget = m_widgetLookup.find(cr, path); TQStringList objectTypes; objectTypes.append(TQSTATUSBAR_OBJECT_NAME_STRING); @@ -1628,7 +1852,7 @@ tdegtk_draw_grip (DRAW_ARGS) cairo_reset_clip(cr); // Draw grip - tqApp->style().drawPrimitive(TQStyle::PE_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); cairo_restore(cr); @@ -1644,11 +1868,11 @@ tdegtk_draw_handle (DRAW_ARGS) const GtkWidgetPath* path; GtkStateFlags state; - //GtkWidget* widget; + GtkWidget* widget; path = gtk_theming_engine_get_path(engine); state = gtk_theming_engine_get_state(engine); - //widget = m_widgetLookup.find(cr, path); + widget = m_widgetLookup.find(cr, path); if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) { TQStringList objectTypes; @@ -1656,7 +1880,7 @@ tdegtk_draw_handle (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); // Draw handle - tqApp->style().drawPrimitive(TQStyle::PE_DockWindowHandle, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal)); + tqApp->style().drawPrimitive(TQStyle::PE_DockWindowHandle, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal)); } else if (gtk_widget_path_is_type(path, GTK_TYPE_PANED)) { @@ -1665,7 +1889,7 @@ tdegtk_draw_handle (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); // Draw handle - tqApp->style().drawPrimitive(TQStyle::PE_Splitter, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal)); + tqApp->style().drawPrimitive(TQStyle::PE_Splitter, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal)); } else { @@ -1716,8 +1940,13 @@ tdegtk_draw_notebook (DRAW_ARGS, DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,255,0); + const GtkWidgetPath* path; GtkStateFlags state; + GtkWidget* widget; + + path = gtk_theming_engine_get_path(engine); state = gtk_theming_engine_get_state(engine); + widget = m_widgetLookup.find(cr, path); TQStringList objectTypes; objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING); @@ -1728,7 +1957,7 @@ tdegtk_draw_notebook (DRAW_ARGS, DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) // Draw tab frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); p.end(); } @@ -1749,7 +1978,7 @@ tdegtk_draw_radio (DRAW_ARGS) widget = m_widgetLookup.find(cr, path); if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) { - tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_GTKTreeViewCell)); + draw_radiobutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_GTKTreeViewCell); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) { const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); @@ -1767,7 +1996,7 @@ tdegtk_draw_radio (DRAW_ARGS) TQPalette objectPalette = tqApp->palette(objectTypes); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; @@ -1777,12 +2006,12 @@ tdegtk_draw_radio (DRAW_ARGS) elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable; if (checked) { - tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorFrame, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton), menuOpt); - tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton), menuOpt); + tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorFrame, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); + tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); } } else { - tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton)); + draw_radiobutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQRadioButton); } p.end(); @@ -1812,7 +2041,7 @@ tdegtk_draw_separator (DRAW_ARGS) bool prelight = false; TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; @@ -1828,17 +2057,17 @@ tdegtk_draw_separator (DRAW_ARGS) TQRect backgroundRect; // Draw item - tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem), menuOpt); + tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget), menuOpt); } else if (gtk_widget_path_is_type(path, GTK_TYPE_SEPARATOR)) { TQt::Orientation orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; - tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else if (gtk_widget_path_is_type(path, GTK_TYPE_SEPARATOR_TOOL_ITEM)) { TQt::Orientation orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; - tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else { @@ -1876,7 +2105,7 @@ tdegtk_draw_slider (DRAW_ARGS, GtkRange* rangeWidget = GTK_RANGE(widget); TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; + TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; ceData.widgetObjectTypes = objectTypes; ceData.rect = boundingRect; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; @@ -1884,7 +2113,7 @@ tdegtk_draw_slider (DRAW_ARGS, gtkRangeToCeData(rangeWidget, ceData); // Draw slider - TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarSlider, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarSlider, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); if (ceData.orientation == TQt::Vertical) { scrollpagerect.setY(ceData.rect.y()); scrollpagerect.setHeight(ceData.rect.height()); @@ -1893,33 +2122,33 @@ tdegtk_draw_slider (DRAW_ARGS, scrollpagerect.setX(ceData.rect.x()); scrollpagerect.setWidth(ceData.rect.width()); } - tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) { - bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; - - TQStringList objectTypes; - objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); - TQPalette objectPalette = tqApp->palette(objectTypes); - - GtkScale* scaleWidget = GTK_SCALE(widget); - - TQStyleControlElementData ceData; - TQStyle::ControlElementFlags elementFlags; - ceData.widgetObjectTypes = objectTypes; - ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; - - boundingRect = TQRect(0, 0, width, height); - TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr); - TQPainter p2(&pd2); - - ceData.rect = boundingRect; - - gtkScaleToSliderCeData(scaleWidget, ceData); - - // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_SliderHandle, ((mousedown)?TQStyle::SC_SliderHandle:TQStyle::SC_None)); +// bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; +// +// TQStringList objectTypes; +// objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); +// TQPalette objectPalette = tqApp->palette(objectTypes); +// +// GtkScale* scaleWidget = GTK_SCALE(widget); +// +// TQStyleControlElementData ceData; +// TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; +// ceData.widgetObjectTypes = objectTypes; +// ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; +// +// boundingRect = TQRect(0, 0, width, height); +// TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr); +// TQPainter p2(&pd2); +// +// ceData.rect = boundingRect; +// +// gtkScaleToSliderCeData(scaleWidget, ceData); +// +// // Draw item +// tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_SliderHandle, ((mousedown)?TQStyle::SC_SliderHandle:TQStyle::SC_None)); } else { |