diff options
Diffstat (limited to 'tdegtk/tdegtk-draw.cpp')
-rw-r--r-- | tdegtk/tdegtk-draw.cpp | 119 |
1 files changed, 105 insertions, 14 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index d3bec4f..21bd704 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -221,6 +221,7 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag else if (wt == TQT3WT_TQMenuItem) { if (prelight) { sflags |= TQStyle::Style_MouseOver; + sflags |= TQStyle::Style_Active; } if (focused) { sflags |= TQStyle::Style_HasFocus; @@ -232,6 +233,16 @@ static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlag sflags |= TQStyle::Style_HasFocus; } } + else if (wt == TQT3WT_TQMenuBarItem) { + if (prelight) { + sflags |= TQStyle::Style_Active; + sflags |= TQStyle::Style_Down; + sflags |= TQStyle::Style_HasFocus; + } + if (!disabled) { + sflags |= TQStyle::Style_Enabled; + } + } else if (wt == TQT3WT_TQSlider) { if (active) { sflags |= TQStyle::Style_Active; @@ -1332,6 +1343,33 @@ tdegtk_draw_common_background (DRAW_ARGS) #endif } + else if (gtk_widget_path_is_type(path, GTK_TYPE_SCROLLED_WINDOW)) { + if ((x == 0) && (y == 0)) { + TQStringList objectTypes; + objectTypes.append(TQFRAME_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + int groupBoxLineWidth = 1; + + int lineWidth = 0; + int midLineWidth = 0; + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQGroupBox, widget); + + lineWidth = groupBoxLineWidth; + midLineWidth = 0; + sflags = sflags | TQStyle::Style_Sunken; + + TQStyleOption opt(lineWidth, midLineWidth); + + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + + // Draw group box + tqApp->style().drawPrimitive(TQStyle::PE_PanelGroupBox, &p, boundingRect, gtkToTQtColorGroup(engine, state), sflags, opt); + } + } + else if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_FRAME) || gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_ENTRY) || gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_BUTTON)) && (Gtk::gtk_widget_path_has_type(path, GTK_TYPE_COMBO_BOX))) { draw_combobox_frame(engine, cr, x, y, width, height, path, state, widget); } @@ -1465,13 +1503,16 @@ tdegtk_draw_common_background (DRAW_ARGS) int maxIconWidth = IconSize(KIcon::Small) + 4; TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth); + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget); + sflags = sflags | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default); + // 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, widget) | ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))?TQStyle::Style_Active:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default), menuOpt); + tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), sflags, menuOpt); } } @@ -1526,6 +1567,21 @@ tdegtk_draw_common_background (DRAW_ARGS) draw_slider_frame(engine, cr, x, y, width, height, path, state, widget); } + else if (gtk_widget_path_is_type(path, GTK_TYPE_LABEL)) { + if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_FRAME)) { + TQStringList objectTypes; + objectTypes.append(TQFRAME_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 { + // Do nothing + } + } + else if (gtk_widget_path_is_type(path, GTK_TYPE_IMAGE)) { // Do nothing } @@ -1638,22 +1694,27 @@ tdegtk_draw_common_frame (DRAW_ARGS) GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L); if (GTK_IS_MENU_BAR(parent)) { TQStringList objectTypes; - objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING); + objectTypes.append(TQMENUBAR_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 = 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; - - // Draw frame - tqApp->style().drawPrimitive(TQStyle::PE_ButtonDropDown, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default) | ((pressed)?TQStyle::Style_Down:TQStyle::Style_Default) | ((prelight)?TQStyle::Style_MouseOver:TQStyle::Style_Default)); + + TQMenuItem tqt3MenuItem; + int maxAcceleratorTextWidth = 0; + int maxIconWidth = IconSize(KIcon::Small) + 4; + TQStyleOption menuOpt(&tqt3MenuItem, maxIconWidth, maxAcceleratorTextWidth); + + TQRect paintDeviceRect; + TQRect backgroundRect; + + TQStyle::SFlags sflags = gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuBarItem, widget); + sflags = sflags | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default); + + // Draw item + tqApp->style().drawControl(TQStyle::CE_MenuBarItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), sflags, menuOpt); } } @@ -1744,6 +1805,10 @@ tdegtk_draw_common_frame (DRAW_ARGS) // Do nothing } + else if (gtk_widget_path_is_type(path, GTK_TYPE_LABEL)) { + // Do mothing + } + 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, widget)); @@ -2311,6 +2376,9 @@ tdegtk_draw_radio (DRAW_ARGS) static void tdegtk_draw_separator (DRAW_ARGS) { + cairo_save(cr); + cairo_reset_clip(cr); + TQRect boundingRect(0, 0, width, height); TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); @@ -2347,8 +2415,29 @@ tdegtk_draw_separator (DRAW_ARGS) TQRect paintDeviceRect; TQRect backgroundRect; - // Draw item - tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget), menuOpt); +// // Draw background +// TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); +// DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + + // HACK + // GTK 3.7 + // Gtk3 attempts to draw two separators instead of just one + if ((x==0) && (y==0)) { + // HACK + // GTK 3.7 + // Related to the previous hack; the separator should therefore be drawn at the bottom of the provided rectangle instead of at the top + if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL)) { + x = x + (width/4); + } + else { + y = y + (height/4); + } + TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); + TQPainter p2(&pd2); + + // Draw item + tqApp->style().drawControl(TQStyle::CE_PopupMenuItem, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQMenuItem, widget), menuOpt); + } } else if (gtk_widget_path_is_type(path, GTK_TYPE_SEPARATOR)) { @@ -2367,6 +2456,8 @@ tdegtk_draw_separator (DRAW_ARGS) } p.end(); + + cairo_restore(cr); } static void |