summaryrefslogtreecommitdiffstats
path: root/tdegtk/tdegtk-theme.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-30 17:05:14 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-30 17:05:14 -0500
commitd53bb7334952ba33745413498b914948f1c5eb90 (patch)
tree9e7e11019069a9340abebfcf9a9d4b706d90967a /tdegtk/tdegtk-theme.cpp
parenta66a6bbf0a4c7dc521f03a3473fb3f550a4990c9 (diff)
downloadgtk3-tqt-engine-d53bb7334952ba33745413498b914948f1c5eb90.tar.gz
gtk3-tqt-engine-d53bb7334952ba33745413498b914948f1c5eb90.zip
Finished tab widgets, group boxes, and add preliminary popup menu support
Diffstat (limited to 'tdegtk/tdegtk-theme.cpp')
-rw-r--r--tdegtk/tdegtk-theme.cpp50
1 files changed, 42 insertions, 8 deletions
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index 28ff8e9..5578fbd 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -18,6 +18,16 @@
*
*/
+// NOTE
+// GTK contains a number of bugs that will interfere with your overall visual experience
+// Those that I have reported can be accessed with this link:
+// https://bugzilla.gnome.org/buglist.cgi?type0-0-4=substring&emailcc1=1&emailreporter1=1&emaillongdesc1=1&field0-0-0=product&type0-0-1=substring&field0-0-1=component&field0-0-4=longdesc&emailtype1=substring&type0-0-3=substring&query_format=advanced&emailassigned_to1=1&field0-0-3=status_whiteboard&emailqa_contact1=1&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&bug_status=RESOLVED&bug_status=VERIFIED&field0-0-2=short_desc&email1=kb9vqf%40pearsoncomputing.net&type0-0-0=substring&value0-0-0=gtk%2B&type0-0-2=substring
+
+// FIXME
+// This style should use the TDE open/save dialogs instead of the stock Gnome GtkFileChooserDialog
+// This is not currently possible in GTK
+// See upstream GTK bug #687173
+
#define TDEGTK_THEME_THEME_DIRECTORY_NAME "tdegtk"
#define TDEGTK_THEME_CONTROL_FILE_NAME "gtk.css"
#define RC_CACHE_VERSION TQString("1")
@@ -72,7 +82,9 @@ extern "C" {
#include <kapplication.h>
#include <kcmdlineargs.h>
+#include <kiconloader.h>
#include <kaboutdata.h>
+#include <kicontheme.h>
#include <klocale.h>
#include <kconfig.h>
#include <kglobal.h>
@@ -115,13 +127,13 @@ G_MODULE_EXPORT GtkThemingEngine* create_engine(void) {
// initialize icon sizes
icon_sizes.push_back(std::make_pair("panel-menu", 16));
icon_sizes.push_back(std::make_pair("panel", 32));
- icon_sizes.push_back(std::make_pair("gtk-small-toolbar", 22));
- icon_sizes.push_back(std::make_pair("gtk-large-toolbar", 22));
- icon_sizes.push_back(std::make_pair("gtk-dnd", 48));
- icon_sizes.push_back(std::make_pair("gtk-button", 16));
- icon_sizes.push_back(std::make_pair("gtk-menu", 16));
- icon_sizes.push_back(std::make_pair("gtk-dialog", 32));
- icon_sizes.push_back(std::make_pair("", 16));
+ icon_sizes.push_back(std::make_pair("gtk-small-toolbar", IconSize(KIcon::Toolbar)));
+ icon_sizes.push_back(std::make_pair("gtk-large-toolbar", IconSize(KIcon::MainToolbar)));
+ icon_sizes.push_back(std::make_pair("gtk-dnd", IconSize(KIcon::Small)));
+ icon_sizes.push_back(std::make_pair("gtk-button", IconSize(KIcon::Small)));
+ icon_sizes.push_back(std::make_pair("gtk-menu", IconSize(KIcon::Small)));
+ icon_sizes.push_back(std::make_pair("gtk-dialog", IconSize(KIcon::Small)));
+ icon_sizes.push_back(std::make_pair("", IconSize(KIcon::Small)));
writeGtkThemeControlFile(false);
@@ -451,6 +463,14 @@ void writeGtkThemeControlFile(int forceRecreate) {
// setColour("text", "insensitive", tqApp->palette().disabled().text());
// setColour("base", "insensitive", tqApp->palette().disabled().background());
+ TQString iconSettingsString;
+ iconSettingsString.append(TQString("gtk-menu=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));
+ iconSettingsString.append(TQString(":gtk-button=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));
+ iconSettingsString.append(TQString(":gtk-small-toolbar=%1,%2").arg(IconSize(KIcon::Toolbar)).arg(IconSize(KIcon::Toolbar)));
+ iconSettingsString.append(TQString(":gtk-large-toolbar=%1,%2").arg(IconSize(KIcon::MainToolbar)).arg(IconSize(KIcon::MainToolbar)));
+ iconSettingsString.append(TQString(":gtk-dnd=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));
+ iconSettingsString.append(TQString(":gtk-dialog=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));
+
// Set up global application settings
GtkSettings* gtksettings = gtk_settings_get_default();
GtkSettingsValue svalue;
@@ -458,6 +478,7 @@ void writeGtkThemeControlFile(int forceRecreate) {
g_object_set(gtksettings, "gtk-alternative-button-order", TRUE, NULL);
g_object_set(gtksettings, "gtk-button-images", tde_showIconsOnPushButtons, NULL);
g_object_set(gtksettings, "gtk-menu-popup-delay", tqApp->style().styleHint(TQStyle::SH_PopupMenu_SubMenuPopupDelay), NULL);
+ g_object_set(gtksettings, "gtk-icon-sizes", iconSettingsString.ascii(), NULL);
// Handle toolbar text display
if (toolbarStyle == 3) {
// This is broken by GTK bug #68700
@@ -571,6 +592,8 @@ void writeGtkThemeControlFile(int forceRecreate) {
bool combobox_appears_as_list = (!(tqApp->style().styleHint(TQStyle::SH_ComboBox_Popup) || tqApp->style().styleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle));
stream << parse_rc_string(TQString("-GtkComboBox-appears-as-list: %1px").arg(combobox_appears_as_list), "*");
+ stream << parse_rc_string("-GtkComboBox-arrow-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ArrowSize)), "*");
+ stream << parse_rc_string("-GtkComboBox-arrow-scaling: 0", "*");
stream << parse_rc_string(TQString("-GtkScrollbar-has-backward-stepper: ") + (back1 ? "1" : "0"), "*");
stream << parse_rc_string(TQString("-GtkScrollbar-has-forward-stepper: ") + (forward2 ? "1" : "0"), "*");
@@ -580,7 +603,9 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string("-GtkScrollbar-stepper-size: " + TQString::number(tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarSubLine).width() - 1), "*");
stream << parse_rc_string("-GtkScrollbar-min-slider-length: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarSliderMin)), "*");
- stream << parse_rc_string("-GtkScrollbar-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarExtent)-2), "*");
+ stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarExtent)), "GtkScrollbar");
+ 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("-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)), "*");
@@ -631,9 +656,11 @@ void writeGtkThemeControlFile(int forceRecreate) {
//stream << parse_rc_string("-GtkNotebook-tab-overlap: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap)), "*");
stream << parse_rc_string("-GtkNotebook-tab-overlap: 0", "*"); // Overlap is handled in the style engine itself
stream << parse_rc_string("-GtkNotebook-tab-curvature: 0", "*");
+ stream << parse_rc_string("-GtkNotebook-initial-gap: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap)), "*");
// This sets both the radio button and check box sizes
stream << parse_rc_string("-GtkCheckButton-indicator-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_IndicatorHeight)), "*");
+ stream << parse_rc_string("-GtkCheckMenuItem-indicator-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_IndicatorHeight)), "*");
// FIXME
// GtkCellRendererToggle indicator-size must be set as follows, however GTK3 does not provide any means to change the default size!
@@ -641,6 +668,11 @@ void writeGtkThemeControlFile(int forceRecreate) {
//stream << parse_rc_string("-GtkCellRendererToggle-indicator-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_IndicatorHeight)), "*");
// FIXME
+ // GtkSpinButton widgets use ugly unthemed horizontal buttons
+ // When GTK provides an option to switch to vertical buttons, implement theming support for them
+ // See upstream GTK bug #687172
+
+ // FIXME
// There must be a way to set the selected tab offset (shift)
// 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)), "*");
@@ -776,6 +808,8 @@ void writeGtkThemeControlFile(int forceRecreate) {
// Other icons that really should have Trinity equivalents in tdelibs
doIconMapping("list-add", "actions/add.png", factory, iconThemeDirs);
doIconMapping("list-remove", "actions/remove.png", factory, iconThemeDirs);
+ doIconMapping("list-add-symbolic", "actions/add.png", factory, iconThemeDirs);
+ doIconMapping("list-remove-symbolic", "actions/remove.png", factory, iconThemeDirs);
gtk_icon_factory_add_default(factory);