summaryrefslogtreecommitdiffstats
path: root/tdegtk/tdegtk-theme.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-11-08 01:35:06 -0600
committerTimothy Pearson <[email protected]>2012-11-08 01:35:06 -0600
commitcf8d4ef895903edde76148ebf4ca9876bcf42d26 (patch)
treea11965ca7212baf2a3c90e8d9bd07f8148797fce /tdegtk/tdegtk-theme.cpp
parent76f5e2671f3a61225a730e3d9699833ae3bec6f2 (diff)
downloadgtk3-tqt-engine-cf8d4ef895903edde76148ebf4ca9876bcf42d26.tar.gz
gtk3-tqt-engine-cf8d4ef895903edde76148ebf4ca9876bcf42d26.zip
Fix toolbar rendering
Diffstat (limited to 'tdegtk/tdegtk-theme.cpp')
-rw-r--r--tdegtk/tdegtk-theme.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index e0b74a9..66e4694 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -704,6 +704,33 @@ void writeGtkThemeControlFile(int forceRecreate) {
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");
+ TQRect probeRect;
+ TQRect comboBoxArrowRect;
+ TQRect comboBoxEditFieldRect;
+ {
+ probeRect = TQRect(0, 0, 100, 100);
+
+ TQStringList objectTypes;
+ objectTypes.append(TQCOMBOBOX_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.orientation = TQt::Horizontal;
+ ceData.rect = probeRect;
+ elementFlags = elementFlags | TQStyle::CEF_IsEditable;
+
+ comboBoxArrowRect = tqApp->style().querySubControlMetrics(TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxArrow);
+ comboBoxEditFieldRect = tqApp->style().querySubControlMetrics(TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField);
+ }
+
+ // The padding is specified in a highly unusual format:
+ // top_width, right_width, bottom_width, left_width
+ // Compare that to the more typical format of:
+ // left, top, right, bottom
+ stream << parse_rc_string("padding: " + TQString::number(comboBoxEditFieldRect.y()-probeRect.y()) + "px " + TQString::number(probeRect.right()-comboBoxEditFieldRect.right()-comboBoxArrowRect.width()) + "px " + TQString::number(probeRect.bottom()-comboBoxEditFieldRect.bottom()) + "px " + TQString::number(comboBoxEditFieldRect.x()-probeRect.x()) + "px", "GtkComboBox>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");
@@ -745,17 +772,41 @@ void writeGtkThemeControlFile(int forceRecreate) {
// Handle menu metrics
int tdeStandardMenuItemHeight;
int tdeSeparatorMenuItemHeight;
+ int tdeMenuFrameWidth;
{
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.orientation = TQt::Horizontal;
+
TQMenuItem tqt3MenuItem;
tqt3MenuItem.setSeparator(false);
tdeStandardMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
tqt3MenuItem.setSeparator(true);
tdeSeparatorMenuItemHeight = TQPopupMenu::menuItemHeight(&tqt3MenuItem, tqApp->fontMetrics());
+
+ TQSize sz;
+ ceData.rect = TQRect(0, 0, 0, tdeStandardMenuItemHeight);
+ sz = tqApp->style().sizeFromContents(TQStyle::CT_PopupMenuItem, ceData, elementFlags, TQSize(0, tdeStandardMenuItemHeight), TQStyleOption(&tqt3MenuItem));
+ sz = sz.expandedTo(TQSize(0, sz.height()));
+ tdeStandardMenuItemHeight = sz.height();
+
+ ceData.rect = TQRect(0, 0, 0, tdeSeparatorMenuItemHeight);
+ sz = tqApp->style().sizeFromContents(TQStyle::CT_PopupMenuItem, ceData, elementFlags, TQSize(0, tdeSeparatorMenuItemHeight), TQStyleOption(&tqt3MenuItem));
+ sz = sz.expandedTo(TQSize(0, sz.height()));
+ tdeSeparatorMenuItemHeight = sz.height();
+
+ tdeMenuFrameWidth = tqApp->style().pixelMetric(TQStyle::PM_DefaultFrameWidth, ceData, elementFlags);
}
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(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px " + TQString::number(tdeMenuFrameWidth) + "px", "GtkMenu");
// 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:)