summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2012-10-19 22:51:19 -0500
committerDarrell Anderson <[email protected]>2012-10-19 22:51:19 -0500
commite230650065e8fd82816319f8fa1c63507027d022 (patch)
tree1bbb6c6e5ec8b92bd94f34eee95d01a863d4c61e /src
parent06e01077e1826d986821404d87de10399a7c1b6e (diff)
parent691129fbcb6c0f377abac61c6051700b4148efc4 (diff)
downloadtqt3-e230650065e8fd82816319f8fa1c63507027d022.tar.gz
tqt3-e230650065e8fd82816319f8fa1c63507027d022.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tqt3
Diffstat (limited to 'src')
-rw-r--r--src/kernel/ntqstyle.h71
-rw-r--r--src/kernel/qapplication.cpp37
-rw-r--r--src/kernel/qapplication_x11.cpp4
-rw-r--r--src/kernel/qstyle.cpp35
-rw-r--r--src/styles/qcommonstyle.cpp35
-rw-r--r--src/styles/qmotifplusstyle.cpp31
-rw-r--r--src/widgets/ntqtabbar.h10
-rw-r--r--src/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/qprogressbar.cpp2
-rw-r--r--src/widgets/qpushbutton.cpp2
-rw-r--r--src/widgets/qscrollbar.cpp2
-rw-r--r--src/widgets/qslider.cpp5
-rw-r--r--src/widgets/qspinwidget.cpp2
-rw-r--r--src/widgets/qsplitter.cpp8
-rw-r--r--src/widgets/qtabbar.cpp237
-rw-r--r--src/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/qtoolbutton.cpp2
17 files changed, 335 insertions, 152 deletions
diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h
index 75a79c79a..a045e21eb 100644
--- a/src/kernel/ntqstyle.h
+++ b/src/kernel/ntqstyle.h
@@ -63,26 +63,26 @@ class TQStyleOption {
public:
enum StyleOptionDefault { Default };
- TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL), cli(NULL) {}
+ TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL), cli(NULL), tbh(NULL) {}
// Note: we don't use default arguments since that is unnecessary
// initialization.
TQStyleOption(int in1) :
- def(FALSE), tb(NULL), i1(in1), cli(NULL) {}
+ def(FALSE), tb(NULL), i1(in1), cli(NULL), tbh(NULL) {}
TQStyleOption(int in1, int in2) :
- def(FALSE), tb(NULL), i1(in1), i2(in2), cli(NULL) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2), cli(NULL), tbh(NULL) {}
TQStyleOption(int in1, int in2, int in3, int in4) :
- def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4), cli(NULL) {}
- TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL), cli(NULL) {}
- TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1), cli(NULL) {}
- TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2), cli(NULL) {}
- TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c), cli(NULL) {}
- TQStyleOption(TQTab* t) : def(FALSE), tb(t), cli(NULL) {}
- TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i), cli(NULL) {}
- TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i) {}
- TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a), cli(NULL) {}
- TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()), i4(r.height()), cli(NULL) {}
- TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), cli(NULL), p1((void*)w) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2), cli(NULL), tbh(NULL) {}
+ TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQTab* t) : def(FALSE), tb(t), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i), tbh(NULL) {}
+ TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a), cli(NULL), tbh(NULL) {}
+ TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()), i4(r.height()), cli(NULL), tbh(NULL) {}
+ TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), cli(NULL), p1((void*)w), tbh(NULL) {}
bool isDefault() const { return def; }
@@ -109,6 +109,9 @@ public:
TQRect rect() const { return TQRect( i1, i2, i3, i4 ); }
TQWidget* widget() const { return (TQWidget*)p1; }
+ TQStyleOption(TQTab* t, TQTab* h) : def(FALSE), tb(t), cli(NULL), tbh(h) {}
+ TQTab* hoverTab() const { return tbh; }
+
private:
// NOTE: none of these components have constructors.
bool def;
@@ -121,6 +124,7 @@ private:
int i5, i6; // reserved
TQCheckListItem* cli;
void *p1, *p2, *p3, *p4; // reserved
+ TQTab* tbh;
// (padded to 64 bytes on some architectures)
};
@@ -129,6 +133,8 @@ class TQStyleHintReturn; // not defined yet
typedef TQMap<TQ_UINT32, TQSize> DialogButtonSizeMap;
typedef TQMap<TQ_INT32, TQ_INT32> TabIdentifierIndexMap;
+class TQStyleControlElementGenericWidgetData;
+
class TQStyleControlElementPopupMenuData {
public:
//
@@ -142,13 +148,6 @@ class TQStyleControlElementCheckListItemData {
int height;
};
-class TQStyleControlElementTabBarData {
- public:
- int tabCount;
- TQTabBar::Shape shape;
- TabIdentifierIndexMap identIndexMap;
-};
-
class TQStyleControlElementListViewData {
public:
bool rootDecorated;
@@ -200,7 +199,23 @@ class TQStyleControlElementGenericWidgetData {
TQFont font;
};
-class TQStyleControlElementData {
+class TQStyleControlElementTabBarData {
+ public:
+ int tabCount;
+ int currentTabIndex;
+ TQTabBar::Shape shape;
+ TabIdentifierIndexMap identIndexMap;
+ TQStyleControlElementGenericWidgetData cornerWidgets[4];
+
+ enum CornerWidgetLocation {
+ CWL_TopLeft = 0,
+ CWL_TopRight = 1,
+ CWL_BottomLeft = 2,
+ CWL_BottomRight = 3
+ };
+};
+
+class Q_EXPORT TQStyleControlElementData {
public:
TQStringList widgetObjectTypes;
bool allDataPopulated;
@@ -251,6 +266,10 @@ class TQStyleControlElementData {
TQ_UINT32 comboBoxLineEditFlags;
TQ_UINT32 frameStyle;
TQRect sliderRect;
+ TQPainter* activePainter;
+
+ public:
+ TQStyleControlElementData();
};
class Q_EXPORT TQStyleWidgetActionRequestData {
@@ -260,6 +279,7 @@ class Q_EXPORT TQStyleWidgetActionRequestData {
TQStyleWidgetActionRequestData(TQPalette palette, bool informWidgets = FALSE, const char* className = 0);
TQStyleWidgetActionRequestData(TQFont font, bool informWidgets = FALSE, const char* className = 0);
TQStyleWidgetActionRequestData(TQRect rect);
+ TQStyleWidgetActionRequestData(TQPaintEvent* paintEvent);
~TQStyleWidgetActionRequestData();
public:
bool bool1;
@@ -271,6 +291,7 @@ class Q_EXPORT TQStyleWidgetActionRequestData {
TQRect rect;
const char * cstr;
TQString string;
+ TQPaintEvent * paintEvent;
};
typedef TQStyleWidgetActionRequestData TQStyleApplicationActionRequestData;
@@ -309,6 +330,7 @@ public:
CEF_IsActiveWindow = 0x00200000,
CEF_IsTopLevel = 0x00400000,
CEF_IsVisible = 0x00800000,
+ CEF_HasMouse = 0x01000000
};
// New TQStyle API - most of these should probably be pure virtual
@@ -1094,7 +1116,10 @@ public:
WAR_SetBackgroundMode,
WAR_SetBackgroundOrigin,
WAR_SetFont,
- WAR_RepaintAllAccelerators
+ WAR_RepaintAllAccelerators,
+ WAR_SetDefault,
+ WAR_UnSetDefault,
+ WAR_SendPaintEvent
};
typedef bool (*WidgetActionRequestHook)(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, TQStyleWidgetActionRequestData requestData);
diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp
index 3dc3db748..71b87ffe0 100644
--- a/src/kernel/qapplication.cpp
+++ b/src/kernel/qapplication.cpp
@@ -2557,6 +2557,21 @@ bool TQApplication::event( TQEvent *e )
return TQObject::event(e);
}
+#define HOVER_SENSITIVE_WIDGET_SELECT if ( widget->inherits("TQPushButton") \
+ || widget->inherits("TQComboBox") \
+ || widget->inherits("TQSpinWidget") \
+ || widget->inherits("TQCheckBox") \
+ || widget->inherits("TQRadioButton") \
+ || widget->inherits("TQToolButton") \
+ || widget->inherits("TQSlider") \
+ || widget->inherits("TQScrollBar") \
+ || widget->inherits("TQTabBar") \
+ || widget->inherits("TQDockWindowHandle") \
+ || widget->inherits("TQSplitterHandle") )
+
+#define FOCUS_SENSITIVE_WIDGET_SELECT if ( widget->inherits("TQLineEdit") )
+#define FOCUS_SENSITIVE_PARENT_WIDGET_SELECT if ( widget->parentWidget() && widget->parentWidget()->inherits("TQSpinWidget") )
+
/*!\internal
Helper function called by notify()
@@ -2579,10 +2594,28 @@ bool TQApplication::internalNotify( TQObject *receiver, TQEvent * e)
TQWidget *widget = (TQWidget*)receiver;
// toggle HasMouse widget state on enter and leave
- if ( e->type() == TQEvent::Enter || e->type() == TQEvent::DragEnter )
+ if ( e->type() == TQEvent::Enter || e->type() == TQEvent::DragEnter ) {
widget->setWState( WState_HasMouse );
- else if ( e->type() == TQEvent::Leave || e->type() == TQEvent::DragLeave )
+ HOVER_SENSITIVE_WIDGET_SELECT {
+ widget->repaint(false);
+ }
+ }
+ else if ( e->type() == TQEvent::Leave || e->type() == TQEvent::DragLeave ) {
widget->clearWState( WState_HasMouse );
+ HOVER_SENSITIVE_WIDGET_SELECT {
+ widget->repaint(false);
+ }
+ }
+
+ // repaint information entry widgets on focus set/unset
+ if ( e->type() == TQEvent::FocusIn || e->type() == TQEvent::FocusOut ) {
+ FOCUS_SENSITIVE_WIDGET_SELECT {
+ widget->repaint(false);
+ }
+ FOCUS_SENSITIVE_PARENT_WIDGET_SELECT {
+ widget->parentWidget()->repaint(false);
+ }
+ }
// throw away any mouse-tracking-only mouse events
if ( e->type() == TQEvent::MouseMove &&
diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp
index aba4fcd50..e76dd1d72 100644
--- a/src/kernel/qapplication_x11.cpp
+++ b/src/kernel/qapplication_x11.cpp
@@ -5184,8 +5184,6 @@ bool TQETWidget::translateKeyEventInternal( const XEvent *event, int& count,
tqAddPostRoutine( deleteKeyDicts );
}
- TQWidget* tlw = topLevelWidget();
-
XKeyEvent xkeyevent = event->xkey;
// save the modifier state, we will use the keystate uint later by passing
@@ -5211,7 +5209,6 @@ bool TQETWidget::translateKeyEventInternal( const XEvent *event, int& count,
// Implementation for X11R5 and newer, using XIM
int keycode = event->xkey.keycode;
- Status status;
if ( type == TQEvent::KeyPress ) {
bool mb=FALSE;
@@ -5295,7 +5292,6 @@ bool TQETWidget::translateKeyEventInternal( const XEvent *event, int& count,
// and independent of whether char is signed or not.
textDict->replace( keycode, (void*)(long)(256+ascii) );
}
- tlw = 0;
} else {
key = (int)(long)keyDict->find( keycode );
if ( key )
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index 7aa144091..ef31c25ca 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -48,6 +48,7 @@
#include "ntqlayout.h"
#include "ntqlistview.h"
#include "ntqpopupmenu.h"
+#include "ntqpushbutton.h"
#include "ntqobjectlist.h"
#include "ntqwidgetlist.h"
@@ -2165,7 +2166,16 @@ bool TQStyle::eventFilter(TQObject *o, TQEvent *e) {
TQStyle* handler = m_objectEventSourceToHandlerMap[o];
TQStyleControlElementData ceData = m_objectEventSourceDataToHandlerMap[o];
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
- bool ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ bool ret;
+ TQWidget* w = dynamic_cast<TQWidget*>(o);
+ if ((w) && (e->type() == TQEvent::Paint)) {
+ TQPainter p(w);
+ ceData.activePainter = &p;
+ ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ }
+ else {
+ ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ }
if (ret) {
return ret;
}
@@ -2291,6 +2301,21 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem
}
delete list;
}
+ else if (request == WAR_SetDefault) {
+ TQPushButton *button = dynamic_cast<TQPushButton*>(widget);
+ if (button) {
+ button->setDefault(TRUE);
+ }
+ }
+ else if (request == WAR_UnSetDefault) {
+ TQPushButton *button = dynamic_cast<TQPushButton*>(widget);
+ if (button) {
+ button->setDefault(FALSE);
+ }
+ }
+ else if (request == WAR_SendPaintEvent) {
+ static_cast<TQObject*>(widget)->event(requestData.paintEvent);
+ }
return true;
}
}
@@ -2395,6 +2420,10 @@ TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQRect param) {
rect = param;
}
+TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPaintEvent* param) {
+ paintEvent = param;
+}
+
TQStyleWidgetActionRequestData::~TQStyleWidgetActionRequestData() {
//
}
@@ -2575,4 +2604,8 @@ TQPixmap TQStyle::stylePixmap(StylePixmap sp, const TQWidget *w, const TQStyleOp
\obsolete
*/
+TQStyleControlElementData::TQStyleControlElementData() {
+ activePainter = 0;
+}
+
#endif // QT_NO_STYLE
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index 8557734cf..0caac2c64 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -49,6 +49,7 @@
#include "ntqpixmap.h"
#include "ntqpushbutton.h"
#include "ntqtabbar.h"
+#include "ntqtabwidget.h"
#include "ntqlineedit.h"
#include "ntqscrollbar.h"
#include "ntqtoolbutton.h"
@@ -226,6 +227,7 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget;
if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy;
if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus;
+ if (widget->hasMouse()) cef = cef | TQStyle::CEF_HasMouse;
if (populateReliantFields) {
if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow;
if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel;
@@ -332,6 +334,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
const TQTabBar *tb = dynamic_cast<const TQTabBar*>(widget);
if (tb) {
ceData.tabBarData.tabCount = tb->count();
+ ceData.tabBarData.currentTabIndex = tb->currentTab();
ceData.tabBarData.shape = tb->shape();
ceData.tabBarData.identIndexMap.clear();
const TQTab* currentTab;
@@ -341,6 +344,38 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier());
}
}
+ const TQTabWidget *tw = dynamic_cast<const TQTabWidget*>(tb->parent());
+ if (tw) {
+ TQWidget *cw;
+ cw = tw->cornerWidget(TQt::TopLeft);
+ if(cw) {
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(TQt::TopRight);
+ if(cw) {
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(TQt::BottomLeft);
+ if(cw) {
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(TQt::BottomRight);
+ if(cw) {
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos();
+ }
+ }
}
}
if (ceData.widgetObjectTypes.contains("TQToolBox")) {
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp
index 2ad7e7f5a..65fa0df91 100644
--- a/src/styles/qmotifplusstyle.cpp
+++ b/src/styles/qmotifplusstyle.cpp
@@ -65,13 +65,10 @@
struct TQMotifPlusStylePrivate
{
TQMotifPlusStylePrivate()
- : hoverWidget(0), hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE),
+ : hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE),
scrollbarElement(0), lastElement(0), ref(1)
{ ; }
- void* hoverWidget;
- TQStyleControlElementData hoverWidgetData;
- TQStyle::ControlElementFlags hoverWidgetFlags;
bool hovering, sliderActive, mousePressed;
int scrollbarElement, lastElement, ref;
TQPoint mousePos;
@@ -660,9 +657,6 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
const TQStyleOption& opt,
const TQWidget *widget) const
{
- if (widget == singleton->hoverWidget)
- flags |= Style_MouseOver;
-
switch (element) {
case CE_PushButton:
{
@@ -1108,9 +1102,6 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
const TQStyleOption& opt,
const TQWidget *widget ) const
{
- if (widget == singleton->hoverWidget)
- flags |= Style_MouseOver;
-
switch (control) {
case CC_ScrollBar:
{
@@ -1516,30 +1507,22 @@ bool TQMotifPlusStyle::objectEventHandler( TQStyleControlElementData ceData, Con
if (!ceData.widgetObjectTypes.contains("TQWidget"))
break;
- singleton->hoverWidget = source;
- singleton->hoverWidgetData = ceData;
- singleton->hoverWidgetFlags = elementFlags;
- if (!(singleton->hoverWidgetFlags & CEF_IsEnabled)) {
- singleton->hoverWidget = 0;
- break;
- }
- widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint);
+ widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
break;
}
case TQEvent::Leave:
{
- if (source != singleton->hoverWidget)
+ if (!ceData.widgetObjectTypes.contains("TQWidget"))
break;
- void *w = singleton->hoverWidget;
- singleton->hoverWidget = 0;
- widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, w, WAR_Repaint);
+
+ widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
break;
}
case TQEvent::MouseMove:
{
- if ((!ceData.widgetObjectTypes.contains("TQWidget")) || source != singleton->hoverWidget)
+ if ((!ceData.widgetObjectTypes.contains("TQWidget")))
break;
if ((!ceData.widgetObjectTypes.contains("TQScrollBar")) && (!ceData.widgetObjectTypes.contains("TQSlider")))
@@ -1548,7 +1531,7 @@ bool TQMotifPlusStyle::objectEventHandler( TQStyleControlElementData ceData, Con
singleton->mousePos = ((TQMouseEvent *) event)->pos();
if (! singleton->mousePressed) {
singleton->hovering = TRUE;
- widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint);
+ widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
singleton->hovering = FALSE;
}
diff --git a/src/widgets/ntqtabbar.h b/src/widgets/ntqtabbar.h
index 2172f8bed..a8271308b 100644
--- a/src/widgets/ntqtabbar.h
+++ b/src/widgets/ntqtabbar.h
@@ -178,6 +178,16 @@ private: // Disabled copy constructor and operator=
TQTabBar( const TQTabBar & );
TQTabBar& operator=( const TQTabBar & );
#endif
+
+protected:
+ void enterEvent ( TQEvent * );
+ void leaveEvent ( TQEvent * );
+
+private:
+ TQTab *hoverTab;
+
+public:
+ TQTab *mouseHoverTab() const;
};
diff --git a/src/widgets/qcombobox.cpp b/src/widgets/qcombobox.cpp
index c595d75e6..9cbb6960b 100644
--- a/src/widgets/qcombobox.cpp
+++ b/src/widgets/qcombobox.cpp
@@ -1244,6 +1244,8 @@ void TQComboBox::paintEvent( TQPaintEvent * )
flags |= TQStyle::Style_Enabled;
if (hasFocus())
flags |= TQStyle::Style_HasFocus;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
if ( width() < 5 || height() < 5 ) {
qDrawShadePanel( &p, rect(), g, FALSE, 2,
diff --git a/src/widgets/qprogressbar.cpp b/src/widgets/qprogressbar.cpp
index 09d6befd7..7a4ec3831 100644
--- a/src/widgets/qprogressbar.cpp
+++ b/src/widgets/qprogressbar.cpp
@@ -390,6 +390,8 @@ void TQProgressBar::drawContents( TQPainter *p )
flags |= TQStyle::Style_Enabled;
if (hasFocus())
flags |= TQStyle::Style_HasFocus;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
style().drawControl(TQStyle::CE_ProgressBarGroove, buffer.painter(), this,
TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarGroove, this), this ),
diff --git a/src/widgets/qpushbutton.cpp b/src/widgets/qpushbutton.cpp
index 3e3925ab7..e43ff2408 100644
--- a/src/widgets/qpushbutton.cpp
+++ b/src/widgets/qpushbutton.cpp
@@ -555,6 +555,8 @@ void TQPushButton::drawButton( TQPainter *paint )
flags |= TQStyle::Style_Raised;
if (isDefault())
flags |= TQStyle::Style_ButtonDefault;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
style().drawControl(TQStyle::CE_PushButton, paint, this, rect(), colorGroup(), flags);
drawButtonLabel( paint );
diff --git a/src/widgets/qscrollbar.cpp b/src/widgets/qscrollbar.cpp
index 18d62acd0..ecaa3b3fc 100644
--- a/src/widgets/qscrollbar.cpp
+++ b/src/widgets/qscrollbar.cpp
@@ -940,6 +940,8 @@ void TQScrollBar::drawControls( uint controls, uint activeControl,
flags |= TQStyle::Style_Enabled;
if (hasFocus())
flags |= TQStyle::Style_HasFocus;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
if ( orientation() == Horizontal )
flags |= TQStyle::Style_Horizontal;
diff --git a/src/widgets/qslider.cpp b/src/widgets/qslider.cpp
index fd9dd15b5..fd8c36581 100644
--- a/src/widgets/qslider.cpp
+++ b/src/widgets/qslider.cpp
@@ -415,10 +415,13 @@ void TQSlider::paintEvent( TQPaintEvent * )
flags |= TQStyle::Style_Enabled;
if (hasFocus())
flags |= TQStyle::Style_HasFocus;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
TQStyle::SCFlags sub = TQStyle::SC_SliderGroove | TQStyle::SC_SliderHandle;
- if ( tickmarks() != NoMarks )
+ if ( tickmarks() != NoMarks ) {
sub |= TQStyle::SC_SliderTickmarks;
+ }
style().drawComplexControl( TQStyle::CC_Slider, &p, this, rect(), colorGroup(),
flags, sub, state == Dragging ? TQStyle::SC_SliderHandle : TQStyle::SC_None );
diff --git a/src/widgets/qspinwidget.cpp b/src/widgets/qspinwidget.cpp
index af2e19888..9c0b2cbbc 100644
--- a/src/widgets/qspinwidget.cpp
+++ b/src/widgets/qspinwidget.cpp
@@ -323,6 +323,8 @@ void TQSpinWidget::paintEvent( TQPaintEvent * )
TQStyle::SFlags flags = TQStyle::Style_Default;
if (isEnabled())
flags |= TQStyle::Style_Enabled;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
if (hasFocus() || (focusProxy() && focusProxy()->hasFocus()))
flags |= TQStyle::Style_HasFocus;
diff --git a/src/widgets/qsplitter.cpp b/src/widgets/qsplitter.cpp
index cedb498b0..f179a7aea 100644
--- a/src/widgets/qsplitter.cpp
+++ b/src/widgets/qsplitter.cpp
@@ -141,11 +141,15 @@ void TQSplitterHandle::mouseReleaseEvent( TQMouseEvent *e )
void TQSplitterHandle::paintEvent( TQPaintEvent * )
{
+ TQStyle::SFlags flags = (orientation() == Horizontal ? TQStyle::Style_Horizontal : 0);
+ if (hasMouse()) {
+ flags |= TQStyle::Style_MouseOver;
+ }
+
TQPainter p( this );
parentWidget()->style().drawPrimitive( TQStyle::PE_Splitter, &p, rect(),
colorGroup(),
- (orientation() == Horizontal ?
- TQStyle::Style_Horizontal : 0) );
+ flags );
}
TQCOORD TQSplitterLayoutStruct::getSizer( Orientation orient )
diff --git a/src/widgets/qtabbar.cpp b/src/widgets/qtabbar.cpp
index caa8e7d15..db08012c4 100644
--- a/src/widgets/qtabbar.cpp
+++ b/src/widgets/qtabbar.cpp
@@ -335,7 +335,7 @@ private:
*/
TQTabBar::TQTabBar( TQWidget * parent, const char *name )
- : TQWidget( parent, name, WNoAutoErase | WNoMousePropagation ), l(NULL)
+ : TQWidget( parent, name, WNoAutoErase | WNoMousePropagation ), l(NULL), hoverTab( 0 )
{
d = new TQTabPrivate;
d->pressed = 0;
@@ -581,45 +581,49 @@ TQSize TQTabBar::minimumSizeHint() const
void TQTabBar::paint( TQPainter * p, TQTab * t, bool selected ) const
{
- TQStyle::SFlags flags = TQStyle::Style_Default;
-
- if (isEnabled() && t->isEnabled())
- flags |= TQStyle::Style_Enabled;
- if (topLevelWidget() == tqApp->activeWindow())
- flags |= TQStyle::Style_Active;
- if ( selected )
- flags |= TQStyle::Style_Selected;
- else if(t == d->pressed)
- flags |= TQStyle::Style_Sunken;
- //selection flags
- if(t->rect().contains(mapFromGlobal(TQCursor::pos())))
- flags |= TQStyle::Style_MouseOver;
- style().drawControl( TQStyle::CE_TabBarTab, p, this, t->rect(),
- colorGroup(), flags, TQStyleOption(t) );
-
- TQRect r( t->r );
- p->setFont( font() );
-
- int iw = 0;
- int ih = 0;
- if ( t->iconset != 0 ) {
- iw = t->iconset->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4;
- ih = t->iconset->pixmap( TQIconSet::Small, TQIconSet::Normal ).height();
- }
- TQFontMetrics fm = p->fontMetrics();
- int fw = fm.width( t->label );
- fw -= t->label.contains('&') * fm.width('&');
- fw += t->label.contains("&&") * fm.width('&');
- int w = iw + fw + 4;
- int h = TQMAX(fm.height() + 4, ih );
- int offset = 3;
+ TQStyle::SFlags flags = TQStyle::Style_Default;
+
+ if (isEnabled() && t->isEnabled()) {
+ flags |= TQStyle::Style_Enabled;
+ }
+ if (topLevelWidget() == tqApp->activeWindow()) {
+ flags |= TQStyle::Style_Active;
+ }
+ if ( selected ) {
+ flags |= TQStyle::Style_Selected;
+ }
+ else if (t == d->pressed) {
+ flags |= TQStyle::Style_Sunken;
+ }
+
+ //selection flags
+ if (t->rect().contains(mapFromGlobal(TQCursor::pos()))) {
+ flags |= TQStyle::Style_MouseOver;
+ }
+ style().drawControl( TQStyle::CE_TabBarTab, p, this, t->rect(), colorGroup(), flags, TQStyleOption(t, hoverTab) );
+
+ TQRect r( t->r );
+ p->setFont( font() );
+
+ int iw = 0;
+ int ih = 0;
+ if ( t->iconset != 0 ) {
+ iw = t->iconset->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4;
+ ih = t->iconset->pixmap( TQIconSet::Small, TQIconSet::Normal ).height();
+ }
+ TQFontMetrics fm = p->fontMetrics();
+ int fw = fm.width( t->label );
+ fw -= t->label.contains('&') * fm.width('&');
+ fw += t->label.contains("&&") * fm.width('&');
+ int w = iw + fw + 4;
+ int h = TQMAX(fm.height() + 4, ih );
+ int offset = 3;
#ifdef Q_WS_MAC
- if (::tqt_cast<TQMacStyle *>(&style()))
- offset = 0;
+ if (::tqt_cast<TQMacStyle *>(&style())) {
+ offset = 0;
+ }
#endif
- paintLabel( p, TQRect( r.left() + (r.width()-w)/2 - offset,
- r.top() + (r.height()-h)/2,
- w, h ), t, t->id == keyboardFocusTab() );
+ paintLabel( p, TQRect( r.left() + (r.width()-w)/2 - offset, r.top() + (r.height()-h)/2, w, h ), t, t->id == keyboardFocusTab() );
}
/*!
@@ -630,43 +634,48 @@ void TQTabBar::paint( TQPainter * p, TQTab * t, bool selected ) const
void TQTabBar::paintLabel( TQPainter* p, const TQRect& br,
TQTab* t, bool has_focus ) const
{
- TQRect r = br;
- bool selected = currentTab() == t->id;
- if ( t->iconset) {
- // the tab has an iconset, draw it in the right mode
- TQIconSet::Mode mode = (t->enabled && isEnabled())
- ? TQIconSet::Normal : TQIconSet::Disabled;
- if ( mode == TQIconSet::Normal && has_focus )
- mode = TQIconSet::Active;
- TQPixmap pixmap = t->iconset->pixmap( TQIconSet::Small, mode );
- int pixw = pixmap.width();
- int pixh = pixmap.height();
- r.setLeft( r.left() + pixw + 4 );
- r.setRight( r.right() + 2 );
-
- int xoff = 0, yoff = 0;
- if(!selected) {
- xoff = style().pixelMetric(TQStyle::PM_TabBarTabShiftHorizontal, this);
- yoff = style().pixelMetric(TQStyle::PM_TabBarTabShiftVertical, this);
+ TQRect r = br;
+ bool selected = currentTab() == t->id;
+ if ( t->iconset) {
+ // the tab has an iconset, draw it in the right mode
+ TQIconSet::Mode mode = (t->enabled && isEnabled())
+ ? TQIconSet::Normal : TQIconSet::Disabled;
+ if ( mode == TQIconSet::Normal && has_focus )
+ mode = TQIconSet::Active;
+ TQPixmap pixmap = t->iconset->pixmap( TQIconSet::Small, mode );
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+ r.setLeft( r.left() + pixw + 4 );
+ r.setRight( r.right() + 2 );
+
+ int xoff = 0, yoff = 0;
+ if(!selected) {
+ xoff = style().pixelMetric(TQStyle::PM_TabBarTabShiftHorizontal, this);
+ yoff = style().pixelMetric(TQStyle::PM_TabBarTabShiftVertical, this);
+ }
+ p->drawPixmap( br.left() + 2 + xoff, br.center().y()-pixh/2 + yoff, pixmap );
}
- p->drawPixmap( br.left() + 2 + xoff, br.center().y()-pixh/2 + yoff, pixmap );
- }
- TQStyle::SFlags flags = TQStyle::Style_Default;
-
- if (isEnabled() && t->isEnabled())
- flags |= TQStyle::Style_Enabled;
- if (has_focus)
- flags |= TQStyle::Style_HasFocus;
- if ( selected )
- flags |= TQStyle::Style_Selected;
- else if(t == d->pressed)
- flags |= TQStyle::Style_Sunken;
- if(t->rect().contains(mapFromGlobal(TQCursor::pos())))
- flags |= TQStyle::Style_MouseOver;
- style().drawControl( TQStyle::CE_TabBarLabel, p, this, r,
- t->isEnabled() ? colorGroup(): palette().disabled(),
- flags, TQStyleOption(t) );
+ TQStyle::SFlags flags = TQStyle::Style_Default;
+
+ if (isEnabled() && t->isEnabled()) {
+ flags |= TQStyle::Style_Enabled;
+ }
+ if (has_focus) {
+ flags |= TQStyle::Style_HasFocus;
+ }
+ if ( selected ) {
+ flags |= TQStyle::Style_Selected;
+ }
+ else if(t == d->pressed) {
+ flags |= TQStyle::Style_Sunken;
+ }
+ if(t->rect().contains(mapFromGlobal(TQCursor::pos()))) {
+ flags |= TQStyle::Style_MouseOver;
+ }
+ style().drawControl( TQStyle::CE_TabBarLabel, p, this, r,
+ t->isEnabled() ? colorGroup(): palette().disabled(),
+ flags, TQStyleOption(t, hoverTab) );
}
@@ -689,8 +698,9 @@ void TQTabBar::paintEvent( TQPaintEvent * e )
t = l->first();
do {
TQTab * n = l->next();
- if ( t && t->r.intersects( e->rect() ) )
+ if ( t && t->r.intersects( e->rect() ) ) {
paint( buffer.painter(), t, n == 0 );
+ }
t = n;
} while ( t != 0 );
@@ -776,19 +786,38 @@ void TQTabBar::mousePressEvent( TQMouseEvent * e )
void TQTabBar::mouseMoveEvent ( TQMouseEvent *e )
{
- if ( e->state() != LeftButton ) {
- e->ignore();
- return;
- }
- if(style().styleHint( TQStyle::SH_TabBar_SelectMouseType, this ) == TQEvent::MouseButtonRelease) {
TQTab *t = selectTab( e->pos() );
- if(t != d->pressed) {
- if(d->pressed)
- repaint(d->pressed->rect(), FALSE);
- if((d->pressed = t))
- repaint(t->rect(), FALSE);
+
+ // Repaint hover indicator(s)
+ // Also, avoid unnecessary repaints which otherwise would occour on every MouseMove event causing high cpu load
+ bool forceRepaint = true;
+ if (hoverTab == t) {
+ forceRepaint = false;
+ }
+ hoverTab = t;
+ if (forceRepaint) {
+ repaint(false);
+ }
+
+ if ( e->state() != LeftButton ) {
+ e->ignore();
+ return;
+ }
+
+ if(style().styleHint( TQStyle::SH_TabBar_SelectMouseType, this ) == TQEvent::MouseButtonRelease) {
+ if(t != d->pressed) {
+ if (d->pressed) {
+ if (!forceRepaint) {
+ repaint(d->pressed->rect(), FALSE);
+ }
+ }
+ if ((d->pressed = t)) {
+ if (!forceRepaint) {
+ repaint(t->rect(), FALSE);
+ }
+ }
+ }
}
- }
}
/*!
@@ -797,16 +826,28 @@ void TQTabBar::mouseMoveEvent ( TQMouseEvent *e )
void TQTabBar::mouseReleaseEvent( TQMouseEvent *e )
{
- if ( e->button() != LeftButton )
- e->ignore();
- if(d->pressed) {
- TQTab *t = selectTab( e->pos() ) == d->pressed ? d->pressed : 0;
- d->pressed = 0;
- if(t && t->enabled && e->type() == style().styleHint( TQStyle::SH_TabBar_SelectMouseType, this ))
- setCurrentTab( t );
- }
+ if (e->button() != LeftButton) {
+ e->ignore();
+ }
+
+ if (d->pressed) {
+ TQTab *t = selectTab( e->pos() ) == d->pressed ? d->pressed : 0;
+ d->pressed = 0;
+ if(t && t->enabled && e->type() == style().styleHint( TQStyle::SH_TabBar_SelectMouseType, this )) {
+ setCurrentTab( t );
+ }
+ }
}
+void TQTabBar::enterEvent( TQEvent * )
+{
+ hoverTab = 0;
+}
+
+void TQTabBar::leaveEvent( TQEvent * )
+{
+ hoverTab = 0;
+}
/*!
\reimp
@@ -1119,7 +1160,7 @@ void TQTabBar::layoutTabs()
h += vframe;
t->r = TQRect(TQPoint(x, 0), style().sizeFromContents(TQStyle::CT_TabBarTab, this,
TQSize( TQMAX( lw + hframe + iw, TQApplication::globalStrut().width() ), h ),
- TQStyleOption(t) ));
+ TQStyleOption(t, hoverTab) ));
x += t->r.width() - overlap;
r = r.unite( t->r );
if ( reverse )
@@ -1375,4 +1416,12 @@ void TQTabBar::fontChange( const TQFont & oldFont )
TQWidget::fontChange( oldFont );
}
+/*!
+ Returns the tab currently under the mouse pointer, or NULL if no tab is under the cursor
+*/
+TQTab *TQTabBar::mouseHoverTab() const
+{
+ return hoverTab;
+}
+
#endif
diff --git a/src/widgets/qtextedit.cpp b/src/widgets/qtextedit.cpp
index c8e2c9bff..5bdf79249 100644
--- a/src/widgets/qtextedit.cpp
+++ b/src/widgets/qtextedit.cpp
@@ -1123,7 +1123,7 @@ bool TQTextEdit::event( TQEvent *e )
{
if ( e->type() == TQEvent::AccelOverride && !isReadOnly() ) {
TQKeyEvent* ke = (TQKeyEvent*) e;
- switch(ke->state()) {
+ switch((int)(ke->state())) {
case NoButton:
case Keypad:
case ShiftButton:
diff --git a/src/widgets/qtoolbutton.cpp b/src/widgets/qtoolbutton.cpp
index e7f7e6db6..1912bebf1 100644
--- a/src/widgets/qtoolbutton.cpp
+++ b/src/widgets/qtoolbutton.cpp
@@ -484,6 +484,8 @@ void TQToolButton::drawButton( TQPainter * p )
flags |= TQStyle::Style_Down;
if (isOn())
flags |= TQStyle::Style_On;
+ if (hasMouse())
+ flags |= TQStyle::Style_MouseOver;
if (autoRaise()) {
flags |= TQStyle::Style_AutoRaise;
if (uses3D()) {