Fix toolbar rendering

pull/1/head
Timothy Pearson 12 years ago
parent 76f5e2671f
commit cf8d4ef895

@ -46,15 +46,18 @@
#define DEBUG_FILL_BACKGROUND_WITH_COLOR(p,x,y,z) TQBrush brush2( TQColor(x,y,z), TQBrush::SolidPattern ); \ #define DEBUG_FILL_BACKGROUND_WITH_COLOR(p,x,y,z) TQBrush brush2( TQColor(x,y,z), TQBrush::SolidPattern ); \
p.setBrush( brush2 ); \ p.setBrush( brush2 ); \
p.setPen( TQt::NoPen ); \ 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); \ #define DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p,x) p.setBrush(x); \
p.setPen(TQt::NoPen); \ 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); \ #define DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p,b,x,y,w,h) p.setBrush(b); \
p.setPen(TQt::NoPen); \ p.setPen(TQt::NoPen); \
p.drawRect(x, y, w, h); p.drawRect(x, y, w, h); \
p.setBrush(TQt::NoBrush);
extern int m_scrollBarSubLineWidth; extern int m_scrollBarSubLineWidth;
@ -105,10 +108,10 @@ static TQPalette::ColorGroup gtkToTQPaletteColorGroup(GtkThemingEngine* engine,
return cg; 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; 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); in_menu = gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM);
prelight = (state & GTK_STATE_FLAG_PRELIGHT) != 0; prelight = (state & GTK_STATE_FLAG_PRELIGHT) != 0;
focused = (state & GTK_STATE_FLAG_FOCUSED) != 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; inconsistent = (state & GTK_STATE_FLAG_INCONSISTENT) != 0;
mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0;
active = (state & GTK_STATE_FLAG_ACTIVE) != 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 ((wt == TQT3WT_TQRadioButton) || (wt == TQT3WT_TQCheckBox) || (wt == TQT3WT_TQPushButton)) {
if (!inconsistent) { if (!inconsistent) {
@ -138,6 +142,35 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; 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) { else if (wt == TQT3WT_GTKTreeViewCell) {
if (!inconsistent) { if (!inconsistent) {
@ -157,6 +190,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; sflags |= TQStyle::Style_Enabled;
} }
if (has_focus) {
sflags |= TQStyle::Style_HasFocus;
}
} }
else if (wt == TQT3WT_TQGroupBox) { else if (wt == TQT3WT_TQGroupBox) {
if (prelight) { if (prelight) {
@ -168,6 +204,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; sflags |= TQStyle::Style_Enabled;
} }
if (has_focus) {
sflags |= TQStyle::Style_HasFocus;
}
} }
else if (wt == TQT3WT_TQMenuItem) { else if (wt == TQT3WT_TQMenuItem) {
if (prelight) { if (prelight) {
@ -179,6 +218,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; sflags |= TQStyle::Style_Enabled;
} }
if (has_focus) {
sflags |= TQStyle::Style_HasFocus;
}
} }
else if (wt == TQT3WT_TQSlider) { else if (wt == TQT3WT_TQSlider) {
if (mousedown) { if (mousedown) {
@ -193,6 +235,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; sflags |= TQStyle::Style_Enabled;
} }
if (has_focus) {
sflags |= TQStyle::Style_HasFocus;
}
} }
else { else {
if (active) { if (active) {
@ -207,6 +252,9 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
if (!disabled) { if (!disabled) {
sflags |= TQStyle::Style_Enabled; sflags |= TQStyle::Style_Enabled;
} }
if (has_focus) {
sflags |= TQStyle::Style_HasFocus;
}
} }
return sflags; return sflags;
@ -268,14 +316,17 @@ static TQColorGroup::ColorRole backgroundModeToColorRole(TQt::BackgroundMode mod
} }
void gtkRangeToCeData(GtkRange* rangeWidget, TQStyleControlElementData &ceData) { void gtkRangeToCeData(GtkRange* rangeWidget, TQStyleControlElementData &ceData) {
gint slider_start_pos;
gint slider_end_pos;
GtkAdjustment* adjustment = gtk_range_get_adjustment(rangeWidget); 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.minSteps = gtk_adjustment_get_lower(adjustment);
ceData.maxSteps = gtk_adjustment_get_upper(adjustment); ceData.maxSteps = gtk_adjustment_get_upper(adjustment);
// ceData.tickMarkSetting = // ceData.tickMarkSetting =
// ceData.tickInterval = // ceData.tickInterval =
ceData.currentStep = gtk_adjustment_get_value(adjustment); ceData.currentStep = gtk_adjustment_get_value(adjustment);
// ceData.startStep = ceData.startStep = slider_start_pos;
ceData.lineStep = gtk_adjustment_get_step_increment(adjustment); ceData.lineStep = gtk_adjustment_get_step_increment(adjustment);
ceData.pageStep = gtk_adjustment_get_page_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); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; 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; ceData.rect = boundingRect;
if (gtk_widget_has_visible_focus(widget)) {
elementFlags = elementFlags | TQStyle::CEF_HasFocus;
}
// Draw item // 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); cairo_restore(cr);
@ -361,7 +417,7 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
@ -371,13 +427,30 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state
ceData.totalSteps = 8192; ceData.totalSteps = 8192;
ceData.currentStep = gtkProgressBarFraction*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); 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 (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL)) {
// If vertical, apply a 90 degree rotation matrix to the painter // If vertical, apply a 90 degree rotation matrix to the painter
// This is required to make TQt draw a vertical progress bar // This is required to make TQt draw a vertical progress bar
TQWMatrix m; TQWMatrix m;
// // Upside down // // Upside down
@ -394,23 +467,171 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state
ceData.rect = boundingRect; ceData.rect = boundingRect;
} }
TQRect progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); 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); progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags);
// Draw background tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p2, ceData, elementFlags, progressBarContentsRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags);
TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base); }
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p2, brush)
// Draw frame cairo_restore(cr);
tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p2, ceData, elementFlags, progressBarGrooveRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); }
// Draw contents static void
tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p2, ceData, elementFlags, progressBarContentsRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); draw_slider_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidget* widget) {
cairo_save(cr);
cairo_matrix_t gtk_matrix;
cairo_get_matrix(cr, &gtk_matrix);
gtk_matrix.x0 = 0;
gtk_matrix.y0 = 0;
cairo_set_matrix(cr, &gtk_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); 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 */ /* draw a texture placed on the centroid */
static gboolean static gboolean
draw_centroid_texture (GtkThemingEngine *engine, draw_centroid_texture (GtkThemingEngine *engine,
@ -480,12 +701,12 @@ tdegtk_draw_activity (DRAW_ARGS)
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; 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); 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); 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); state = gtk_theming_engine_get_state(engine);
widget = m_widgetLookup.find(cr, path); widget = m_widgetLookup.find(cr, path);
GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L);
GtkArrowType arrow_direction; GtkArrowType arrow_direction;
if ((angle <= ((G_PI/2)-(G_PI/4))) || (angle > ((3*(G_PI/2))+(G_PI/4)))) { 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); GtkRange* rangeWidget = GTK_RANGE(widget);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.orientation = ((arrow_direction == GTK_ARROW_UP) || (arrow_direction == GTK_ARROW_DOWN))?TQt::Vertical:TQt::Horizontal; 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; 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); bool combine_addlineregion_drawing_areas = tqApp->style().styleHint(TQStyle::SH_ScrollBar_CombineAddLineRegionDrawingAreas);
const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); 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); sflags = sflags | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default);
if (combine_addlineregion_drawing_areas) { 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); 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 // Do nothing
} }
@ -646,7 +869,7 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
else { else {
pe = TQStyle::PE_ArrowRight; 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) { if (p) {
@ -685,7 +908,7 @@ tdegtk_draw_cell_background (DRAW_ARGS,
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
if ((state & GTK_STATE_FLAG_SELECTED) != 0) { if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
@ -699,7 +922,7 @@ tdegtk_draw_cell_background (DRAW_ARGS,
TQStyleOption listViewItemOpt(&tqt3ListViewItem); TQStyleOption listViewItemOpt(&tqt3ListViewItem);
// Draw item // 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 // FIXME
@ -739,7 +962,7 @@ tdegtk_draw_cell_frame (DRAW_ARGS,
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
if ((state & GTK_STATE_FLAG_SELECTED) != 0) { if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
@ -756,7 +979,7 @@ tdegtk_draw_cell_frame (DRAW_ARGS,
TQRect backgroundRect; TQRect backgroundRect;
// Draw item // 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 { else {
@ -775,15 +998,19 @@ tdegtk_draw_check (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd); TQPainter p(&pd);
const GtkWidgetPath* path;
GtkStateFlags state; GtkStateFlags state;
GtkWidget* widget;
path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(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)) { 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 { 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(); p.end();
} }
@ -799,7 +1026,7 @@ tdegtk_draw_common (DRAW_ARGS)
GtkStateFlags state; GtkStateFlags state;
state = gtk_theming_engine_get_state(engine); 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(); p.end();
} }
@ -830,7 +1057,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
GtkRange* rangeWidget = GTK_RANGE(widget); GtkRange* rangeWidget = GTK_RANGE(widget);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; 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); gtkRangeToCeData(rangeWidget, ceData);
// Draw frame // 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))) { 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); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; 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; ceData.rect = boundingRect;
// Draw item // 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 #endif
else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
#if 0
TQStringList objectTypes; TQStringList objectTypes;
objectTypes.append(TQBUTTON_OBJECT_NAME_STRING); objectTypes.append(TQBUTTON_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
// Draw background if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TOOLBAR)) {
TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); // Draw background
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) 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)) { 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; bool prelight = false;
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
@ -966,7 +1207,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
TQRect backgroundRect; TQRect backgroundRect;
// Draw item // 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); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
if ((state & GTK_STATE_FLAG_SELECTED) != 0) { if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
@ -1014,29 +1255,11 @@ tdegtk_draw_common_background (DRAW_ARGS)
TQStyleOption listViewItemOpt(&tqt3ListViewItem); TQStyleOption listViewItemOpt(&tqt3ListViewItem);
// Draw item // 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)*/) { 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; draw_slider_frame(engine, cr, x, y, width, height, path, state, widget);
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));
} }
else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) { 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); GtkRange* rangeWidget = GTK_RANGE(widget);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal); 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 // HACK
// PE_ScrollBarAddPage and PE_ScrollBarSubPage are separate in TQt3 // PE_ScrollBarAddPage and PE_ScrollBarSubPage are separate in TQt3
// Apparently there is no such distinction in GTK3! // 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) { if (ceData.orientation == TQt::Vertical) {
scrollpagerect.setY(ceData.rect.y()); scrollpagerect.setY(ceData.rect.y());
scrollpagerect.setHeight(ceData.rect.height()); scrollpagerect.setHeight(ceData.rect.height());
@ -1119,7 +1342,7 @@ tdegtk_draw_common_frame (DRAW_ARGS)
scrollpagerect.setX(ceData.rect.x()); scrollpagerect.setX(ceData.rect.x());
scrollpagerect.setWidth(ceData.rect.width()); 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 { else {
if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TOOLBAR)) { if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TOOLBAR)) {
// Draw frame draw_toolbar_button(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQToolButton);
tqApp->style().drawPrimitive(TQStyle::PE_ButtonTool, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton));
} }
else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TREE_VIEW)) { else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_TREE_VIEW)) {
// Draw frame // 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 { else {
if (gtk_widget_has_default(widget)) { draw_pushbutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQPushButton);
// 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));
}
} }
} }
@ -1162,13 +1377,13 @@ tdegtk_draw_common_frame (DRAW_ARGS)
bool prelight = false; bool prelight = false;
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
// Draw frame // 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); TQPalette objectPalette = tqApp->palette(objectTypes);
// Draw frame // 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)) { else if (gtk_widget_path_is_type(path, GTK_TYPE_SPIN_BUTTON)) {
// Draw frame // 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)) else if ((gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX))
|| (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR))
) { ) {
// Draw frame // 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)) { else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR)) {
// Draw frame // 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)) { else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_STATUSBAR)) {
// Draw frame // 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)) { 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); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
// Draw frame // 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)) { 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)) { else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) {
// Draw frame // 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)) 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); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; 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_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p2, brush, backgroundRect.x(), backgroundRect.y(), backgroundRect.width(), backgroundRect.height())
// Draw tab // 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); cairo_restore(cr);
} }
@ -1498,7 +1713,7 @@ tdegtk_draw_focus (DRAW_ARGS)
TQRect focusBoundingRect = boundingRect; TQRect focusBoundingRect = boundingRect;
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
TQStringList objectTypes; TQStringList objectTypes;
@ -1510,7 +1725,11 @@ tdegtk_draw_focus (DRAW_ARGS)
} }
TQStyleOption opt(bgColor); 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)) 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 lineWidth = 0;
int midLineWidth = 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) { if (gtkShadowType == GTK_SHADOW_NONE) {
lineWidth = 0; lineWidth = 0;
@ -1613,8 +1832,13 @@ tdegtk_draw_grip (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd); TQPainter p(&pd);
const GtkWidgetPath* path;
GtkStateFlags state; GtkStateFlags state;
GtkWidget* widget;
path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(engine); state = gtk_theming_engine_get_state(engine);
widget = m_widgetLookup.find(cr, path);
TQStringList objectTypes; TQStringList objectTypes;
objectTypes.append(TQSTATUSBAR_OBJECT_NAME_STRING); objectTypes.append(TQSTATUSBAR_OBJECT_NAME_STRING);
@ -1628,7 +1852,7 @@ tdegtk_draw_grip (DRAW_ARGS)
cairo_reset_clip(cr); cairo_reset_clip(cr);
// Draw grip // 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); cairo_restore(cr);
@ -1644,11 +1868,11 @@ tdegtk_draw_handle (DRAW_ARGS)
const GtkWidgetPath* path; const GtkWidgetPath* path;
GtkStateFlags state; GtkStateFlags state;
//GtkWidget* widget; GtkWidget* widget;
path = gtk_theming_engine_get_path(engine); path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(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)) { if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) {
TQStringList objectTypes; TQStringList objectTypes;
@ -1656,7 +1880,7 @@ tdegtk_draw_handle (DRAW_ARGS)
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
// Draw handle // 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)) { 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); TQPalette objectPalette = tqApp->palette(objectTypes);
// Draw handle // 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 { else {
@ -1716,8 +1940,13 @@ tdegtk_draw_notebook (DRAW_ARGS,
DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,255,0); DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,255,0);
const GtkWidgetPath* path;
GtkStateFlags state; GtkStateFlags state;
GtkWidget* widget;
path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(engine); state = gtk_theming_engine_get_state(engine);
widget = m_widgetLookup.find(cr, path);
TQStringList objectTypes; TQStringList objectTypes;
objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING); objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING);
@ -1728,7 +1957,7 @@ tdegtk_draw_notebook (DRAW_ARGS,
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
// Draw tab frame // 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(); p.end();
} }
@ -1749,7 +1978,7 @@ tdegtk_draw_radio (DRAW_ARGS)
widget = m_widgetLookup.find(cr, path); widget = m_widgetLookup.find(cr, path);
if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) { 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)) { else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) {
const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget);
@ -1767,7 +1996,7 @@ tdegtk_draw_radio (DRAW_ARGS)
TQPalette objectPalette = tqApp->palette(objectTypes); TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
@ -1777,12 +2006,12 @@ tdegtk_draw_radio (DRAW_ARGS)
elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable; elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable;
if (checked) { 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_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), menuOpt); tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt);
} }
} }
else { 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(); p.end();
@ -1812,7 +2041,7 @@ tdegtk_draw_separator (DRAW_ARGS)
bool prelight = false; bool prelight = false;
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
@ -1828,17 +2057,17 @@ tdegtk_draw_separator (DRAW_ARGS)
TQRect backgroundRect; TQRect backgroundRect;
// Draw item // 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)) { 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; 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)) { 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; 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 { else {
@ -1876,7 +2105,7 @@ tdegtk_draw_slider (DRAW_ARGS,
GtkRange* rangeWidget = GTK_RANGE(widget); GtkRange* rangeWidget = GTK_RANGE(widget);
TQStyleControlElementData ceData; TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect; ceData.rect = boundingRect;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; 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); gtkRangeToCeData(rangeWidget, ceData);
// Draw slider // 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) { if (ceData.orientation == TQt::Vertical) {
scrollpagerect.setY(ceData.rect.y()); scrollpagerect.setY(ceData.rect.y());
scrollpagerect.setHeight(ceData.rect.height()); scrollpagerect.setHeight(ceData.rect.height());
@ -1893,33 +2122,33 @@ tdegtk_draw_slider (DRAW_ARGS,
scrollpagerect.setX(ceData.rect.x()); scrollpagerect.setX(ceData.rect.x());
scrollpagerect.setWidth(ceData.rect.width()); 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)) { else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) {
bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; // bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
//
TQStringList objectTypes; // TQStringList objectTypes;
objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); // objectTypes.append(TQSLIDER_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes); // TQPalette objectPalette = tqApp->palette(objectTypes);
//
GtkScale* scaleWidget = GTK_SCALE(widget); // GtkScale* scaleWidget = GTK_SCALE(widget);
//
TQStyleControlElementData ceData; // TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags; // TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes; // ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal; // ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
//
boundingRect = TQRect(0, 0, width, height); // boundingRect = TQRect(0, 0, width, height);
TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr); // TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr);
TQPainter p2(&pd2); // TQPainter p2(&pd2);
//
ceData.rect = boundingRect; // ceData.rect = boundingRect;
//
gtkScaleToSliderCeData(scaleWidget, ceData); // gtkScaleToSliderCeData(scaleWidget, ceData);
//
// Draw item // // 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)); // 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 { else {

