summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdegtk/tdegtk-draw.cpp360
-rw-r--r--tdegtk/tdegtk-theme.cpp24
2 files changed, 290 insertions, 94 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index 818b2c1..032d6b6 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -27,6 +27,8 @@
#include <tqstyle.h>
#include <tqpopupmenu.h>
#include <tqlistview.h>
+#include <tqdrawutil.h>
+#include <tqslider.h>
#include <kiconloader.h>
#include <kicontheme.h>
@@ -176,6 +178,20 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
sflags |= TQStyle::Style_Enabled;
}
}
+ else if (wt == TQT3WT_TQSlider) {
+ if (mousedown) {
+ sflags |= TQStyle::Style_Active;
+ }
+ if (prelight) {
+ sflags |= TQStyle::Style_MouseOver;
+ }
+ if (focused) {
+ sflags |= TQStyle::Style_HasFocus;
+ }
+ if (!disabled) {
+ sflags |= TQStyle::Style_Enabled;
+ }
+ }
else {
if (active) {
sflags |= TQStyle::Style_Down;
@@ -249,6 +265,36 @@ static TQColorGroup::ColorRole backgroundModeToColorRole(TQt::BackgroundMode mod
return ret;
}
+void gtkScaleToSliderCeData(GtkScale* scaleWidget, TQStyleControlElementData &ceData) {
+ GtkAdjustment* adjustment = gtk_range_get_adjustment(GTK_RANGE(scaleWidget));
+
+ ceData.minSteps = gtk_adjustment_get_lower(adjustment);
+ ceData.maxSteps = gtk_adjustment_get_upper(adjustment);
+// ceData.tickMarkSetting =
+// ceData.tickInterval =
+ ceData.currentStep = gtk_adjustment_get_value(adjustment);
+// ceData.startStep =
+ ceData.lineStep = gtk_adjustment_get_step_increment(adjustment);
+ ceData.pageStep = gtk_adjustment_get_page_increment(adjustment);
+
+// GtkPositionType valuePosition = gtk_scale_get_value_pos(scaleWidget);
+// if (valuePosition == GTK_POS_LEFT) {
+// ceData.tickMarkSetting = TQSlider::Left;
+// }
+// else if (valuePosition == GTK_POS_RIGHT) {
+// ceData.tickMarkSetting = TQSlider::Right;
+// }
+// else if (valuePosition == GTK_POS_TOP) {
+// ceData.tickMarkSetting = TQSlider::Above;
+// }
+// else if (valuePosition == GTK_POS_BOTTOM) {
+// ceData.tickMarkSetting = TQSlider::Below;
+// }
+// else {
+ ceData.tickMarkSetting = TQSlider::NoMarks;
+// }
+}
+
/* draw a texture placed on the centroid */
static gboolean
draw_centroid_texture (GtkThemingEngine *engine,
@@ -299,13 +345,41 @@ draw_centroid_texture (GtkThemingEngine *engine,
static void
tdegtk_draw_activity (DRAW_ARGS)
{
- /* playground for effects */
- tdegtk_cairo_draw_background (engine, cr,
- x, y, width, height,
- 0, gtk_theming_engine_get_junction_sides (engine));
- tdegtk_cairo_draw_frame (engine, cr,
- x, y, width, height,
- 0, gtk_theming_engine_get_junction_sides (engine));
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
+
+ const GtkWidgetPath* path;
+ GtkStateFlags state;
+ GtkWidget* widget;
+
+ path = gtk_theming_engine_get_path(engine);
+ state = gtk_theming_engine_get_state(engine);
+ widget = m_widgetLookup.find(cr, path);
+
+ if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQPROGRESSBAR_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;
+
+ 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));
+ }
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,0,128);
+ printf("[WARNING] tdegtk_draw_activity() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
+
+ p.end();
}
static void
@@ -457,9 +531,6 @@ tdegtk_draw_cell_background (DRAW_ARGS,
TQListViewItem tqt3ListViewItem;
TQStyleOption listViewItemOpt(&tqt3ListViewItem);
- TQRect paintDeviceRect;
- TQRect backgroundRect;
-
// Draw item
tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt);
}
@@ -648,7 +719,6 @@ tdegtk_draw_common_background (DRAW_ARGS)
else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))) {
GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L);
if (!GTK_IS_MENU_BAR(parent)) {
-
// FIXME
// Mouse movements in the popup menu should be tracked similarly to mouse movements in the tab bar
// Many TQt3 styles highlight inactive menu items on hover; not providing this visual feedback may cause users to briefly think their GTK application has frozen up
@@ -703,23 +773,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
}
else if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) {
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,64,64,255);
- }
-
- else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND))
- || (gtk_widget_path_is_type(path, GTK_TYPE_EXPANDER))
- || (gtk_widget_path_is_type(path, GTK_TYPE_BOX))
- || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT))
- || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW))
- || (gtk_widget_path_is_type(path, GTK_TYPE_PANED))
- ) {
- TQStringList objectTypes;
- objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
- TQPalette objectPalette = tqApp->palette(objectTypes);
-
- // Draw background
- TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
- DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+ // Do nothing; backround is drawn in frame drawing routine
}
else if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) {
@@ -751,17 +805,52 @@ tdegtk_draw_common_background (DRAW_ARGS)
TQListViewItem tqt3ListViewItem;
TQStyleOption listViewItemOpt(&tqt3ListViewItem);
- TQRect paintDeviceRect;
- TQRect backgroundRect;
-
// Draw item
tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt);
}
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) {
+ //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0;
+ bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
+
+ TQStringList objectTypes;
+ objectTypes.append(TQSLIDER_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ GtkScale* scaleWidget = GTK_SCALE(widget);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.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)) {
// Do nothing
}
+ else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_EXPANDER))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_BOX))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_PANED))
+ ) {
+ TQStringList objectTypes;
+ objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+ }
+
else {
DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,0,255);
printf("[WARNING] tdegtk_draw_common_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
@@ -824,6 +913,29 @@ tdegtk_draw_common_frame (DRAW_ARGS)
// Draw frame
tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton));
}
+
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) {
+ GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L);
+ if (GTK_IS_MENU_BAR(parent)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ // See FIXME in tdegtk_draw_common_background
+
+ bool pressed = true;
+ bool prelight = false;
+
+ 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;
+
+ // 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));
+ }
+ }
else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) {
TQStringList objectTypes;
@@ -839,6 +951,23 @@ tdegtk_draw_common_frame (DRAW_ARGS)
tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton));
}
+ else if ((gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR))
+ ) {
+ // Draw frame
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelDockWindow, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ }
+
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR)) {
+ // Draw frame
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelMenuBar, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ }
+
+ else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_STATUSBAR)) {
+ // Draw frame
+ tqApp->style().drawPrimitive(TQStyle::PE_StatusBarSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ }
+
else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) {
TQStringList objectTypes;
objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
@@ -854,43 +983,66 @@ tdegtk_draw_common_frame (DRAW_ARGS)
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));
}
- else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) {
- GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L);
- if (GTK_IS_MENU_BAR(parent)) {
- TQStringList objectTypes;
- objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
- TQPalette objectPalette = tqApp->palette(objectTypes);
-
- // See FIXME in tdegtk_draw_common_background
-
- bool pressed = true;
- bool prelight = false;
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLTIP)) {
+ GtkFrame* frame = GTK_FRAME(widget);
+ GtkShadowType gtkShadowType = gtk_frame_get_shadow_type(frame);
- 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;
+ TQStringList objectTypes;
+ objectTypes.append(TQTOOLTIP_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
- // 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));
- }
+ int groupBoxLineWidth = 1;
+
+ int lineWidth = 0;
+
+ lineWidth = groupBoxLineWidth;
+
+ // Draw tooltip frame
+ qDrawPlainRect(&p, boundingRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()).foreground(), lineWidth);
}
else if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) {
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,64,64,255);
+ TQStringList objectTypes;
+ objectTypes.append(TQPROGRESSBAR_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;
+
+ GtkProgressBar* progressBar = GTK_PROGRESS_BAR(widget);
+ gdouble gtkProgressBarFraction = gtk_progress_bar_get_fraction(progressBar);
+ ceData.totalSteps = 8192;
+ ceData.currentStep = gtkProgressBarFraction*8192;
+
+ TQRect progressBarRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags);
+
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+
+ // Draw item
+ tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &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));
}
else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) {
// Do nothing
}
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) {
+ // Draw frame
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ }
+
else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND))
- || (gtk_widget_path_is_type(path, GTK_TYPE_EXPANDER))
- || (gtk_widget_path_is_type(path, GTK_TYPE_BOX))
- || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT))
- || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW))
- || (gtk_widget_path_is_type(path, GTK_TYPE_PANED))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_BOX))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_EXPANDER))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_BOX))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_VIEWPORT))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_SCROLLED_WINDOW))
+ || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_PANED))
) {
// Do nothing
}
@@ -1127,12 +1279,26 @@ tdegtk_draw_focus (DRAW_ARGS)
bgColor = objectPalette.color(TQPalette::Active, TQColorGroup::Background);
}
+ TQRect focusBoundingRect = boundingRect;
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+
+ if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQBUTTON_OBJECT_NAME_STRING);
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ focusBoundingRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_PushButtonFocusRect, ceData, elementFlags, NULL), ceData, elementFlags);
+ }
+
TQStyleOption opt(bgColor);
- tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, boundingRect, gtkToTQtColorGroup(engine, state), sflags, opt);
+ tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, focusBoundingRect, gtkToTQtColorGroup(engine, state), sflags, opt);
}
else if ((gtk_widget_path_is_type(path, GTK_TYPE_ENTRY))
|| (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE))
) {
// Draw nothing
}
@@ -1155,8 +1321,6 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,0);
-
const GtkWidgetPath* path;
GtkStateFlags state;
GtkWidget* widget;
@@ -1216,6 +1380,11 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
// Draw background behind groupbox label
DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p, brush, xy0_gap, x, (xy1_gap-xy0_gap), (height/2))
}
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,0);
+ printf("[WARNING] tdegtk_draw_frame_gap() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
p.end();
}
@@ -1223,38 +1392,21 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
static void
tdegtk_draw_grip (DRAW_ARGS)
{
- GdkRGBA border_color;
- GdkRGBA *inner_stroke_color;
- GtkStateFlags state;
- gint lx, ly;
+ cairo_save(cr);
+ cairo_reset_clip(cr);
- state = gtk_theming_engine_get_state (engine);
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
- gtk_theming_engine_get (engine, state,
- "-tdegtk-inner-stroke-color", &inner_stroke_color,
- NULL);
- gtk_theming_engine_get_border_color (engine, state, &border_color);
+ GtkStateFlags state;
+ state = gtk_theming_engine_get_state(engine);
- for (ly = 0; ly < 4; ly++)
- {
- /* vertically, four rows of dots */
- for (lx = 0; lx <= ly; lx++)
- {
- /* horizontally */
- int ny = (3.5 - ly) * 3;
- int nx = lx * 3;
-
- gdk_cairo_set_source_rgba (cr, inner_stroke_color);
- cairo_rectangle (cr, x + width - nx - 1, y + height - ny - 1, 2, 2);
- cairo_fill (cr);
-
- gdk_cairo_set_source_rgba (cr, &border_color);
- cairo_rectangle (cr, x + width - nx - 1, y + height - ny - 1, 1, 1);
- cairo_fill (cr);
- }
- }
+ tqApp->style().drawPrimitive(TQStyle::PE_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+
+ p.end();
- gdk_rgba_free (inner_stroke_color);
+ cairo_restore(cr);
}
static void
@@ -1516,10 +1668,13 @@ tdegtk_draw_slider (DRAW_ARGS,
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,255);
-
+ const GtkWidgetPath* path;
GtkStateFlags state;
+ GtkWidget* widget;
+
+ path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(engine);
+ widget = m_widgetLookup.find(cr, path);
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) {
TQStringList objectTypes;
@@ -1545,6 +1700,33 @@ tdegtk_draw_slider (DRAW_ARGS,
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));
}
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) {
+ //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0;
+ bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0;
+
+ TQStringList objectTypes;
+ objectTypes.append(TQSLIDER_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ GtkScale* scaleWidget = GTK_SCALE(widget);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.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_SliderHandle, ((mousedown)?TQStyle::SC_SliderHandle:TQStyle::SC_None));
+ }
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,255);
+ printf("[WARNING] tdegtk_draw_slider() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
+
p.end();
}
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index 25c212c..79763b6 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -136,7 +136,9 @@ G_MODULE_EXPORT GtkThemingEngine* create_engine(void) {
icon_sizes.push_back(std::make_pair("gtk-dialog", IconSize(KIcon::Small)));
icon_sizes.push_back(std::make_pair("", IconSize(KIcon::Small)));
- writeGtkThemeControlFile(false);
+ if (gtk3TQtDebug) {
+ writeGtkThemeControlFile(true);
+ }
// Initialize hooks
m_widgetLookup.initializeHooks();
@@ -608,6 +610,17 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarExtent)), "GtkScrollbar");
stream << parse_rc_string("-GtkRange-trough-border: 0", "GtkScrollbar");
+ {
+ //stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderControlThickness, ceData, elementFlags)), "GtkScale");
+ //stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderControlThickness)), "GtkScale");
+
+ // FIXME
+ // These are hardcoded for now as TQt3 does not easily give up its slider sizes
+ // We need to read the Gtk slider width for this to make any sense!
+ // Also, GTK does not seem to be able to set a minimum slider length at this time
+ stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(20), "GtkScale");
+ }
+
stream << parse_rc_string("-GtkButton-child-displacement-x: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftHorizontal)), "*");
stream << parse_rc_string("-GtkButton-child-displacement-y: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftVertical)), "*");
stream << parse_rc_string("-GtkButton-default-border: 0 0 0 0", "*");
@@ -678,9 +691,6 @@ void writeGtkThemeControlFile(int forceRecreate) {
// If not, it may be neccessary to override the GTK text drawing routines for notebooks to insert the proper shift
//stream << parse_rc_string("-????: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_TabBarTabShiftHorizontal)), "*");
- stream << parse_rc_string("-GtkButton-child-displacement-x: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftHorizontal)), "*");
- stream << parse_rc_string("-GtkButton-child-displacement-y: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftVertical)), "*");
-
// Expand widget padding so as to keep the prelighting out of the active widget area
// FIXME
// Where do these 3px values actually come from?
@@ -736,6 +746,10 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string("-GtkWidget-separator-width: " + TQString::number(tdeSeparatorMenuItemHeight), "GtkMenuItem");
stream << parse_rc_string("-GtkWidget-wide-separators: 1", "GtkMenuItem");
+ // 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:)
+ // This is rather jarring visually; if a way is found to work around this GTK bug the menu bar item spacing should be fixed ASAP!
+
// stream << parse_rc_string("padding: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_)), "GtkMenuBar");
stream << parse_rc_string("padding: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_MenuBarFrameWidth)) + "px " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_MenuBarItemSpacing)*0.75) + "px", "GtkMenuBar>GtkMenuItem");
stream << parse_rc_string("padding: " + TQString::number((tdeStandardMenuItemHeight-tqApp->style().pixelMetric(TQStyle::PM_IndicatorHeight))/2) + "px " + TQString::number(0) + "px", "GtkMenu>GtkMenuItem");
@@ -877,7 +891,7 @@ void writeGtkThemeControlFile(int forceRecreate) {
themeFile.close();
- if (!forceRecreate) {
+ if (!gtk3TQtDebug) {
gtk3_tqt_reload_theme_definition_file(themeFilePath.latin1());
}
}