pull/1/head
Timothy Pearson 12 years ago
parent 469e7d600f
commit d3b9433c0a

@ -46,7 +46,7 @@
#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, 5000,5000 ); p.drawRect( 0,0, width*2,height*2 );
#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); \
@ -374,10 +374,13 @@ tdegtk_draw_activity (DRAW_ARGS)
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);
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);
// Draw item // Draw item
tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p, ceData, elementFlags, progressBarRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p, ceData, elementFlags, progressBarRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags);
} }
else { else {
@ -426,6 +429,13 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
arrow_direction = GTK_ARROW_LEFT; arrow_direction = GTK_ARROW_LEFT;
} }
#if 0
if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX)) {
// Do nothing
}
else
#endif
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) { if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) {
TQStringList objectTypes; TQStringList objectTypes;
objectTypes.append(TQSCROLLBAR_OBJECT_NAME_STRING); objectTypes.append(TQSCROLLBAR_OBJECT_NAME_STRING);
@ -529,50 +539,15 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
} }
cairo_restore(cr); cairo_restore(cr);
return;
GdkRGBA color;
gdouble size_reduction = 2;
state = gtk_theming_engine_get_state (engine);
gtk_theming_engine_get_color (engine, state, &color);
cairo_save (cr);
/* use floor function to adjust doubles */
y = floor (y);
x = floor (x);
size = floor (size);
size -= size_reduction;
cairo_translate (cr, size_reduction / 2, size_reduction / 2);
cairo_translate (cr, x + (gint) (size / 2.0) + 0.5, y + (gint) (size / 2.0) + 0.5);
cairo_rotate (cr, angle - G_PI_2);
cairo_translate (cr, (gint) (size / 4.0), 0);
/* FIXME this + 1/- 1 is done to fix blurred diagonal lines.
* I know it's not nice at all, but it fix a visual bug */
cairo_move_to (cr, - (gint) (size / 2.0), - (gint) (size / 2.0));
cairo_rel_line_to (cr, (gint) (size / 2.0) + 1, (gint) (size / 2.0));
cairo_rel_line_to (cr, - (gint) (size / 2.0) - 1, (gint) (size / 2.0));
cairo_close_path (cr);
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha * 0.75);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &color);
cairo_stroke (cr);
cairo_restore (cr);
} }
static void static void
tdegtk_draw_cell_background (DRAW_ARGS, tdegtk_draw_cell_background (DRAW_ARGS,
GtkRegionFlags flags) GtkRegionFlags flags)
{ {
cairo_save(cr);
cairo_reset_clip(cr);
TQRect boundingRect(0, 0, width, height); TQRect boundingRect(0, 0, width, height);
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd); TQPainter p(&pd);
@ -614,6 +589,8 @@ tdegtk_draw_cell_background (DRAW_ARGS,
} }
p.end(); p.end();
cairo_restore(cr);
} }
static void static void
@ -756,6 +733,30 @@ tdegtk_draw_common_background (DRAW_ARGS)
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) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
} }
#if 0
else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX)) {
bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
TQStringList objectTypes;
objectTypes.append(TQCOMBOBOX_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags;
ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) {
elementFlags = elementFlags | TQStyle::CEF_IsEditable;
}
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);
}
#endif
else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
TQStringList objectTypes; TQStringList objectTypes;
objectTypes.append(TQBUTTON_OBJECT_NAME_STRING); objectTypes.append(TQBUTTON_OBJECT_NAME_STRING);
@ -889,7 +890,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
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), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt);
} }
else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) { 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_SELECTED) != 0;
bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
@ -994,6 +995,29 @@ tdegtk_draw_common_frame (DRAW_ARGS)
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));
} }
} }
#if 0
else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX)) {
bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
TQStringList objectTypes;
objectTypes.append(TQCOMBOBOX_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags;
ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) {
elementFlags = elementFlags | TQStyle::CEF_IsEditable;
}
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_ComboBoxFrame, TQStyle::SC_None);
}
#endif
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)) {
@ -1364,6 +1388,9 @@ tdegtk_draw_focus (DRAW_ARGS)
else if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) { else if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) {
objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING); objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
} }
else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
objectTypes.append(TQPUSHBUTTON_OBJECT_NAME_STRING);
}
else { else {
objectTypes.append(TQWIDGET_OBJECT_NAME_STRING); objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
} }
@ -1491,9 +1518,6 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
static void static void
tdegtk_draw_grip (DRAW_ARGS) tdegtk_draw_grip (DRAW_ARGS)
{ {
cairo_save(cr);
cairo_reset_clip(cr);
TQRect boundingRect(0, 0, width, height); TQRect boundingRect(0, 0, width, height);
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd); TQPainter p(&pd);
@ -1501,11 +1525,23 @@ tdegtk_draw_grip (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_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); TQStringList objectTypes;
objectTypes.append(TQSTATUSBAR_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
p.end(); // Draw background
TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
cairo_save(cr);
cairo_reset_clip(cr);
// Draw grip
tqApp->style().drawPrimitive(TQStyle::PE_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
cairo_restore(cr); cairo_restore(cr);
p.end();
} }
static void static void
@ -1820,10 +1856,8 @@ tdegtk_draw_slider (DRAW_ARGS,
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;
// HACK boundingRect = TQRect(0, 0, width, height);
// GTK3 or TQt3 (not sure which) does not draw the slider in the correct location! TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr);
boundingRect = TQRect((ceData.orientation == TQt::Horizontal)?2:0, (ceData.orientation == TQt::Horizontal)?0:2, width, height);
TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr);
TQPainter p2(&pd2); TQPainter p2(&pd2);
ceData.rect = boundingRect; ceData.rect = boundingRect;

@ -56,9 +56,6 @@ tdegtk_engine_render_activity (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
path = gtk_theming_engine_get_path (engine); path = gtk_theming_engine_get_path (engine);
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE))
tdegtk_trim_scale_allocation (engine, &x, &y, &width, &height);
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINNER)) if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINNER))
GTK_THEMING_ENGINE_CLASS (tdegtk_engine_parent_class)->render_activity (engine, cr, x, y, width, height); GTK_THEMING_ENGINE_CLASS (tdegtk_engine_parent_class)->render_activity (engine, cr, x, y, width, height);
else else
@ -99,10 +96,6 @@ tdegtk_engine_render_background (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
path = gtk_theming_engine_get_path (engine); path = gtk_theming_engine_get_path (engine);
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE) &&
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
tdegtk_trim_scale_allocation (engine, &x, &y, &width, &height);
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) && if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINBUTTON)) gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINBUTTON))
style_functions->draw_spinbutton_background (engine, cr, x, y, width, height); style_functions->draw_spinbutton_background (engine, cr, x, y, width, height);
@ -128,12 +121,6 @@ tdegtk_engine_render_check (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM))
{
if (tdegtk_cairo_draw_from_texture (engine, cr, x, y, width, height))
return;
}
style_functions->draw_check (engine, cr, x, y, width, height); style_functions->draw_check (engine, cr, x, y, width, height);
} }
@ -206,10 +193,6 @@ tdegtk_engine_render_frame (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
path = gtk_theming_engine_get_path (engine); path = gtk_theming_engine_get_path (engine);
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE) &&
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
tdegtk_trim_scale_allocation (engine, &x, &y, &width, &height);
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SEPARATOR)) if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SEPARATOR))
style_functions->draw_separator (engine, cr, x, y, width, height); style_functions->draw_separator (engine, cr, x, y, width, height);
else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) && else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
@ -297,12 +280,6 @@ tdegtk_engine_render_option (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM))
{
if (tdegtk_cairo_draw_from_texture (engine, cr, x, y, width, height))
return;
}
style_functions->draw_radio (engine, cr, x, y, width, height); style_functions->draw_radio (engine, cr, x, y, width, height);
} }
@ -321,12 +298,6 @@ tdegtk_engine_render_slider (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions); tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SCALE))
{
if (tdegtk_cairo_draw_from_texture (engine, cr, x, y, width, height))
return;
}
style_functions->draw_slider (engine, cr, x, y, width, height, orientation); style_functions->draw_slider (engine, cr, x, y, width, height, orientation);
} }

Loading…
Cancel
Save