summaryrefslogtreecommitdiffstats
path: root/src/styles/qwindowsstyle.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:32:24 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:32:24 -0500
commit74dac1c21d3ad1f446874fd29f7e670e77a196b5 (patch)
tree8ff20c2c06d337cdcec36a32afc8bfd9f4120064 /src/styles/qwindowsstyle.cpp
parentc73edd8f63289c619c20a8e5d031a24d870c62ee (diff)
downloadtqt3-74dac1c21d3ad1f446874fd29f7e670e77a196b5.tar.gz
tqt3-74dac1c21d3ad1f446874fd29f7e670e77a196b5.zip
Automated update from Qt3
Diffstat (limited to 'src/styles/qwindowsstyle.cpp')
-rw-r--r--src/styles/qwindowsstyle.cpp104
1 files changed, 28 insertions, 76 deletions
diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp
index 5c5c996e5..5a1289dca 100644
--- a/src/styles/qwindowsstyle.cpp
+++ b/src/styles/qwindowsstyle.cpp
@@ -95,99 +95,42 @@ class TQWindowsStyle::Private : public TQObject
public:
Private(TQWindowsStyle *parent);
- bool hasSeenAlt(const TQWidget *widget) const;
- bool altDown() const { return alt_down; }
-
-protected:
- bool eventFilter(TQObject *o, TQEvent *e);
+ bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:
- TQPtrList<TQWidget> seenAlt;
- bool alt_down;
int menuBarTimer;
};
TQWindowsStyle::Private::Private(TQWindowsStyle *parent)
-: TQObject(parent, "TQWindowsStylePrivate"), alt_down(FALSE), menuBarTimer(0)
+: TQObject(parent, "TQWindowsStylePrivate"), menuBarTimer(0)
{
}
-// Returns true if the toplevel parent of \a widget has seen the Alt-key
-bool TQWindowsStyle::Private::hasSeenAlt(const TQWidget *widget) const
-{
- widget = widget->topLevelWidget();
- return seenAlt.contains(widget);
-}
-
// Records Alt- and Focus events
-bool TQWindowsStyle::Private::eventFilter(TQObject *o, TQEvent *e)
+bool TQWindowsStyle::Private::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags, void* source, TQEvent *e )
{
- if (!o->isWidgetType())
- return TQObject::eventFilter(o, e);
+ if (!(ceData.widgetObjectTypes.contains("TQWidget"))) {
+ return TRUE;
+ }
- TQWidget *widget = ::tqt_cast<TQWidget*>(o);
+ TQWidget *widget = reinterpret_cast<TQWidget*>(source);
switch(e->type()) {
- case TQEvent::KeyPress:
- if (((TQKeyEvent*)e)->key() == Key_Alt) {
- widget = widget->topLevelWidget();
-
- // 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(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, w))
- l->removeRef(w);
- }
- // Update states before repainting
- seenAlt.append(widget);
- alt_down = TRUE;
-
- // Repaint all relevant widgets
- it.toFirst();
- while ( (w = (TQWidget*)it.current()) != 0 ) {
- ++it;
- w->repaint(FALSE);
- }
- delete l;
- }
- break;
- case TQEvent::KeyRelease:
- if (((TQKeyEvent*)e)->key() == Key_Alt) {
- widget = widget->topLevelWidget();
-
- // Update state
- alt_down = FALSE;
- // Repaint only menubars
- TQObjectList *l = widget->queryList("TQMenuBar");
- TQObjectListIt it( *l );
- TQMenuBar *menuBar;
- while ( (menuBar = (TQMenuBar*)it.current()) != 0) {
- ++it;
- menuBar->repaint(FALSE);
- }
- }
- break;
case TQEvent::FocusIn:
case TQEvent::FocusOut:
{
// Menubars toggle based on focus
- TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(o);
+ TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(widget);
if (menuBar && !menuBarTimer) // delayed repaint to avoid flicker
menuBarTimer = menuBar->startTimer(0);
}
break;
case TQEvent::Close:
// Reset widget when closing
- seenAlt.removeRef(widget);
- seenAlt.removeRef(widget->topLevelWidget());
break;
case TQEvent::Timer:
{
- TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(o);
+ TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(widget);
TQTimerEvent *te = (TQTimerEvent*)e;
if (menuBar && te->timerId() == menuBarTimer) {
menuBar->killTimer(te->timerId());
@@ -201,7 +144,7 @@ bool TQWindowsStyle::Private::eventFilter(TQObject *o, TQEvent *e)
break;
}
- return TQObject::eventFilter(o, e);
+ return TRUE;
}
/*!
@@ -230,32 +173,40 @@ TQWindowsStyle::~TQWindowsStyle()
}
/*! \reimp */
-void TQWindowsStyle::polish(TQApplication *app)
+bool TQWindowsStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) {
+ if (d) {
+ return d->objectEventHandler(ceData, elementFlags, source, e);
+ }
+ return TRUE;
+}
+
+/*! \reimp */
+void TQWindowsStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
// We only need the overhead when shortcuts are sometimes hidden
- if (!styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0)) {
+ if (styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0) && styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, 0)) {
d = new Private(this);
- app->installEventFilter(d);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
/*! \reimp */
-void TQWindowsStyle::unPolish(TQApplication *)
+void TQWindowsStyle::applicationUnPolish(TQStyleControlElementData, ControlElementFlags, void *)
{
delete d;
d = 0;
}
/*! \reimp */
-void TQWindowsStyle::polish(TQWidget *widget)
+void TQWindowsStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- TQCommonStyle::polish(widget);
+ TQCommonStyle::polish(ceData, elementFlags, ptr);
}
/*! \reimp */
-void TQWindowsStyle::unPolish(TQWidget *widget)
+void TQWindowsStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- TQCommonStyle::polish(widget);
+ TQCommonStyle::polish(ceData, elementFlags, ptr);
}
/*! \reimp */
@@ -946,8 +897,9 @@ void TQWindowsStyle::drawControl( ControlElement element,
if ( !s.isNull() ) { // draw text
int t = s.find( '\t' );
int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
- if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget))
+ if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) {
text_flags |= NoAccel;
+ }
text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft );
if ( t >= 0 ) { // draw tab text
int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1;