TQStyle API update

pull/1/head
Timothy Pearson 12 years ago
parent 8a81e3e9ad
commit 4fc58f393f

@ -119,28 +119,36 @@ TQString TQtCKStyle::defaultStyle()
}
void TQtCKStyle::polish( TQWidget* widget )
void TQtCKStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if ( d->useFilledFrameWorkaround )
{
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->installEventFilter(this);
}
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if ( d->useFilledFrameWorkaround )
{
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
installObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
}
}
void TQtCKStyle::unPolish( TQWidget* widget )
void TQtCKStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if ( d->useFilledFrameWorkaround )
{
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->removeEventFilter(this);
}
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if ( d->useFilledFrameWorkaround )
{
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
}
}
@ -1671,51 +1679,54 @@ int TQtCKStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, Contr
}
}
bool TQtCKStyle::eventFilter( TQObject* object, TQEvent* event )
bool TQtCKStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{
if ( d->useFilledFrameWorkaround )
{
// Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to
// ensure that the filled frame contents are properly painted.
// We essentially modify the paintEvent's rect to include the
// panel border, which also paints the widget's interior.
// This is nasty, but I see no other way to properly repaint
// filled frames in all TQMenuBars and TQToolBars.
// -- Karol.
TQFrame *frame = 0;
if ( event->type() == TQEvent::Paint
&& (frame = ::tqqt_cast<TQFrame*>(object)) )
{
if (frame->frameShape() != TQFrame::ToolBarPanel && frame->frameShape() != TQFrame::MenuBarPanel)
return false;
bool horizontal = true;
TQPaintEvent* pe = (TQPaintEvent*)event;
TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame );
TQRect r = pe->rect();
if (toolbar && toolbar->orientation() == Qt::Vertical)
horizontal = false;
if (horizontal) {
if ( r.height() == frame->height() )
return false; // Let TQFrame handle the painting now.
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* object = reinterpret_cast<TQObject*>(source);
// Else, send a new paint event with an updated paint rect.
TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) );
TQApplication::sendEvent( frame, &dummyPE );
}
else { // Vertical
if ( r.width() == frame->width() )
if ( d->useFilledFrameWorkaround )
{
// Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to
// ensure that the filled frame contents are properly painted.
// We essentially modify the paintEvent's rect to include the
// panel border, which also paints the widget's interior.
// This is nasty, but I see no other way to properly repaint
// filled frames in all TQMenuBars and TQToolBars.
// -- Karol.
TQFrame *frame = 0;
if ( event->type() == TQEvent::Paint
&& (frame = ::tqqt_cast<TQFrame*>(object)) )
{
if (frame->frameShape() != TQFrame::ToolBarPanel && frame->frameShape() != TQFrame::MenuBarPanel)
return false;
TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) );
TQApplication::sendEvent( frame, &dummyPE );
bool horizontal = true;
TQPaintEvent* pe = (TQPaintEvent*)event;
TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame );
TQRect r = pe->rect();
if (toolbar && toolbar->orientation() == Qt::Vertical)
horizontal = false;
if (horizontal) {
if ( r.height() == frame->height() )
return false; // Let TQFrame handle the painting now.
// Else, send a new paint event with an updated paint rect.
TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) );
TQApplication::sendEvent( frame, &dummyPE );
}
else { // Vertical
if ( r.width() == frame->width() )
return false;
TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) );
TQApplication::sendEvent( frame, &dummyPE );
}
// Discard this event as we sent a new paintEvent.
return true;
}
// Discard this event as we sent a new paintEvent.
return true;
}
}

@ -253,8 +253,8 @@ class TQtCKStyle: public TQCommonStyle
// ---------------------------------------------------------------------------
void polish( TQWidget* widget );
void unPolish( TQWidget* widget );
void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polishPopupMenu( TQPopupMenu* );
void drawPrimitive( PrimitiveElement pe,
@ -320,7 +320,7 @@ class TQtCKStyle: public TQCommonStyle
const TQWidget* w = 0 ) const;
protected:
bool eventFilter( TQObject* object, TQEvent* event );
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:
// Disable copy constructor and = operator

File diff suppressed because it is too large Load Diff

@ -134,11 +134,11 @@ class TQtCurveStyle : public BASE_STYLE
virtual ~TQtCurveStyle();
void polish(TQApplication *app);
void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal);
TQColorGroup setColorGroup(const TQColorGroup &old, const TQColorGroup &act, bool dis=false);
void polish(TQWidget *widget);
void unPolish(TQWidget *widget);
void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(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
@ -186,7 +186,7 @@ class TQtCurveStyle : public BASE_STYLE
protected:
bool appIsNotEmbedded(TQDialog *dlg);
bool eventFilter(TQObject *object, TQEvent *event);
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void drawMenuItem(TQPainter *p, const TQRect &r, int flags, const TQColorGroup &cg,
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,

Loading…
Cancel
Save