summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-01 17:03:43 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-01 17:03:43 -0500
commitb2d6cebbfdb2db6aa250bb43c9e773e97bb96378 (patch)
tree29352a3127cf30da095649304f85612d5ad40528
parentd53bb7334952ba33745413498b914948f1c5eb90 (diff)
downloadgtk3-tqt-engine-b2d6cebbfdb2db6aa250bb43c9e773e97bb96378.tar.gz
gtk3-tqt-engine-b2d6cebbfdb2db6aa250bb43c9e773e97bb96378.zip
Quite a few widgets now work
-rw-r--r--tdegtk/tdegtk-draw.cpp659
-rw-r--r--tdegtk/tdegtk-theme.cpp66
2 files changed, 561 insertions, 164 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index ad8edd9..818b2c1 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -26,6 +26,7 @@
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqpopupmenu.h>
+#include <tqlistview.h>
#include <kiconloader.h>
#include <kicontheme.h>
@@ -319,8 +320,6 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
TQt3CairoPaintDevice pd(NULL, x, y, size, size, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,0,255);
-
GtkStateFlags state;
state = gtk_theming_engine_get_state(engine);
@@ -427,54 +426,102 @@ static void
tdegtk_draw_cell_background (DRAW_ARGS,
GtkRegionFlags flags)
{
- GtkJunctionSides junction;
- guint hidden_side;
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
- junction = (GtkJunctionSides)(GTK_JUNCTION_RIGHT | GTK_JUNCTION_LEFT);
+ const GtkWidgetPath* path;
+ GtkStateFlags state;
+ GtkWidget* widget;
- hidden_side = SIDE_RIGHT | SIDE_LEFT;
+ path = gtk_theming_engine_get_path(engine);
+ state = gtk_theming_engine_get_state(engine);
+ widget = m_widgetLookup.find(cr, path);
- if ((flags & GTK_REGION_FIRST) != 0)
- {
- junction = (GtkJunctionSides)(junction & ~(GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT));
- hidden_side &= ~(SIDE_LEFT);
- }
- if ((flags & GTK_REGION_LAST) != 0)
- {
- junction = (GtkJunctionSides)(junction & ~(GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT));
- hidden_side &= ~(SIDE_RIGHT);
- }
+ if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
- tdegtk_cairo_draw_background (engine, cr,
- x, y, width, height,
- hidden_side, junction);
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+ if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Highlight);
+ }
+ else {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base);
+ }
+
+ 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 {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,64);
+ printf("[WARNING] tdegtk_draw_cell_background() 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
tdegtk_draw_cell_frame (DRAW_ARGS,
GtkRegionFlags flags)
{
- GtkJunctionSides junction;
- guint hidden_side;
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
- junction = (GtkJunctionSides)(GTK_JUNCTION_RIGHT | GTK_JUNCTION_LEFT);
+ const GtkWidgetPath* path;
+ GtkStateFlags state;
+ GtkWidget* widget;
- hidden_side = SIDE_RIGHT | SIDE_LEFT;
+ path = gtk_theming_engine_get_path(engine);
+ state = gtk_theming_engine_get_state(engine);
+ widget = m_widgetLookup.find(cr, path);
- if ((flags & GTK_REGION_FIRST) != 0)
- {
- junction = (GtkJunctionSides)(junction & ~(GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT));
- hidden_side &= ~(SIDE_LEFT);
- }
- if ((flags & GTK_REGION_LAST) != 0)
- {
- junction = (GtkJunctionSides)(junction & ~(GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT));
- hidden_side &= ~(SIDE_RIGHT);
- }
+#if 0
+ if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
- tdegtk_cairo_draw_frame (engine, cr,
- x, y, width, height,
- hidden_side, junction);
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+ if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Highlight);
+ }
+ else {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base);
+ }
+
+ 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 {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,64,64);
+ printf("[WARNING] tdegtk_draw_cell_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
+#endif
+
+ p.end();
}
static void
@@ -484,8 +531,6 @@ tdegtk_draw_check (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,0);
-
GtkStateFlags state;
state = gtk_theming_engine_get_state(engine);
const GtkWidgetPath* path(gtk_theming_engine_get_path(engine));
@@ -522,12 +567,20 @@ tdegtk_draw_common_background (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,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_ENTRY)) {
+ if ((gtk_widget_path_is_type(path, GTK_TYPE_ENTRY))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_VIEW))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_BUFFER))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_COMBOBOX_ENTRY))
+ ) {
TQStringList objectTypes;
objectTypes.append(TQLINEEDIT_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
@@ -537,7 +590,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
}
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) {
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) {
TQStringList objectTypes;
objectTypes.append(TQSCROLLBAR_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
@@ -552,7 +605,7 @@ 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 (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BUTTON)) {
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
TQStringList objectTypes;
objectTypes.append(TQBUTTON_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
@@ -562,7 +615,27 @@ tdegtk_draw_common_background (DRAW_ARGS)
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
}
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLTIP)) {
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQTOOLBAR_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 if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQMENUBAR_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 if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLTIP)) {
TQStringList objectTypes;
objectTypes.append(TQTIPLABEL_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
@@ -572,56 +645,126 @@ tdegtk_draw_common_background (DRAW_ARGS)
DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
}
- if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))) {
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,255);
+ 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
+
+// // Register menu item with animation engine
+// m_animations.menuItemEngine().registerWidget(widget);
+//
+// // Check tab properties
+// int tabIndex = Gtk::gtk_notebook_find_tab(widget, x+width/2, y+height/2);
+// m_animations.tabWidgetEngine().updateTabRect(widget, tabIndex, x, y, width, height);
+// bool prelight = (tabIndex == m_animations.tabWidgetEngine().hoveredTab(widget));
+// GtkMenuItem* menuitem = GTK_MENU_ITEM(widget);
+// const int currentPage = gtk_notebook_get_current_page(notebook);
+// const int numPages = gtk_notebook_get_n_pages(notebook);
+// bool selectedTab = (tabIndex==currentPage);
+
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ bool pressed = false;
+ bool prelight = false;
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ TQMenuItem tqt3MenuItem;
+ int maxAcceleratorTextWidth = 0;
+ int maxIconWidth = IconSize(KIcon::Small) + 4;
+ TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth);
+
+// if (???) elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable;
+
+ TQRect paintDeviceRect;
+ TQRect backgroundRect;
+
+ // Draw item
+ tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))?TQStyle::Style_Active:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), menuOpt);
+ }
+ }
+
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
- // 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
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+ }
-// // Register menu item with animation engine
-// m_animations.menuItemEngine().registerWidget(widget);
-//
-// // Check tab properties
-// int tabIndex = Gtk::gtk_notebook_find_tab(widget, x+width/2, y+height/2);
-// m_animations.tabWidgetEngine().updateTabRect(widget, tabIndex, x, y, width, height);
-// bool prelight = (tabIndex == m_animations.tabWidgetEngine().hoveredTab(widget));
-// GtkMenuItem* menuitem = GTK_MENU_ITEM(widget);
-// const int currentPage = gtk_notebook_get_current_page(notebook);
-// const int numPages = gtk_notebook_get_n_pages(notebook);
-// bool selectedTab = (tabIndex==currentPage);
+ 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(TQPOPUPMENU_OBJECT_NAME_STRING);
+ 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 if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQDOCKWINDOWHANDLE_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 if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_CELL)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
TQStyleControlElementData ceData;
TQStyle::ControlElementFlags elementFlags;
ceData.widgetObjectTypes = objectTypes;
ceData.rect = boundingRect;
+ if ((state & GTK_STATE_FLAG_SELECTED) != 0) {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Highlight);
+ }
+ else {
+ ceData.viewportData.bgBrush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base);
+ }
- TQMenuItem tqt3MenuItem;
- int maxAcceleratorTextWidth = 0;
- int maxIconWidth = IconSize(KIcon::Small) + 4;
- TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth);
-
-// if (???) elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable;
+ TQListViewItem tqt3ListViewItem;
+ TQStyleOption listViewItemOpt(&tqt3ListViewItem);
TQRect paintDeviceRect;
TQRect backgroundRect;
// Draw item
- tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))?TQStyle::Style_Active:TQStyle::Style_Default), menuOpt);
+ 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);
}
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND)) {
- TQStringList objectTypes;
- objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
- TQPalette objectPalette = tqApp->palette(objectTypes);
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) {
+ // Do nothing
+ }
- // 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);
}
p.end();
@@ -630,12 +773,20 @@ tdegtk_draw_common_background (DRAW_ARGS)
static void
tdegtk_draw_common_frame (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);
+ 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)) {
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BUTTON)) {
@@ -669,12 +820,12 @@ tdegtk_draw_common_frame (DRAW_ARGS)
}
}
else {
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BUTTON)) {
+ if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) {
// Draw frame
tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton));
}
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) {
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) {
TQStringList objectTypes;
objectTypes.append(TQLINEEDIT_OBJECT_NAME_STRING);
TQPalette objectPalette = tqApp->palette(objectTypes);
@@ -683,23 +834,76 @@ tdegtk_draw_common_frame (DRAW_ARGS)
tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
}
- if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) {
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_SPIN_BUTTON)) {
+ // Draw frame
+ tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton));
+ }
+
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) {
TQStringList objectTypes;
objectTypes.append(TQPOPUPMENU_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;
-
+
// 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));
}
+
+ 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_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,64,64,255);
+ }
+
+ 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))
+ ) {
+ // Do nothing
+ }
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,64,255);
+ printf("[WARNING] tdegtk_draw_common_frame() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
}
p.end();
+
+ cairo_restore(cr);
}
static void
@@ -753,8 +957,6 @@ tdegtk_draw_extension (DRAW_ARGS,
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,255,0);
-
const GtkWidgetPath* path;
GtkStateFlags state;
GtkWidget* widget;
@@ -809,7 +1011,7 @@ tdegtk_draw_extension (DRAW_ARGS,
ceData.tabBarData.shape = TQTabBar::RoundedBelow;
paintDeviceRect = TQRect(x-tab_overlap, y-tab_to_frame_gap_height, width+(tab_overlap*2), height+tab_to_frame_gap_height);
- boundingRect = TQRect(0, 0, width+(tab_overlap*2)-tab_overlap, height+tab_to_frame_gap_height);
+ boundingRect = TQRect(0, 0, width+tab_overlap, height+tab_to_frame_gap_height);
backgroundRect = TQRect(tab_overlap, 0, width, height+2);
break;
case GTK_POS_LEFT:
@@ -822,15 +1024,15 @@ tdegtk_draw_extension (DRAW_ARGS,
tqt3Tab.setIdentifier(tabIndex);
ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = tabIndex;
- paintDeviceRect = TQRect(x-tab_overlap, y, width+(tab_overlap*2), height);
- boundingRect = TQRect(0, 0, width+(tab_overlap*2)-tab_overlap, height);
+ paintDeviceRect = TQRect(x-tab_to_frame_gap_height, y, width+tab_to_frame_gap_height, height);
+ boundingRect = TQRect(0, 0, width, height);
backgroundRect = TQRect(0, 0, width, height);
break;
case GTK_POS_BOTTOM:
ceData.tabBarData.shape = TQTabBar::RoundedAbove;
paintDeviceRect = TQRect(x-tab_overlap, y, width+(tab_overlap*2), height+tab_to_frame_gap_height);
- boundingRect = TQRect(0, 0, width+(tab_overlap*2)-tab_overlap, height+tab_to_frame_gap_height);
+ boundingRect = TQRect(0, 0, width+tab_overlap, height+tab_to_frame_gap_height);
backgroundRect = TQRect(tab_overlap, 0, width, height+2);
break;
case GTK_POS_RIGHT:
@@ -843,8 +1045,8 @@ tdegtk_draw_extension (DRAW_ARGS,
tqt3Tab.setIdentifier(tabIndex);
ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = tabIndex;
- paintDeviceRect = TQRect(x-tab_overlap, y, width+(tab_overlap*2), height);
- boundingRect = TQRect(0, 0, width+(tab_overlap*2)-tab_overlap, height);
+ paintDeviceRect = TQRect(x, y, width+tab_to_frame_gap_height, height);
+ boundingRect = TQRect(0, 0, width, height);
backgroundRect = TQRect(0, 0, width, height);
break;
}
@@ -865,17 +1067,82 @@ tdegtk_draw_extension (DRAW_ARGS,
cairo_restore(cr);
}
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,255,0);
+ printf("[WARNING] tdegtk_draw_extension() 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
tdegtk_draw_focus (DRAW_ARGS)
{
+ 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_ENTRY))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_VIEW))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_BUFFER))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_COMBOBOX_ENTRY))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_EXPANDER))
+ ) {
+ TQStyle::SFlags sflags = TQStyle::Style_Default;
+
+ TQStringList objectTypes;
+ if ((gtk_widget_path_is_type(path, GTK_TYPE_ENTRY))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_VIEW))
+ || (gtk_widget_path_is_type(path, GTK_TYPE_TEXT_BUFFER))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY))
+ || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_COMBOBOX_ENTRY))
+ ) {
+ objectTypes.append(TQLINEEDIT_OBJECT_NAME_STRING);
+ }
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) {
+ objectTypes.append(TQLISTVIEW_OBJECT_NAME_STRING);
+ }
+ else {
+ objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
+ }
+
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+ TQColor bgColor;
- state = gtk_theming_engine_get_state (engine);
-
- return;
+ if (state & GTK_STATE_FLAG_INSENSITIVE) {
+ bgColor = objectPalette.color(TQPalette::Disabled, TQColorGroup::Background);
+ }
+ else {
+ bgColor = objectPalette.color(TQPalette::Active, TQColorGroup::Background);
+ }
+
+ TQStyleOption opt(bgColor);
+ tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, boundingRect, 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))
+ ) {
+ // Draw nothing
+ }
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,255,64);
+ printf("[WARNING] tdegtk_draw_focus() 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
@@ -997,59 +1264,38 @@ tdegtk_draw_handle (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,128,255);
-
- p.end();
-
- return;
-
- gdouble line_width;
- gint i, bar_y, num_bars, bar_spacing, bar_width, bar_height;
-
- tdegtk_cairo_draw_background (engine, cr,
- x, y, width, height,
- 0, gtk_theming_engine_get_junction_sides (engine));
-
- if (draw_centroid_texture (engine, cr, x, y, width, height))
- return;
-
- tdegtk_get_line_width (engine, &line_width);
-
- bar_y = 1;
- num_bars = 3;
- bar_spacing = 3;
- bar_width = 3;
- bar_height = num_bars * bar_spacing * line_width;
-
- cairo_save (cr);
-
- cairo_translate (cr, x + (gint) (width / 2), y + (gint) (height / 2));
+ const GtkWidgetPath* path;
+ GtkStateFlags state;
+ //GtkWidget* widget;
- if (height > width)
- cairo_translate (cr, - bar_width / 2 - 0.5, - bar_height / 2 + 0.5);
- else
- {
- cairo_translate (cr, - bar_height / 2 + 0.5, bar_width / 2 + 0.5);
- cairo_rotate (cr, - G_PI / 2);
- }
+ path = gtk_theming_engine_get_path(engine);
+ state = gtk_theming_engine_get_state(engine);
+ //widget = m_widgetLookup.find(cr, path);
- for (i = 0; i < num_bars; i++)
- {
- /* draw bars */
- cairo_move_to (cr, 0, bar_y);
- cairo_line_to (cr, bar_width, bar_y);
- tdegtk_cairo_set_source_border (engine, cr, bar_width, 3);
- cairo_stroke (cr);
+ if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ // Draw handle
+ tqApp->style().drawPrimitive(TQStyle::PE_DockWindowHandle, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal));
+ }
- cairo_move_to (cr, 0, bar_y + line_width);
- cairo_line_to (cr, bar_width, bar_y + line_width);
- tdegtk_cairo_set_source_inner_stroke (engine, cr, bar_width, line_width);
- cairo_stroke (cr);
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_PANED)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQSPLITTER_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ // Draw handle
+ tqApp->style().drawPrimitive(TQStyle::PE_Splitter, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQStyle::Style_Default:TQStyle::Style_Horizontal));
+ }
- bar_y += bar_spacing;
- }
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,128,255);
+ printf("[WARNING] tdegtk_draw_handle() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
- cairo_restore (cr);
+ p.end();
}
static void
@@ -1060,26 +1306,24 @@ tdegtk_draw_line (GtkThemingEngine *engine,
gdouble x1,
gdouble y1)
{
- /* line endings */
- if (y0 == y1)
- {
- y0 += 0.5;
- y1 += 0.5;
- x0 += 0.5;
- x1 -= 0.5;
- }
- else if (x0 == x1)
- {
- x0 += 0.5;
- x1 += 0.5;
- y0 += 0.5;
- y1 -= 0.5;
- }
-
- cairo_move_to (cr, x0, y0);
- cairo_line_to (cr, x1, y1);
- tdegtk_cairo_set_source_border (engine, cr, MAX (x1 - x0, 1), MAX (y1 - y0, 1));
- cairo_stroke (cr);
+ // line endings
+ if (y0 == y1) {
+ y0 += 0.5;
+ y1 += 0.5;
+ x0 += 0.5;
+ x1 -= 0.5;
+ }
+ else if (x0 == x1) {
+ x0 += 0.5;
+ x1 += 0.5;
+ y0 += 0.5;
+ y1 -= 0.5;
+ }
+
+ cairo_move_to (cr, x0, y0);
+ cairo_line_to (cr, x1, y1);
+ tdegtk_cairo_set_source_border (engine, cr, MAX (x1 - x0, 1), MAX (y1 - y0, 1));
+ cairo_stroke (cr);
}
static void
@@ -1118,15 +1362,47 @@ tdegtk_draw_radio (DRAW_ARGS)
TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
TQPainter p(&pd);
- DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,0);
-
+ const GtkWidgetPath* path;
GtkStateFlags state;
+ GtkWidget* widget;
+
+ path = gtk_theming_engine_get_path(engine);
state = gtk_theming_engine_get_state(engine);
- const GtkWidgetPath* path(gtk_theming_engine_get_path(engine));
+ widget = m_widgetLookup.find(cr, path);
if (gtk_widget_path_is_type(path, GTK_TYPE_TREE_VIEW)) {
tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_GTKTreeViewCell));
}
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) {
+ const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget);
+
+ boundingRect = TQRect(0, 0, allocation.width, allocation.height);
+ TQt3CairoPaintDevice pd2(NULL, 0, 0, allocation.width, allocation.height, cr);
+ TQPainter p2(&pd2);
+
+ bool checked = ((state & GTK_STATE_FLAG_ACTIVE) != 0);
+ int maxAcceleratorTextWidth = 0;
+ int maxIconWidth = IconSize(KIcon::Small) + 4;
+
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ TQMenuItem tqt3MenuItem;
+ tqt3MenuItem.setChecked(checked);
+ TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth);
+ elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable;
+
+ if (checked) {
+ tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorFrame, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton), menuOpt);
+ tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton), menuOpt);
+ }
+ }
else {
tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton));
}
@@ -1137,6 +1413,65 @@ tdegtk_draw_radio (DRAW_ARGS)
static void
tdegtk_draw_separator (DRAW_ARGS)
{
+ 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_SEPARATOR_MENU_ITEM)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ bool pressed = false;
+ bool prelight = false;
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ TQMenuItem tqt3MenuItem;
+ tqt3MenuItem.setSeparator(true);
+ int maxAcceleratorTextWidth = 0;
+ int maxIconWidth = IconSize(KIcon::Small) + 4;
+ TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth);
+
+// if (???) elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable;
+
+ TQRect paintDeviceRect;
+ TQRect backgroundRect;
+
+ // Draw item
+ tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem), menuOpt);
+ }
+
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_SEPARATOR)) {
+ TQt::Orientation orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
+ tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
+ }
+
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_SEPARATOR_TOOL_ITEM)) {
+ TQt::Orientation orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
+ tqApp->style().drawPrimitive(TQStyle::PE_Separator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
+ }
+
+ else {
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,128,255);
+ printf("[WARNING] tdegtk_draw_separator() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout);
+ }
+
+ p.end();
+
+ return;
+
gdouble line_width;
tdegtk_get_line_width (engine, &line_width);
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index 5578fbd..25c212c 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -79,6 +79,7 @@ extern "C" {
#include <tqscrollbar.h>
#include <tqregexp.h>
#include <tqfont.h>
+#include <tqpopupmenu.h>
#include <kapplication.h>
#include <kcmdlineargs.h>
@@ -376,12 +377,12 @@ TQString colorString(TQColor color) {
return ret;
}
-void setColour(TQString name, TQString state, TQColor color) {
+void setColour(TQString name, TQString state, TQColor color, TQString widgetTypes = TQString("*")) {
state = ":" + state;
if (state == ":normal") {
state = "";
}
- gtk3_tqt_load_resource_string(parse_rc_string(name + ": " + colorString(color), "*" + state).latin1());
+ gtk3_tqt_load_resource_string(parse_rc_string(name + ": " + colorString(color), widgetTypes + state).latin1());
}
static TQStringList iconInheritsDirs(const TQString& icondir) {
@@ -680,6 +681,67 @@ void writeGtkThemeControlFile(int forceRecreate) {
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?
+ stream << parse_rc_string("padding: " + TQString::number(3) + "px " + TQString::number(3) + "px", "GtkButton");
+ 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");
+
+ // Set header sizes
+ 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("padding: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkList>*>GtkButton");
+ stream << parse_rc_string("border-width: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkList>*>GtkButton");
+
+ // Separators appear to be hardcoded to 1px high in TQt3
+ // Anything else will cause a silent drawing failure!
+ stream << parse_rc_string("-GtkWidget-separator-height: " + TQString::number(1), "*");
+ stream << parse_rc_string("-GtkWidget-separator-width: " + TQString::number(1), "*");
+ stream << parse_rc_string("-GtkWidget-wide-separators: 1", "*");
+
+ // Set treeview cell size
+ stream << parse_rc_string("-GtkTreeView-vertical-separator: 0", "*");
+
+ // FIXME
+ // GTK3 does not currently support drawing GtkTextView backgrounds through the style engine
+ // Therefore, the best we can currently do is to set the background to the correct TQt3 color, which is obviously suboptimal as the TQt3 background drawing methods are never called!
+ // Even the recommended CSS style properties do not appear to work!
+ // See upstream GTK bug #687363
+ {
+ TQStringList objectTypes;
+ objectTypes.append(TQTEXTEDIT_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+// stream << parse_rc_string("background-color: " + colorString(objectPalette.color(TQPalette::Active, TQColorGroup::Base)), "GtkTextView");
+// stream << parse_rc_string("background-color: " + colorString(objectPalette.color(TQPalette::Disabled, TQColorGroup::Base)), "GtkTextView:insensitive");
+
+ setColour("color", "normal", objectPalette.color(TQPalette::Active, TQColorGroup::Foreground), "GtkTextView");
+ setColour("color", "insensitive", objectPalette.color(TQPalette::Disabled, TQColorGroup::Foreground), "GtkTextView");
+ setColour("background-color", "normal", objectPalette.color(TQPalette::Active, TQColorGroup::Base), "GtkTextView");
+ setColour("background-color", "insensitive", objectPalette.color(TQPalette::Disabled, TQColorGroup::Base), "GtkTextView");
+ }
+
+ // Handle menu metrics
+ int tdeStandardMenuItemHeight;
+ int tdeSeparatorMenuItemHeight;
+ {
+ TQMenuItem tqt3MenuItem;
+ tqt3MenuItem.setSeparator(false);
+ tdeStandardMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
+ tqt3MenuItem.setSeparator(true);
+ tdeSeparatorMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
+ }
+
+ 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-wide-separators: 1", "GtkMenuItem");
+
+// 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");
+ stream << parse_rc_string("padding: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkMenu>GtkMenuSpacerItem");
+// stream << parse_rc_string("padding: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_)), "GtkMenu>GtkSeparatorMenuItem");
+
// Set up fonts
TQFont generalFont = KGlobalSettings::generalFont();
TQFont toolBarFont = KGlobalSettings::toolBarFont();