summaryrefslogtreecommitdiffstats
path: root/tdegtk/tdegtk-theme.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdegtk/tdegtk-theme.cpp')
-rw-r--r--tdegtk/tdegtk-theme.cpp66
1 files changed, 64 insertions, 2 deletions
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();