summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorTCH <[email protected]>2020-05-03 00:47:21 +0900
committerMichele Calgaro <[email protected]>2020-05-03 00:47:21 +0900
commit6114a94ecda09795a500706ca326f33c9ebf75b6 (patch)
tree7300c397390e9a3fe3d4e0c7ee723f1d6f13bcda /style
parent579d92c0eb2b0f96de01cccf2c7f08d794d87509 (diff)
downloadtde-style-qtcurve-6114a94ecda09795a500706ca326f33c9ebf75b6.tar.gz
tde-style-qtcurve-6114a94ecda09795a500706ca326f33c9ebf75b6.zip
Updated to QtCurve version 1.8.5
Based on the original LGPL 2.1 QtCurve code from Craig Drummond <[email protected]> available at https://github.com/KDE/qtcurve Signed-off-by: TCH <[email protected]> Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'style')
-rw-r--r--style/CMakeLists.txt2
-rw-r--r--style/qtc_fixx11h.h4
-rw-r--r--style/qtc_tdestyle.cpp6
-rw-r--r--style/qtc_tdestyle.h59
-rw-r--r--style/qtcurve.cpp375
-rw-r--r--style/qtcurve.h45
-rw-r--r--style/shortcuthandler.cpp188
-rw-r--r--style/shortcuthandler.h62
8 files changed, 524 insertions, 217 deletions
diff --git a/style/CMakeLists.txt b/style/CMakeLists.txt
index 94e80f5..f7a29b6 100644
--- a/style/CMakeLists.txt
+++ b/style/CMakeLists.txt
@@ -37,7 +37,7 @@ install( FILES qtcurve.themerc DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
set( target qtcurve )
set( ${target}_SRCS
- qtcurve.cpp pixmaps.h
+ qtcurve.cpp pixmaps.h shortcuthandler.cpp
)
tde_add_kpart( ${target} AUTOMOC
diff --git a/style/qtc_fixx11h.h b/style/qtc_fixx11h.h
index 572870a..4eba111 100644
--- a/style/qtc_fixx11h.h
+++ b/style/qtc_fixx11h.h
@@ -5,12 +5,12 @@
If you get compile errors caused by X11 includes (the line
where first error appears contains word like None, Unsorted,
- Below, etc.), put #include <fixx11h.h> in the .cpp file
+ Below, etc.), put #include <fixx11h.h> in the .cpp file
(not .h file!) between the place where X11 headers are
included and the place where the file with compile
error is included (or the place where the compile error
in the .cpp file occurs).
-
+
This file remaps X11 #defines to const variables or
inline functions. The side effect may be that these
symbols may now refer to different variables
diff --git a/style/qtc_tdestyle.cpp b/style/qtc_tdestyle.cpp
index abe7bf4..a7ca77f 100644
--- a/style/qtc_tdestyle.cpp
+++ b/style/qtc_tdestyle.cpp
@@ -130,7 +130,7 @@ void TQtCTDEStyle::polish( TQStyleControlElementData ceData, ControlElementFlags
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
installObjectEventHandler(ceData, elementFlags, ptr, this);
- }
+ }
}
}
}
@@ -147,7 +147,7 @@ void TQtCTDEStyle::unPolish( TQStyleControlElementData ceData, ControlElementFla
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
removeObjectEventHandler(ceData, elementFlags, ptr, this);
- }
+ }
}
}
}
@@ -884,7 +884,7 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item)
sibling = sibling->nextSibling();
}
while (sibling && !sibling->isVisible());
-
+
return sibling;
}
diff --git a/style/qtc_tdestyle.h b/style/qtc_tdestyle.h
index 9d01a15..a606f5c 100644
--- a/style/qtc_tdestyle.h
+++ b/style/qtc_tdestyle.h
@@ -1,12 +1,12 @@
/*
* $Id$
- *
+ *
* TDEStyle
* Copyright (C) 2001-2002 Karol Szwed <[email protected]>
- *
+ *
* TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech,
* Copyright (C) 1998-2000 TrollTech AS.
- *
+ *
* Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
*
* This library is free software; you can redistribute it and/or
@@ -35,9 +35,9 @@
#include <tqcommonstyle.h>
struct TQtCTDEStylePrivate;
-/**
+/**
* Simplifies and extends the TQStyle API to make style coding easier.
- *
+ *
* The TDEStyle class provides a simple internal menu transparency engine
* which attempts to use XRender for accelerated blending where requested,
* or falls back to fast internal software tinting/blending routines.
@@ -53,24 +53,23 @@ struct TQtCTDEStylePrivate;
class TQtCTDEStyle: public TQCommonStyle
{
Q_OBJECT
-
public:
/**
* TQtCTDEStyle Flags:
- *
+ *
* @li Default - Default style setting, where menu transparency
* and the FilledFrameWorkaround are disabled.
- *
+ *
* @li AllowMenuTransparency - Enable this flag to use TQtCTDEStyle's
* internal menu transparency engine.
- *
- * @li FilledFrameWorkaround - Enable this flag to facilitate
- * proper repaints of TQMenuBars and TQToolBars when the style chooses
- * to paint the interior of a TQFrame. The style primitives in question
+ *
+ * @li FilledFrameWorkaround - Enable this flag to facilitate
+ * proper repaints of TQMenuBars and TQToolBars when the style chooses
+ * to paint the interior of a TQFrame. The style primitives in question
* are PE_PanelMenuBar and PE_PanelDockWindow. The HighColor style uses
- * this workaround to enable painting of gradients in menubars and
+ * this workaround to enable painting of gradients in menubars and
* toolbars.
*/
typedef uint TDEStyleFlags;
@@ -90,12 +89,12 @@ class TQtCTDEStyle: public TQCommonStyle
* @li WindowsStyleScrollBar - Two button scrollbar with the previous
* button at the top/left, and the next button at the bottom/right.
*
- * @li PlatinumStyleScrollBar - Two button scrollbar with both the
+ * @li PlatinumStyleScrollBar - Two button scrollbar with both the
* previous and next buttons at the bottom/right.
*
* @li ThreeButtonScrollBar - %KDE style three button scrollbar with
* two previous buttons, and one next button. The next button is always
- * at the bottom/right, whilst the two previous buttons are on either
+ * at the bottom/right, whilst the two previous buttons are on either
* end of the scrollbar.
*
* @li NextStyleScrollBar - Similar to the PlatinumStyle scroll bar, but
@@ -110,14 +109,14 @@ class TQtCTDEStyle: public TQCommonStyle
NextStyleScrollBar = 0x00000004 //!< two button, NeXT style
};
- /**
+ /**
* Constructs a TDEStyle object.
*
* Select the appropriate TDEStyle flags and scrollbar type
* for your style. The user's style preferences selected in KControl
* are read by using TQSettings and are automatically applied to the style.
* As a fallback, TDEStyle paints progressbars and tabbars. It inherits from
- * TQCommonStyle for speed, so don't expect much to be implemented.
+ * TQCommonStyle for speed, so don't expect much to be implemented.
*
* It is advisable to use a currently implemented style such as the HighColor
* style as a foundation for any new TDEStyle, so the limited number of
@@ -132,7 +131,7 @@ class TQtCTDEStyle: public TQCommonStyle
TQtCTDEStyle( TDEStyleFlags flags = TQtCTDEStyle::Default,
TDEStyleScrollBarType sbtype = TQtCTDEStyle::WindowsStyleScrollBar );
- /**
+ /**
* Destructs the TQtCTDEStyle object.
*/
~TQtCTDEStyle();
@@ -144,7 +143,7 @@ class TQtCTDEStyle: public TQCommonStyle
/**
* Modifies the scrollbar type used by the style.
- *
+ *
* This function is only provided for convenience. It allows
* you to make a late decision about what scrollbar type to use for the
* style after performing some processing in your style's constructor.
@@ -165,12 +164,12 @@ class TQtCTDEStyle: public TQCommonStyle
/**
* TDEStyle Primitive Elements:
*
- * The TDEStyle class extends the TQt's Style API by providing certain
+ * The TDEStyle class extends the TQt's Style API by providing certain
* simplifications for parts of TQStyle. To do this, the TDEStylePrimitive
* elements were defined, which are very similar to TQt's PrimitiveElement.
- *
- * The first three Handle primitives simplify and extend PE_DockWindowHandle,
- * so do not reimplement PE_DockWindowHandle if you want the TDEStyle handle
+ *
+ * The first three Handle primitives simplify and extend PE_DockWindowHandle,
+ * so do not reimplement PE_DockWindowHandle if you want the TDEStyle handle
* simplifications to be operable. Similarly do not reimplement CC_Slider,
* SC_SliderGroove and SC_SliderHandle when using the TDEStyle slider
* primitives. TDEStyle automatically double-buffers slider painting
@@ -190,7 +189,7 @@ class TQtCTDEStyle: public TQCommonStyle
* as the applet handles used in Kicker. The default implementation paints a filled
* rect of arbitrary color.
*
- * @li KPE_SliderGroove - This primitive must be reimplemented. It is used to
+ * @li KPE_SliderGroove - This primitive must be reimplemented. It is used to
* paint the slider groove. The default implementation paints a filled rect of
* arbitrary color.
*
@@ -199,7 +198,7 @@ class TQtCTDEStyle: public TQCommonStyle
* arbitrary color.
*
* @li KPE_ListViewExpander - This primitive is already implemented in TDEStyle. It
- * is used to draw the Expand/Collapse element in TQListViews. To indicate the
+ * is used to draw the Expand/Collapse element in TQListViews. To indicate the
* expanded state, the style flags are set to Style_Off, while Style_On implies collapsed.
*
* @li KPE_ListViewBranch - This primitive is already implemented in TDEStyle. It is
@@ -218,8 +217,8 @@ class TQtCTDEStyle: public TQCommonStyle
};
/**
- * This function is identical to TQt's TQStyle::drawPrimitive(), except that
- * it adds one further parameter, 'widget', that can be used to determine
+ * This function is identical to TQt's TQStyle::drawPrimitive(), except that
+ * it adds one further parameter, 'widget', that can be used to determine
* the widget state of the TDEStylePrimitive in question.
*
* @see TDEStyle::TDEStylePrimitive
@@ -302,10 +301,10 @@ class TQtCTDEStyle: public TQCommonStyle
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
- int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
+ int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget* widget = 0 ) const;
- TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags,
+ TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags,
const TQWidget* widget = 0 ) const;
TQPixmap stylePixmap( StylePixmap stylepixmap,
@@ -314,7 +313,7 @@ class TQtCTDEStyle: public TQCommonStyle
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
- int styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
+ int styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption &opt = TQStyleOption::Default,
TQStyleHintReturn* shr = 0,
const TQWidget* w = 0 ) const;
diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp
index fa0fe51..7ceb358 100644
--- a/style/qtcurve.cpp
+++ b/style/qtcurve.cpp
@@ -110,6 +110,7 @@ dimension, so as to draw the scrollbar at the correct size.
#include <iostream>
#define COMMON_FUNCTIONS
#include "qtcurve.h"
+#include "shortcuthandler.h"
#define CONFIG_READ
#include "config_file.c"
#include "pixmaps.h"
@@ -515,6 +516,20 @@ static bool inStackWidget(const TQWidget *w)
return false;
}
+static bool isOnToolbar(const TQWidget *widget, TQPainter *p)
+{
+ const TQWidget *wid=widget ? widget->parentWidget() : (p && p->device() ? dynamic_cast<TQWidget *>(p->device()) : 0L);
+
+ while(wid)
+ {
+ if(::tqqt_cast<const TQToolBar *>(wid))
+ return true;
+ wid=wid->parentWidget();
+ }
+
+ return false;
+}
+
static void setRgb(TQColor *col, const TQStringList &rgb)
{
if(3==rgb.size())
@@ -719,11 +734,11 @@ enum ECacheFlags
CACHE_COL_SEL_TAB
};
-static TQString createKey(int size, TQRgb color, bool horiz, int app, ECacheFlags flags)
+static TQString createKey(int size, TQRgb color, TQRgb bgnd, bool horiz, int app, ECacheFlags flags)
{
TQString key;
- TQTextOStream(&key) << size << '-' << color << '-' << horiz << '-' << app << '-' << flags;
+ TQTextOStream(&key) << size << '-' << color << '-' << bgnd << '-' << horiz << '-' << app << '-' << flags;
return key;
}
@@ -845,6 +860,7 @@ QtCurveStyle::QtCurveStyle(const TQString &name)
QtCurveStyle::QtCurveStyle()
#endif
: BASE_STYLE(AllowMenuTransparency, WindowsStyleScrollBar),
+ itsPopupMenuCols(0L),
itsSliderCols(0L),
itsDefBtnCols(0L),
itsMouseOverCols(0L),
@@ -870,7 +886,8 @@ QtCurveStyle::QtCurveStyle()
itsActive(true),
itsIsSpecialHover(false),
itsDragWidget(0L),
- itsDragWidgetHadMouseTracking(false)
+ itsDragWidgetHadMouseTracking(false),
+ itsShortcutHandler(new ShortcutHandler(this))
{
#ifdef TQTC_STYLE_SUPPORT
TQString rcFile;
@@ -1112,10 +1129,6 @@ QtCurveStyle::QtCurveStyle()
setMenuColors(TQApplication::palette().active());
- if(USE_LIGHTER_POPUP_MENU)
- itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE],
- TO_FACTOR(opts.lighterPopupMenuBgnd));
-
if ((SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars) &&
"soffice.bin"==TQString(tqApp->argv()[0]) && TOO_DARK(SHADE_CUSTOM==opts.shadeMenubars
? opts.customMenubarsColor
@@ -1147,9 +1160,10 @@ QtCurveStyle::QtCurveStyle()
QtCurveStyle::~QtCurveStyle()
{
- if(itsSidebarButtonsCols!=itsSliderCols &&
- itsSidebarButtonsCols!=itsDefBtnCols)
+ if(itsSidebarButtonsCols!=itsSliderCols && itsSidebarButtonsCols!=itsDefBtnCols)
delete [] itsSidebarButtonsCols;
+ if(itsPopupMenuCols && itsPopupMenuCols!=itsMenubarCols && itsPopupMenuCols!=itsBackgroundCols && itsPopupMenuCols!=itsActiveMdiColors)
+ delete [] itsPopupMenuCols;
if(itsActiveMdiColors && itsActiveMdiColors!=itsHighlightCols && itsActiveMdiColors!=itsBackgroundCols)
delete [] itsActiveMdiColors;
if(itsMdiColors && itsMdiColors!=itsBackgroundCols)
@@ -1188,6 +1202,12 @@ static TQString getFile(const TQString &f)
return d;
}
+inline void addEventFilter(TQObject *object, TQObject *filter)
+{
+ object->removeEventFilter(filter);
+ object->installEventFilter(filter);
+}
+
void QtCurveStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
{
if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
@@ -1280,6 +1300,19 @@ void QtCurveStyle::applicationPolish(const TQStyleControlElementData &ceData, Co
if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde")))
opts.fixParentlessDialogs=false;
#endif
+// BASE_STYLE::polish(app);
+ if(opts.hideShortcutUnderline)
+ addEventFilter(app, itsShortcutHandler);
+ }
+}
+
+void QtCurveStyle::applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+ if(opts.hideShortcutUnderline)
+ app->removeEventFilter(itsShortcutHandler);
+// BASE_STYLE::unPolish(app);
}
}
@@ -1412,10 +1445,6 @@ void QtCurveStyle::polish(TQPalette &pal)
shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
itsButtonCols[ORIGINAL_SHADE]), itsSidebarButtonsCols);
- if(USE_LIGHTER_POPUP_MENU && newGray)
- itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE],
- TO_FACTOR(opts.lighterPopupMenuBgnd));
-
if(newCheckRadioSelCols) {
if(SHADE_BLEND_SELECTED==opts.crColor) {
shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsCheckRadioSelCols);
@@ -2134,7 +2163,8 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData,
{
TQWidget *widget=(TQWidget*)object;
TQPainter painter(widget);
- TQColor col(popupMenuCol(widget->palette().active()));
+ const TQColor *pc(popupMenuCols(widget->palette().active()));
+ TQColor col(pc[ORIGINAL_SHADE]);
if(APPEARANCE_STRIPED==opts.menuBgndAppearance)
{
@@ -2147,7 +2177,7 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData,
}
else
{
- drawBevelGradientReal(col, &painter, ceData.rect, GT_HORIZ==opts.menuBgndGrad, false,
+ drawBevelGradientReal(col, col, &painter, ceData.rect, GT_HORIZ==opts.menuBgndGrad, false,
opts.menuBgndAppearance, WIDGET_OTHER);
}
return false;
@@ -2482,12 +2512,13 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData,
itsHoverTab=0L;
itsHoverWidget->repaint(false);
}
- else if(!itsHoverWidget->hasMouseTracking() ||
- (itsFormMode=isFormWidget(itsHoverWidget)))
+ else if(!itsHoverWidget->hasMouseTracking() || (itsFormMode=isFormWidget(itsHoverWidget)))
{
itsHoverWidget->repaint(false);
itsFormMode=false;
}
+ else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView *>(itsHoverWidget))
+ itsHoverWidget->repaint(false);
}
else
itsHoverWidget=0L;
@@ -2523,38 +2554,38 @@ bool QtCurveStyle::objectEventHandler( const TQStyleControlElementData &ceData,
return BASE_STYLE::objectEventHandler(ceData, elementFlags, source, event);
}
-void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &rOrig,
- const TQColorGroup &cg, SFlags flags,
- int round, const TQColor &fill, const TQColor *custom,
- bool doBorder, bool doCorners, EWidget w) const
+void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &rOrig, const TQColorGroup &cg, SFlags flags, int round,
+ const TQColor &fill, const TQColor *custom, bool doBorder, bool doCorners, EWidget w, const TQWidget *widget) const
{
- EAppearance app(widgetApp(w, &opts));
+ EAppearance app(widgetApp(APPEARANCE_NONE!=opts.tbarBtnAppearance &&
+ (WIDGET_TOOLBAR_BUTTON==w || (WIDGET_BUTTON(w) && isOnToolbar(widget, p)))
+ ? WIDGET_TOOLBAR_BUTTON : w, &opts));
TQRect r(rOrig),
- br(r);
- bool bevelledButton(WIDGET_BUTTON(w) && APPEARANCE_BEVELLED==app),
- sunken(flags &(Style_Down|Style_On|Style_Sunken)),
- flatWidget(WIDGET_PROGRESSBAR==w && !opts.borderProgress),
- lightBorder(!flatWidget && DRAW_LIGHT_BORDER(sunken , w, app)),
- draw3dfull(!flatWidget && !lightBorder && DRAW_3D_FULL_BORDER(sunken, app)),
- draw3d(!flatWidget && (draw3dfull || (!lightBorder && DRAW_3D_BORDER(sunken, app)))),
- doColouredMouseOver(!sunken && doBorder &&
+ br(r);
+ bool bevelledButton(WIDGET_BUTTON(w) && APPEARANCE_BEVELLED==app),
+ sunken(flags &(Style_Down|Style_On|Style_Sunken)),
+ flatWidget(WIDGET_PROGRESSBAR==w && !opts.borderProgress),
+ lightBorder(!flatWidget && DRAW_LIGHT_BORDER(sunken , w, app)),
+ draw3dfull(!flatWidget && !lightBorder && DRAW_3D_FULL_BORDER(sunken, app)),
+ draw3d(!flatWidget && (draw3dfull || (!lightBorder && DRAW_3D_BORDER(sunken, app)))),
+ doColouredMouseOver(!sunken && doBorder &&
opts.coloredMouseOver && flags&Style_MouseOver &&
WIDGET_SPIN!=w && WIDGET_COMBO_BUTTON!=w && WIDGET_SB_BUTTON!=w &&
(WIDGET_SB_SLIDER!=w || !opts.colorSliderMouseOver) &&
!(flags&DW_CLOSE_BUTTON) &&
(opts.coloredTbarMo || !(flags&STD_TOOLBUTTON)) &&
(flags&CHECK_BUTTON || flags&TOGGLE_BUTTON || !sunken)),
- plastikMouseOver(doColouredMouseOver && MO_PLASTIK==opts.coloredMouseOver),
- colouredMouseOver(doColouredMouseOver &&
+ plastikMouseOver(doColouredMouseOver && MO_PLASTIK==opts.coloredMouseOver),
+ colouredMouseOver(doColouredMouseOver &&
(MO_COLORED==opts.coloredMouseOver || MO_COLORED_THICK==opts.coloredMouseOver ||
(MO_GLOW==opts.coloredMouseOver && itsFormMode))),
- doEtch(!itsFormMode && doBorder && ETCH_WIDGET(w) && !(flags&CHECK_BUTTON) &&
+ doEtch(!itsFormMode && doBorder && ETCH_WIDGET(w) && !(flags&CHECK_BUTTON) &&
DO_EFFECT),
- glowFocus(doEtch && USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled),
- sunkenToggleMo(sunken && !(flags&Style_Down) && flags&(Style_MouseOver|TOGGLE_BUTTON)),
- horiz(flags&Style_Horizontal);
+ glowFocus(doEtch && USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled),
+ sunkenToggleMo(sunken && !(flags&Style_Down) && flags&(Style_MouseOver|TOGGLE_BUTTON)),
+ horiz(flags&Style_Horizontal);
const TQColor *cols(custom ? custom : itsBackgroundCols),
- *border(colouredMouseOver ? borderColors(flags, cols) : cols);
+ *border(colouredMouseOver ? borderColors(flags, cols) : cols);
p->save();
@@ -2574,7 +2605,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
p->setClipRegion(p->clipRegion().eor(TQRegion(br)));
}
br.addCoords(1, 1,-1,-1);
- drawBevelGradient(fill, p, br, horiz, sunken, app, w);
+ drawBevelGradient(fill, bgnd, p, br, horiz, sunken, app, w);
br.addCoords(-1, -1, 1, 1);
if(WIDGET_PROGRESSBAR==w && opts.stripedProgress)
p->restore();
@@ -2585,7 +2616,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
else if(colouredMouseOver || (draw3d && flags&Style_Raised))
{
int dark(/*bevelledButton ? */2/* : 4*/);
-
+
if(colouredMouseOver)
p->setPen(border[MO_STD_LIGHT(w, sunken)]);
else
@@ -2646,16 +2677,16 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
if(horiz)
{
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(r.x()+so, r.y(), len, r.height()),
+ drawBevelGradient(itsMouseOverCols[col], bgnd, p, TQRect(r.x()+so, r.y(), len, r.height()),
horiz, sunken, app, w);
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(r.x()+r.width()-eo, r.y(), len, r.height()),
+ drawBevelGradient(itsMouseOverCols[col], bgnd, p, TQRect(r.x()+r.width()-eo, r.y(), len, r.height()),
horiz, sunken, app, w);
}
else
{
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(r.x(), r.y()+so, r.width(), len),
+ drawBevelGradient(itsMouseOverCols[col], bgnd, p, TQRect(r.x(), r.y()+so, r.width(), len),
horiz, sunken, app, w);
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(r.x(), r.y()+r.height()-eo, r.width(), len),
+ drawBevelGradient(itsMouseOverCols[col], bgnd, p, TQRect(r.x(), r.y()+r.height()-eo, r.width(), len),
horiz, sunken, app, w);
}
}
@@ -2716,7 +2747,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
? itsMouseOverCols
: itsButtonCols
: cols;
-
+
if((!sunken || sunkenToggleMo) && flags&Style_Enabled && !glowFocus &&
((((doEtch && WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w) || WIDGET_COMBO==w || WIDGET_SB_SLIDER==w) &&
MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) ||
@@ -2732,7 +2763,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
}
if(doEtch || glowFocus) {
- if( (!sunken || sunkenToggleMo) && !(opts.thin&THIN_FRAMES) &&
+ if( (!sunken || sunkenToggleMo) && !(opts.thin&THIN_FRAMES) &&
((WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w && MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) ||
glowFocus ||
(WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator)/* ||
@@ -2740,7 +2771,7 @@ void QtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRec
drawGlow(p, rOrig, cg, WIDGET_DEF_BUTTON==w && flags&Style_MouseOver ? WIDGET_STD_BUTTON : w,
glowFocus ? itsFocusCols : 0);
else
- drawEtch(p, rOrig, cg, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken, ROUNDED_NONE==round);
+ drawEtch(p, rOrig, cg, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken, ROUNDED_NONE==round, w);
}
p->restore();
@@ -2781,12 +2812,15 @@ void QtCurveStyle::drawGlow(TQPainter *p, const TQRect &r, const TQColorGroup &c
}
}
-void QtCurveStyle::drawEtch(TQPainter *p, const TQRect &r, const TQColorGroup &cg, bool raised, bool square) const
+void QtCurveStyle::drawEtch(TQPainter *p, const TQRect &r, const TQColorGroup &cg, bool raised, bool square, EWidget w) const
{
square=square || ROUND_NONE==opts.round;
int mod(square ? 0 : 2);
+ if(WIDGET_TOOLBAR_BUTTON==w && EFFECT_ETCH==opts.tbarBtnEffect)
+ raised=false;
+
{
TQColor col(raised ? shade(cg.background(), ETCHED_DARK) : itsBackgroundCols[1]);
@@ -3292,7 +3326,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
bool menuTitle(widget && (ceData.widgetObjectTypes.count() > 0) && 0==qstrcmp(ceData.widgetObjectTypes[ceData.widgetObjectTypes.count()-1].ascii(), "TDEPopupTitle"));
const TQColor *use(buttonColors(cg));
TQRect r2(r);
-
+
if(menuTitle)
r2.addCoords(2, 2, -2, -2);
drawLightBevel(p, r2, cg, flags|Style_Horizontal, ROUNDED_ALL, getFill(flags, use), use);
@@ -3302,7 +3336,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
const TQColor *use(flags&Style_Enabled && itsSortedLvColors && isSort
? itsSortedLvColors
: opts.lvButton ? buttonColors(cg) : backgroundColors(cg));
-
+
flags=((flags|Style_Sunken)^Style_Sunken)| Style_Raised;
if(NO_SECT!=itsHoverSect && HOVER_HEADER==itsHover && itsHoverWidget)
@@ -3315,7 +3349,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
bool sunken(flags &(Style_Down | Style_On | Style_Sunken));
- drawBevelGradient(getFill(flags, use), p, r, flags&Style_Horizontal,
+ drawBevelGradient(getFill(flags, use), cg.background(), p, r, flags&Style_Horizontal,
sunken, opts.lvAppearance, WIDGET_LISTVIEW_HEADER);
if(APPEARANCE_RAISED==opts.lvAppearance)
@@ -3593,7 +3627,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
if(IS_FLAT(opts.appearance))
p->fillRect(TQRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2), bgnd);
else
- drawBevelGradient(bgnd, p, TQRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2), true,
+ drawBevelGradient(bgnd, bgnd, p, TQRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2), true,
drawSunken, app, wid);
if(MO_NONE!=opts.coloredMouseOver && !glow && sflags&Style_MouseOver && sflags&Style_Enabled)
@@ -3726,7 +3760,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
p->save();
if(opts.crHighlight && sflags&Style_MouseOver)
- drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, r, true,
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), cg.background(), p, r, true,
false, opts.selectionAppearance, WIDGET_SELECTION);
else
p->fillRect(r, cg.background());
@@ -3743,7 +3777,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
if(IS_FLAT(opts.appearance))
p->fillRect(TQRect(x+1, y+1, rect.width()-2, rect.height()-2), bgnd);
else
- drawBevelGradient(bgnd, p, TQRect(x+1, y+1, rect.width()-2, rect.height()-2), true,
+ drawBevelGradient(bgnd, bgnd, p, TQRect(x+1, y+1, rect.width()-2, rect.height()-2), true,
drawSunken, app, wid);
if(coloredMo)
@@ -3867,9 +3901,9 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
if(0!=opts.tabBgnd && p->device() && inStackWidget(dynamic_cast<const TQWidget *>(p->device())))
color=shade(color, TO_FACTOR(opts.tabBgnd));
-
+
if(flags&Style_MouseOver && opts.splitterHighlight)
- drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.splitterHighlight)), p, r, !(flags&Style_Horizontal),
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.splitterHighlight)), cg.background(), p, r, !(flags&Style_Horizontal),
false, opts.selectionAppearance, WIDGET_SELECTION);
else
p->fillRect(r, color);
@@ -3901,7 +3935,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
(!((TQGroupBox *)(p->device()))->title().isEmpty() || ((TQGroupBox *)(p->device()))->isCheckable()))
r2.addCoords(8, 0, -8, 0);
p->setPen(backgroundColors(cg)[STD_BORDER]);
- p->drawLine(r2.x(), r2.y(), r2.x()+r2.width()-1, r2.y());
+ p->drawLine(r2.x(), r2.y(), r2.x()+r2.width()-1, r2.y());
}
else if (FRAME_NONE!=opts.groupBox) {
if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault())
@@ -3934,8 +3968,6 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
(sv ||
(widget && widget->parentWidget() && ::tqqt_cast<const TQFrame *>(widget) &&
widget->parentWidget()->inherits("KateView"))));
- const TQColor *use(opts.highlightScrollViews && /*!square &&*/ flags&Style_HasFocus ? itsHighlightCols :
- backgroundColors(cg));
// if(square)
// {
@@ -3954,19 +3986,29 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
flags&=~Style_HasFocus;
if(sv && opts.etchEntry && ((TQFrame *)widget)->lineWidth()>2)
{
- drawEntryField(p, r, cg, flags, flags&Style_Enabled
- ? /*flags&Style_MouseOver
+ drawEntryField(p, r, cg, flags, flags&Style_Enabled && opts.highlightScrollViews
+ ? flags&Style_MouseOver
? ENTRY_MOUSE_OVER
- :*/ flags&Style_HasFocus
+ : flags&Style_HasFocus
? ENTRY_FOCUS
: ENTRY_NONE
: ENTRY_NONE, square ? ROUNDED_NONE : ROUNDED_ALL, WIDGET_SCROLLVIEW);
}
else
+ {
+ const TQColor *use(sv && opts.highlightScrollViews
+ ? widget==itsHoverWidget
+ ? itsMouseOverCols
+ : flags&Style_HasFocus
+ ? itsFocusCols
+ : backgroundColors(cg)
+ : backgroundColors(cg));
+
drawBorder(cg.background(), p, r, cg,
(SFlags)(flags|Style_Horizontal|Style_Enabled),
square ? ROUNDED_NONE : ROUNDED_ALL, use, sv ? WIDGET_SCROLLVIEW : WIDGET_OTHER, APP_KICKER!=itsThemedApp,
itsIsTransKicker ? BORDER_FLAT : (flags&Style_Sunken ? BORDER_SUNKEN : BORDER_RAISED) );
+ }
itsFormMode=false;
}
}
@@ -4000,7 +4042,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
else
{
if(GB_3D==border)
- p->setPen(popupMenuCol(cg));
+ p->setPen(use[ORIGINAL_SHADE]);
p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1);
p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2);
p->setPen(use[FRAME_DARK_SHADOW]);
@@ -4010,7 +4052,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
}
else if(IS_FLAT_BGND(opts.menuBgndAppearance))
{
- p->setPen(/*USE_LIGHTER_POPUP_MENU ? */popupMenuCol(cg)/* : cg.background()*/);
+ p->setPen(/*USE_LIGHTER_POPUP_MENU ? */use[ORIGINAL_SHADE]/* : cg.background()*/);
p->drawRect(TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2));
}
break;
@@ -4041,7 +4083,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
case PE_PanelDockWindow:
case PE_PanelMenuBar:
{
- // fix for toolbar lag (from Mosfet Liquid)
+ // fix for toolbar lag (from Mosfet Liquid)
TQWidget *w = dynamic_cast<TQWidget *>(p->device());
if(w)
@@ -4144,7 +4186,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
p->setClipRegion(TQRegion(s2)+TQRegion(addpage));
if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED && !IS_FLAT(opts.sbarBgndAppearance))
- drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
+ drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
opts.sbarBgndAppearance, WIDGET_SB_BGND);
else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && IS_FLAT(opts.sbarBgndAppearance))
{
@@ -4311,7 +4353,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
? cg.highlightedText()
: itsFocusCols[FOCUS_SHADE(flags&Style_Selected)]);
p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1);
- }
+ }
else if(r.width()<4 || r.height()<4 || view)
{
// TQRect r2(r);
@@ -4394,7 +4436,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
// if((opts.square&SQUARE_SCROLLVIEW) && scrollView)
// {
// const TQColor *use(backgroundColors(cg));
-//
+//
// p->setPen(use[STD_BORDER]);
// p->drawLine(r.bottomLeft(), r.topLeft());
// p->drawLine(r.topLeft(), r.topRight());
@@ -4418,7 +4460,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
if(flags&Style_Enabled && isReadOnly)
flags-=Style_Enabled;
}
-
+
// HACK!! (From Plastik)
//
// In this place there is no reliable way to detect if we are in tdehtml; the
@@ -4434,8 +4476,8 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQS
TQRect r2(r);
r2.addCoords(1, 1, -1, -1);
// p->fillRect(r2, flags&Style_Enabled ? cg.base() : cg.background());
- drawEntryField(p, r, cg, flags, !isReadOnly && isEnabled
- ? flags&Style_MouseOver && !scrollView
+ drawEntryField(p, r, cg, flags, !isReadOnly && isEnabled && (!scrollView || opts.highlightScrollViews)
+ ? flags&Style_MouseOver
? ENTRY_MOUSE_OVER
: flags&Style_HasFocus
? ENTRY_FOCUS
@@ -4561,7 +4603,7 @@ void QtCurveStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter *p, co
r.rect(&x, &y, &w, &h);
if(!IS_FLAT(opts.dwtAppearance))
- drawBevelGradient(cg.background(), p, r, horizontal, false, opts.dwtAppearance, WIDGET_DOCK_WIDGET_TITLE);
+ drawBevelGradient(cg.background(), cg.background(), p, r, horizontal, false, opts.dwtAppearance, WIDGET_DOCK_WIDGET_TITLE);
else
p->fillRect(r, cg.background()); // .dark(DW_BGND));
// p->setPen(itsBackgroundCols[STD_BORDER]);
@@ -4757,7 +4799,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
rx.addCoords(1, 0, -1, -6);
p->fillRect(rx, shade(cg.background(), TO_FACTOR(opts.tabBgnd)));
}
-
+
if(!active) {
if(top) {
tr.addCoords(0, 2, 0, 0);
@@ -4784,11 +4826,11 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
if(opts.tabBgnd)
col=shade(col, TO_FACTOR(opts.tabBgnd));
-
+
if(invertedSel)
p->fillRect(glowTr, col);
else
- drawBevelGradient(col, p, glowTr, true,
+ drawBevelGradient(col, cg.background(), p, glowTr, true,
active, active ? SEL_TAB_APP : NORM_TAB_APP, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT);
drawBorder(cg.background(), p, glowTr, cg, flags|Style_Horizontal|Style_Enabled,
@@ -4905,7 +4947,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
}
p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawLine(r.x(), r.y()+1, r.x()+r.width()-1, r.y()+1);
-
+
if(opts.coloredMouseOver && itsHover && TAB_MO_GLOW!=opts.tabMouseOver)
drawHighlight(p, TQRect(tr.x()+(firstTab ? moOffset : 1),
tr.y()+(TAB_MO_TOP==opts.tabMouseOver ? tr.height()-2 : 1),
@@ -4918,7 +4960,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawPoint(r.x(), r.y());
}
-
+
if(active && opts.highlightTab)
{
p->setPen(itsHighlightCols[0]);
@@ -4993,7 +5035,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
}
}
- drawItem(p, tr, AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text());
+ drawItem(p, tr, AlignCenter | ShowPrefix | (styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget) ? 0 : NoAccel), cg, flags & Style_Enabled, 0, t->text());
if ((flags & Style_HasFocus) && !t->text().isEmpty())
{
@@ -5076,7 +5118,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
int cw(iw+pw+constSpace);
- xo=cw<w ? (w-cw)>>1 : constSpace;
+ xo=cw<w ? (w-cw)>>1 : constSpace;
p->drawPixmap(x+xo, y + (h>>1) - (pixmap.height()>>1), pixmap);
xo+=pw;
}
@@ -5099,7 +5141,8 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
// Make the label indicate if the button is a default button or not
int i,
- j(opts.embolden && (elementFlags & CEF_IsDefault) ? 2 : 1);
+ j(opts.embolden && button->isDefault() ? 2 : 1),
+ textFlags(AlignCenter|ShowPrefix|(styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget) ? 0 : NoAccel));
bool sidebar(!opts.stdSidebarButtons &&
(((elementFlags & CEF_IsFlat) && button->inherits("KMultiTabBarTab")) ||
((elementFlags & CEF_HasParentWidget) && button->inherits("Ideal::Button") &&
@@ -5109,7 +5152,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
: ceData.colorGroup.buttonText());
for(i=0; i<j; i++)
- drawItem(p, TQRect(x+i, y, w, h), AlignCenter|ShowPrefix, ceData.colorGroup,
+ drawItem(p, TQRect(x+i, y, w, h), textFlags, ceData.colorGroup,
(elementFlags & CEF_IsEnabled),
button->pixmap(), button->text(), -1, &textCol);
@@ -5131,6 +5174,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
maxpmw(data.maxIconWidth()),
x, y, w, h;
bool reverse(TQApplication::reverseLayout());
+ const TQColor *use(popupMenuCols(cg));
maxpmw=TQMAX(maxpmw, constMenuPixmapWidth);
r.rect(&x, &y, &w, &h);
@@ -5140,17 +5184,17 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
else
{
if(IS_FLAT_BGND(opts.menuBgndAppearance))
- p->fillRect(r, popupMenuCol(cg));
+ p->fillRect(r, use[ORIGINAL_SHADE]);
if(opts.menuStripe)
- drawBevelGradient(menuStripeCol(cg), p,
+ drawBevelGradient(menuStripeCol(cg), use[ORIGINAL_SHADE], p,
TQRect(reverse ? r.right()-maxpmw : r.x(),
r.y(), maxpmw, r.height()), false,
false, opts.menuStripeAppearance, WIDGET_OTHER);
}
if((flags&Style_Active) && (flags&Style_Enabled))
- drawMenuItem(p, r, flags, cg, false, ROUNDED_ALL, popupMenuCol(cg),
+ drawMenuItem(p, r, flags, cg, false, ROUNDED_ALL, use[ORIGINAL_SHADE],
opts.useHighlightForMenu ? itsHighlightCols : itsBackgroundCols);
if(!mi)
@@ -5228,15 +5272,18 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
if(!text.isNull())
{
- int t(text.find('\t'));
+ int t(text.find('\t')),
+ textFlags=AlignVCenter|ShowPrefix|DontClip|SingleLine;
+
+ if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget))
+ textFlags |= NoAccel;
// draw accelerator/tab-text
if(t>=0)
- p->drawText(tr, AlignVCenter|ShowPrefix|DontClip|SingleLine|(reverse ? AlignLeft : AlignRight),
- text.mid(t+1));
+ p->drawText(tr, textFlags|(reverse ? AlignLeft : AlignRight), text.mid(t+1));
- p->drawText(ir, AlignVCenter|ShowPrefix|DontClip|SingleLine|(reverse ? AlignRight : AlignLeft), text, t);
- }
+ p->drawText(ir, textFlags|(reverse ? AlignRight : AlignLeft), text, t);
+ }
else if(mi->pixmap())
{
TQPixmap *pixmap(mi->pixmap());
@@ -5283,8 +5330,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
TQMenuItem *mi(data.menuItem());
if(mi->text().isEmpty()) // Draw pixmap...
- drawItem(p, r, AlignCenter|ShowPrefix|DontClip|SingleLine, cg, flags&Style_Enabled,
- mi->pixmap(), TQString());
+ drawItem(p, r, AlignCenter|ShowPrefix|DontClip|SingleLine, cg, flags&Style_Enabled, mi->pixmap(), TQString());
else
{
const TQColor *col=((opts.colorMenubarMouseOver && active) || (!opts.colorMenubarMouseOver && down))
@@ -5296,7 +5342,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
: &cg.foreground();
p->setPen(*col);
- p->drawText(r, AlignCenter|ShowPrefix|DontClip|SingleLine, mi->text());
+ p->drawText(r, AlignCenter|ShowPrefix|DontClip|SingleLine|(styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget) ? 0 : NoAccel), mi->text());
}
break;
@@ -5335,8 +5381,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
col=itsBackgroundCols[2];
}
- drawBevelGradient(col, p, rx, true,
- false, opts.progressGrooveAppearance, WIDGET_PBAR_TROUGH);
+ drawBevelGradient(col, cg.background(), p, rx, true, false, opts.progressGrooveAppearance, WIDGET_PBAR_TROUGH);
const TQColor *use(backgroundColors(cg));
@@ -5350,7 +5395,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
p->drawLine(r.topLeft(), r.topRight());
p->drawLine(r.bottomLeft(), r.bottomRight());
}
-
+
if(doEtch)
drawEtch(p, r, cg, false, (opts.square&SQUARE_PROGRESS));
@@ -5535,13 +5580,13 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
r-=visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r);
- drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, checkbox->rect(), true,
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), cg.background(), p, checkbox->rect(), true,
false, opts.selectionAppearance, WIDGET_SELECTION);
p->setClipping(false);
}
int alignment(TQApplication::reverseLayout() ? AlignRight : AlignLeft);
- drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
+ drawItem(p, r, alignment|AlignVCenter|ShowPrefix|(styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget) ? 0 : NoAccel), cg,
flags & Style_Enabled, checkbox->pixmap(), checkbox->text());
if(checkbox->hasFocus() && FOCUS_GLOW!=opts.focus)
@@ -5573,15 +5618,15 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQSty
rb.height()));
r-=visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r);
- drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, ceData.rect, true,
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), cg.background(), p, ceData.rect, true,
false, opts.selectionAppearance, WIDGET_SELECTION);
p->setClipping(false);
}
int alignment(TQApplication::reverseLayout() ? AlignRight : AlignLeft);
- drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, flags & Style_Enabled,
- radiobutton->pixmap(), radiobutton->text());
+ drawItem(p, r, alignment|AlignVCenter|ShowPrefix|(styleHint(SH_UnderlineAccelerator, ceData, elementFlags, data, 0, widget) ? 0 : NoAccel),
+ cg, flags & Style_Enabled, radiobutton->pixmap(), radiobutton->text());
if((elementFlags & CEF_HasFocus) && FOCUS_GLOW!=opts.focus)
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags,
@@ -5705,7 +5750,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
case CC_ToolButton:
{
const TQToolButton *toolbutton((const TQToolButton *)widget);
- TQRect button(querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, data, widget)),
+ TQRect button(querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, data, widget)),
menuarea(querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu,
data, widget));
SFlags bflags(flags|STD_TOOLBUTTON),
@@ -5735,7 +5780,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
break;
bflags|=DW_CLOSE_BUTTON;
}
-
+
if (!tb && !onExtender && (elementFlags & CEF_HasParentWidget) &&
!qstrcmp(ceData.parentWidgetData.name.ascii(), "qt_maxcontrols"))
onControlButtons = true;
@@ -5951,7 +5996,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
getFill(fillFlags, cols, false, (SHADE_DARKEN==opts.comboBtn ||
(SHADE_NONE!=opts.comboBtn && !(flags&Style_Enabled))) &&
editable),
- cols, true, true, editable ? WIDGET_COMBO_BUTTON : WIDGET_COMBO);
+ cols, true, true, editable ? WIDGET_COMBO_BUTTON : WIDGET_COMBO, widget);
}
}
@@ -5980,7 +6025,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
: fieldFlags&Style_HasFocus
? ENTRY_FOCUS
: ENTRY_NONE
- : ENTRY_NONE,
+ : ENTRY_NONE,
(opts.square&SQUARE_ENTRY)
? ROUNDED_NONE
: opts.unifyCombo
@@ -6050,7 +6095,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
drawLightBevel(p, btn, cg, btnFlags|Style_Horizontal, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT,
getFill(btnFlags, cols, false, SHADE_DARKEN==opts.comboBtn ||
(SHADE_NONE!=opts.comboBtn && !(flags&Style_Enabled))),
- cols, true, true, WIDGET_COMBO);
+ cols, true, true, WIDGET_COMBO, widget);
p->restore();
}
@@ -6066,7 +6111,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
{
bool glowFocus(USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled);
- if(!sunken && !editable && !(opts.thin&THIN_FRAMES) &&
+ if(!sunken && !editable && !(opts.thin&THIN_FRAMES) &&
((MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver)/* ||
(FOCUS_FULL==opts.focus && flags&Style_HasFocus)*/ || glowFocus))
drawGlow(p, widget ? TQT_TQRECT_OBJECT(ceData.rect) : r, cg, WIDGET_COMBO, glowFocus ? itsFocusCols : NULL);
@@ -6106,7 +6151,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
if(opts.unifySpin)
drawEntryField(p, all, cg, flags, ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) && flags&Style_Enabled
- ? flags&Style_MouseOver || hw
+ ? flags&Style_MouseOver || hw
? ENTRY_MOUSE_OVER
: flags&Style_HasFocus || (elementFlags & CEF_HasFocus)
? ENTRY_FOCUS
@@ -6140,14 +6185,14 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
btnFlags|=Style_Horizontal;
drawLightBevel(p, btns, cg, btnFlags, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT, getFill(btnFlags, use),
- use, true, true, WIDGET_SPIN);
+ use, true, true, WIDGET_SPIN, widget);
if(hw && (HOVER_SW_DOWN==itsHover || HOVER_SW_UP==itsHover) && flags&Style_Enabled && !(flags&Style_Sunken))
{
btnFlags|=Style_MouseOver;
p->save();
p->setClipRect(HOVER_SW_UP==itsHover ? up : down);
drawLightBevel(p, btns, cg, btnFlags, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT, getFill(btnFlags, use),
- use, true, true, WIDGET_SPIN);
+ use, true, true, WIDGET_SPIN, widget);
p->restore();
}
p->setPen(use[BORDER_VAL(style&Style_Enabled)]);
@@ -6195,7 +6240,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
frame.setWidth(frame.width()+1);
drawEntryField(p, frame, cg, flags,
ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) && flags&Style_Enabled
- ? flags&Style_MouseOver || hw
+ ? flags&Style_MouseOver || hw
? ENTRY_MOUSE_OVER
: flags&Style_HasFocus || (elementFlags & CEF_HasFocus)
? ENTRY_FOCUS
@@ -6346,7 +6391,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
if(opts.thinSbarGroove) {
if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED) {
- drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, slider, flags&Style_Horizontal, false,
+ drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE], p, slider, flags&Style_Horizontal, false,
opts.sbarBgndAppearance, WIDGET_SB_BGND);
}
else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) &&
@@ -6500,7 +6545,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, cons
textRect(full ? tb->rect().x() : ir.x(), ir.y(), full ? tb->rect().width() : ir.width(), ir.height());
EAppearance app=isActive ? opts.titlebarAppearance : opts.inactiveTitlebarAppearance;
- drawBevelGradient(cols[ORIGINAL_SHADE], p, r, true, false, app, WIDGET_MDI_WINDOW);
+ drawBevelGradient(cols[ORIGINAL_SHADE], cg.background(), p, r, true, false, app, WIDGET_MDI_WINDOW);
ir.addCoords(2, 0, -4, 0);
TQFontMetrics fm(TQFontMetrics(ceData.font));
@@ -7107,6 +7152,8 @@ int QtCurveStyle::styleHint(StyleHint stylehint, const TQStyleControlElementData
{
switch(stylehint)
{
+ case SH_UnderlineAccelerator:
+ return widget && opts.hideShortcutUnderline ? itsShortcutHandler->showShortcut(widget) : true;
case SH_PopupMenu_SubMenuPopupDelay:
return opts.menuDelay;
case SH_ScrollView_FrameOnlyAroundContents:
@@ -7180,9 +7227,8 @@ void QtCurveStyle::drawItem(TQPainter *p, const TQRect &r, int flags, const TQCo
f.setBold(true);
p->setPen(box->colorGroup().foreground());
p->setFont(f);
- p->drawText(TQRect(left, top, width, th), (TQApplication::reverseLayout()
- ? AlignRight
- : AlignLeft)|AlignVCenter|ShowPrefix|SingleLine,
+ p->drawText(TQRect(left, top, width, th), (TQApplication::reverseLayout() ? AlignRight : AlignLeft)|
+ AlignVCenter|ShowPrefix|SingleLine,
text);
return;
}
@@ -7251,7 +7297,7 @@ void QtCurveStyle::drawItem(TQPainter *p, const TQRect &r, int flags, const TQCo
del = !TQPixmapCache::insert(k, mask);
}
pm = *mask;
- if (del)
+ if (del)
delete mask;
#endif
}
@@ -7269,8 +7315,7 @@ void QtCurveStyle::drawItem(TQPainter *p, const TQRect &r, int flags, const TQCo
}
}
-void QtCurveStyle::drawMenuItem(TQPainter *p, const TQRect &r, int flags, const TQColorGroup &cg,
- bool mbi, int round, const TQColor &bgnd, const TQColor *cols) const
+void QtCurveStyle::drawMenuItem(TQPainter *p, const TQRect &r, int flags, const TQColorGroup &cg, bool mbi, int round, const TQColor &bgnd, const TQColor *cols) const
{
int fill=opts.useHighlightForMenu && (!mbi || itsHighlightCols==cols) ? ORIGINAL_SHADE : 4,
border=opts.borderMenuitems ? 0 : fill;
@@ -7278,25 +7323,25 @@ void QtCurveStyle::drawMenuItem(TQPainter *p, const TQRect &r, int flags, const
if(itsHighlightCols!=cols && mbi && !((flags&Style_Enabled) && (flags&Style_Active) && (flags&Style_Down)) &&
!opts.colorMenubarMouseOver && (opts.borderMenuitems || !IS_FLAT(opts.menuitemAppearance)))
fill=ORIGINAL_SHADE;
-
+
if(!mbi && APPEARANCE_FADE==opts.menuitemAppearance)
{
- bool reverse=TQApplication::reverseLayout();
- int roundOffet=ROUNDED ? 1 : 0;
- TQRect main(r.x()+(reverse ? 1+MENUITEM_FADE_SIZE : roundOffet+1), r.y()+roundOffet+1,
- r.width()-(1+MENUITEM_FADE_SIZE), r.height()-(2+(roundOffet*2))),
- fade(reverse ? r.x()+1 : r.width()-MENUITEM_FADE_SIZE, r.y()+1, MENUITEM_FADE_SIZE, r.height()-2);
+ bool reverse=TQApplication::reverseLayout();
+ int roundOffet=ROUNDED ? 1 : 0;
+ TQRect main(r.x()+(reverse ? 1+MENUITEM_FADE_SIZE : roundOffet+1), r.y()+roundOffet+1,
+ r.width()-(1+MENUITEM_FADE_SIZE), r.height()-(2+(roundOffet*2))),
+ fade(reverse ? r.x()+1 : r.width()-MENUITEM_FADE_SIZE, r.y()+1, MENUITEM_FADE_SIZE, r.height()-2);
+ const TQColor *pc(popupMenuCols(cg));
p->fillRect(main, cols[fill]);
if(ROUNDED)
{
main.addCoords(-1, -1, 1, 1);
- drawBorder(popupMenuCol(cg), p, main, cg, Style_Horizontal|Style_Raised, reverse ? ROUNDED_RIGHT : ROUNDED_LEFT,
- cols, WIDGET_MENU_ITEM, false, BORDER_FLAT, false, fill);
+ drawBorder(pc[ORIGINAL_SHADE], p, main, cg, Style_Horizontal|Style_Raised, reverse ? ROUNDED_RIGHT : ROUNDED_LEFT,
+ pc, WIDGET_MENU_ITEM, false, BORDER_FLAT, false, fill);
}
- TQColor bgnd(popupMenuCol(cg));
- drawGradient(reverse ? bgnd : cols[fill], reverse ? cols[fill] : bgnd, p, fade, false);
+ drawGradient(reverse ? pc[ORIGINAL_SHADE] : cols[fill], reverse ? cols[fill] : pc[ORIGINAL_SHADE], p, fade, false);
}
else if(mbi || opts.borderMenuitems)
{
@@ -7316,13 +7361,13 @@ void QtCurveStyle::drawMenuItem(TQPainter *p, const TQRect &r, int flags, const
fr.addCoords(1, 1, -1, -1);
if(fr.width()>0 && fr.height()>0)
- drawBevelGradient(cols[fill], p, fr, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
+ drawBevelGradient(cols[fill], cg.background(), p, fr, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
drawBorder(bgnd, p, r, cg, flags, round, cols, WIDGET_OTHER, false, BORDER_FLAT, false, border);
}
itsFormMode=false;
}
else
- drawBevelGradient(cols[fill], p, r, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
+ drawBevelGradient(cols[fill], cg.background(), p, r, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
}
void QtCurveStyle::drawProgress(TQPainter *p, const TQRect &rx, const TQColorGroup &cg, SFlags flags,
@@ -7418,7 +7463,7 @@ void QtCurveStyle::drawProgress(TQPainter *p, const TQRect &rx, const TQColorGro
}
}
-void QtCurveStyle::drawBevelGradient(const TQColor &base, TQPainter *p, const TQRect &origRect, bool horiz, bool sel, EAppearance bevApp, EWidget w) const
+void QtCurveStyle::drawBevelGradient(const TQColor &base, const TQColor &bgnd, TQPainter *p, const TQRect &origRect, bool horiz, bool sel, EAppearance bevApp, EWidget w) const
{
if(IS_FLAT(bevApp) && opts.colorSelTab && sel)
bevApp=APPEARANCE_GRADIENT;
@@ -7439,7 +7484,7 @@ void QtCurveStyle::drawBevelGradient(const TQColor &base, TQPainter *p, const TQ
: APPEARANCE_GRADIENT);
TQRect r(0, 0, horiz ? PIXMAP_DIMENSION : origRect.width(),
horiz ? origRect.height() : PIXMAP_DIMENSION);
- TQString key(createKey(horiz ? r.height() : r.width(), base.rgb(), horiz, app,
+ TQString key(createKey(horiz ? r.height() : r.width(), base.rgb(), bgnd.rgb(), horiz, app,
tab && sel && opts.colorSelTab ? CACHE_COL_SEL_TAB : CACHE_STD));
TQPixmap *pix(itsPixmapCache.find(key));
bool inCache(true);
@@ -7448,9 +7493,9 @@ void QtCurveStyle::drawBevelGradient(const TQColor &base, TQPainter *p, const TQ
{
pix=new TQPixmap(r.width(), r.height());
- TQPainter pixPainter(pix);
+ TQPainter pixPainter(pix);
- drawBevelGradientReal(base, &pixPainter, r, horiz, sel, app, w);
+ drawBevelGradientReal(base, bgnd, &pixPainter, r, horiz, sel, app, w);
pixPainter.end();
int cost(pix->width()*pix->height()*(pix->depth()/8));
@@ -7466,7 +7511,7 @@ void QtCurveStyle::drawBevelGradient(const TQColor &base, TQPainter *p, const TQ
}
}
-void QtCurveStyle::drawBevelGradientReal(const TQColor &base, TQPainter *p, const TQRect &r, bool horiz, bool sel, EAppearance app, EWidget w) const
+void QtCurveStyle::drawBevelGradientReal(const TQColor &base, const TQColor &bgnd, TQPainter *p, const TQRect &r, bool horiz, bool sel, EAppearance app, EWidget w) const
{
const Gradient *grad=getGradient(app, &opts);
@@ -7494,7 +7539,8 @@ void QtCurveStyle::drawBevelGradientReal(const TQColor &base, TQPainter *p, cons
if(/*sel && */opts.colorSelTab && i>0)
col=tint(col, itsHighlightCols[0], (1.0-(*it).pos)*(0.2+TO_ALPHA(opts.colorSelTab)));
-
+ if((*it).alpha<0.9999)
+ col=tint(bgnd, col, (*it).alpha);
if(i)
drawGradient(prev, col, p,
horiz
@@ -7522,7 +7568,8 @@ void QtCurveStyle::drawBevelGradientReal(const TQColor &base, TQPainter *p, cons
if(sel && opts.colorSelTab && topTab && i<numStops-1)
col=tint(col, itsHighlightCols[0], (1.0-(*it).pos)*(0.2+TO_ALPHA(opts.colorSelTab)));
-
+ if((*it).alpha<0.9999)
+ col=tint(bgnd, col, (*it).alpha);
if(i)
drawGradient(prev, col, p,
horiz
@@ -7535,8 +7582,7 @@ void QtCurveStyle::drawBevelGradientReal(const TQColor &base, TQPainter *p, cons
}
}
-void QtCurveStyle::drawGradient(const TQColor &top, const TQColor &bot,
- TQPainter *p, TQRect const &r, bool horiz) const
+void QtCurveStyle::drawGradient(const TQColor &top, const TQColor &bot, TQPainter *p, TQRect const &r, bool horiz) const
{
if(r.width()>0 && r.height()>0)
{
@@ -7620,7 +7666,7 @@ void QtCurveStyle::drawSbSliderHandle(TQPainter *p, const TQRect &orig, const TQ
r.addCoords(-1, 0, 0, 0);
else
r.addCoords(horiz ? 1 : 0, horiz ? 0 : 1, 0, 0);
-
+
switch(opts.sliderThumbs)
{
case LINE_FLAT:
@@ -7737,7 +7783,7 @@ void QtCurveStyle::drawSliderHandle(TQPainter *p, const TQRect &r, const TQColor
}
else
{
- drawBevelGradient(fill, p, TQRect(x, y, horiz ? r.width()-1 : size, horiz ? size : r.height()-1),
+ drawBevelGradient(fill, cg.background(), p, TQRect(x, y, horiz ? r.width()-1 : size, horiz ? size : r.height()-1),
horiz, false, opts.sliderAppearance);
if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver && !opts.colorSliderMouseOver)
@@ -7747,18 +7793,18 @@ void QtCurveStyle::drawSliderHandle(TQPainter *p, const TQRect &r, const TQColor
if(horiz)
{
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(x+1, y+1, len, size-2),
+ drawBevelGradient(itsMouseOverCols[col], cg.background(), p, TQRect(x+1, y+1, len, size-2),
horiz, false, opts.sliderAppearance);
- drawBevelGradient(itsMouseOverCols[col], p,
+ drawBevelGradient(itsMouseOverCols[col], cg.background(), p,
TQRect(x+r.width()-((SLIDER_ROUND_ROTATED==opts.sliderStyle ? 3 : 1)+len),
y+1, len, size-2),
horiz, false, opts.sliderAppearance);
}
else
{
- drawBevelGradient(itsMouseOverCols[col], p, TQRect(x+1, y+1, size-2, len),
+ drawBevelGradient(itsMouseOverCols[col], cg.background(), p, TQRect(x+1, y+1, size-2, len),
horiz, false, opts.sliderAppearance);
- drawBevelGradient(itsMouseOverCols[col], p,
+ drawBevelGradient(itsMouseOverCols[col], cg.background(), p,
TQRect(x+1, y+r.height()-((SLIDER_ROUND_ROTATED==opts.sliderStyle ? 3 : 1)+len),
size-2, len),
horiz, false, opts.sliderAppearance);
@@ -7860,7 +7906,7 @@ void QtCurveStyle::drawSliderGroove(TQPainter *p, const TQRect &r, const TQColor
itsBackgroundCols[flags&Style_Enabled ? 2 : ORIGINAL_SHADE],
itsBackgroundCols, true, true, WIDGET_SLIDER_TROUGH);
- if(opts.fillSlider && (horiz ? ceData.currentStep>0 : ceData.currentStep<ceData.maxSteps) &&
+ if(opts.fillSlider && (horiz ? ceData.currentStep>0 : ceData.currentStep<ceData.maxSteps) &&
ceData.maxSteps!=ceData.minSteps && flags&Style_Enabled)
{
TQRect used(groove);
@@ -7905,7 +7951,7 @@ void QtCurveStyle::drawMenuOrToolBarBackground(TQPainter *p, const TQRect &r, co
if(menu && BLEND_TITLEBAR)
rx.addCoords(0, -qtcGetWindowBorderSize().titleHeight, 0, 0);
- drawBevelGradient(color, p, rx, horiz, false, app);
+ drawBevelGradient(color, cg.background(), p, rx, horiz, false, app);
}
void QtCurveStyle::drawHandleMarkers(TQPainter *p, const TQRect &r, SFlags flags, bool tb,
@@ -8004,15 +8050,6 @@ const TQColor * QtCurveStyle::popupMenuCols(const TQColorGroup &cg) const
return opts.shadePopupMenu ? menuColors(cg, true) : backgroundColors(cg);
}
-const TQColor & QtCurveStyle::popupMenuCol(const TQColorGroup &cg, int shade) const
-{
- return opts.shadePopupMenu
- ? menuColors(cg, true)[ORIGINAL_SHADE]
- : USE_LIGHTER_POPUP_MENU
- ? itsLighterPopupMenuBgndCol
- : itsBackgroundCols[shade];
-}
-
const TQColor * QtCurveStyle::checkRadioColors(const TQColorGroup &cg, SFlags flags) const
{
return opts.crColor && flags&Style_Enabled && (flags&Style_On || !(flags&Style_Off))
@@ -8090,6 +8127,21 @@ void QtCurveStyle::setMenuColors(const TQColorGroup &cg)
case SHADE_WINDOW_BORDER:
break;
}
+
+ TQColor *base=opts.shadePopupMenu
+ ? SHADE_WINDOW_BORDER==opts.shadeMenubars
+ ? (TQColor *)getMdiColors(cg, true)
+ : itsMenubarCols
+ : itsBackgroundCols;
+
+ if(USE_LIGHTER_POPUP_MENU)
+ {
+ if(!itsPopupMenuCols)
+ itsPopupMenuCols=new TQColor [TOTAL_SHADES+1];
+ shadeColors(shade(base[ORIGINAL_SHADE], TO_FACTOR(opts.lighterPopupMenuBgnd)), itsPopupMenuCols);
+ }
+ else
+ itsPopupMenuCols=base;
}
void QtCurveStyle::setMenuTextColors(TQWidget *widget, bool isMenuBar) const
@@ -8110,7 +8162,8 @@ void QtCurveStyle::setMenuTextColors(TQWidget *widget, bool isMenuBar) const
}
else if(opts.shadePopupMenu)
{
- pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground, midColor(itsActiveMdiTextColor, popupMenuCol(pal.active())));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground, midColor(itsActiveMdiTextColor,
+ popupMenuCols(pal.active())[ORIGINAL_SHADE]));
pal.setBrush(TQPalette::Disabled, TQColorGroup::Text, pal.brush(TQPalette::Disabled, TQColorGroup::Foreground));
}
@@ -8136,8 +8189,9 @@ void QtCurveStyle::setMenuTextColors(TQWidget *widget, bool isMenuBar) const
}
else if(!isMenuBar && opts.shadePopupMenu)
{
+ const TQColor *pc(popupMenuCols(pal.active()));
pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground,
- midColor(pal.brush(TQPalette::Active, TQColorGroup::Foreground).color(), popupMenuCol(pal.active())));
+ midColor(pal.brush(TQPalette::Active, TQColorGroup::Foreground).color(), pc[ORIGINAL_SHADE]));
pal.setBrush(TQPalette::Disabled, TQColorGroup::Text, pal.brush(TQPalette::Disabled, TQColorGroup::Foreground));
}
widget->setPalette(pal);
@@ -8605,6 +8659,7 @@ const TQColor & QtCurveStyle::getTabFill(bool current, bool highlight, const TQC
const TQColor & QtCurveStyle::menuStripeCol(const TQColorGroup &cg) const
{
+ const TQColor *pc(popupMenuCols(cg));
switch(opts.menuStripe)
{
default:
@@ -8615,12 +8670,12 @@ const TQColor & QtCurveStyle::menuStripeCol(const TQColorGroup &cg) const
case SHADE_BLEND_SELECTED:
// Hack! Use opts.customMenuStripeColor to store this setting!
if(IS_BLACK(opts.customMenuStripeColor))
- opts.customMenuStripeColor=midColor(itsHighlightCols[ORIGINAL_SHADE], popupMenuCol(cg));
+ opts.customMenuStripeColor=midColor(itsHighlightCols[ORIGINAL_SHADE], pc[ORIGINAL_SHADE]);
return opts.customMenuStripeColor;
case SHADE_SELECTED:
return itsHighlightCols[MENU_STRIPE_SHADE];
case SHADE_DARKEN:
- return popupMenuCol(cg);
+ return pc[MENU_STRIPE_SHADE];
}
}
@@ -8688,7 +8743,7 @@ TQPixmap * QtCurveStyle::createStripePixmap(const TQColor &col, bool forWindow)
pix=new TQPixmap(64, 64);
pix->fill(col.rgb());
-
+
TQPainter p;
p.begin(pix);
p.setPen(TQColor((3*col.red()+col2.red())/4,
diff --git a/style/qtcurve.h b/style/qtcurve.h
index 5bd78ca..453076a 100644
--- a/style/qtcurve.h
+++ b/style/qtcurve.h
@@ -78,10 +78,11 @@ class TQSlider;
#define BASE_STYLE TDEStyle
#endif
+class ShortcutHandler;
+
class QtCurveStyle : public BASE_STYLE
{
Q_OBJECT
-
public:
@@ -139,19 +140,20 @@ class QtCurveStyle : public BASE_STYLE
virtual ~QtCurveStyle();
void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal);
TQColorGroup setColorGroup(const TQColorGroup &old, const TQColorGroup &act, bool dis=false);
void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags,
int round, const TQColor &fill, const TQColor *custom=NULL,
- bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const
- { drawLightBevel(cg.background(), p, r, cg, flags, round, fill, custom, doBorder, doCorners, w); }
+ bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER, const TQWidget *widget=0L) const
+ { drawLightBevel(cg.background(), p, r, cg, flags, round, fill, custom, doBorder, doCorners, w, widget); }
void drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &r, const TQColorGroup &cg,
SFlags flags, int round, const TQColor &fill, const TQColor *custom=NULL,
- bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const;
+ bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER, const QWidget *widget=0L) const;
void drawGlow(TQPainter *p, const TQRect &r, const TQColorGroup &cg, EWidget w, const TQColor *cols=0) const;
- void drawEtch(TQPainter *p, const TQRect &r, const TQColorGroup &cg, bool raised=false, bool square=false) const;
+ void drawEtch(TQPainter *p, const TQRect &r, const TQColorGroup &cg, bool raised=false, bool square=false, EWidget w=WIDGET_OTHER) const;
void drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect &r, const TQColorGroup &cg,
SFlags flags, int round, const TQColor *custom=NULL, EWidget w=WIDGET_OTHER,
bool doCorners=true, EBorder borderProfile=BORDER_FLAT, bool blendBorderColors=true, int borderVal=STD_BORDER) const;
@@ -195,9 +197,9 @@ class QtCurveStyle : public BASE_STYLE
bool mbi, int round, const TQColor &bgnd, const TQColor *cols) const;
void drawProgress(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, int round,
const TQWidget *widget) const;
- void drawBevelGradient(const TQColor &base, TQPainter *p, TQRect const &r,
+ void drawBevelGradient(const TQColor &base, const TQColor &bgnd, TQPainter *p, TQRect const &r,
bool horiz, bool sel, EAppearance bevApp, EWidget w=WIDGET_OTHER) const;
- void drawBevelGradientReal(const TQColor &base, TQPainter *p, TQRect const &r,
+ void drawBevelGradientReal(const TQColor &base, const TQColor &bgnd, TQPainter *p, TQRect const &r,
bool horiz, bool sel, EAppearance bevApp, EWidget w=WIDGET_OTHER) const;
void drawGradient(const TQColor &top, const TQColor &bot, TQPainter *p, const TQRect &r, bool horiz=true) const;
void drawSbSliderHandle(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, bool slider=false) const;
@@ -215,7 +217,7 @@ class QtCurveStyle : public BASE_STYLE
return tqGray(col.rgb()) < 100 ? TQColor(255, 255, 255) : TQColor(0, 0, 0);
}
- void shadeColors(const TQColor &base, TQColor *vals) const;
+ void shadeColors(const TQColor &base, TQColor *vals) const;
const TQColor * buttonColors(const TQColorGroup &cg) const;
const TQColor * popupMenuCols(const TQColorGroup &cg) const;
const TQColor & popupMenuCol(const TQColorGroup &cg, int shade=ORIGINAL_SHADE) const;
@@ -226,31 +228,31 @@ class QtCurveStyle : public BASE_STYLE
{ return backgroundColors(cg.background()); }
const TQColor * borderColors(SFlags flags, const TQColor *use) const;
const TQColor * getSidebarButtons() const;
- void setMenuColors(const TQColorGroup &cg);
- void setMenuTextColors(TQWidget *widget, bool isMenuBar) const;
+ void setMenuColors(const TQColorGroup &cg);
+ void setMenuTextColors(TQWidget *widget, bool isMenuBar) const;
const TQColor * menuColors(const TQColorGroup &cg, bool active) const;
- void setDecorationColors(bool init=false);
+ void setDecorationColors(bool init=false);
const TQColor * getMdiColors(const TQColorGroup &cg, bool active) const;
#ifdef SET_MDI_WINDOW_BUTTON_POSITIONS
void readMdiPositions() const;
#endif
- bool redrawHoverWidget(const TQPoint &pos);
+ bool redrawHoverWidget(const TQPoint &pos);
const TQColor & getFill(SFlags flags, const TQColor *use, bool cr=false, bool darker=false) const;
const TQColor & getListViewFill(SFlags flags, const TQColor *use) const;
const TQColor & getTabFill(bool current, bool highlight, const TQColor *use) const;
const TQColor & menuStripeCol(const TQColorGroup &cg) const;
const TQColor & checkRadioCol(SFlags flags, const TQColorGroup &cg) const;
TQColor shade(const TQColor &a, float k) const;
- void shade(const color &ca, color *cb, double k) const;
- void drawDot(TQPainter *p, const TQRect &r, const TQColor *cols) const;
+ void shade(const color &ca, color *cb, double k) const;
+ void drawDot(TQPainter *p, const TQRect &r, const TQColor *cols) const;
TQPixmap * getPixelPixmap(const TQColor col) const;
TQPixmap * getPixmap(const TQColor col, EPixmap pix, double shade=1.0) const;
TQPixmap * createStripePixmap(const TQColor &col, bool forWindow) const;
- void setSbType();
- bool isFormWidget(const TQWidget *w) const { return itsKhtmlWidgets.contains(w); }
- void resetHover();
- bool isWindowDragWidget(TQObject *o, const TQPoint &pos=TQPoint());
- void adjustScrollbarRects(bool &itsFormMode, bool &horiz, bool &useThreeButtonScrollBar, TQRect &subline, TQRect &addline, TQRect &subpage, TQRect &addpage, TQRect &slider, TQRect &first, TQRect &last, TQRect &subline2, TQRect &sbRect, Options& opts, const TQWidget* widget) const;
+ void setSbType();
+ bool isFormWidget(const TQWidget *w) const { return itsKhtmlWidgets.contains(w); }
+ void resetHover();
+ bool isWindowDragWidget(TQObject *o, const TQPoint &pos=TQPoint());
+ void adjustScrollbarRects(bool &itsFormMode, bool &horiz, bool &useThreeButtonScrollBar, TQRect &subline, TQRect &addline, TQRect &subpage, TQRect &addpage, TQRect &slider, TQRect &first, TQRect &last, TQRect &subline2, TQRect &sbRect, Options& opts, const TQWidget* widget) const;
private slots:
@@ -263,10 +265,11 @@ class QtCurveStyle : public BASE_STYLE
private:
mutable Options opts;
- TQColor itsHighlightCols[TOTAL_SHADES+1],
+ TQColor itsHighlightCols[TOTAL_SHADES+1],
itsBackgroundCols[TOTAL_SHADES+1],
itsMenubarCols[TOTAL_SHADES+1],
itsFocusCols[TOTAL_SHADES+1],
+ *itsPopupMenuCols,
*itsSliderCols,
*itsDefBtnCols,
*itsMouseOverCols,
@@ -275,7 +278,6 @@ class QtCurveStyle : public BASE_STYLE
*itsSortedLvColors,
*itsProgressCols,
itsButtonCols[TOTAL_SHADES+1],
- itsLighterPopupMenuBgndCol,
itsCheckRadioCol;
mutable TQColor *itsSidebarButtonsCols;
mutable TQColor *itsActiveMdiColors;
@@ -304,6 +306,7 @@ class QtCurveStyle : public BASE_STYLE
mutable TQValueList<int> itsMdiButtons[2]; // 0=left, 1=right
TQWidget *itsDragWidget;
bool itsDragWidgetHadMouseTracking;
+ ShortcutHandler *itsShortcutHandler;
};
#endif
diff --git a/style/shortcuthandler.cpp b/style/shortcuthandler.cpp
new file mode 100644
index 0000000..b880a89
--- /dev/null
+++ b/style/shortcuthandler.cpp
@@ -0,0 +1,188 @@
+/*
+ QtCurve (C) Craig Drummond, 2007 - 2010 [email protected]
+
+ ----
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "shortcuthandler.h"
+#include <tqpopupmenu.h>
+#include <tqapplication.h>
+#include <tqobjectlist.h>
+#include <tqmainwindow.h>
+#include <tqdialog.h>
+#include <tqstyle.h>
+
+ShortcutHandler::ShortcutHandler(TQObject *parent)
+ : TQObject(parent)
+ , itsAltDown(false)
+{
+}
+
+ShortcutHandler::~ShortcutHandler()
+{
+}
+
+bool ShortcutHandler::hasSeenAlt(const TQWidget *widget) const
+{
+ if(widget && !widget->isEnabled())
+ return false;
+
+ if(::tqqt_cast<const TQPopupMenu *>(widget))
+ return itsOpenMenus.count() && itsOpenMenus.last()==widget;
+ else
+ return itsOpenMenus.isEmpty() && itsSeenAlt.contains((TQWidget *)(widget->topLevelWidget()));
+/* return false;
+ {
+ const TQWidget *w=widget;
+
+ while(w)
+ {
+ if(itsSeenAlt.contains((TQWidget *)w))
+ return true;
+ w=w->parentWidget();
+ }
+ }
+ if(itsHandlePopupsOnly)
+ return false;
+ widget = widget->topLevelWidget();
+ return itsSeenAlt.contains((TQWidget *)widget);*/
+}
+
+bool ShortcutHandler::showShortcut(const TQWidget *widget) const
+{
+ return itsAltDown && hasSeenAlt(widget);
+}
+
+void ShortcutHandler::widgetDestroyed(TQObject *o)
+{
+ itsUpdated.remove(static_cast<TQWidget *>(o));
+ itsOpenMenus.remove(static_cast<TQWidget *>(o));
+}
+
+void ShortcutHandler::updateWidget(TQWidget *w)
+{
+ if(!itsUpdated.contains(w))
+ {
+ connect(w, SIGNAL(destroyed(TQObject *)), this, SLOT(widgetDestroyed(TQObject *)));
+ itsUpdated.append(w);
+ w->repaint(TRUE);
+ }
+}
+
+void ShortcutHandler::setSeenAlt(TQWidget *w)
+{
+ if(!itsSeenAlt.contains(w))
+ itsSeenAlt.append(w);
+}
+
+bool ShortcutHandler::eventFilter(TQObject *o, TQEvent *e)
+{
+ if (!o->isWidgetType())
+ return TQObject::eventFilter(o, e);
+
+ TQWidget *widget = ::tqqt_cast<TQWidget*>(o);
+ switch(e->type())
+ {
+ case TQEvent::KeyPress:
+ if (Key_Alt==((TQKeyEvent*)e)->key())
+ {
+ itsAltDown = true;
+
+ if(::tqqt_cast<TQPopupMenu *>(widget))
+ {
+ setSeenAlt(widget);
+ updateWidget(widget);
+ if(widget->parentWidget() && widget->parentWidget()->topLevelWidget())
+ itsSeenAlt.append(widget->parentWidget()->topLevelWidget());
+ }
+ else
+ {
+ widget = widget->topLevelWidget();
+ setSeenAlt(widget);
+
+ // Alt has been pressed - find all widgets that care
+ TQObjectList *l = widget->queryList("TQWidget");
+ TQObjectListIt it( *l );
+ TQWidget *w;
+ while ((w = (TQWidget *)it.current()) != 0)
+ {
+ ++it;
+ if (!(w->isTopLevel() || !w->isVisible())) // || w->style().styleHint(QStyle::SH_UnderlineAccelerator, w)))
+ updateWidget(w);
+ }
+ delete l;
+ }
+ }
+ break;
+ case TQEvent::WindowDeactivate:
+ case TQEvent::KeyRelease:
+ if (TQEvent::WindowDeactivate==e->type() || Key_Alt==static_cast<TQKeyEvent*>(e)->key())
+ {
+ itsAltDown = false;
+ TQValueList<TQWidget *>::const_iterator it(itsUpdated.begin()),
+ end(itsUpdated.end());
+
+ for (; it!=end; ++it)
+ (*it)->repaint(TRUE);
+ if(!itsUpdated.contains(widget))
+ widget->repaint(TRUE);
+ itsSeenAlt.clear();
+ itsUpdated.clear();
+ }
+ break;
+ case TQEvent::Show:
+ if(::tqqt_cast<TQPopupMenu *>(widget))
+ {
+ TQWidget *prev=itsOpenMenus.count() ? itsOpenMenus.last() : 0L;
+ itsOpenMenus.append(widget);
+ if(itsAltDown && prev)
+ prev->repaint(TRUE);
+ connect(widget, SIGNAL(destroyed(TQObject *)), this, SLOT(widgetDestroyed(TQObject *)));
+ }
+ break;
+ case TQEvent::Hide:
+ if(::tqqt_cast<TQPopupMenu *>(widget))
+ {
+ itsSeenAlt.remove(widget);
+ itsUpdated.remove(widget);
+ itsOpenMenus.remove(widget);
+ if(itsAltDown)
+ {
+ if(itsOpenMenus.count())
+ itsOpenMenus.last()->repaint(TRUE);
+ else if(widget->parentWidget() && widget->parentWidget()->topLevelWidget())
+ widget->parentWidget()->topLevelWidget()->repaint(TRUE);
+ }
+ }
+ break;
+ case TQEvent::Close:
+ // Reset widget when closing
+ itsSeenAlt.remove(widget);
+ itsUpdated.remove(widget);
+ itsSeenAlt.remove(widget->topLevelWidget());
+ itsOpenMenus.remove(widget);
+ if(itsAltDown && itsOpenMenus.count())
+ itsOpenMenus.last()->repaint(TRUE);
+ break;
+ break;
+ default:
+ break;
+ }
+ return TQObject::eventFilter(o, e);
+}
+
+#include "shortcuthandler.moc"
diff --git a/style/shortcuthandler.h b/style/shortcuthandler.h
new file mode 100644
index 0000000..4eaa665
--- /dev/null
+++ b/style/shortcuthandler.h
@@ -0,0 +1,62 @@
+#ifndef __SHORTCUT_HANDLER_H__
+#define __SHORTCUT_HANDLER_H__
+
+/*
+ QtCurve (C) Craig Drummond, 2007 - 2010 [email protected]
+
+ ----
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqobject.h>
+#include <tqvaluelist.h>
+#include <tqevent.h>
+
+class TQWidget;
+
+class ShortcutHandler : public TQObject
+{
+ Q_OBJECT
+
+ public:
+
+ explicit ShortcutHandler(TQObject *parent = 0);
+ virtual ~ShortcutHandler();
+
+ bool hasSeenAlt(const TQWidget *widget) const;
+ bool isAltDown() const { return itsAltDown; }
+ bool showShortcut(const TQWidget *widget) const;
+
+ private slots:
+
+ void widgetDestroyed(TQObject *o);
+
+ protected:
+
+ void updateWidget(TQWidget *w);
+ void setSeenAlt(TQWidget *w);
+ bool eventFilter(TQObject *watched, TQEvent *event);
+
+ private:
+
+ bool itsAltDown;
+ TQValueList<TQWidget *> itsSeenAlt,
+ itsUpdated,
+ itsOpenMenus;
+
+};
+
+#endif \ No newline at end of file