Beispiel #1
0
void NextClient::resizeEvent(TQResizeEvent *)
{
    if (widget()->isVisible()) {
	// TODO ? update border area only?
        widget()->update();
#if 0
        widget()->update(titlebar->tqgeometry());
        TQPainter p(widget());
	TQRect t = titlebar->tqgeometry();
	t.setTop( 0 );
	TQRegion r = widget()->rect();
	r = r.subtract( t );
	p.setClipRegion( r );
	p.eraseRect(widget()->rect());
#endif
    }
}
Beispiel #2
0
void ExtensionManager::reduceArea(TQRect &area, const ExtensionContainer *extension) const
{
    if (!extension ||
        extension->hideMode() == ExtensionContainer::AutomaticHide ||
        !extension->reserveStrut())
    {
        return;
    }

    TQRect geom = extension->initialGeometry(extension->position(), extension->alignment(),
                                            extension->xineramaScreen());

    // reduce given area (TQRect) to the space not covered by the given extension
    // As simplification: the length of the extension is not taken into account
    // which means that even a small extension e.g. on the left side of the desktop
    // will remove the available area with its with

    switch (extension->position())
    {
        case KPanelExtension::Left:
        {
            area.setLeft(TQMAX(area.left(), geom.right()));
            break;
        }
        case KPanelExtension::Right:
        {
            area.setRight(TQMIN(area.right(), geom.left()));
            break;
        }
        case KPanelExtension::Top:
        {
            area.setTop(TQMAX(area.top(), geom.bottom()));
            break;
        }
        case KPanelExtension::Bottom:
        {
            area.setBottom(TQMIN(area.bottom(), geom.top()));
            break;
        }
        default: ;  // ignore KPanelExtension::Floating ... at least for now
    }
}
Beispiel #3
0
void NextClient::paintEvent( TQPaintEvent* )
{
    TQPainter p(widget());

    // Draw black frame
    TQRect fr = widget()->rect();
    p.setPen(TQt::black);
    p.drawRect(fr);

    // Draw title bar
    TQRect t = titlebar->tqgeometry();
    t.setTop(1);
    p.drawTiledPixmap(t.x()+1, t.y()+1, t.width()-2, t.height()-2,
                      isActive() ? *aTitlePix : *iTitlePix);
    qDrawShadePanel(&p, t.x(), t.y(), t.width(), t.height()-1,
                   options()->tqcolorGroup(KDecoration::ColorTitleBar, isActive()));
    p.drawLine(t.x(), t.bottom(), t.right(), t.bottom());

#if 0
    // Why setting up a clipping region if it is not used? (setClipping(false))
    TQRegion r = fr;
    r = r.subtract( t );
    p.setClipRegion( r );
    p.setClipping(false);
#endif

    t.setTop( 1 );
    t.setHeight(t.height()-2);
    t.setLeft( t.left() + 4 );
    t.setRight( t.right() - 2 );

    p.setPen(options()->color(KDecoration::ColorFont, isActive()));
    p.setFont(options()->font(isActive()));
    p.drawText( t, AlignCenter | AlignVCenter, caption() );

    // Draw resize handle
    if (mustDrawHandle()) {
        int corner = 16 + 3*handleSize/2;
	qDrawShadePanel(&p,
		fr.x() + 1, fr.bottom() - handleSize, corner-1, handleSize,
		options()->tqcolorGroup(KDecoration::ColorHandle, isActive()),
		false);
	p.drawTiledPixmap(fr.x() + 2, fr.bottom() - handleSize + 1,
		corner - 3, handleSize - 2, isActive() ? *aHandlePix : *iHandlePix);

	qDrawShadePanel(&p,
		fr.x() + corner, fr.bottom() - handleSize,
		fr.width() - 2*corner, handleSize,
		options()->tqcolorGroup(KDecoration::ColorFrame, isActive()),
		false);
	p.drawTiledPixmap(fr.x() + corner + 1, fr.bottom() - handleSize + 1,
		fr.width() - 2*corner - 2, handleSize - 2,
		isActive() ? *aFramePix : *iFramePix);

	qDrawShadePanel(&p,
		fr.right() - corner + 1, fr.bottom() - handleSize, corner - 1, handleSize,
		options()->tqcolorGroup(KDecoration::ColorHandle, isActive()),
		false);
	p.drawTiledPixmap(fr.right() - corner + 2, fr.bottom() - handleSize + 1,
		corner - 3, handleSize - 2, isActive() ? *aHandlePix : *iHandlePix);
    }
}