|
|
@ -119,27 +119,35 @@ TQString TQtCKStyle::defaultStyle()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::polish( TQWidget* widget )
|
|
|
|
void TQtCKStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( d->useFilledFrameWorkaround )
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
{
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
|
|
|
|
|
|
|
|
TQFrame::Shape shape = frame->frameShape();
|
|
|
|
if ( d->useFilledFrameWorkaround )
|
|
|
|
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
|
|
|
|
{
|
|
|
|
widget->installEventFilter(this);
|
|
|
|
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 (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
{
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
|
|
|
|
|
|
|
|
TQFrame::Shape shape = frame->frameShape();
|
|
|
|
if ( d->useFilledFrameWorkaround )
|
|
|
|
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
|
|
|
|
{
|
|
|
|
widget->removeEventFilter(this);
|
|
|
|
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::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
bool TQtCKStyle::eventFilter( TQObject* object, TQEvent* event )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( d->useFilledFrameWorkaround )
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
|
|
|
|
{
|
|
|
|
TQObject* object = reinterpret_cast<TQObject*>(source);
|
|
|
|
// Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to
|
|
|
|
|
|
|
|
// ensure that the filled frame contents are properly painted.
|
|
|
|
if ( d->useFilledFrameWorkaround )
|
|
|
|
// 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)
|
|
|
|
// Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to
|
|
|
|
return false;
|
|
|
|
// 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;
|
|
|
|
bool horizontal = true;
|
|
|
|
TQPaintEvent* pe = (TQPaintEvent*)event;
|
|
|
|
TQPaintEvent* pe = (TQPaintEvent*)event;
|
|
|
|
TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame );
|
|
|
|
TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame );
|
|
|
|
TQRect r = pe->rect();
|
|
|
|
TQRect r = pe->rect();
|
|
|
|
|
|
|
|
|
|
|
|
if (toolbar && toolbar->orientation() == Qt::Vertical)
|
|
|
|
if (toolbar && toolbar->orientation() == Qt::Vertical)
|
|
|
|
horizontal = false;
|
|
|
|
horizontal = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (horizontal) {
|
|
|
|
if (horizontal) {
|
|
|
|
if ( r.height() == frame->height() )
|
|
|
|
if ( r.height() == frame->height() )
|
|
|
|
return false; // Let TQFrame handle the painting now.
|
|
|
|
return false; // Let TQFrame handle the painting now.
|
|
|
|
|
|
|
|
|
|
|
|
// Else, send a new paint event with an updated paint rect.
|
|
|
|
// Else, send a new paint event with an updated paint rect.
|
|
|
|
TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) );
|
|
|
|
TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) );
|
|
|
|
TQApplication::sendEvent( frame, &dummyPE );
|
|
|
|
TQApplication::sendEvent( frame, &dummyPE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // Vertical
|
|
|
|
else { // Vertical
|
|
|
|
if ( r.width() == frame->width() )
|
|
|
|
if ( r.width() == frame->width() )
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) );
|
|
|
|
TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) );
|
|
|
|
TQApplication::sendEvent( frame, &dummyPE );
|
|
|
|
TQApplication::sendEvent( frame, &dummyPE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Discard this event as we sent a new paintEvent.
|
|
|
|
// Discard this event as we sent a new paintEvent.
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|