summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdegtk/tdegtk-draw.cpp134
-rw-r--r--tdegtk/tdegtk-engine.c29
2 files changed, 84 insertions, 79 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index 20cce27..36244e6 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -46,7 +46,7 @@
#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, 5000,5000 );
+ p.drawRect( 0,0, width*2,height*2 );
#define DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p,x) p.setBrush(x); \
p.setPen(TQt::NoPen); \
@@ -374,10 +374,13 @@ tdegtk_draw_activity (DRAW_ARGS)
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);
+ 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);
// 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 {
@@ -426,6 +429,13 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
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)) {
TQStringList objectTypes;
objectTypes.append(TQSCROLLBAR_OBJECT_NAME_STRING);
@@ -529,50 +539,15 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
}
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
tdegtk_draw_cell_background (DRAW_ARGS,
GtkRegionFlags flags)
{
+ cairo_save(cr);
+ cairo_reset_clip(cr);
+
TQRect boundingRect(0, 0, width, height);
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
@@ -614,6 +589,8 @@ tdegtk_draw_cell_background (DRAW_ARGS,
}
p.end();
+
+ cairo_restore(cr);
}
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));
}
+#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)) {
TQStringList objectTypes;
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);
}
- 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_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));
}
}
+#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 {
if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
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)) {
objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
}
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
+ objectTypes.append(TQPUSHBUTTON_OBJECT_NAME_STRING);
+ }
else {
objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
}
@@ -1491,9 +1518,6 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
static void
tdegtk_draw_grip (DRAW_ARGS)
{
- cairo_save(cr);
- cairo_reset_clip(cr);
-
TQRect boundingRect(0, 0, width, height);
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
@@ -1501,11 +1525,23 @@ tdegtk_draw_grip (DRAW_ARGS)
GtkStateFlags state;
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);
+
+ p.end();
}
static void
@@ -1820,10 +1856,8 @@ tdegtk_draw_slider (DRAW_ARGS,
ceData.widgetObjectTypes = objectTypes;
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
- // HACK
- // GTK3 or TQt3 (not sure which) does not draw the slider in the correct location!
- boundingRect = TQRect((ceData.orientation == TQt::Horizontal)?2:0, (ceData.orientation == TQt::Horizontal)?0:2, width, height);
- TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr);
+ boundingRect = TQRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd2(NULL, x, y, width+4, height+4, cr);
TQPainter p2(&pd2);
ceData.rect = boundingRect;
diff --git a/tdegtk/tdegtk-engine.c b/tdegtk/tdegtk-engine.c
index dfca517..2032d99 100644
--- a/tdegtk/tdegtk-engine.c
+++ b/tdegtk/tdegtk-engine.c
@@ -56,9 +56,6 @@ tdegtk_engine_render_activity (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
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))
GTK_THEMING_ENGINE_CLASS (tdegtk_engine_parent_class)->render_activity (engine, cr, x, y, width, height);
else
@@ -99,10 +96,6 @@ tdegtk_engine_render_background (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
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) &&
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINBUTTON))
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);
- 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);
}
@@ -206,10 +193,6 @@ tdegtk_engine_render_frame (GtkThemingEngine *engine,
tdegtk_lookup_functions (TDEGTK_ENGINE (engine), &style_functions);
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))
style_functions->draw_separator (engine, cr, x, y, width, height);
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);
- 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);
}
@@ -321,12 +298,6 @@ tdegtk_engine_render_slider (GtkThemingEngine *engine,
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);
}