|
|
|
@ -15,13 +15,13 @@
|
|
|
|
|
#include <kconfig.h>
|
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
|
|
|
|
|
|
#include <qlabel.h>
|
|
|
|
|
#include <qlayout.h>
|
|
|
|
|
#include <qdrawutil.h>
|
|
|
|
|
#include <qdatetime.h>
|
|
|
|
|
#include <qcursor.h>
|
|
|
|
|
#include <qbitmap.h>
|
|
|
|
|
#include <qimage.h>
|
|
|
|
|
#include <ntqlabel.h>
|
|
|
|
|
#include <ntqlayout.h>
|
|
|
|
|
#include <ntqdrawutil.h>
|
|
|
|
|
#include <ntqdatetime.h>
|
|
|
|
|
#include <ntqcursor.h>
|
|
|
|
|
#include <ntqbitmap.h>
|
|
|
|
|
#include <ntqimage.h>
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
@ -43,20 +43,20 @@ bool titlebarResize, titlebarPlain,
|
|
|
|
|
double titlebarLenseButtonFlare;
|
|
|
|
|
|
|
|
|
|
static bool pixmaps_created = false;
|
|
|
|
|
static QImage left_img[2][2];
|
|
|
|
|
static QImage middle_img[2][2];
|
|
|
|
|
static QImage right_img[2][2];
|
|
|
|
|
static QImage text_img[2][2];
|
|
|
|
|
static QImage bar_img[2][2];
|
|
|
|
|
static QImage kroete_img[2][2];
|
|
|
|
|
static QImage button_img[2][2];
|
|
|
|
|
static QImage button_l_img[2][2];
|
|
|
|
|
static QImage button_r_img[2][2];
|
|
|
|
|
static TQImage left_img[2][2];
|
|
|
|
|
static TQImage middle_img[2][2];
|
|
|
|
|
static TQImage right_img[2][2];
|
|
|
|
|
static TQImage text_img[2][2];
|
|
|
|
|
static TQImage bar_img[2][2];
|
|
|
|
|
static TQImage kroete_img[2][2];
|
|
|
|
|
static TQImage button_img[2][2];
|
|
|
|
|
static TQImage button_l_img[2][2];
|
|
|
|
|
static TQImage button_r_img[2][2];
|
|
|
|
|
|
|
|
|
|
extern QColor *btnForeground;
|
|
|
|
|
extern QPixmap *defaultPixmap;
|
|
|
|
|
extern TQColor *btnForeground;
|
|
|
|
|
extern TQPixmap *defaultPixmap;
|
|
|
|
|
|
|
|
|
|
static QImage colorize(QImage img, const QColor &col1, const QColor &col2, float bright, float contrast )
|
|
|
|
|
static TQImage colorize(TQImage img, const TQColor &col1, const TQColor &col2, float bright, float contrast )
|
|
|
|
|
{
|
|
|
|
|
int rval, gval, bval, val, val2, i;
|
|
|
|
|
int pixels = (img.depth() > 8) ? img.width()*img.height()
|
|
|
|
@ -66,8 +66,8 @@ static QImage colorize(QImage img, const QColor &col1, const QColor &col2, float
|
|
|
|
|
|
|
|
|
|
for (i=0; i<pixels; i++)
|
|
|
|
|
{
|
|
|
|
|
val = static_cast<int>(qBlue(data[i]) * contrast);
|
|
|
|
|
val2 = static_cast<int>(qGreen(data[i]) * contrast);
|
|
|
|
|
val = static_cast<int>(tqBlue(data[i]) * contrast);
|
|
|
|
|
val2 = static_cast<int>(tqGreen(data[i]) * contrast);
|
|
|
|
|
|
|
|
|
|
rval = static_cast<int>( (val2*255*3 + (255-val2)*col2.red())/255 );
|
|
|
|
|
gval = static_cast<int>( (val2*255*3 + (255-val2)*col2.green())/255 );
|
|
|
|
@ -76,12 +76,12 @@ static QImage colorize(QImage img, const QColor &col1, const QColor &col2, float
|
|
|
|
|
gval = static_cast<int>( (val *gval + (255-val)*col1.green())/255 );
|
|
|
|
|
bval = static_cast<int>( (val *bval + (255-val)*col1.blue())/255 );
|
|
|
|
|
|
|
|
|
|
if ( 255 < rval+qRed(data[i]) ) rval = 255;
|
|
|
|
|
else rval += qRed(data[i]);
|
|
|
|
|
if ( 255 < gval+qRed(data[i]) ) gval = 255;
|
|
|
|
|
else gval += qRed(data[i]);
|
|
|
|
|
if ( 255 < bval+qRed(data[i]) ) bval = 255;
|
|
|
|
|
else bval += qRed(data[i]);
|
|
|
|
|
if ( 255 < rval+tqRed(data[i]) ) rval = 255;
|
|
|
|
|
else rval += tqRed(data[i]);
|
|
|
|
|
if ( 255 < gval+tqRed(data[i]) ) gval = 255;
|
|
|
|
|
else gval += tqRed(data[i]);
|
|
|
|
|
if ( 255 < bval+tqRed(data[i]) ) bval = 255;
|
|
|
|
|
else bval += tqRed(data[i]);
|
|
|
|
|
|
|
|
|
|
if (bright != 1.0)
|
|
|
|
|
{
|
|
|
|
@ -90,21 +90,21 @@ static QImage colorize(QImage img, const QColor &col1, const QColor &col2, float
|
|
|
|
|
bval = static_cast<int>(bright*bval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data[i] = qRgba(rval, gval, bval, qAlpha(data[i]));
|
|
|
|
|
data[i] = tqRgba(rval, gval, bval, tqAlpha(data[i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return img;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KPixmap create_buttonPixmap( int x, int y, QPixmap _pix, QPixmap bg, int active, int mouse )
|
|
|
|
|
KPixmap create_buttonPixmap( int x, int y, TQPixmap _pix, TQPixmap bg, int active, int mouse )
|
|
|
|
|
{
|
|
|
|
|
QImage i;
|
|
|
|
|
KPixmap _p(QPixmap(x,y));
|
|
|
|
|
QPixmap t, pix;
|
|
|
|
|
QPainter p;
|
|
|
|
|
TQImage i;
|
|
|
|
|
KPixmap _p(TQPixmap(x,y));
|
|
|
|
|
TQPixmap t, pix;
|
|
|
|
|
TQPainter p;
|
|
|
|
|
|
|
|
|
|
if ( _pix.isNull() )
|
|
|
|
|
pix = QPixmap(kdelogo);
|
|
|
|
|
pix = TQPixmap(kdelogo);
|
|
|
|
|
else
|
|
|
|
|
pix = _pix;
|
|
|
|
|
|
|
|
|
@ -123,9 +123,9 @@ KPixmap create_buttonPixmap( int x, int y, QPixmap _pix, QPixmap bg, int active,
|
|
|
|
|
if ( !(mouse == 1 && titlebarPlain) && !(mouse == 0 && !titlebarPlain) ){ // not standard
|
|
|
|
|
i=_p;
|
|
|
|
|
if ( (mouse == 0 && titlebarPlain) || (mouse == 1 && !titlebarPlain) ){ // mouse over
|
|
|
|
|
_p.convertFromImage(KImageEffect::blend(Qt::white, i, 0.25 ));
|
|
|
|
|
_p.convertFromImage(KImageEffect::blend(TQt::white, i, 0.25 ));
|
|
|
|
|
}else{ // pressed
|
|
|
|
|
_p.convertFromImage(KImageEffect::blend(Qt::black, i, 0.25 ));
|
|
|
|
|
_p.convertFromImage(KImageEffect::blend(TQt::black, i, 0.25 ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( mouse == 2 ) { // pressed
|
|
|
|
@ -139,9 +139,9 @@ KPixmap create_buttonPixmap( int x, int y, QPixmap _pix, QPixmap bg, int active,
|
|
|
|
|
return _p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QImage image_convert( const char **b, int h){
|
|
|
|
|
QPixmap p(b);
|
|
|
|
|
QImage i;
|
|
|
|
|
TQImage image_convert( const char **b, int h){
|
|
|
|
|
TQPixmap p(b);
|
|
|
|
|
TQImage i;
|
|
|
|
|
i = p.convertToImage();
|
|
|
|
|
if ( p.height()!=h )
|
|
|
|
|
i = i.smoothScale((p.width()*h)/p.height(),h);
|
|
|
|
@ -157,8 +157,8 @@ static void create_pixmaps( )
|
|
|
|
|
|
|
|
|
|
for ( int m=0; m<2; m++ )
|
|
|
|
|
for ( int i=0; i<2; i++){
|
|
|
|
|
QColor ctb = KDecoration::options()->color(KDecoration::ColorTitleBar,i);
|
|
|
|
|
QColor ctbB = KDecoration::options()->color(KDecoration::ColorTitleBlend,i);
|
|
|
|
|
TQColor ctb = KDecoration::options()->color(KDecoration::ColorTitleBar,i);
|
|
|
|
|
TQColor ctbB = KDecoration::options()->color(KDecoration::ColorTitleBlend,i);
|
|
|
|
|
left_img[i][m] = colorize(image_convert(left_xpm, m ? 12 : PIX_HEIGHT) , ctb,
|
|
|
|
|
ctbB, 0.75 , 0.75 );
|
|
|
|
|
right_img[i][m] = colorize(image_convert(right_xpm, m ? 12 : PIX_HEIGHT) , ctb,
|
|
|
|
@ -182,23 +182,23 @@ static void create_pixmaps( )
|
|
|
|
|
for ( int m=0; m<2; m++ )
|
|
|
|
|
for ( int M=0; M<3; M++ )
|
|
|
|
|
for ( int a=0; a<2; a++ ){
|
|
|
|
|
buttonPixmap[0][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(kdelogo), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[1][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(sticky_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[2][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(question_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[3][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(iconify_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[4][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(maximze_xpm), button_img[a][m], a, M );
|
|
|
|
|
QPixmap i(button_img[a][m]);
|
|
|
|
|
QPainter p(&i);
|
|
|
|
|
buttonPixmap[0][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(kdelogo), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[1][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(sticky_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[2][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(question_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[3][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(iconify_xpm), button_img[a][m], a, M );
|
|
|
|
|
buttonPixmap[4][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(maximze_xpm), button_img[a][m], a, M );
|
|
|
|
|
TQPixmap i(button_img[a][m]);
|
|
|
|
|
TQPainter p(&i);
|
|
|
|
|
p.drawPixmap(button_img[a][m].width()-right_img[a][m].width()+BORDER_RIGHT, 0, right_img[a][m]);
|
|
|
|
|
p.end();
|
|
|
|
|
buttonPixmap[5][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, QPixmap(close_xpm), i, a, M );
|
|
|
|
|
buttonPixmap[5][a][M][m] = create_buttonPixmap( m ? 12 : PIX_HEIGHT, m ? 12 : PIX_HEIGHT, TQPixmap(close_xpm), i, a, M );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Make sure button pixmaps contrast with the current colour scheme.
|
|
|
|
|
if(qGray(KDecoration::options()->color(KDecoration::ColorTitleBar,true).rgb()) > 127)
|
|
|
|
|
btnForeground = new QColor(Qt::black);
|
|
|
|
|
if(tqGray(KDecoration::options()->color(KDecoration::ColorTitleBar,true).rgb()) > 127)
|
|
|
|
|
btnForeground = new TQColor(TQt::black);
|
|
|
|
|
else
|
|
|
|
|
btnForeground = new QColor(Qt::white);
|
|
|
|
|
btnForeground = new TQColor(TQt::white);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void delete_pixmaps()
|
|
|
|
@ -246,7 +246,7 @@ void MachBunt::init()
|
|
|
|
|
titlebarNoPlainButtons = c.readBoolEntry("TitleBarNoPlainButtons", false);
|
|
|
|
|
titlebarSidebar = c.readBoolEntry("TitleBarSideBar", false);
|
|
|
|
|
titlebarLenseButtonFlare = c.readDoubleNumEntry("titlebarLenseButtonFlare", 1.7);
|
|
|
|
|
defaultPixmap = new QPixmap(kdelogo);
|
|
|
|
|
defaultPixmap = new TQPixmap(kdelogo);
|
|
|
|
|
create_pixmaps();
|
|
|
|
|
createButtons();
|
|
|
|
|
|
|
|
|
@ -278,7 +278,7 @@ void MachBunt::createButtons()
|
|
|
|
|
connect( button[i], SIGNAL(shapeMe(int)),this, SLOT(doShape(int)));
|
|
|
|
|
connect( button[i], SIGNAL(pressed()),this, SLOT(buttonPressed()));
|
|
|
|
|
connect( button[i], SIGNAL(released()),this, SLOT(buttonReleased()));
|
|
|
|
|
connect( button[i], SIGNAL(mousePressedMove(QMouseEvent*)),this, SLOT(mouseMoveOnButtonPressed(QMouseEvent*)));
|
|
|
|
|
connect( button[i], SIGNAL(mousePressedMove(TQMouseEvent*)),this, SLOT(mouseMoveOnButtonPressed(TQMouseEvent*)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect( button[BtnHelp], SIGNAL( clicked() ), this, SLOT( showContextHelp() ));
|
|
|
|
@ -306,7 +306,7 @@ void MachBunt::reset( unsigned long changed )
|
|
|
|
|
widget()->repaint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int MachBunt::mapButton( const QChar &c)
|
|
|
|
|
int MachBunt::mapButton( const TQChar &c)
|
|
|
|
|
{
|
|
|
|
|
switch (c.latin1())
|
|
|
|
|
{
|
|
|
|
@ -324,7 +324,7 @@ int MachBunt::mapButton( const QChar &c)
|
|
|
|
|
return BtnClose;
|
|
|
|
|
}
|
|
|
|
|
// something went wrong
|
|
|
|
|
qDebug("unknown Button to map \"%c\"", c.latin1() );
|
|
|
|
|
tqDebug("unknown Button to map \"%c\"", c.latin1() );
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -332,17 +332,17 @@ void MachBunt::doLayout()
|
|
|
|
|
{
|
|
|
|
|
delete windowLayout;
|
|
|
|
|
|
|
|
|
|
windowLayout = new QVBoxLayout(widget(), 0, 0);
|
|
|
|
|
titlebar = new QSpacerItem ( 0, titleHeight, QSizePolicy::Expanding,
|
|
|
|
|
QSizePolicy::Fixed);
|
|
|
|
|
QBoxLayout *topLayout = new QBoxLayout(windowLayout, QBoxLayout::LeftToRight, 0, 0);
|
|
|
|
|
windowLayout = new TQVBoxLayout(widget(), 0, 0);
|
|
|
|
|
titlebar = new TQSpacerItem ( 0, titleHeight, TQSizePolicy::Expanding,
|
|
|
|
|
TQSizePolicy::Fixed);
|
|
|
|
|
TQBoxLayout *topLayout = new TQBoxLayout(windowLayout, TQBoxLayout::LeftToRight, 0, 0);
|
|
|
|
|
#if 0
|
|
|
|
|
bool first_left = true;
|
|
|
|
|
for ( unsigned int i = 0; i <options()->titleButtonsLeft().length(); i++)
|
|
|
|
|
{
|
|
|
|
|
int b = mapButton(options()->titleButtonsLeft()[i]);
|
|
|
|
|
if ( b>=0 ){
|
|
|
|
|
topLayout->addWidget(button[b], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[b], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[b], 0);
|
|
|
|
|
button[b]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
if( first_left )
|
|
|
|
@ -356,26 +356,26 @@ void MachBunt::doLayout()
|
|
|
|
|
topLayout->addItem(titlebar);
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
topLayout->addWidget(button[BtnMenu], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[BtnMenu], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[BtnMenu], 0);
|
|
|
|
|
button[BtnMenu]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
button[BtnMenu]->setPosition( ButtonLeft );
|
|
|
|
|
|
|
|
|
|
topLayout->addItem(titlebar);
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(button[BtnHelp], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[BtnHelp], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[BtnHelp], 0);
|
|
|
|
|
button[BtnHelp]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(button[BtnIconify], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[BtnIconify], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[BtnIconify], 0);
|
|
|
|
|
button[BtnIconify]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(button[BtnMax], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[BtnMax], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[BtnMax], 0);
|
|
|
|
|
button[BtnMax]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
|
|
|
|
|
topLayout->addWidget(button[BtnClose], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[BtnClose], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[BtnClose], 0);
|
|
|
|
|
button[BtnClose]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
button[BtnClose]->setPosition( ButtonRight );
|
|
|
|
@ -391,7 +391,7 @@ void MachBunt::doLayout()
|
|
|
|
|
{
|
|
|
|
|
int b = mapButton(options()->titleButtonsRight()[i]);
|
|
|
|
|
if ( b>=0 ){
|
|
|
|
|
topLayout->addWidget(button[b], Qt::AlignVCenter);
|
|
|
|
|
topLayout->addWidget(button[b], TQt::AlignVCenter);
|
|
|
|
|
topLayout->setStretchFactor(button[b], 0);
|
|
|
|
|
button[b]->setFixedSize(titleHeight, titleHeight);
|
|
|
|
|
last_right = button[b];
|
|
|
|
@ -401,12 +401,12 @@ void MachBunt::doLayout()
|
|
|
|
|
last_right->setPosition( ButtonRight );
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
QHBoxLayout * midLayout = new QHBoxLayout(windowLayout, 0, 0);
|
|
|
|
|
TQHBoxLayout * midLayout = new TQHBoxLayout(windowLayout, 0, 0);
|
|
|
|
|
midLayout->addSpacing(BORDER_LEFT);
|
|
|
|
|
if( isPreview())
|
|
|
|
|
midLayout->addWidget(new QLabel( i18n( "<center><b>MachBunt</b></center>" ), widget()));
|
|
|
|
|
midLayout->addWidget(new TQLabel( i18n( "<center><b>MachBunt</b></center>" ), widget()));
|
|
|
|
|
else
|
|
|
|
|
midLayout->addItem( new QSpacerItem( 0, 0 )); // no widget in the middle
|
|
|
|
|
midLayout->addItem( new TQSpacerItem( 0, 0 )); // no widget in the middle
|
|
|
|
|
midLayout->addSpacing(BORDER_RIGHT);
|
|
|
|
|
|
|
|
|
|
windowLayout->addSpacing(BORDER_BOTTOM);
|
|
|
|
@ -422,18 +422,18 @@ void MachBunt::borders(int& left, int& right, int& top, int& bottom) const
|
|
|
|
|
bottom = BORDER_BOTTOM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::mouseMoveOnButtonPressed( QMouseEvent *e )
|
|
|
|
|
void MachBunt::mouseMoveOnButtonPressed( TQMouseEvent *e )
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
|
|
|
|
if ( buttonPressedPosition.x() >= 0 ){
|
|
|
|
|
QPoint p( buttonPressedPosition.x() - geometry().x(),
|
|
|
|
|
TQPoint p( buttonPressedPosition.x() - geometry().x(),
|
|
|
|
|
buttonPressedPosition.y() - geometry().y());
|
|
|
|
|
|
|
|
|
|
if ( mousePosition(p) == KDecoration::TopLeft ||
|
|
|
|
|
mousePosition(p) == KDecoration::TopRight )
|
|
|
|
|
performMouseCommand(Options::MouseResize, QCursor::pos());
|
|
|
|
|
performMouseCommand(Options::MouseResize, TQCursor::pos());
|
|
|
|
|
else if ( mousePosition(p) == KDecoration::Top ){
|
|
|
|
|
QPoint m(geometry().x()+geometry().width()/2, geometry().y());
|
|
|
|
|
TQPoint m(geometry().x()+geometry().width()/2, geometry().y());
|
|
|
|
|
performMouseCommand(Options::MouseResize, m );
|
|
|
|
|
}
|
|
|
|
|
buttonPressedPosition.setX( -1 );
|
|
|
|
@ -445,13 +445,13 @@ void MachBunt::mouseMoveOnButtonPressed( QMouseEvent *e )
|
|
|
|
|
|
|
|
|
|
void MachBunt::buttonPressed()
|
|
|
|
|
{
|
|
|
|
|
QPoint p( QCursor::pos().x() - geometry().x(),
|
|
|
|
|
QCursor::pos().y() - geometry().y());
|
|
|
|
|
TQPoint p( TQCursor::pos().x() - geometry().x(),
|
|
|
|
|
TQCursor::pos().y() - geometry().y());
|
|
|
|
|
|
|
|
|
|
if ( mousePosition(p) == KDecorationDefines::PositionTopLeft ||
|
|
|
|
|
mousePosition(p) == KDecorationDefines::PositionTopRight ||
|
|
|
|
|
mousePosition(p) == KDecorationDefines::PositionTop )
|
|
|
|
|
buttonPressedPosition = QCursor::pos();
|
|
|
|
|
buttonPressedPosition = TQCursor::pos();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::buttonReleased()
|
|
|
|
@ -461,7 +461,7 @@ void MachBunt::buttonReleased()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KDecoration::Position
|
|
|
|
|
MachBunt::mousePosition(const QPoint & p) const
|
|
|
|
|
MachBunt::mousePosition(const TQPoint & p) const
|
|
|
|
|
{
|
|
|
|
|
int x = p.x();
|
|
|
|
|
int y = p.y();
|
|
|
|
@ -496,14 +496,14 @@ void MachBunt::slotMaximize()
|
|
|
|
|
maximize(maximizeMode() == MaximizeFull ? MaximizeRestore : MaximizeFull);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::resize( const QSize& s )
|
|
|
|
|
void MachBunt::resize( const TQSize& s )
|
|
|
|
|
{
|
|
|
|
|
widget()->resize( s );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSize MachBunt::minimumSize() const
|
|
|
|
|
TQSize MachBunt::minimumSize() const
|
|
|
|
|
{
|
|
|
|
|
return QSize( 200, 50 );
|
|
|
|
|
return TQSize( 200, 50 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask
|
|
|
|
@ -516,23 +516,23 @@ bool MachBunt::isTool()
|
|
|
|
|
return ((type==NET::Toolbar)||(type==NET::NET::Utility)||(type==NET::Menu));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MachBunt::eventFilter( QObject* o, QEvent* e )
|
|
|
|
|
bool MachBunt::eventFilter( TQObject* o, TQEvent* e )
|
|
|
|
|
{
|
|
|
|
|
if( o != widget())
|
|
|
|
|
return false;
|
|
|
|
|
switch( e->type())
|
|
|
|
|
{
|
|
|
|
|
case QEvent::Resize:
|
|
|
|
|
resizeEvent(static_cast< QResizeEvent* >( e ) );
|
|
|
|
|
case TQEvent::Resize:
|
|
|
|
|
resizeEvent(static_cast< TQResizeEvent* >( e ) );
|
|
|
|
|
return true;
|
|
|
|
|
case QEvent::Paint:
|
|
|
|
|
paintEvent(static_cast< QPaintEvent* >( e ) );
|
|
|
|
|
case TQEvent::Paint:
|
|
|
|
|
paintEvent(static_cast< TQPaintEvent* >( e ) );
|
|
|
|
|
return true;
|
|
|
|
|
case QEvent::MouseButtonDblClick:
|
|
|
|
|
mouseDoubleClickEvent(static_cast< QMouseEvent* >( e ) );
|
|
|
|
|
case TQEvent::MouseButtonDblClick:
|
|
|
|
|
mouseDoubleClickEvent(static_cast< TQMouseEvent* >( e ) );
|
|
|
|
|
return true;
|
|
|
|
|
case QEvent::MouseButtonPress:
|
|
|
|
|
processMousePressEvent(static_cast< QMouseEvent* >( e ) );
|
|
|
|
|
case TQEvent::MouseButtonPress:
|
|
|
|
|
processMousePressEvent(static_cast< TQMouseEvent* >( e ) );
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -572,13 +572,13 @@ bool BuntFactory::reset(unsigned long changed)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QValueList< BuntFactory::BorderSize > BuntFactory::borderSizes() const
|
|
|
|
|
TQValueList< BuntFactory::BorderSize > BuntFactory::borderSizes() const
|
|
|
|
|
{ // the list must be sorted
|
|
|
|
|
return QValueList< BorderSize >() << BorderNormal;
|
|
|
|
|
return TQValueList< BorderSize >() << BorderNormal;
|
|
|
|
|
// TODO << BorderLarge << BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::resizeEvent( QResizeEvent*)
|
|
|
|
|
void MachBunt::resizeEvent( TQResizeEvent*)
|
|
|
|
|
{
|
|
|
|
|
doShape();
|
|
|
|
|
|
|
|
|
@ -596,10 +596,10 @@ void MachBunt::resizeEvent( QResizeEvent*)
|
|
|
|
|
int dy = 0;
|
|
|
|
|
|
|
|
|
|
if ( e->oldSize().width() != width() )
|
|
|
|
|
dx = 32 + QABS( e->oldSize().width() - width() );
|
|
|
|
|
dx = 32 + TQABS( e->oldSize().width() - width() );
|
|
|
|
|
|
|
|
|
|
if ( e->oldSize().height() != height() )
|
|
|
|
|
dy = 8 + QABS( e->oldSize().height() - height() );
|
|
|
|
|
dy = 8 + TQABS( e->oldSize().height() - height() );
|
|
|
|
|
|
|
|
|
|
if ( dy )
|
|
|
|
|
update( 0, height() - dy + 1, width(), dy );
|
|
|
|
@ -607,10 +607,10 @@ void MachBunt::resizeEvent( QResizeEvent*)
|
|
|
|
|
if ( dx )
|
|
|
|
|
{
|
|
|
|
|
update( width() - dx + 1, 0, dx, height() );
|
|
|
|
|
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) );
|
|
|
|
|
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
|
|
|
|
update( TQRect( TQPoint(4,4), titlebar->geometry().bottomLeft() - TQPoint(1,0) ) );
|
|
|
|
|
update( TQRect( titlebar->geometry().topRight(), TQPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
|
|
|
|
// Titlebar needs no paint event
|
|
|
|
|
QApplication::postEvent( widget(), new QPaintEvent( titlebar->geometry(), FALSE ) );
|
|
|
|
|
TQApplication::postEvent( widget(), new TQPaintEvent( titlebar->geometry(), FALSE ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -624,23 +624,23 @@ void MachBunt::captionChange()
|
|
|
|
|
|
|
|
|
|
void MachBunt::iconChange()
|
|
|
|
|
{
|
|
|
|
|
button[BtnMenu]->setPixmap( icon().pixmap( QIconSet::Small, QIconSet::Normal ));
|
|
|
|
|
button[BtnMenu]->setPixmap( icon().pixmap( TQIconSet::Small, TQIconSet::Normal ));
|
|
|
|
|
|
|
|
|
|
if (button[BtnMenu]->isVisible())
|
|
|
|
|
button[BtnMenu]->repaint(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
void MachBunt::paintEvent( TQPaintEvent *pe )
|
|
|
|
|
{
|
|
|
|
|
// bool hicolor = QPixmap::defaultDepth() > 8;
|
|
|
|
|
// bool hicolor = TQPixmap::defaultDepth() > 8;
|
|
|
|
|
int fontoffset = 1;
|
|
|
|
|
|
|
|
|
|
QPainter p(widget());
|
|
|
|
|
TQPainter p(widget());
|
|
|
|
|
p.setClipRegion(pe->region());
|
|
|
|
|
|
|
|
|
|
// Obtain widget bounds.
|
|
|
|
|
QRect r(widget()->rect());
|
|
|
|
|
TQRect r(widget()->rect());
|
|
|
|
|
int i;
|
|
|
|
|
int x = r.x();
|
|
|
|
|
int y = r.y();
|
|
|
|
@ -649,7 +649,7 @@ void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
int w = r.width();
|
|
|
|
|
int ps = smallButtons ? PIX_SIDE/2 : PIX_SIDE;
|
|
|
|
|
|
|
|
|
|
QColorGroup g = options()->colorGroup(KDecorationDefines::ColorFrame, isActive());
|
|
|
|
|
TQColorGroup g = options()->colorGroup(KDecorationDefines::ColorFrame, isActive());
|
|
|
|
|
|
|
|
|
|
p.setPen( g.dark() );
|
|
|
|
|
// the dark outer drawings
|
|
|
|
@ -676,7 +676,7 @@ void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
|
|
|
|
|
// draw the title bar.
|
|
|
|
|
r = titlebar->geometry();
|
|
|
|
|
// QFontMetrics fm(options()->font(true));
|
|
|
|
|
// TQFontMetrics fm(options()->font(true));
|
|
|
|
|
|
|
|
|
|
KPixmap titleBuffer;
|
|
|
|
|
if ( titlebarSidebar )
|
|
|
|
@ -685,7 +685,7 @@ void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
titleBuffer.resize(w, titleHeight);
|
|
|
|
|
KIconEffect kie;
|
|
|
|
|
|
|
|
|
|
QPainter p2( &titleBuffer, widget());
|
|
|
|
|
TQPainter p2( &titleBuffer, widget());
|
|
|
|
|
|
|
|
|
|
p2.drawTiledPixmap( ps, 0, titleBuffer.width()-2*ps, titleHeight, middle_img[isActive()][smallButtons]);
|
|
|
|
|
p2.drawTiledPixmap( 0, 0, ps, titleHeight, left_img[isActive()][smallButtons]);
|
|
|
|
@ -706,11 +706,11 @@ void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
p2.drawTiledPixmap(l-titleHeight/2, 0, titleHeight-(titleHeight/2), titleHeight, button_img[isActive()][smallButtons], titleHeight/2, 0);
|
|
|
|
|
|
|
|
|
|
// Reduce the font size and weight for toolwindows.
|
|
|
|
|
QFont font = options()->font(true);
|
|
|
|
|
TQFont font = options()->font(true);
|
|
|
|
|
if ( smallButtons )
|
|
|
|
|
{
|
|
|
|
|
font.setPointSize( font.pointSize() - 2 );
|
|
|
|
|
font.setWeight( QFont::Normal );
|
|
|
|
|
font.setWeight( TQFont::Normal );
|
|
|
|
|
fontoffset = 0;
|
|
|
|
|
}
|
|
|
|
|
p2.setFont( font );
|
|
|
|
@ -731,13 +731,13 @@ void MachBunt::paintEvent( QPaintEvent *pe )
|
|
|
|
|
p.drawPixmap( 0, 0, titleBuffer );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::showEvent(QShowEvent *)
|
|
|
|
|
void MachBunt::showEvent(TQShowEvent *)
|
|
|
|
|
{
|
|
|
|
|
doShape();
|
|
|
|
|
widget()->repaint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MachBunt::mouseDoubleClickEvent( QMouseEvent * e )
|
|
|
|
|
void MachBunt::mouseDoubleClickEvent( TQMouseEvent * e )
|
|
|
|
|
{
|
|
|
|
|
if (titlebar->geometry().contains( e->pos() ) )
|
|
|
|
|
titlebarDblClickOperation();
|
|
|
|
@ -821,7 +821,7 @@ void MachBunt::calcHiddenButtons()
|
|
|
|
|
void MachBunt::menuButtonPressed()
|
|
|
|
|
{
|
|
|
|
|
// KS - move the menu left by 3 pixels, and down 2 pixels.
|
|
|
|
|
QPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-3,
|
|
|
|
|
TQPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-3,
|
|
|
|
|
button[BtnMenu]->rect().bottomLeft().y()+2 );
|
|
|
|
|
KDecorationFactory* f = factory();
|
|
|
|
|
showWindowMenu( button[BtnMenu]->mapToGlobal( menupoint ));
|
|
|
|
@ -832,7 +832,7 @@ void MachBunt::menuButtonPressed()
|
|
|
|
|
|
|
|
|
|
void MachBunt::doShape(int x)
|
|
|
|
|
{
|
|
|
|
|
QRegion mask(0, 0, width(), height());
|
|
|
|
|
TQRegion mask(0, 0, width(), height());
|
|
|
|
|
|
|
|
|
|
int bWidth = smallButtons ? 12 : PIX_HEIGHT;
|
|
|
|
|
int i, bl=0, br=0, p=0;
|
|
|
|
@ -845,40 +845,40 @@ void MachBunt::doShape(int x)
|
|
|
|
|
p=2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mask -= QRegion(0, 0, bl+3, 1);
|
|
|
|
|
mask -= QRegion(0, 1, bl+1, 1);
|
|
|
|
|
mask -= TQRegion(0, 0, bl+3, 1);
|
|
|
|
|
mask -= TQRegion(0, 1, bl+1, 1);
|
|
|
|
|
|
|
|
|
|
// Remove top-right corner.
|
|
|
|
|
if ( smallButtons ){
|
|
|
|
|
mask -= QRegion(r-3-br, 0, 3+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-2-br, 1, 2+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-1-br, 2, 1+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-3-br, 0, 3+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-2-br, 1, 2+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-1-br, 2, 1+br, 1+p);
|
|
|
|
|
}else{
|
|
|
|
|
mask -= QRegion(r-7-br, 0, 7+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-5-br, 1, 5+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-4-br, 2, 4+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-3-br, 3, 3+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-2-br, 4, 2+br, 1+p);
|
|
|
|
|
mask -= QRegion(r-1-br, 5, 1+br, 2+p);
|
|
|
|
|
mask -= TQRegion(r-7-br, 0, 7+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-5-br, 1, 5+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-4-br, 2, 4+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-3-br, 3, 3+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-2-br, 4, 2+br, 1+p);
|
|
|
|
|
mask -= TQRegion(r-1-br, 5, 1+br, 2+p);
|
|
|
|
|
}
|
|
|
|
|
for ( i=0; i<br; i++)
|
|
|
|
|
mask -= QRegion(r-i-1, 0, 1, PIX_CORNER_RADIUS+bl+br-i);
|
|
|
|
|
mask -= TQRegion(r-i-1, 0, 1, PIX_CORNER_RADIUS+bl+br-i);
|
|
|
|
|
|
|
|
|
|
// the buttons
|
|
|
|
|
for ( i=0; i<BtnCount; i++){
|
|
|
|
|
if ( button[i] && button[i]->isShown() ){
|
|
|
|
|
// top left corner of this button and right part of the button before
|
|
|
|
|
mask -= QRegion( button[i]->x() - 3, 0, 4, 1 );
|
|
|
|
|
mask -= QRegion( button[i]->x() - 1, 0, 1, 2 );
|
|
|
|
|
mask -= TQRegion( button[i]->x() - 3, 0, 4, 1 );
|
|
|
|
|
mask -= TQRegion( button[i]->x() - 1, 0, 1, 2 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the pressed button
|
|
|
|
|
if ( x != 0 ){
|
|
|
|
|
mask -= QRegion( x, 0, bWidth, 2 );
|
|
|
|
|
mask -= QRegion( x, 0, 1, 3 );
|
|
|
|
|
mask -= QRegion( x + bWidth -3 , 0, 3, 3 );
|
|
|
|
|
mask -= QRegion( x + bWidth -1 , 0, 1, 4 );
|
|
|
|
|
mask -= TQRegion( x, 0, bWidth, 2 );
|
|
|
|
|
mask -= TQRegion( x, 0, 1, 3 );
|
|
|
|
|
mask -= TQRegion( x + bWidth -3 , 0, 3, 3 );
|
|
|
|
|
mask -= TQRegion( x + bWidth -1 , 0, 1, 4 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setMask(mask);
|
|
|
|
|