summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-19 14:56:01 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-19 14:56:01 -0600
commit77b8059cbf4ba97c20f7dfa8945f6f7ac6c6d533 (patch)
tree274fe97efc2b34c75952423297a38e0d616940a2
parent114c26e88f3814bc9d864faa0b46b00c19b8513b (diff)
downloadgtk3-tqt-engine-77b8059cbf4ba97c20f7dfa8945f6f7ac6c6d533.tar.gz
gtk3-tqt-engine-77b8059cbf4ba97c20f7dfa8945f6f7ac6c6d533.zip
Add GtkLevelBar support
-rw-r--r--tdegtk/tdegtk-draw.cpp60
-rw-r--r--tdegtk/tdegtk-theme.cpp9
-rw-r--r--tdegtk/tqtcairopainter.cpp5
3 files changed, 72 insertions, 2 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index 2bd54e8..741eb1c 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -1320,6 +1320,9 @@ tdegtk_draw_common_background (DRAW_ARGS)
state = gtk_theming_engine_get_state(engine);
widget = m_widgetLookup.find(cr, path);
+ //TQString widgetPath(Gtk::gtk_widget_path(widget));
+ TQString widgetThemingEnginePath(gtk_widget_path_to_string(gtk_theming_engine_get_path(engine)));
+
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) {
#ifdef DRAW_SCROLLBAR_PIECES_INSTEAD_OF_ENTIRE_BAR
TQStringList objectTypes;
@@ -1602,6 +1605,33 @@ tdegtk_draw_common_background (DRAW_ARGS)
tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
}
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_LEVEL_BAR)) {
+ TQStringList objectTypes;
+ objectTypes.append(TQPROGRESSBAR_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ if (gtk_theming_engine_has_class(engine, "fill-block")) {
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Highlight);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+ }
+ if (gtk_theming_engine_has_class(engine, "empty-fill-block")) {
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
+ }
+ }
+
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_COMBO_BOX)) {
+ // Do nothing
+ }
+
+ else if (widgetThemingEnginePath.endsWith("GtkTextHandle")) {
+ // Do nothing
+ // FIXME
+ // Where is this widget actually used?
+ }
+
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))
@@ -1830,6 +1860,33 @@ tdegtk_draw_common_frame (DRAW_ARGS)
tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget));
}
+ else if (gtk_widget_path_is_type(path, GTK_TYPE_LEVEL_BAR)) {
+ 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);
+
+ TQStringList objectTypes;
+ objectTypes.append(TQPROGRESSBAR_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+ ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
+
+ if (gtk_theming_engine_has_class(engine, "fill-block")) {
+ // Do nothing
+ }
+ if (gtk_theming_engine_has_class(engine, "empty-fill-block")) {
+ // Draw frame
+ p2.setClipRect(TQRect(x, y, width, height));
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p2, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
+ }
+ }
+
else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND))
|| (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_BOX))
|| (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_EXPANDER))
@@ -2544,7 +2601,8 @@ tdegtk_draw_slider (DRAW_ARGS,
ceData.startStep = 0;
// Draw slider
- tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
+ //tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
+ tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
}
else {
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index 446480b..e18e30d 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -728,8 +728,10 @@ void writeGtkThemeControlFile(int forceRecreate) {
stream << parse_rc_string(TQString("-GtkComboBox-appears-as-list: %1px").arg(combobox_appears_as_list), "*");
// FIXME
- // Work around problems detailed in upstream GTK bug #687677
+ // Partially work around problems detailed in upstream GTK bug #687677
+ // These issues will likely have a more permanent and complete resolution in GTK 3.8, and the following two lines should be removed at that point
stream << parse_rc_string(TQString("-GtkComboBox-shadow-type: in"), "*");
+ stream << parse_rc_string(TQString("background-color: transparent"), "GtkComboBox");
stream << parse_rc_string(TQString("-GtkScrolledWindow-scrollbars-within-bevel: 1"), "*");
stream << parse_rc_string(TQString("-GtkScrolledWindow-scrollbar-spacing: 0px"), "*");
@@ -828,6 +830,11 @@ void writeGtkThemeControlFile(int forceRecreate) {
// See upstream GTK bug #687172
// FIXME
+ // GtkSwitch slider height must be set to the TQt3 scrollbar slider width
+ // When GTK provides an option to set the GtkSwitch height, implement theming support for this
+ // See upstream GTK bug #688675
+
+ // 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)), "*");
diff --git a/tdegtk/tqtcairopainter.cpp b/tdegtk/tqtcairopainter.cpp
index a2867f0..677d9c7 100644
--- a/tdegtk/tqtcairopainter.cpp
+++ b/tdegtk/tqtcairopainter.cpp
@@ -149,6 +149,11 @@ void TQt3CairoPaintDevice::resetIntermediateSurface() {
m_intermediateSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
}
+// FIXME
+// transferIntermediateSurface should only be used when clipping is active or ROP != CopyROP
+// Cairo however does not allow the target surface of a context to be switched, effectively preventing
+// direct drawing with dynamic switching to and from the intermediate surface on clip or ROP set/unset
+// See upstream Cairo bug report https://bugs.freedesktop.org/show_bug.cgi?id=57289
void TQt3CairoPaintDevice::transferIntermediateSurface() {
bool overlayMerge = true;
cairo_surface_flush(m_intermediateSurface);