summaryrefslogtreecommitdiffstats
path: root/tdegtk/tdegtk-draw.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-draw.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-draw.cpp')
-rw-r--r--tdegtk/tdegtk-draw.cpp445
1 files changed, 217 insertions, 228 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index a4788f2..ad8edd9 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -25,6 +25,10 @@
#include <tqapplication.h>
#include <tqpainter.h>
#include <tqstyle.h>
+#include <tqpopupmenu.h>
+
+#include <kiconloader.h>
+#include <kicontheme.h>
#include "tdegtk-cairo-support.h"
#include "tdegtk-draw.h"
@@ -149,6 +153,28 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag
sflags |= TQStyle::Style_Enabled;
}
}
+ else if (wt == TQT3WT_TQGroupBox) {
+ if (prelight) {
+ sflags |= TQStyle::Style_MouseOver;
+ }
+ if (focused) {
+ sflags |= TQStyle::Style_HasFocus;
+ }
+ if (!disabled) {
+ sflags |= TQStyle::Style_Enabled;
+ }
+ }
+ else if (wt == TQT3WT_TQMenuItem) {
+ if (prelight) {
+ sflags |= TQStyle::Style_MouseOver;
+ }
+ if (focused) {
+ sflags |= TQStyle::Style_HasFocus;
+ }
+ if (!disabled) {
+ sflags |= TQStyle::Style_Enabled;
+ }
+ }
else {
if (active) {
sflags |= TQStyle::Style_Down;
@@ -338,6 +364,23 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
}
tqApp->style().drawPrimitive((subline)?TQStyle::PE_ScrollBarSubLine:TQStyle::PE_ScrollBarAddLine, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
}
+ else {
+ // Draw arrow
+ TQStyle::PrimitiveElement pe;
+ if (arrow_direction == GTK_ARROW_UP) {
+ pe = TQStyle::PE_ArrowUp;
+ }
+ else if (arrow_direction == GTK_ARROW_DOWN) {
+ pe = TQStyle::PE_ArrowDown;
+ }
+ else if (arrow_direction == GTK_ARROW_LEFT) {
+ pe = TQStyle::PE_ArrowLeft;
+ }
+ else {
+ pe = TQStyle::PE_ArrowRight;
+ }
+ tqApp->style().drawPrimitive(pe, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ }
p.end();
@@ -506,7 +549,7 @@ tdegtk_draw_common_background (DRAW_ARGS)
ceData.orientation = (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal;
// Draw frame
- tqApp->style().drawPrimitive(TQStyle::PE_PanelLineEdit, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ 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)) {
@@ -529,6 +572,48 @@ 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);
+
+ // 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);
+
+ 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), menuOpt);
+ }
+
if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BACKGROUND)) {
TQStringList objectTypes;
objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
@@ -565,13 +650,13 @@ tdegtk_draw_common_frame (DRAW_ARGS)
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;
+ ceData.orientation = ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL))?TQt::Vertical:TQt::Horizontal);
// Draw background
// HACK
// PE_ScrollBarAddPage and PE_ScrollBarSubPage are separate in TQt3
// Apparently there is no such distinction in GTK3!
- TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarAddPage, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ TQRect scrollpagerect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarAddPage, gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
if (ceData.orientation == TQt::Vertical) {
scrollpagerect.setY(ceData.rect.y());
scrollpagerect.setHeight(ceData.rect.height());
@@ -597,6 +682,21 @@ tdegtk_draw_common_frame (DRAW_ARGS)
// Draw frame
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)) {
+ 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));
+ }
}
p.end();
@@ -668,7 +768,7 @@ tdegtk_draw_extension (DRAW_ARGS,
m_animations.tabWidgetEngine().registerWidget(widget);
// Check tab properties
- const int tabIndex = Gtk::gtk_notebook_find_tab(widget, x+width/2, y+height/2);
+ 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));
GtkNotebook* notebook = GTK_NOTEBOOK(widget);
@@ -676,6 +776,7 @@ tdegtk_draw_extension (DRAW_ARGS,
// bool lastTab = (tabIndex == gtk_notebook_get_n_pages(notebook)-1);
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(TQTABBAR_OBJECT_NAME_STRING);
@@ -694,42 +795,72 @@ tdegtk_draw_extension (DRAW_ARGS,
ceData.parentWidgetData.widgetObjectTypes.append(TQTABBAR_OBJECT_NAME_STRING);
int tab_overlap = tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap);
+ int tab_to_frame_gap_height = 2;
- boundingRect = TQRect(0, 0, width+(tab_overlap*2)-tab_overlap, height);
- TQt3CairoPaintDevice pd2(NULL, x-tab_overlap, y, width+(tab_overlap*2), height, cr);
- TQPainter p2(&pd2);
+ ceData.tabBarData.tabCount = numPages;
+ ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = tabIndex;
+
+ TQRect paintDeviceRect;
+ TQRect backgroundRect;
switch (gap_side) {
default:
case GTK_POS_TOP:
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);
+ backgroundRect = TQRect(tab_overlap, 0, width, height+2);
break;
case GTK_POS_LEFT:
+ ceData.tabBarData.shape = TQTabBar::RoundedAbove;
// FIXME
// TQt3 does not know how to draw these
- ceData.tabBarData.shape = TQTabBar::RoundedAbove;
+ // For now, draw a single unconnected tab in this location
+ tabIndex = 0;
+ ceData.tabBarData.tabCount = 1;
+ 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);
+ 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);
+ backgroundRect = TQRect(tab_overlap, 0, width, height+2);
break;
case GTK_POS_RIGHT:
+ ceData.tabBarData.shape = TQTabBar::RoundedAbove;
// FIXME
// TQt3 does not know how to draw these
- ceData.tabBarData.shape = TQTabBar::RoundedAbove;
+ // For now, draw a single unconnected tab in this location
+ tabIndex = 0;
+ ceData.tabBarData.tabCount = 1;
+ 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);
+ backgroundRect = TQRect(0, 0, width, height);
break;
}
- ceData.tabBarData.tabCount = numPages;
- ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = tabIndex;
cairo_save(cr);
cairo_reset_clip(cr);
+ TQt3CairoPaintDevice pd2(NULL, paintDeviceRect.x(), paintDeviceRect.y(), paintDeviceRect.width(), paintDeviceRect.height(), cr);
+ TQPainter p2(&pd2);
+
// Draw background
TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
- DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p2, brush, 0, 0, width, height)
+ DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p2, brush, backgroundRect.x(), backgroundRect.y(), backgroundRect.width(), backgroundRect.height())
// Draw tab
- tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((tabIndex==currentPage)?TQStyle::Style_Selected:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), tabOpt);
+ tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((selectedTab)?TQStyle::Style_Selected:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), tabOpt);
cairo_restore(cr);
}
@@ -759,155 +890,67 @@ tdegtk_draw_frame_gap (DRAW_ARGS,
DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,0);
- p.end();
-
- return;
-
- GtkBorder border;
- GtkBorder *outer_border;
- GtkCssBorderCornerRadius *top_left_radius, *top_right_radius;
- GtkCssBorderCornerRadius *bottom_left_radius, *bottom_right_radius;
- GtkCssBorderRadius border_radius = { { 0, }, };
- GtkJunctionSides junction;
- GtkStateFlags state;
- gboolean has_outer_stroke = FALSE;
- gdouble x0, y0, x1, y1, xc, yc, wc, hc;
-
- xc = yc = wc = hc = 0;
-
- junction = gtk_theming_engine_get_junction_sides (engine);
-
- state = gtk_theming_engine_get_state (engine);
-
- gtk_theming_engine_get (engine, state,
- /* Can't use border-radius as it's an int for
- * backwards compat */
- "border-top-left-radius", &top_left_radius,
- "border-top-right-radius", &top_right_radius,
- "border-bottom-right-radius", &bottom_right_radius,
- "border-bottom-left-radius", &bottom_left_radius,
- "-tdegtk-outer-stroke-width", &outer_border,
- NULL);
- gtk_theming_engine_get_border (engine, state, &border);
-
- if (!tdegtk_gtk_border_is_zero (outer_border))
- has_outer_stroke = TRUE;
-
- if (top_left_radius)
- border_radius.top_left = *top_left_radius;
- g_free (top_left_radius);
- if (top_right_radius)
- border_radius.top_right = *top_right_radius;
- g_free (top_right_radius);
- if (bottom_right_radius)
- border_radius.bottom_right = *bottom_right_radius;
- g_free (bottom_right_radius);
- if (bottom_left_radius)
- border_radius.bottom_left = *bottom_left_radius;
- g_free (bottom_left_radius);
-
- cairo_save (cr);
-
- switch (gap_side)
- {
- case GTK_POS_TOP:
- xc = x + xy0_gap + border.left;
- yc = y;
- wc = MAX (xy1_gap - xy0_gap - (border.left + border.right), 0);
- hc = border.top * 2;
-
- if (has_outer_stroke)
- {
- xc += outer_border->left;
- wc = MAX (xy1_gap - xy0_gap - (outer_border->left + outer_border->right) - (border.left + border.right), 0);
- hc += outer_border->top;
- }
-
- if (xy0_gap < border_radius.top_left.horizontal)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_TOPLEFT);
-
- if (xy1_gap > width - border_radius.top_right.horizontal)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_TOPRIGHT);
- break;
- default:
- case GTK_POS_BOTTOM:
- xc = x + xy0_gap + border.left;
- yc = y + height - border.bottom * 2;
- wc = MAX (xy1_gap - xy0_gap - (border.left + border.right), 0);
- hc = border.bottom * 2;
-
- if (has_outer_stroke)
- {
- xc += outer_border->left;
- yc -= outer_border->bottom;
- wc = MAX (xy1_gap - xy0_gap - (outer_border->left + outer_border->right) - (border.left + border.right), 0);
- hc += outer_border->bottom;
- }
-
- if (xy0_gap < border_radius.bottom_left.horizontal)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_BOTTOMLEFT);
-
- if (xy1_gap > width - border_radius.bottom_right.horizontal)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_BOTTOMRIGHT);
-
- break;
- case GTK_POS_LEFT:
- xc = x;
- yc = y + xy0_gap + border.top;
- wc = border.left * 2;
- hc = MAX (xy1_gap - xy0_gap - (border.top + border.bottom), 0);
-
- if (has_outer_stroke)
- {
- yc += outer_border->top;
- wc += outer_border->left;
- hc = MAX (xy1_gap - xy0_gap - (outer_border->top + outer_border->bottom) - (border.top + border.bottom), 0);
- }
-
- if (xy0_gap < border_radius.top_left.vertical)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_TOPLEFT);
+ const GtkWidgetPath* path;
+ GtkStateFlags state;
+ GtkWidget* widget;
- if (xy1_gap > height - border_radius.bottom_left.vertical)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_BOTTOMLEFT);
+ path = gtk_theming_engine_get_path(engine);
+ state = gtk_theming_engine_get_state(engine);
+ widget = m_widgetLookup.find(cr, path);
- break;
- case GTK_POS_RIGHT:
- xc = x + width - border.right * 2;
- yc = y + xy0_gap + border.top;
- wc = border.right * 2;
- hc = MAX (xy1_gap - xy0_gap - (border.top + border.bottom), 0);
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_FRAME)) {
+ GtkFrame* frame = GTK_FRAME(widget);
+ GtkShadowType gtkShadowType = gtk_frame_get_shadow_type(frame);
- if (has_outer_stroke)
- {
- xc -= outer_border->right;
- yc += outer_border->top;
- wc += outer_border->right;
- hc = MAX (xy1_gap - xy0_gap - (outer_border->top + outer_border->bottom) - (border.top + border.bottom), 0);
- }
+ TQStringList objectTypes;
+ objectTypes.append(TQGROUPBOX_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
- if (xy0_gap < border_radius.top_right.vertical)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_TOPRIGHT);
+ int groupBoxLineWidth = 1;
- if (xy1_gap > height - border_radius.bottom_right.vertical)
- junction = (GtkJunctionSides)(junction | GTK_JUNCTION_CORNER_BOTTOMRIGHT);
+ int lineWidth = 0;
+ int midLineWidth = 0;
+ TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQGroupBox);
- break;
- }
+ if (gtkShadowType == GTK_SHADOW_NONE) {
+ lineWidth = 0;
+ midLineWidth = 0;
+ }
+ else if (gtkShadowType == GTK_SHADOW_IN) {
+ lineWidth = groupBoxLineWidth;
+ midLineWidth = 0;
+ sflags = sflags | TQStyle::Style_Sunken;
+ }
+ else if (gtkShadowType == GTK_SHADOW_OUT) {
+ lineWidth = groupBoxLineWidth;
+ midLineWidth = 0;
+ sflags = sflags | TQStyle::Style_Raised;
+ }
+ else if (gtkShadowType == GTK_SHADOW_ETCHED_IN) {
+ lineWidth = groupBoxLineWidth;
+ midLineWidth = groupBoxLineWidth;
+ sflags = sflags | TQStyle::Style_Sunken;
+ }
+ else if (gtkShadowType == GTK_SHADOW_ETCHED_OUT) {
+ lineWidth = groupBoxLineWidth;
+ midLineWidth = groupBoxLineWidth;
+ sflags = sflags | TQStyle::Style_Raised;
+ }
- /* clip the gap */
- cairo_clip_extents (cr, &x0, &y0, &x1, &y1);
- cairo_rectangle (cr, x0, y0, x1 - x0, yc - y0);
- cairo_rectangle (cr, x0, yc, xc - x0, hc);
- cairo_rectangle (cr, xc + wc, yc, x1 - (xc + wc), hc);
- cairo_rectangle (cr, x0, yc + hc, x1 - x0, y1 - (yc + hc));
- cairo_clip (cr);
+ TQStyleOption opt(lineWidth, midLineWidth);
- /* draw the frame, gap area will not be drawn */
- tdegtk_cairo_draw_frame (engine, cr, x, y, width, height, 0, junction);
+ // Draw background
+ TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background);
+ DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush)
- cairo_restore (cr);
+ // Draw group box
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelGroupBox, &p, boundingRect, gtkToTQtColorGroup(engine, state), sflags, opt);
- gtk_border_free (outer_border);
+ // Draw background behind groupbox label
+ DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p, brush, xy0_gap, x, (xy1_gap-xy0_gap), (height/2))
+ }
+
+ p.end();
}
static void
@@ -1053,7 +1096,17 @@ tdegtk_draw_notebook (DRAW_ARGS,
GtkStateFlags state;
state = gtk_theming_engine_get_state(engine);
- //tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+
+ TQStringList objectTypes;
+ objectTypes.append(TQTABWIDGET_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)
+
+ // Draw tab frame
+ tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
p.end();
}
@@ -1154,7 +1207,7 @@ tdegtk_draw_slider (DRAW_ARGS,
scrollpagerect.setX(ceData.rect.x());
scrollpagerect.setWidth(ceData.rect.width());
}
- tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE));
+ tqApp->style().drawPrimitive(TQStyle::PE_ScrollBarSlider, &p, scrollpagerect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default));
}
p.end();
@@ -1163,89 +1216,25 @@ tdegtk_draw_slider (DRAW_ARGS,
static void
tdegtk_draw_spinbutton_background (DRAW_ARGS)
{
- GtkBorder border, *outer_border;
- GtkJunctionSides junction;
- GtkStateFlags state;
-
- junction = gtk_theming_engine_get_junction_sides (engine);
-
- state = gtk_theming_engine_get_state (engine);
-
- gtk_theming_engine_get (engine, state,
- "-tdegtk-outer-stroke-width", &outer_border,
- NULL);
- gtk_theming_engine_get_border (engine, state, &border);
-
- cairo_save (cr);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_clip (cr);
-
- if (!(junction & GTK_JUNCTION_CORNER_TOPRIGHT))
- {
- y = ceil (y);
- height = floor (height);
- height += border.bottom + outer_border->bottom;
- }
- else
- {
- y = floor (y);
- height = ceil (height);
- y -= outer_border->top;
- height += outer_border->bottom;
- }
-
- tdegtk_cairo_draw_background (engine, cr,
- x, y, width, height,
- 0, junction);
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
- cairo_restore (cr);
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,255,0);
- gtk_border_free (outer_border);
+ p.end();
}
static void
tdegtk_draw_spinbutton_frame (DRAW_ARGS)
{
- GtkBorder border, *outer_border;
- GtkJunctionSides junction;
- GtkStateFlags state;
-
- junction = gtk_theming_engine_get_junction_sides (engine);
-
- state = gtk_theming_engine_get_state (engine);
-
- gtk_theming_engine_get (engine, state,
- "-tdegtk-outer-stroke-width", &outer_border,
- NULL);
- gtk_theming_engine_get_border (engine, state, &border);
-
- cairo_save (cr);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_clip (cr);
-
- if (!(junction & GTK_JUNCTION_CORNER_TOPRIGHT))
- {
- y = ceil (y);
- height = floor (height);
- height += border.bottom + outer_border->bottom;
- }
- else
- {
- y = floor (y);
- height = ceil (height);
- y -= outer_border->top;
- height += outer_border->bottom;
- }
-
- tdegtk_cairo_draw_frame (engine, cr,
- x, y, width, height,
- 0, junction);
+ TQRect boundingRect(0, 0, width, height);
+ TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr);
+ TQPainter p(&pd);
- cairo_restore (cr);
+ DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,255,128);
- gtk_border_free (outer_border);
+ p.end();
}
void