diff options
author | Timothy Pearson <[email protected]> | 2012-11-01 22:49:00 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-01 22:49:00 -0500 |
commit | e363fd4cf89ebbabe94471bdc921d72796c05ade (patch) | |
tree | 619177d8545c701d9c09a357a983662d430ed081 /tdegtk/tdegtk-draw.cpp | |
parent | b2d6cebbfdb2db6aa250bb43c9e773e97bb96378 (diff) | |
download | gtk3-tqt-engine-e363fd4cf89ebbabe94471bdc921d72796c05ade.tar.gz gtk3-tqt-engine-e363fd4cf89ebbabe94471bdc921d72796c05ade.zip |
All widgets are now (more or less) drawn with TQt3 style primitives
Diffstat (limited to 'tdegtk/tdegtk-draw.cpp')
-rw-r--r-- | tdegtk/tdegtk-draw.cpp | 360 |
1 files changed, 271 insertions, 89 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index 818b2c1..032d6b6 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -27,6 +27,8 @@ #include <tqstyle.h> #include <tqpopupmenu.h> #include <tqlistview.h> +#include <tqdrawutil.h> +#include <tqslider.h> #include <kiconloader.h> #include <kicontheme.h> @@ -176,6 +178,20 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag sflags |= TQStyle::Style_Enabled; } } + else if (wt == TQT3WT_TQSlider) { + if (mousedown) { + sflags |= TQStyle::Style_Active; + } + 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; @@ -249,6 +265,36 @@ static TQColorGroup::ColorRole backgroundModeToColorRole(TQt::BackgroundMode mod return ret; } +void gtkScaleToSliderCeData(GtkScale* scaleWidget, TQStyleControlElementData &ceData) { + GtkAdjustment* adjustment = gtk_range_get_adjustment(GTK_RANGE(scaleWidget)); + + ceData.minSteps = gtk_adjustment_get_lower(adjustment); + ceData.maxSteps = gtk_adjustment_get_upper(adjustment); +// ceData.tickMarkSetting = +// ceData.tickInterval = + ceData.currentStep = gtk_adjustment_get_value(adjustment); +// ceData.startStep = + ceData.lineStep = gtk_adjustment_get_step_increment(adjustment); + ceData.pageStep = gtk_adjustment_get_page_increment(adjustment); + +// GtkPositionType valuePosition = gtk_scale_get_value_pos(scaleWidget); +// if (valuePosition == GTK_POS_LEFT) { +// ceData.tickMarkSetting = TQSlider::Left; +// } +// else if (valuePosition == GTK_POS_RIGHT) { +// ceData.tickMarkSetting = TQSlider::Right; +// } +// else if (valuePosition == GTK_POS_TOP) { +// ceData.tickMarkSetting = TQSlider::Above; +// } +// else if (valuePosition == GTK_POS_BOTTOM) { +// ceData.tickMarkSetting = TQSlider::Below; +// } +// else { + ceData.tickMarkSetting = TQSlider::NoMarks; +// } +} + /* draw a texture placed on the centroid */ static gboolean draw_centroid_texture (GtkThemingEngine *engine, @@ -299,13 +345,41 @@ draw_centroid_texture (GtkThemingEngine *engine, static void tdegtk_draw_activity (DRAW_ARGS) { - /* playground for effects */ - tdegtk_cairo_draw_background (engine, cr, - x, y, width, height, - 0, gtk_theming_engine_get_junction_sides (engine)); - tdegtk_cairo_draw_frame (engine, cr, - x, y, width, height, - 0, gtk_theming_engine_get_junction_sides (engine)); + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); + + const GtkWidgetPath* path; + GtkStateFlags state; + GtkWidget* widget; + + path = gtk_theming_engine_get_path(engine); + state = gtk_theming_engine_get_state(engine); + widget = m_widgetLookup.find(cr, path); + + if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) { + TQStringList objectTypes; + objectTypes.append(TQPROGRESSBAR_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; + + TQRect progressBarRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); + + // Draw item + tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p, ceData, elementFlags, progressBarRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); + } + + else { + DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,0,128); + printf("[WARNING] tdegtk_draw_activity() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); + } + + p.end(); } static void @@ -457,9 +531,6 @@ tdegtk_draw_cell_background (DRAW_ARGS, TQListViewItem tqt3ListViewItem; TQStyleOption listViewItemOpt(&tqt3ListViewItem); - TQRect paintDeviceRect; - TQRect backgroundRect; - // Draw item tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); } @@ -648,7 +719,6 @@ tdegtk_draw_common_background (DRAW_ARGS) else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))) { GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); if (!GTK_IS_MENU_BAR(parent)) { - // 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 @@ -703,23 +773,7 @@ tdegtk_draw_common_background (DRAW_ARGS) } else if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) { - DEBUG_FILL_BACKGROUND_WITH_COLOR(p,64,64,255); - } - - 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)) - || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT)) - || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW)) - || (gtk_widget_path_is_type(path, GTK_TYPE_PANED)) - ) { - TQStringList objectTypes; - objectTypes.append(TQWIDGET_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) + // Do nothing; backround is drawn in frame drawing routine } else if (gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) { @@ -751,17 +805,52 @@ tdegtk_draw_common_background (DRAW_ARGS) TQListViewItem tqt3ListViewItem; TQStyleOption listViewItemOpt(&tqt3ListViewItem); - TQRect paintDeviceRect; - TQRect backgroundRect; - // Draw item tqApp->style().drawComplexControl(TQStyle::CC_ListView, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE), TQStyle::SC_ListView, TQStyle::SC_All, listViewItemOpt); } + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) { + //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; + bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; + + TQStringList objectTypes; + objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + GtkScale* scaleWidget = GTK_SCALE(widget); + + 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; + + gtkScaleToSliderCeData(scaleWidget, ceData); + + // Draw item + tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_SliderGroove, ((mousedown)?TQStyle::SC_SliderGroove:TQStyle::SC_None)); + } + else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) { // Do nothing } + 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)) + || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT)) + || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW)) + || (gtk_widget_path_is_type(path, GTK_TYPE_PANED)) + ) { + TQStringList objectTypes; + objectTypes.append(TQWIDGET_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) + } + else { DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,0,255); printf("[WARNING] tdegtk_draw_common_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); @@ -824,6 +913,29 @@ tdegtk_draw_common_frame (DRAW_ARGS) // Draw frame tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); } + + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) { + GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); + if (GTK_IS_MENU_BAR(parent)) { + TQStringList objectTypes; + objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + // See FIXME in tdegtk_draw_common_background + + bool pressed = true; + bool prelight = false; + + 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_ButtonDropDown, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default)); + } + } else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY)) { TQStringList objectTypes; @@ -839,6 +951,23 @@ tdegtk_draw_common_frame (DRAW_ARGS) tqApp->style().drawPrimitive(TQStyle::PE_ButtonBevel, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQPushButton)); } + else if ((gtk_widget_path_is_type(path, GTK_TYPE_HANDLE_BOX)) + || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR)) + ) { + // Draw frame + tqApp->style().drawPrimitive(TQStyle::PE_PanelDockWindow, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + } + + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR)) { + // Draw frame + tqApp->style().drawPrimitive(TQStyle::PE_PanelMenuBar, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + } + + else if (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_STATUSBAR)) { + // Draw frame + tqApp->style().drawPrimitive(TQStyle::PE_StatusBarSection, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + } + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) { TQStringList objectTypes; objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING); @@ -854,43 +983,66 @@ tdegtk_draw_common_frame (DRAW_ARGS) 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)); } - else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) { - GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); - if (GTK_IS_MENU_BAR(parent)) { - TQStringList objectTypes; - objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING); - TQPalette objectPalette = tqApp->palette(objectTypes); - - // See FIXME in tdegtk_draw_common_background - - bool pressed = true; - bool prelight = false; + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLTIP)) { + GtkFrame* frame = GTK_FRAME(widget); + GtkShadowType gtkShadowType = gtk_frame_get_shadow_type(frame); - 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; + TQStringList objectTypes; + objectTypes.append(TQTOOLTIP_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); - // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonDropDown, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default)); - } + int groupBoxLineWidth = 1; + + int lineWidth = 0; + + lineWidth = groupBoxLineWidth; + + // Draw tooltip frame + qDrawPlainRect(&p, boundingRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()).foreground(), lineWidth); } else if (gtk_widget_path_is_type(path, GTK_TYPE_PROGRESS_BAR)) { - DEBUG_FILL_BACKGROUND_WITH_COLOR(p,64,64,255); + TQStringList objectTypes; + objectTypes.append(TQPROGRESSBAR_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; + + GtkProgressBar* progressBar = GTK_PROGRESS_BAR(widget); + gdouble gtkProgressBarFraction = gtk_progress_bar_get_fraction(progressBar); + ceData.totalSteps = 8192; + ceData.currentStep = gtkProgressBarFraction*8192; + + TQRect progressBarRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); + + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + + // Draw item + tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p, ceData, elementFlags, progressBarRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default)); } else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) { // Do nothing } + else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) { + // Draw frame + tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + } + 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)) - || (gtk_widget_path_is_type(path, GTK_TYPE_VIEWPORT)) - || (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW)) - || (gtk_widget_path_is_type(path, GTK_TYPE_PANED)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_BOX)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_EXPANDER)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_BOX)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_VIEWPORT)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_SCROLLED_WINDOW)) + || (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_PANED)) ) { // Do nothing } @@ -1127,12 +1279,26 @@ tdegtk_draw_focus (DRAW_ARGS) bgColor = objectPalette.color(TQPalette::Active, TQColorGroup::Background); } + TQRect focusBoundingRect = boundingRect; + TQStyleControlElementData ceData; + TQStyle::ControlElementFlags elementFlags; + + if (gtk_widget_path_is_type(path, GTK_TYPE_BUTTON)) { + TQStringList objectTypes; + objectTypes.append(TQBUTTON_OBJECT_NAME_STRING); + ceData.widgetObjectTypes = objectTypes; + ceData.rect = boundingRect; + + focusBoundingRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_PushButtonFocusRect, ceData, elementFlags, NULL), ceData, elementFlags); + } + TQStyleOption opt(bgColor); - tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, boundingRect, gtkToTQtColorGroup(engine, state), sflags, opt); + tqApp->style().drawPrimitive(TQStyle::PE_FocusRect, &p, focusBoundingRect, gtkToTQtColorGroup(engine, state), sflags, opt); } else if ((gtk_widget_path_is_type(path, GTK_TYPE_ENTRY)) || (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) + || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) ) { // Draw nothing } @@ -1155,8 +1321,6 @@ tdegtk_draw_frame_gap (DRAW_ARGS, TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); - DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,0); - const GtkWidgetPath* path; GtkStateFlags state; GtkWidget* widget; @@ -1216,6 +1380,11 @@ tdegtk_draw_frame_gap (DRAW_ARGS, // Draw background behind groupbox label DRAW_FILLED_RECTANGLE_OVER_SPECIFIC_AREA(p, brush, xy0_gap, x, (xy1_gap-xy0_gap), (height/2)) } + + else { + DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,128,0); + printf("[WARNING] tdegtk_draw_frame_gap() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); + } p.end(); } @@ -1223,38 +1392,21 @@ tdegtk_draw_frame_gap (DRAW_ARGS, static void tdegtk_draw_grip (DRAW_ARGS) { - GdkRGBA border_color; - GdkRGBA *inner_stroke_color; - GtkStateFlags state; - gint lx, ly; + cairo_save(cr); + cairo_reset_clip(cr); - state = gtk_theming_engine_get_state (engine); + TQRect boundingRect(0, 0, width, height); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); - gtk_theming_engine_get (engine, state, - "-tdegtk-inner-stroke-color", &inner_stroke_color, - NULL); - gtk_theming_engine_get_border_color (engine, state, &border_color); + GtkStateFlags state; + state = gtk_theming_engine_get_state(engine); - for (ly = 0; ly < 4; ly++) - { - /* vertically, four rows of dots */ - for (lx = 0; lx <= ly; lx++) - { - /* horizontally */ - int ny = (3.5 - ly) * 3; - int nx = lx * 3; - - gdk_cairo_set_source_rgba (cr, inner_stroke_color); - cairo_rectangle (cr, x + width - nx - 1, y + height - ny - 1, 2, 2); - cairo_fill (cr); - - gdk_cairo_set_source_rgba (cr, &border_color); - cairo_rectangle (cr, x + width - nx - 1, y + height - ny - 1, 1, 1); - cairo_fill (cr); - } - } + tqApp->style().drawPrimitive(TQStyle::PE_SizeGrip, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE)); + + p.end(); - gdk_rgba_free (inner_stroke_color); + cairo_restore(cr); } static void @@ -1516,10 +1668,13 @@ tdegtk_draw_slider (DRAW_ARGS, TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); - DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,255); - + const GtkWidgetPath* path; GtkStateFlags state; + GtkWidget* widget; + + path = gtk_theming_engine_get_path(engine); state = gtk_theming_engine_get_state(engine); + widget = m_widgetLookup.find(cr, path); if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCROLLBAR)) { TQStringList objectTypes; @@ -1545,6 +1700,33 @@ tdegtk_draw_slider (DRAW_ARGS, 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)); } + else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SCALE)) { + //bool mousedown = (state & GTK_STATE_FLAG_SELECTED) != 0; + bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; + + TQStringList objectTypes; + objectTypes.append(TQSLIDER_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + GtkScale* scaleWidget = GTK_SCALE(widget); + + 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; + + gtkScaleToSliderCeData(scaleWidget, ceData); + + // Draw item + tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_SliderHandle, ((mousedown)?TQStyle::SC_SliderHandle:TQStyle::SC_None)); + } + + else { + DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,0,255); + printf("[WARNING] tdegtk_draw_slider() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); + } + p.end(); } |