Updated to QtCurve version 1.8.5

Based on the original LGPL 2.1 QtCurve code from Craig Drummond <craig.p.drummond@gmail.com> available at https://github.com/KDE/qtcurve

Signed-off-by: TCH <tch@protonmail.com>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/4/head
TCH 5 years ago committed by Michele Calgaro
parent 82fe64d550
commit f77e5f19e6
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -19,8 +19,8 @@ set(DEBIAN_PACKAGE_DESCRIPTION "QtCurve for TQt/TDE")
set(DEBIAN_PACKAGE_SECTION "tde")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "7")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_VERSION_MINOR "8")
set(CPACK_PACKAGE_VERSION_PATCH "5")
set(CPACK_PACKAGE_CONTACT "Craig Drummond <craig.p.drummond@gmail.com>")
set(QTCURVE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
@ -32,6 +32,7 @@ include(CPack)
##### general package setup #####################
project( tde-style-qtcurve )
set( VERSION R14.1.0 )
##### include essential cmake modules ###########

@ -1,3 +1,38 @@
1.8.5
-----
1. Allow scrollbar sliders to be as thin as 5 pixels. At this setting, sliders
will be squared.
1.8.4
-----
1. Fix crash upon exit - due to double free.
1.8.3
-----
1. If a gradient uses alpha, then blen gradient colour with background
colour - as Qt3 does not support painting with an alpha channel.
1.8.2
-----
1. When hiding shortcuts, only show these if widget is enabled.
2. Slightly clean-up code.
1.8.1
-----
1. Safer handling of hidden shortcut underscore in popup menus. Only keep
track of menu widget, not its ancestors.
2. If hiding keyboard shortcut underlines: Keep track of open popup menus,
and only show keyboard short cut for the current one.
1.8.0
-----
1. Add option to not display keyboard shortcurt underline until 'Alt' is
pressed.
2. Add options to specify appearance of toolbar buttons.
3. Allow to use popup menu shade factor when colouring as per menubar.
4. If highlighting scrollviews, and allow mouse-over for entries, also allow
mouse-over for scrollviews.
1.7.1
-----
1. Remove box around arrow in listview lines - to match Gtk better.

@ -1102,7 +1102,9 @@ typedef struct
crSize,
gbFactor,
gbLabel,
thin;
thin,
tbarBtnAppearance,
tbarBtnEffect;
ERound round;
bool embolden,
highlightTab,
@ -1124,6 +1126,7 @@ typedef struct
gtkScrollViews,
stdSidebarButtons,
toolbarTabs,
hideShortcutUnderline,
#ifdef __cplusplus
gtkComboMenus,
/*

@ -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

@ -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

@ -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;
}

@ -1,12 +1,12 @@
/*
* $Id$
*
*
* TDEStyle
* Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
*
*
* 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;

File diff suppressed because it is too large Load Diff

@ -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

@ -0,0 +1,188 @@
/*
QtCurve (C) Craig Drummond, 2007 - 2010 craig.p.drummond@gmail.com
----
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"

@ -0,0 +1,62 @@
#ifndef __SHORTCUT_HANDLER_H__
#define __SHORTCUT_HANDLER_H__
/*
QtCurve (C) Craig Drummond, 2007 - 2010 craig.p.drummond@gmail.com
----
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
Loading…
Cancel
Save