@ -704,6 +704,33 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string("padding: " + TQString::number(3) + "px " + TQString::number(3) + "px", "GtkNotebook"); stream << parse_rc_string("padding: " + TQString::number(3) + "px " + TQString::number(3) + "px", "GtkNotebook");
stream << parse_rc_string("padding: " + TQString::number(3) + "px " + TQString::number(3) + "px", "GtkEntry"); stream << parse_rc_string("padding: " + TQString::number(3) + "px " + TQString::number(3) + "px", "GtkEntry");
TQRect probeRect;
TQRect comboBoxArrowRect;
TQRect comboBoxEditFieldRect;
{
probeRect = TQRect(0, 0, 100, 100);
TQStringList objectTypes;
objectTypes.append(TQCOMBOBOX_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes;
ceData.orientation = TQt::Horizontal;
ceData.rect = probeRect;
elementFlags = elementFlags | TQStyle::CEF_IsEditable;
comboBoxArrowRect = tqApp->style().querySubControlMetrics(TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxArrow);
comboBoxEditFieldRect = tqApp->style().querySubControlMetrics(TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField);
}
// The padding is specified in a highly unusual format:
// top_width, right_width, bottom_width, left_width
// Compare that to the more typical format of:
// left, top, right, bottom
stream << parse_rc_string("padding: " + TQString::number(comboBoxEditFieldRect.y()-probeRect.y()) + "px " + TQString::number(probeRect.right()-comboBoxEditFieldRect.right()-comboBoxArrowRect.width()) + "px " + TQString::number(probeRect.bottom()-comboBoxEditFieldRect.bottom()) + "px " + TQString::number(comboBoxEditFieldRect.x()-probeRect.x()) + "px", "GtkComboBox>GtkEntry");
// Set header sizes // Set header sizes
stream << parse_rc_string("padding: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkTreeView>*>GtkButton"); stream << parse_rc_string("padding: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkTreeView>*>GtkButton");
stream << parse_rc_string("border-width: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkTreeView>*>GtkButton"); stream << parse_rc_string("border-width: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkTreeView>*>GtkButton");
@ -745,17 +772,41 @@ void writeGtkThemeControlFile(int forceRecreate) {
// Handle menu metrics // Handle menu metrics
int tdeStandardMenuItemHeight; int tdeStandardMenuItemHeight;
int tdeSeparatorMenuItemHeight; int tdeSeparatorMenuItemHeight;
int tdeMenuFrameWidth;
{ {
TQStringList objectTypes;
objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
ceData.widgetObjectTypes = objectTypes;
ceData.orientation = TQt::Horizontal;
TQMenuItem tqt3MenuItem; TQMenuItem tqt3MenuItem;
tqt3MenuItem.setSeparator(false); tqt3MenuItem.setSeparator(false);
tdeStandardMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics()); tdeStandardMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
tqt3MenuItem.setSeparator(true); tqt3MenuItem.setSeparator(true);
tdeSeparatorMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics()); tdeSeparatorMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
TQSize sz;
ceData.rect = TQRect(0, 0, 0, tdeStandardMenuItemHeight);
sz = tqApp->style().sizeFromContents(TQStyle::CT_PopupMenuItem, ceData, elementFlags, TQSize(0, tdeStandardMenuItemHeight), TQStyleOption(&tqt3MenuItem));
sz = sz.expandedTo(TQSize(0, sz.height()));
tdeStandardMenuItemHeight = sz.height();
ceData.rect = TQRect(0, 0, 0, tdeSeparatorMenuItemHeight);
sz = tqApp->style().sizeFromContents(TQStyle::CT_PopupMenuItem, ceData, elementFlags, TQSize(0, tdeSeparatorMenuItemHeight), TQStyleOption(&tqt3MenuItem));
sz = sz.expandedTo(TQSize(0, sz.height()));
tdeSeparatorMenuItemHeight = sz.height();
tdeMenuFrameWidth = tqApp->style().pixelMetric(TQStyle::PM_DefaultFrameWidth, ceData, elementFlags);
} }
stream << parse_rc_string("-GtkWidget-separator-height: " + TQString::number(tdeSeparatorMenuItemHeight), "GtkMenuItem"); stream << parse_rc_string("-GtkWidget-separator-height: " + TQString::number(tdeSeparatorMenuItemHeight), "GtkMenuItem");
stream << parse_rc_string("-GtkWidget-separator-width: " + TQString::number(tdeSeparatorMenuItemHeight), "GtkMenuItem"); stream << parse_rc_string("-GtkWidget-separator-width: " + TQString::number(tdeSeparatorMenuItemHeight), "GtkMenuItem");
stream << parse_rc_string("-GtkWidget-wide-separators: 1", "GtkMenuItem"); stream << parse_rc_string("-GtkWidget-wide-separators: 1", "GtkMenuItem");
stream << parse_rc_string("padding: " + TQString::number(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px", "GtkMenu");
// FIXME // FIXME
// GTK does not seem to support inserting actual space between the items in a menu bar; instead it insists on expanding the size of the menu items themselves (GtkMenuBar>GtkMenuItem padding:) // GTK does not seem to support inserting actual space between the items in a menu bar; instead it insists on expanding the size of the menu items themselves (GtkMenuBar>GtkMenuItem padding:)

Loading…
Cancel
Save