876
810
if(opts.contrast<0 || opts.contrast>10)
879
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), itsMenuitemCols);
813
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), itsHighlightCols);
880
814
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Background), itsBackgroundCols);
881
815
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Button), itsButtonCols);
883
if(SHADE_SELECTED==opts.shadeSliders)
884
itsSliderCols=itsMenuitemCols;
885
else if(SHADE_NONE!=opts.shadeSliders)
887
itsSliderCols=new QColor [TOTAL_SHADES+1];
888
shadeColors(SHADE_BLEND_SELECTED==opts.shadeSliders
889
? midColor(itsMenuitemCols[ORIGINAL_SHADE],
890
itsButtonCols[ORIGINAL_SHADE])
891
: opts.customSlidersColor,
895
if(IND_TINT==opts.defBtnIndicator)
897
itsDefBtnCols=new QColor [TOTAL_SHADES+1];
898
shadeColors(tint(itsButtonCols[ORIGINAL_SHADE],
899
itsMenuitemCols[ORIGINAL_SHADE]), itsDefBtnCols);
901
else/* if(IND_COLORED==opts.defBtnIndicator)*/
903
if(SHADE_BLEND_SELECTED==opts.shadeSliders)
904
itsDefBtnCols=itsSliderCols;
817
// Set defaults for Hover and Focus, these will be changed when KDE4 palette is applied...
818
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), itsFocusCols);
819
if(opts.coloredMouseOver)
821
itsMouseOverCols=new QColor [TOTAL_SHADES+1];
822
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), itsMouseOverCols);
825
switch(opts.shadeSliders)
832
itsSliderCols=itsHighlightCols;
834
case SHADE_BLEND_SELECTED:
837
itsSliderCols=new QColor [TOTAL_SHADES+1];
838
shadeColors(SHADE_BLEND_SELECTED==opts.shadeSliders
839
? midColor(itsHighlightCols[ORIGINAL_SHADE],
840
itsButtonCols[ORIGINAL_SHADE])
841
: opts.customSlidersColor,
845
switch(opts.defBtnIndicator)
848
itsDefBtnCols=itsFocusCols;
907
851
itsDefBtnCols=new QColor [TOTAL_SHADES+1];
908
shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
909
itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
913
if(opts.coloredMouseOver || IND_CORNER==opts.defBtnIndicator || IND_GLOW==opts.defBtnIndicator)
914
if(itsDefBtnCols && IND_TINT!=opts.defBtnIndicator)
915
itsMouseOverCols=itsDefBtnCols;
918
itsMouseOverCols=new QColor [TOTAL_SHADES+1];
919
shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
920
itsButtonCols[ORIGINAL_SHADE]), itsMouseOverCols);
852
shadeColors(tint(itsButtonCols[ORIGINAL_SHADE],
853
itsHighlightCols[ORIGINAL_SHADE], QTC_DEF_BNT_TINT), itsDefBtnCols);
858
if(SHADE_BLEND_SELECTED==opts.shadeSliders)
859
itsDefBtnCols=itsSliderCols;
862
itsDefBtnCols=new QColor [TOTAL_SHADES+1];
863
shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
864
itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
868
switch(opts.comboBtn)
875
itsComboBtnCols=itsHighlightCols;
877
case SHADE_BLEND_SELECTED:
878
if(opts.shadeSliders==SHADE_BLEND_SELECTED)
880
itsComboBtnCols=itsSliderCols;
884
if(opts.shadeSliders==SHADE_CUSTOM && opts.customSlidersColor==opts.customComboBtnColor)
886
itsComboBtnCols=itsSliderCols;
890
itsComboBtnCols=new QColor [TOTAL_SHADES+1];
891
shadeColors(SHADE_BLEND_SELECTED==opts.comboBtn
892
? midColor(itsHighlightCols[ORIGINAL_SHADE],
893
itsButtonCols[ORIGINAL_SHADE])
894
: opts.customComboBtnColor,
923
898
setMenuColors(QApplication::palette().color(QPalette::Active, QPalette::Background));
925
900
if(USE_LIGHTER_POPUP_MENU)
3812
3873
case Qt::BottomLeftCorner:
3814
for (int i = 0; i < 4; ++i)
3816
// painter->setPen(QPen(itsBackgroundCols[0], 1));
3817
// painter->drawLine(x, sy - 1 , sx + 1, sw);
3818
painter->setPen(QPen(itsBackgroundCols[dark], 1));
3819
painter->drawLine(x, sy, sx, sw);
3874
triangle.putPoints(0, 3, 0,0, size,size, 0,size);
3875
triangle.translate(r.x(), r.y()+(r.height()-(SIZE_GRIP_SIZE-1)));
3824
3877
case Qt::BottomRightCorner:
3825
for (int i = 0; i < 4; ++i)
3827
// painter->setPen(QPen(itsBackgroundCols[0], 1));
3828
// painter->drawLine(sx - 1, sw, sw, sy - 1);
3829
painter->setPen(QPen(itsBackgroundCols[dark], 1));
3830
painter->drawLine(sx, sw, sw, sy);
3878
triangle.putPoints(0, 3, size,0, size,size, 0,size);
3879
triangle.translate(r.x()+(r.width()-(SIZE_GRIP_SIZE-1)), r.y()+(r.height()-(SIZE_GRIP_SIZE-1)));
3835
3881
case Qt::TopRightCorner:
3837
for (int i = 0; i < 4; ++i)
3839
// painter->setPen(QPen(itsBackgroundCols[0], 1));
3840
// painter->drawLine(sx - 1, y, sw, sy + 1);
3841
painter->setPen(QPen(itsBackgroundCols[dark], 1));
3842
painter->drawLine(sx, y, sw, sy);
3882
triangle.putPoints(0, 3, 0,0, size,0, size,size);
3883
triangle.translate(r.x()+(r.width()-(SIZE_GRIP_SIZE-1)), r.y());
3847
3885
case Qt::TopLeftCorner:
3848
for (int i = 0; i < 4; ++i)
3850
// painter->setPen(QPen(itsBackgroundCols[0], 1));
3851
// painter->drawLine(x, sy - 1, sx - 1, y);
3852
painter->setPen(QPen(itsBackgroundCols[dark], 1));
3853
painter->drawLine(x, sy, sx, y);
3886
triangle.putPoints(0, 3, 0,0, size,0, 0,size);
3887
triangle.translate(r.x(), r.y());
3858
painter->setRenderHint(QPainter::Antialiasing, false);
3890
painter->setPen(itsBackgroundCols[2]);
3891
painter->setBrush(itsBackgroundCols[2]);
3892
painter->drawPolygon(triangle);
3859
3893
painter->restore();
4032
4069
if(-1==ho->section && !(state&State_Enabled) && widget && widget->isEnabled())
4033
4070
opt.state|=State_Enabled;
4035
drawBevelGradient(getFill(&opt, itsBackgroundCols), painter, r,
4072
drawBevelGradient(getFill(&opt, use), painter, r,
4036
4073
Qt::Horizontal==ho->orientation,
4037
4074
sunken, opts.lvAppearance, WIDGET_LISTVIEW_HEADER);
4039
4076
painter->setRenderHint(QPainter::Antialiasing, true);
4040
4077
if(APPEARANCE_RAISED==opts.lvAppearance)
4042
painter->setPen(itsBackgroundCols[4]);
4079
painter->setPen(use[4]);
4043
4080
if(Qt::Horizontal==ho->orientation)
4044
4081
drawAaLine(painter, r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2);
4046
4083
drawAaLine(painter, r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
4049
const QColor *border(borderColors(&opt, NULL));
4051
4086
if(Qt::Horizontal==ho->orientation)
4055
painter->setPen(border[ORIGINAL_SHADE]);
4056
drawAaLine(painter, r.x(), r.y()+r.height()-2, r.x()+r.width()-1,
4057
r.y()+r.height()-2);
4058
painter->setPen(border[QT_STD_BORDER]);
4061
painter->setPen(itsBackgroundCols[QT_STD_BORDER]);
4088
painter->setPen(use[QT_STD_BORDER]);
4062
4089
drawAaLine(painter, r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1);
4090
if(itsMouseOverCols && opts.coloredMouseOver && state&State_MouseOver && state&State_Enabled)
4091
drawHighlight(painter, QRect(r.x(), r.y()+r.height()-2, r.width(), 2), true, true);
4065
4094
(QStyleOptionHeader::End!=ho->position && QStyleOptionHeader::OnlyOneSection!=ho->position))
4067
4096
drawFadedLine(painter, QRect(r.x()+r.width()-2, r.y()+5, 1, r.height()-10),
4068
itsBackgroundCols[QT_STD_BORDER], true, true, false);
4097
use[QT_STD_BORDER], true, true, false);
4069
4098
drawFadedLine(painter, QRect(r.x()+r.width()-1, r.y()+5, 1, r.height()-10),
4070
itsBackgroundCols[0], true, true, false);
4099
use[0], true, true, false);
4077
painter->setPen(border[ORIGINAL_SHADE]);
4078
drawAaLine(painter, r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
4079
painter->setPen(border[QT_STD_BORDER]);
4082
painter->setPen(itsBackgroundCols[QT_STD_BORDER]);
4104
painter->setPen(use[QT_STD_BORDER]);
4083
4105
drawAaLine(painter, r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1);
4086
4108
(QStyleOptionHeader::End!=ho->position && QStyleOptionHeader::OnlyOneSection!=ho->position))
4088
painter->setPen(itsBackgroundCols[QT_STD_BORDER]);
4110
painter->setPen(use[QT_STD_BORDER]);
4089
4111
drawAaLine(painter, r.x()+5, r.y()+r.height()-2, r.x()+r.width()-6,
4090
4112
r.y()+r.height()-2);
4091
painter->setPen(itsBackgroundCols[0]);
4113
painter->setPen(use[0]);
4092
4114
drawAaLine(painter, r.x()+5, r.y()+r.height()-1, r.x()+r.width()-6,
4093
4115
r.y()+r.height()-1);
4117
if(itsMouseOverCols && opts.coloredMouseOver && state&State_MouseOver && state&State_Enabled)
4118
drawHighlight(painter, QRect(r.x(), r.y()+r.height()-3, r.width(), 2), true, true);
4096
4120
painter->setRenderHint(QPainter::Antialiasing, false);
4099
painter->fillRect(r, getFill(option, itsBackgroundCols));
4123
painter->fillRect(r, getFill(option, use));
4100
4124
painter->restore();
5059
5120
if(opts.highlightTab)
5122
QColor col(itsHighlightCols[0]);
5061
5123
painter->setRenderHint(QPainter::Antialiasing, true);
5062
painter->setPen(itsMenuitemCols[0]);
5063
drawAaLine(painter, r.left()+1, r.top()+1, r.right()-1, r.top()+1);
5064
painter->setPen(midColor(fill, itsMenuitemCols[0], IS_FLAT(opts.activeTabAppearance) ? 1.0 : 1.2));
5124
painter->setPen(col);
5125
drawAaLine(painter, r.left()+highlightOffset, r.top()+1, r.right()-highlightOffset, r.top()+1);
5127
painter->setPen(col);
5065
5128
drawAaLine(painter, r.left()+1, r.top()+2, r.right()-1, r.top()+2);
5066
5129
painter->setRenderHint(QPainter::Antialiasing, false);
5130
painter->setClipRect(QRect(r.x(), r.y(), r.width(), highlightBorder));
5131
drawBorder(painter, r, option, ROUNDED_ALL, itsHighlightCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5068
painter->setClipRect(QRect(r.x(), r.y(), r.width(), 3));
5069
drawBorder(painter, r, option, ROUNDED_ALL, itsMenuitemCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5072
else if(mouseOver && opts.coloredMouseOver)
5074
painter->setRenderHint(QPainter::Antialiasing, true);
5075
painter->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
5076
drawAaLine(painter, r.x()+(firstTab ? moOffset : 1), r.y()+1,
5077
r.x()+r.width()-((lastTab ? moOffset : 0)+1), r.y()+1);
5078
painter->setPen(itsMouseOverCols[QT_STD_BORDER]);
5079
drawAaLine(painter, r.x()+(firstTab ? moOffset : 1), r.y(),
5080
r.x()+r.width()-((lastTab ? moOffset : 0)+1), r.y());
5081
painter->setRenderHint(QPainter::Antialiasing, false);
5134
if(opts.colorSelTab)
5135
colorTab(painter, r, true, WIDGET_TAB_TOP, round);
5137
else if(mouseOver && opts.coloredMouseOver && TAB_MO_GLOW!=opts.tabMouseOver)
5138
drawHighlight(painter, QRect(r.x()+(firstTab ? moOffset : 1),
5139
r.y()+(TAB_MO_TOP==opts.tabMouseOver ? 0 : r.height()-1),
5140
r.width()-(firstTab || lastTab ? moOffset : 1), 2),
5141
true, TAB_MO_TOP==opts.tabMouseOver);
5085
5144
case QTabBar::RoundedSouth:
5086
5145
case QTabBar::TriangularSouth:
5088
int round=selected || onlyTab
5147
int round=selected || onlyTab || TAB_MO_GLOW==opts.tabMouseOver || opts.roundAllTabs
5089
5148
? ROUNDED_BOTTOM
5091
5150
? ROUNDED_BOTTOMLEFT
5126
5187
if(opts.highlightTab)
5189
QColor col(itsHighlightCols[0]);
5128
5190
painter->setRenderHint(QPainter::Antialiasing, true);
5129
painter->setPen(itsMenuitemCols[0]);
5130
drawAaLine(painter, r.left()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
5131
painter->setPen(midColor(fill, itsMenuitemCols[0]));
5191
painter->setPen(col);
5192
drawAaLine(painter, r.left()+highlightOffset, r.bottom()-1, r.right()-highlightOffset, r.bottom()-1);
5194
painter->setPen(col);
5132
5195
drawAaLine(painter, r.left()+1, r.bottom()-2, r.right()-1, r.bottom()-2);
5133
5196
painter->setRenderHint(QPainter::Antialiasing, false);
5197
painter->setClipRect(QRect(r.x(), r.y()+r.height()-highlightBorder, r.width(), r.y()+r.height()-1));
5198
drawBorder(painter, r, option, ROUNDED_ALL, itsHighlightCols, WIDGET_TAB_BOT, BORDER_FLAT, false, 3);
5135
painter->setClipRect(QRect(r.x(), r.y()+r.height()-3, r.width(), r.y()+r.height()-1));
5136
drawBorder(painter, r, option, ROUNDED_ALL, itsMenuitemCols, WIDGET_TAB_BOT, BORDER_FLAT, false, 3);
5139
else if(mouseOver && opts.coloredMouseOver)
5141
painter->setRenderHint(QPainter::Antialiasing, true);
5142
painter->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
5143
drawAaLine(painter, r.x()+(firstTab ? moOffset : 1), r.bottom()-1,
5144
r.x()+r.width()-((lastTab ? moOffset : 0)+1), r.bottom()-1);
5145
painter->setPen(itsMouseOverCols[QT_STD_BORDER]);
5146
drawAaLine(painter, r.x()+(firstTab ? moOffset : 1), r.bottom(),
5147
r.x()+r.width()-((lastTab ? moOffset : 0)+1), r.bottom());
5148
painter->setRenderHint(QPainter::Antialiasing, false);
5201
if(opts.colorSelTab)
5202
colorTab(painter, r, true, WIDGET_TAB_BOT, round);
5204
else if(mouseOver && opts.coloredMouseOver && TAB_MO_GLOW!=opts.tabMouseOver)
5205
drawHighlight(painter, QRect(r.x()+(firstTab ? moOffset : 1),
5206
r.y()+(TAB_MO_TOP==opts.tabMouseOver ? r.height()-2 : -1),
5207
r.width()-(firstTab || lastTab ? moOffset : 1), 2),
5208
true, TAB_MO_TOP!=opts.tabMouseOver);
5152
5211
case QTabBar::RoundedWest:
5153
5212
case QTabBar::TriangularWest:
5155
int round=selected || onlyTab
5214
int round=selected || onlyTab || TAB_MO_GLOW==opts.tabMouseOver || opts.roundAllTabs
5158
5217
? ROUNDED_TOPLEFT
5193
5254
if(opts.highlightTab)
5256
QColor col(itsHighlightCols[0]);
5195
5257
painter->setRenderHint(QPainter::Antialiasing, true);
5196
painter->setPen(itsMenuitemCols[0]);
5197
drawAaLine(painter, r.left()+1, r.top()+1, r.left()+1, r.bottom()-1);
5198
painter->setPen(midColor(fill, itsMenuitemCols[0], IS_FLAT(opts.activeTabAppearance) ? 1.0 : 1.2));
5258
painter->setPen(col);
5259
drawAaLine(painter, r.left()+1, r.top()+highlightOffset, r.left()+1, r.bottom()-highlightOffset);
5261
painter->setPen(col);
5199
5262
drawAaLine(painter, r.left()+2, r.top()+1, r.left()+2, r.bottom()-1);
5200
5263
painter->setRenderHint(QPainter::Antialiasing, false);
5264
painter->setClipRect(QRect(r.x(), r.y(), highlightBorder, r.height()));
5265
drawBorder(painter, r, option, ROUNDED_ALL, itsHighlightCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5202
painter->setClipRect(QRect(r.x(), r.y(), 3, r.height()));
5203
drawBorder(painter, r, option, ROUNDED_ALL, itsMenuitemCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5206
else if(mouseOver && opts.coloredMouseOver)
5208
painter->setRenderHint(QPainter::Antialiasing, true);
5209
painter->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
5210
drawAaLine(painter, r.x()+1, r.y()+(firstTab ? moOffset : 1),
5211
r.x()+1, r.y()+r.height()-((lastTab ? moOffset : 0)+1));
5212
painter->setPen(itsMouseOverCols[QT_STD_BORDER]);
5213
drawAaLine(painter, r.x(), r.y()+(firstTab ? moOffset : 1),
5214
r.x(), r.y()+r.height()-((lastTab ? moOffset : 0)+1));
5215
painter->setRenderHint(QPainter::Antialiasing, false);
5268
if(opts.colorSelTab)
5269
colorTab(painter, r, false, WIDGET_TAB_TOP, round);
5271
else if(mouseOver && opts.coloredMouseOver && TAB_MO_GLOW!=opts.tabMouseOver)
5272
drawHighlight(painter, QRect(r.x()+(TAB_MO_TOP==opts.tabMouseOver ? 0 : r.width()-1),
5273
r.y()+(firstTab ? moOffset : 1),
5274
2, r.height()-(firstTab || lastTab ? moOffset : 1)),
5275
false, TAB_MO_TOP==opts.tabMouseOver);
5219
5278
case QTabBar::RoundedEast:
5220
5279
case QTabBar::TriangularEast:
5222
int round=selected || onlyTab
5281
int round=selected || onlyTab || TAB_MO_GLOW==opts.tabMouseOver || opts.roundAllTabs
5223
5282
? ROUNDED_RIGHT
5225
5284
? ROUNDED_TOPRIGHT
5260
5321
if(opts.highlightTab)
5323
QColor col(itsHighlightCols[0]);
5262
5324
painter->setRenderHint(QPainter::Antialiasing, true);
5263
painter->setPen(itsMenuitemCols[0]);
5264
drawAaLine(painter, r.right()-1, r.top()+1, r.right()-1, r.bottom()-1);
5265
painter->setPen(midColor(fill, itsMenuitemCols[0]));
5325
painter->setPen(col);
5326
drawAaLine(painter, r.right()-1, r.top()+highlightOffset, r.right()-1, r.bottom()-highlightOffset);
5328
painter->setPen(col);
5266
5329
drawAaLine(painter, r.right()-2, r.top()+1, r.right()-2, r.bottom()-1);
5267
5330
painter->setRenderHint(QPainter::Antialiasing, false);
5331
painter->setClipRect(QRect(r.x()+r.width()-highlightBorder, r.y(), r.x()+r.width()-1, r.height()));
5332
drawBorder(painter, r, option, ROUNDED_ALL, itsHighlightCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5269
painter->setClipRect(QRect(r.x()+r.width()-3, r.y(), r.x()+r.width()-1, r.height()));
5270
drawBorder(painter, r, option, ROUNDED_ALL, itsMenuitemCols, WIDGET_TAB_TOP, BORDER_FLAT, false, 3);
5273
else if(mouseOver && opts.coloredMouseOver)
5275
painter->setRenderHint(QPainter::Antialiasing, true);
5276
painter->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
5277
drawAaLine(painter, r.right()-1, r.y()+(firstTab ? moOffset : 1),
5278
r.right()-1, r.y()+r.height()-((lastTab ? moOffset : 0)+1));
5279
painter->setPen(itsMouseOverCols[QT_STD_BORDER]);
5280
drawAaLine(painter, r.right(), r.y()+(firstTab ? moOffset : 1),
5281
r.right(), r.y()+r.height()-((lastTab ? moOffset : 0)+1));
5282
painter->setRenderHint(QPainter::Antialiasing, false);
5335
if(opts.colorSelTab)
5336
colorTab(painter, r, false, WIDGET_TAB_BOT, round);
5338
else if(mouseOver && opts.coloredMouseOver && TAB_MO_GLOW!=opts.tabMouseOver)
5339
drawHighlight(painter, QRect(r.x()+(TAB_MO_TOP==opts.tabMouseOver ? r.width()-2 : -1),
5340
r.y()+(firstTab ? moOffset : 1),
5341
2, r.height()-(firstTab || lastTab ? moOffset : 1)),
5342
false, TAB_MO_TOP!=opts.tabMouseOver);
6269
6371
if(state&QtC_StateKWinHighlight)
6270
6372
opt.state|=QtC_StateKWinHighlight;
6272
if(APP_KWIN!=theThemedApp && roundKWinFull) // Set clipping for preview in kcmshell...
6274
int x(r.x()), y(r.y()), w(r.width()), h(r.height());
6275
QRegion mask(x+5, y+0, w-10, h);
6277
mask += QRegion(x+0, y+5, 1, h-6);
6278
mask += QRegion(x+1, y+3, 1, h-3);
6279
mask += QRegion(x+2, y+2, 1, h-2);
6280
mask += QRegion(x+3, y+1, 2, h-1);
6282
mask += QRegion(x+w-1, y+5, 1, h-6);
6283
mask += QRegion(x+w-2, y+3, 1, h-3);
6284
mask += QRegion(x+w-3, y+2, 1, h-2);
6285
mask += QRegion(x+w-5, y+1, 2, h-1);
6286
painter->setClipRegion(mask);
6289
drawLightBevel(painter, r, &opt, widget,
6290
titleBar->titleBarState&State_Raised
6292
: titleBar->titleBarState&State_Enabled
6295
btnCols[ORIGINAL_SHADE], btnCols, true,
6296
titleBar->titleBarState&Qt::WindowMinimized ? WIDGET_MDI_WINDOW : WIDGET_MDI_WINDOW_TITLE);
6300
bool kwinHighlight(state&QtC_StateKWinHighlight);
6301
QColor col(kwinHighlight ? itsMenuitemCols[0] : btnCols[QT_STD_BORDER]);
6303
painter->setPen(col);
6305
if(kwinHighlight || (state&QtC_StateKWinShadows))
6307
painter->drawPoint(r.x()+3, r.y()+1);
6308
painter->drawPoint(r.x()+1, r.y()+3);
6309
painter->drawPoint(r.x()+r.width()-4, r.y()+1);
6310
painter->drawPoint(r.x()+r.width()-2, r.y()+3);
6312
painter->setPen(col);
6313
painter->drawPoint(r.x()+2, r.y()+2);
6314
painter->drawPoint(r.x()+4, r.y()+1);
6315
painter->drawPoint(r.x()+1, r.y()+4);
6316
painter->drawPoint(r.x()+r.width()-3, r.y()+2);
6317
painter->drawPoint(r.x()+r.width()-5, r.y()+1);
6318
painter->drawPoint(r.x()+r.width()-2, r.y()+4);
6322
painter->drawLine(r.x()+1, r.y()+4, r.x()+1, r.y()+3);
6323
painter->drawPoint(r.x()+2, r.y()+2);
6324
painter->drawLine(r.x()+3, r.y()+1, r.x()+4, r.y()+1);
6325
painter->drawLine(r.x()+r.width()-2, r.y()+4, r.x()+r.width()-2, r.y()+3);
6326
painter->drawPoint(r.x()+r.width()-3, r.y()+2);
6327
painter->drawLine(r.x()+r.width()-4, r.y()+1, r.x()+r.width()-5, r.y()+1);
6329
if(APPEARANCE_SHINY_GLASS!=(active ? opts.titlebarAppearance : opts.inactiveTitlebarAppearance))
6374
// if(APP_KWIN!=theThemedApp && roundKWinFull) // Set clipping for preview in kcmshell...
6376
// int x(r.x()), y(r.y()), w(r.width()), h(r.height());
6377
// QRegion mask(x+5, y+0, w-10, h);
6379
// mask += QRegion(x+0, y+5, 1, h-6);
6380
// mask += QRegion(x+1, y+3, 1, h-3);
6381
// mask += QRegion(x+2, y+2, 1, h-2);
6382
// mask += QRegion(x+3, y+1, 2, h-1);
6384
// mask += QRegion(x+w-1, y+5, 1, h-6);
6385
// mask += QRegion(x+w-2, y+3, 1, h-3);
6386
// mask += QRegion(x+w-3, y+2, 1, h-2);
6387
// mask += QRegion(x+w-5, y+1, 2, h-1);
6388
// painter->setClipRegion(mask);
6391
if(state&QtCStateKWinNoBorder)
6392
drawBevelGradient(titleCols[ORIGINAL_SHADE], painter, r, true, false,
6393
widgetApp(WIDGET_MDI_WINDOW, &opts, option->state&State_Active), WIDGET_MDI_WINDOW);
6396
drawLightBevel(painter, r, &opt, widget,
6397
titleBar->titleBarState&State_Raised
6399
: titleBar->titleBarState&State_Enabled
6402
titleCols[ORIGINAL_SHADE], titleCols, true,
6403
titleBar->titleBarState&Qt::WindowMinimized ? WIDGET_MDI_WINDOW : WIDGET_MDI_WINDOW_TITLE);
6405
if(opts.titlebarBorder)
6331
6407
painter->setPen(btnCols[0]);
6332
painter->drawLine(r.x()+2, r.y()+4, r.x()+2, r.y()+3);
6333
painter->drawLine(r.x()+3, r.y()+2, r.x()+4, r.y()+2);
6334
//painter->drawLine(r.x()+r.width()-3, r.y()+4, r.x()+r.width()-3, r.y()+3);
6335
painter->drawLine(r.x()+r.width()-4, r.y()+2, r.x()+r.width()-5, r.y()+2);
6408
painter->drawPoint(r.x()+1, r.y()+r.height()-1);
6413
bool kwinHighlight(state&QtC_StateKWinHighlight);
6414
QColor col(kwinHighlight ? itsFocusCols[0] : btnCols[QT_STD_BORDER]);
6416
painter->setPen(col);
6418
if(kwinHighlight || (state&QtC_StateKWinShadows))
6420
painter->drawPoint(r.x()+3, r.y()+1);
6421
painter->drawPoint(r.x()+1, r.y()+3);
6422
painter->drawPoint(r.x()+r.width()-4, r.y()+1);
6423
painter->drawPoint(r.x()+r.width()-2, r.y()+3);
6424
// painter->drawPoint(r.x()+r.width()-1, r.y()+6);
6426
painter->setPen(col);
6427
painter->drawPoint(r.x()+2, r.y()+2);
6428
painter->drawPoint(r.x()+4, r.y()+1);
6429
painter->drawPoint(r.x()+1, r.y()+4);
6430
painter->drawPoint(r.x()+r.width()-3, r.y()+2);
6431
painter->drawPoint(r.x()+r.width()-5, r.y()+1);
6432
painter->drawPoint(r.x()+r.width()-2, r.y()+4);
6436
painter->drawLine(r.x()+1, r.y()+4, r.x()+1, r.y()+3);
6437
painter->drawPoint(r.x()+2, r.y()+2);
6438
painter->drawLine(r.x()+3, r.y()+1, r.x()+4, r.y()+1);
6439
painter->drawLine(r.x()+r.width()-2, r.y()+4, r.x()+r.width()-2, r.y()+3);
6440
painter->drawPoint(r.x()+r.width()-3, r.y()+2);
6441
painter->drawLine(r.x()+r.width()-4, r.y()+1, r.x()+r.width()-5, r.y()+1);
6443
if(opts.titlebarBorder && (APPEARANCE_SHINY_GLASS!=(active ? opts.titlebarAppearance : opts.inactiveTitlebarAppearance)))
6446
//col.setAlphaF(0.5);
6447
painter->setPen(col);
6448
painter->drawLine(r.x()+2, r.y()+4, r.x()+2, r.y()+3);
6449
painter->drawLine(r.x()+3, r.y()+2, r.x()+4, r.y()+2);
6450
//painter->drawLine(r.x()+r.width()-3, r.y()+4, r.x()+r.width()-3, r.y()+3);
6451
painter->drawLine(r.x()+r.width()-4, r.y()+2, r.x()+r.width()-5, r.y()+2);
6342
6459
painter->drawLine(r.left()+1, r.bottom(), r.right()-1, r.bottom());
6462
bool showIcon=TITLEBAR_ICON_NEXT_TO_TITLE==opts.titlebarIcon && !titleBar->icon.isNull();
6463
int iconSize=showIcon ? pixelMetric(QStyle::PM_SmallIconSize) : 0,
6468
pixmap=getIconPixmap(titleBar->icon, iconSize, titleBar->state);
6345
6470
if(!titleBar->text.isEmpty())
6472
static const int constPad=4;
6347
6474
QFont font(painter->font());
6348
Qt::Alignment align((Qt::Alignment)pixelMetric((QStyle::PixelMetric)QtC_TitleAlignment, NULL, NULL));
6349
QRect textRect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget));
6350
QTextOption textOpt(align|Qt::AlignVCenter);
6351
bool alignRealCenter(Qt::AlignHCenter==align);
6475
Qt::Alignment alignment((Qt::Alignment)pixelMetric((QStyle::PixelMetric)QtC_TitleAlignment, 0L, 0L));
6476
bool alignFull(Qt::AlignHCenter==alignment),
6477
iconRight((!reverse && alignment&Qt::AlignRight) || (reverse && alignment&Qt::AlignLeft));
6478
QRect captionRect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget)),
6480
? QRect(r.x(), captionRect.y(), r.width(), captionRect.height())
6353
6483
font.setBold(true);
6354
6484
painter->setFont(font);
6486
QFontMetrics fm(painter->fontMetrics());
6487
QString str(fm.elidedText(titleBar->text, Qt::ElideRight, textRect.width(), QPalette::WindowText));
6489
int textWidth=alignFull || (showIcon && alignment&Qt::AlignHCenter)
6490
? fm.boundingRect(str).width()+(showIcon ? iconSize+constPad : 0) : 0;
6493
if(captionRect.left()>((textRect.width()-textWidth)>>1))
6495
alignment=Qt::AlignVCenter|Qt::AlignLeft;
6496
textRect=captionRect;
6498
else if(captionRect.right()<((textRect.width()+textWidth)>>1))
6500
alignment=Qt::AlignVCenter|Qt::AlignRight;
6501
textRect=captionRect;
6505
if(alignment&Qt::AlignHCenter)
6509
iconX=((textRect.width()-textWidth)/2.0)+0.5+textWidth+iconSize;
6510
textRect.setX(textRect.x()-(iconSize+constPad));
6514
iconX=((textRect.width()-textWidth)/2.0)+0.5;
6515
textRect.setX(iconX+iconSize+constPad);
6516
alignment=Qt::AlignVCenter|Qt::AlignLeft;
6519
else if((!reverse && alignment&Qt::AlignLeft) || (reverse && alignment&Qt::AlignRight))
6522
textRect.setX(textRect.x()+(iconSize+constPad));
6524
else if((!reverse && alignment&Qt::AlignRight) || (reverse && alignment&Qt::AlignLeft))
6528
iconX=textRect.x()+textRect.width()-iconSize;
6529
textRect.setWidth(textRect.width()-(iconSize+constPad));
6533
iconX=textRect.x()+textRect.width()-textWidth;
6534
if(iconX<textRect.x())
6539
QTextOption textOpt(alignment|Qt::AlignVCenter);
6355
6540
textOpt.setWrapMode(QTextOption::NoWrap);
6357
QString str(painter->fontMetrics().elidedText(titleBar->text, Qt::ElideRight, textRect.width(), QPalette::WindowText));
6361
painter->setClipRect(textRect);
6364
6542
painter->setPen(shadow);
6365
6543
painter->drawText(textRect.adjusted(1, 1, 1, 1), str, textOpt);
6366
6544
painter->setPen(textColor);
6367
6545
painter->drawText(textRect, str, textOpt);
6369
painter->setClipping(false);
6373
if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
6374
!(titleBar->titleBarState& Qt::WindowMinimized))
6376
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget));
6380
bool sunken((titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken));
6382
drawMdiButton(painter, rect,
6383
(titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver),
6385
drawMdiIcon(painter, textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarMinButton);
6389
if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
6390
!(titleBar->titleBarState & Qt::WindowMaximized))
6392
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget));
6396
bool sunken((titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken));
6398
drawMdiButton(painter, rect,
6399
(titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver),
6401
drawMdiIcon(painter, textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarMaxButton);
6406
if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint))
6408
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget));
6413
bool sunken((titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken)),
6414
hover((titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver));
6416
drawMdiButton(painter, rect, hover, sunken, btnCols);
6417
drawMdiIcon(painter, hover || sunken ? CLOSE_COLOR : textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarCloseButton);
6422
if ((titleBar->subControls & SC_TitleBarNormalButton) &&
6423
(((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
6424
(titleBar->titleBarState & Qt::WindowMinimized)) ||
6425
((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
6426
(titleBar->titleBarState & Qt::WindowMaximized))))
6428
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget));
6432
bool sunken((titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken));
6434
QRect normalButtonIconRect(rect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin));
6435
drawMdiButton(painter, rect,
6436
(titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver),
6438
drawMdiIcon(painter, textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarNormalButton);
6442
// context help button
6443
if (titleBar->subControls & SC_TitleBarContextHelpButton && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint))
6445
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget));
6449
bool sunken((titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken));
6451
drawMdiButton(painter, rect,
6452
(titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver),
6456
QImage image(standardPixmap(SP_TitleBarContextHelpButton, option, widget).toImage());
6457
QColor alpha(textColor);
6459
alpha.setAlpha(128);
6460
image.setColor(1, textColor.rgba());
6461
image.setColor(2, alpha.rgba());
6462
painter->setRenderHint(QPainter::SmoothPixmapTransform);
6463
painter->drawImage(rect.adjusted(4, 4, -4, -4), image);
6468
if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint))
6470
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget));
6474
bool sunken((titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken));
6476
drawMdiButton(painter, rect,
6477
(titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver),
6479
drawMdiIcon(painter, textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarShadeButton);
6484
if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint))
6486
QRect rect(subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget));
6490
bool sunken((titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken));
6492
drawMdiButton(painter, rect,
6493
(titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver),
6495
drawMdiIcon(painter, textColor, shadow, rect, sunken, buttonMargin, SC_TitleBarUnshadeButton);
6499
if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint))
6501
QRect rect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
6504
drawMdiButton(painter, rect,
6505
(titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_MouseOver),
6506
(titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_Sunken), btnCols);
6508
if (!titleBar->icon.isNull())
6509
titleBar->icon.paint(painter, rect);
6548
if(showIcon && iconX>=0)
6549
painter->drawPixmap(iconX, r.y()+((r.height()-iconSize)/2)+1, pixmap);
6551
if ((titleBar->subControls&SC_TitleBarMinButton) && (titleBar->titleBarFlags&Qt::WindowMinimizeButtonHint) &&
6552
!(titleBar->titleBarState&Qt::WindowMinimized))
6553
drawMdiControl(painter, titleBar, SC_TitleBarMinButton, widget, TITLEBAR_MIN, textColor, shadow, btnCols, bgndCols);
6555
if ((titleBar->subControls&SC_TitleBarMaxButton) && (titleBar->titleBarFlags&Qt::WindowMaximizeButtonHint) &&
6556
!(titleBar->titleBarState&Qt::WindowMaximized))
6557
drawMdiControl(painter, titleBar, SC_TitleBarMaxButton, widget, TITLEBAR_MAX, textColor, shadow, btnCols, bgndCols);
6559
if ((titleBar->subControls&SC_TitleBarCloseButton) && (titleBar->titleBarFlags&Qt::WindowSystemMenuHint))
6560
drawMdiControl(painter, titleBar, SC_TitleBarCloseButton, widget, TITLEBAR_CLOSE, textColor, shadow, btnCols, bgndCols);
6562
if ((titleBar->subControls&SC_TitleBarNormalButton) &&
6563
(((titleBar->titleBarFlags&Qt::WindowMinimizeButtonHint) &&
6564
(titleBar->titleBarState&Qt::WindowMinimized)) ||
6565
((titleBar->titleBarFlags&Qt::WindowMaximizeButtonHint) &&
6566
(titleBar->titleBarState&Qt::WindowMaximized))))
6567
drawMdiControl(painter, titleBar, SC_TitleBarNormalButton, widget, TITLEBAR_MAX, textColor, shadow, btnCols, bgndCols);
6569
if (titleBar->subControls&SC_TitleBarContextHelpButton && (titleBar->titleBarFlags&Qt::WindowContextHelpButtonHint))
6570
drawMdiControl(painter, titleBar, SC_TitleBarContextHelpButton, widget, TITLEBAR_HELP, textColor, shadow, btnCols, bgndCols);
6572
if (titleBar->subControls&SC_TitleBarShadeButton && (titleBar->titleBarFlags&Qt::WindowShadeButtonHint))
6573
drawMdiControl(painter, titleBar, SC_TitleBarShadeButton, widget, TITLEBAR_SHADE, textColor, shadow, btnCols, bgndCols);
6575
if (titleBar->subControls&SC_TitleBarUnshadeButton && (titleBar->titleBarFlags&Qt::WindowShadeButtonHint))
6576
drawMdiControl(painter, titleBar, SC_TitleBarUnshadeButton, widget, TITLEBAR_SHADE, textColor, shadow, btnCols, bgndCols);
6578
if ((titleBar->subControls&SC_TitleBarSysMenu) && (titleBar->titleBarFlags&Qt::WindowSystemMenuHint))
6579
if(TITLEBAR_ICON_MENU_BUTTON==opts.titlebarIcon)
6581
QRect rect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
6512
QStyleOption tool(0);
6514
tool.palette = palette;
6517
drawItemPixmap(painter, rect, Qt::AlignCenter, standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16));
6584
bool sunken((titleBar->activeSubControls&SC_TitleBarSysMenu) && (titleBar->state&State_Sunken)),
6585
hover((titleBar->activeSubControls&SC_TitleBarSysMenu) && (titleBar->state&State_MouseOver));
6586
int offset(sunken ? 1 : 0);
6588
if(!(opts.titlebarButtons&QTC_TITLEBAR_BUTTON_ROUND))
6589
drawMdiButton(painter, rect, hover, sunken,
6590
coloredMdiButtons(state&State_Active, hover) ? itsTitleBarButtonsCols[TITLEBAR_MENU] : btnCols);
6592
if (!titleBar->icon.isNull())
6593
titleBar->icon.paint(painter, rect.adjusted(offset, offset, offset, offset));
6596
QStyleOption tool(0);
6598
tool.palette = palette;
6601
drawItemPixmap(painter, rect.adjusted(offset, offset, offset, offset), Qt::AlignCenter, standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16));
6607
drawMdiControl(painter, titleBar, SC_TitleBarSysMenu, widget, TITLEBAR_MENU, textColor, shadow, btnCols, bgndCols);
6522
6608
painter->restore();
6780
6890
drawLightBevel(painter, frame, &frameOpt, widget,
6781
6891
comboBox->editable ? (reverse ? ROUNDED_LEFT : ROUNDED_RIGHT) : ROUNDED_ALL,
6782
getFill(&frameOpt, use), use, true,
6783
comboBox->editable ? WIDGET_COMBO_BUTTON : WIDGET_COMBO);
6892
getFill(&frameOpt, cols, false,
6893
(SHADE_DARKEN==opts.comboBtn || (SHADE_NONE!=opts.comboBtn &&
6894
!(state&State_Enabled))) &&
6895
comboBox->editable),
6896
cols, true, comboBox->editable ? WIDGET_COMBO_BUTTON : WIDGET_COMBO);
6786
6899
if(/*controls&SC_ComboBoxArrow && */arrow.isValid())
6901
bool mouseOver=comboBox->editable && !(comboBox->activeSubControls&SC_ComboBoxArrow)
6902
? false : (state&State_MouseOver ? true : false);
6904
if(!comboBox->editable && (SHADE_DARKEN==opts.comboBtn || itsComboBtnCols))
6906
QStyleOption frameOpt(*option);
6907
QRect btn(arrow.x(), frame.y(), arrow.width()+2, frame.height());
6908
const QColor *cols=SHADE_DARKEN==opts.comboBtn || !(state&State_Enabled) ? use : itsComboBtnCols;
6910
frameOpt.state|=State_Raised;
6912
painter->setClipRect(btn);
6913
drawLightBevel(painter, opts.comboSplitter
6915
: btn.adjusted(reverse ? 0 : -2, 0, reverse ? 2 : 0, 0),
6916
&frameOpt, widget, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT,
6917
getFill(&frameOpt, cols, false,
6918
SHADE_DARKEN==opts.comboBtn || (SHADE_NONE!=opts.comboBtn &&
6919
!(state&State_Enabled))),
6920
cols, true, WIDGET_COMBO);
6789
6925
arrow.adjust(1, 1, 1, 1);
6791
6927
//if(comboBox->editable || !opts.gtkComboMenus)
6792
drawArrow(painter, arrow, PE_IndicatorArrowDown, option->palette.buttonText().color());
6928
drawArrow(painter, arrow, PE_IndicatorArrowDown, QTC_MO_ARROW_X(mouseOver, option->palette.buttonText().color()),
6795
6932
// int middle=arrow.y()+(arrow.height()>>1);
8308
8498
? QT_SLIDER_MO_BORDER
8312
8502
p->setRenderHint(QPainter::Antialiasing, true);
8314
8504
p->setBrush(Qt::NoBrush);
8316
switch(borderProfile)
8506
if(!window || opts.titlebarBorder)
8507
switch(borderProfile)
8323
EAppearance app(widgetApp(w, &opts));
8324
int dark=window ? ORIGINAL_SHADE : QT_FRAME_DARK_SHADOW;
8326
if(APPEARANCE_FLAT==app && window)
8327
app=APPEARANCE_RAISED;
8329
QColor tl(cols[BORDER_RAISED==borderProfile ? 0 : dark]),
8330
br(cols[BORDER_RAISED==borderProfile ? dark : 0]);
8331
QPainterPath topPath,
8334
if(doBlend && !window)
8336
tl.setAlphaF(QTC_BORDER_BLEND_ALPHA);
8337
br.setAlphaF(QTC_BORDER_BLEND_ALPHA);
8340
buildSplitPath(r.adjusted(1, 1, -1, -1), w, round, getRadius(opts.round, r.width(), r.height(), w, RADIUS_INTERNAL),
8343
p->setPen((enabled || BORDER_SUNKEN==borderProfile) &&
8344
(BORDER_RAISED==borderProfile || hasFocus || APPEARANCE_FLAT!=app)
8346
: option->palette.background().color());
8347
p->drawPath(topPath);
8348
p->setPen(WIDGET_SCROLLVIEW==w && !hasFocus
8349
? option->palette.background().color()
8350
: WIDGET_ENTRY==w && !hasFocus
8351
? option->palette.base().color()
8352
: enabled && (BORDER_SUNKEN==borderProfile || hasFocus || APPEARANCE_FLAT!=app ||
8353
WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w)
8514
EAppearance app(widgetApp(w, &opts));
8515
int dark=window ? ORIGINAL_SHADE : QT_FRAME_DARK_SHADOW;
8517
if(APPEARANCE_FLAT==app && window)
8518
app=APPEARANCE_RAISED;
8520
QColor tl(cols[BORDER_RAISED==borderProfile ? 0 : dark]),
8521
br(cols[BORDER_RAISED==borderProfile ? dark : 0]);
8522
QPainterPath topPath,
8525
if(doBlend && !window)
8527
tl.setAlphaF(QTC_BORDER_BLEND_ALPHA);
8528
br.setAlphaF(QTC_BORDER_BLEND_ALPHA);
8532
// tl.setAlphaF(0.5);
8534
buildSplitPath(r.adjusted(1, 1, -1, -1), w, round, getRadius(&opts, r.width(), r.height(), w, RADIUS_INTERNAL),
8537
p->setPen((enabled || BORDER_SUNKEN==borderProfile) &&
8538
(BORDER_RAISED==borderProfile || hasFocus || APPEARANCE_FLAT!=app)
8355
8540
: option->palette.background().color());
8356
p->drawPath(botPath);
8541
p->drawPath(topPath);
8542
p->setPen(WIDGET_SCROLLVIEW==w && !hasFocus
8543
? option->palette.background().color()
8544
: WIDGET_ENTRY==w && !hasFocus
8545
? option->palette.base().color()
8546
: enabled && (BORDER_SUNKEN==borderProfile || hasFocus || APPEARANCE_FLAT!=app ||
8547
WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w)
8549
: option->palette.background().color());
8550
p->drawPath(botPath);
8360
p->setPen(window && state&QtC_StateKWinHighlight ? itsMenuitemCols[0] : border);
8361
p->drawPath(buildPath(r, w, round, getRadius(opts.round, r.width(), r.height(), w, RADIUS_EXTERNAL)));
8554
p->setPen(window && state&QtC_StateKWinHighlight ? itsFocusCols[0] : border);
8555
p->drawPath(buildPath(r, w, round, getRadius(&opts, r.width(), r.height(), w, RADIUS_EXTERNAL)));
8363
8557
p->setRenderHint(QPainter::Antialiasing, false);
8365
8559
if(QTC_FULLLY_ROUNDED && window)
8408
8631
void QtCurveStyle::drawMdiIcon(QPainter *painter, const QColor &color, const QColor &shadow, const QRect &r,
8409
bool sunken, int margin, SubControl button) const
8632
bool hover, bool sunken, SubControl button, bool customCol) const
8634
static const int margin(6);
8636
if(!sunken) // && hover && !(opts.titlebarButtons&QTC_TITLEBAR_BUTTON_HOVER_SYMBOL) && !customCol)
8412
8637
drawWindowIcon(painter, shadow, r.adjusted(1, 1, 1, 1), sunken, margin, button);
8413
drawWindowIcon(painter, color, r, sunken, margin, button);
8641
if(!sunken && !hover && opts.titlebarButtons&QTC_TITLEBAR_BUTTON_HOVER_SYMBOL)
8642
col.setAlphaF(HOVER_BUTTON_ALPHA);
8644
drawWindowIcon(painter, col, r, sunken, margin, button);
8416
8647
void QtCurveStyle::drawWindowIcon(QPainter *painter, const QColor &color, const QRect &r, bool sunken, int margin, SubControl button) const
8649
static const int constIconSize=9;
8420
// Icons look best at 22x22...
8421
if(rect.height()>22)
8423
int diff=(rect.height()-22)/2;
8424
rect.adjust(diff, diff, -diff, -diff);
8653
int diff=(rect.height()-constIconSize)/2;
8654
rect.adjust(diff, diff, -diff, -diff);
8655
rect.setHeight(constIconSize);
8656
rect.setWidth(constIconSize);
8428
8659
rect.adjust(1, 1, 1, 1);
8431
rect.adjust(margin, margin, -margin, -margin);
8433
8661
painter->setPen(color);
8437
8665
case SC_TitleBarMinButton:
8438
painter->drawLine(rect.center().x() - 2, rect.center().y() + 3, rect.center().x() + 3, rect.center().y() + 3);
8439
painter->drawLine(rect.center().x() - 2, rect.center().y() + 4, rect.center().x() + 3, rect.center().y() + 4);
8440
painter->drawLine(rect.center().x() - 3, rect.center().y() + 3, rect.center().x() - 3, rect.center().y() + 4);
8441
painter->drawLine(rect.center().x() + 4, rect.center().y() + 3, rect.center().x() + 4, rect.center().y() + 4);
8666
drawRect(painter, QRect(rect.left(), rect.bottom()-1, rect.width(), 2));
8443
8668
case SC_TitleBarMaxButton:
8444
painter->drawRect(rect.adjusted(0, 0, -1, -1));
8669
drawRect(painter, rect);
8445
8670
painter->drawLine(rect.left() + 1, rect.top() + 1, rect.right() - 1, rect.top() + 1);
8446
painter->drawPoint(rect.topLeft());
8447
painter->drawPoint(rect.topRight());
8448
painter->drawPoint(rect.bottomLeft());
8449
painter->drawPoint(rect.bottomRight());
8451
8672
case SC_TitleBarCloseButton:
8452
painter->drawLine(rect.left() + 1, rect.top(), rect.right(), rect.bottom() - 1);
8453
painter->drawLine(rect.left(), rect.top() + 1, rect.right() - 1, rect.bottom());
8454
painter->drawLine(rect.right() - 1, rect.top(), rect.left(), rect.bottom() - 1);
8455
painter->drawLine(rect.right(), rect.top() + 1, rect.left() + 1, rect.bottom());
8456
painter->drawPoint(rect.topLeft());
8457
painter->drawPoint(rect.topRight());
8458
painter->drawPoint(rect.bottomLeft());
8459
painter->drawPoint(rect.bottomRight());
8460
painter->drawLine(rect.left() + 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 1);
8461
painter->drawLine(rect.left() + 1, rect.bottom() - 1, rect.right() - 1, rect.top() + 1);
8674
static unsigned char xbm[] = { 0x83, 0x01, 0xc7, 0x01, 0xee, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x7c, 0x00,
8675
0xee, 0x00, 0xc7, 0x01, 0x83, 0x01 };
8676
static QBitmap bitmap=QBitmap::fromData(QSize(constIconSize, constIconSize), xbm);
8677
painter->drawPixmap(rect.x()+(rect.width()-bitmap.width())/2, rect.y()+(rect.height()-bitmap.height())/2, bitmap);
8463
8680
case SC_TitleBarNormalButton:
8465
QRect r2 = rect.adjusted(0, 3, -3, 0);
8467
painter->drawRect(r2.adjusted(0, 0, -1, -1));
8468
painter->drawLine(r2.left() + 1, r2.top() + 1, r2.right() - 1, r2.top() + 1);
8469
painter->drawPoint(r2.topLeft());
8470
painter->drawPoint(r2.topRight());
8471
painter->drawPoint(r2.bottomLeft());
8472
painter->drawPoint(r2.bottomRight());
8474
QRect backWindowRect(rect.adjusted(3, 0, 0, -3));
8475
QRegion clipRegion(backWindowRect);
8479
backWindowRect.adjust(1, 1, 1, 1);
8480
painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1));
8481
painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
8482
backWindowRect.right() - 1, backWindowRect.top() + 1);
8483
painter->drawPoint(backWindowRect.topLeft());
8484
painter->drawPoint(backWindowRect.topRight());
8485
painter->drawPoint(backWindowRect.bottomLeft());
8486
painter->drawPoint(backWindowRect.bottomRight());
8682
static unsigned char xbm[] = {0xfc, 0x01, 0xfc, 0x01, 0x04, 0x01, 0x7f, 0x01, 0x7f, 0x01, 0xc1, 0x01,
8683
0x41, 0x00, 0x41, 0x00, 0x7f, 0x00 };
8684
static QBitmap bitmap=QBitmap::fromData(QSize(constIconSize, constIconSize), xbm);
8685
painter->drawPixmap(rect.x()+(rect.width()-bitmap.width())/2, rect.y()+(rect.height()-bitmap.height())/2, bitmap);
8489
8688
case SC_TitleBarShadeButton:
8490
drawArrow(painter, rect, PE_IndicatorArrowUp, color);
8689
drawArrow(painter, rect, PE_IndicatorArrowUp, color, false, true);
8492
8691
case SC_TitleBarUnshadeButton:
8493
drawArrow(painter, rect, PE_IndicatorArrowDown, color);
8692
drawArrow(painter, rect, PE_IndicatorArrowDown, color, false, true);
8694
case SC_TitleBarSysMenu:
8695
for(int i=1; i<=constIconSize; i+=3)
8696
painter->drawLine(rect.left() + 1, rect.top() + i, rect.right() - 1, rect.top() + i);
8599
8803
opt.state&=~QTC_STATE_REVERSE;
8805
if((vertical ? r.height() : r.width())<1)
8604
int length(vertical ? r.height() : r.width());
8605
bool drawFull(length > 3);
8808
if(vertical && r.height()<3)
8811
if(!vertical && rx.width()<3)
8814
int length(vertical ? rx.height() : rx.width());
8606
8815
const QColor *use=option->state&State_Enabled || ECOLOR_BACKGROUND==opts.progressGrooveColor
8607
? itsMenuitemCols : itsBackgroundCols;
8609
drawLightBevel(p, r, &opt, 0L, opts.fillProgress ? ROUNDED_ALL : round, use[ORIGINAL_SHADE], use, true, WIDGET_PROGRESSBAR);
8816
? itsHighlightCols : itsBackgroundCols;
8818
drawLightBevel(p, rx, &opt, 0L, opts.fillProgress ? ROUNDED_ALL : round, use[ORIGINAL_SHADE], use, true,
8819
WIDGET_PROGRESSBAR);
8611
8821
if(!opts.fillProgress && QTC_ROUNDED && length>2 && ROUNDED_ALL!=round)
8823
bool drawFull(length > 3);
8615
if(opts.fillProgress)
8617
p->setPen(backgroundColors(option)[QT_STD_BORDER]);
8618
rb.adjust(1, 1, -1, -1);
8621
p->setPen(midColor(option->palette.background().color(), itsMenuitemCols[QT_PBAR_BORDER]));
8825
p->setPen(midColor(option->palette.background().color(), itsHighlightCols[QT_PBAR_BORDER]));
8622
8826
if(!(round&CORNER_TL) || !drawFull)
8623
p->drawPoint(rb.x(), rb.y());
8827
p->drawPoint(rx.x(), rx.y());
8624
8828
if(!(round&CORNER_BL) || !drawFull)
8625
p->drawPoint(rb.x(), rb.y()+rb.height()-1);
8829
p->drawPoint(rx.x(), rx.y()+rx.height()-1);
8626
8830
if(!(round&CORNER_TR) || !drawFull)
8627
p->drawPoint(rb.x()+rb.width()-1, rb.y());
8831
p->drawPoint(rx.x()+rx.width()-1, rx.y());
8628
8832
if(!(round&CORNER_BR) || !drawFull)
8629
p->drawPoint(rb.x()+rb.width()-1, rb.y()+rb.height()-1);
8833
p->drawPoint(rx.x()+rx.width()-1, rx.y()+rx.height()-1);
8633
void QtCurveStyle::drawArrow(QPainter *p, const QRect &r, PrimitiveElement pe, QColor col, bool small) const
8837
void QtCurveStyle::drawArrow(QPainter *p, const QRect &r, PrimitiveElement pe, QColor col, bool small, bool mdi) const
8636
8840
QPainterPath path;
9289
9477
itsMdiButtons[1].append(WINDOWTITLE_SPACER);
9290
9478
itsMdiButtons[1].append(SC_TitleBarCloseButton);
9293
checkKComponentData();
9480
#if !defined QTC_QT_ONLY
9295
9481
KConfig cfg("kwinrc");
9296
9482
KConfigGroup grp(&cfg, "Style");
9299
val=grp.readEntry("ButtonsOnLeft");
9302
itsMdiButtons[0].clear();
9303
parseWindowLine(val, itsMdiButtons[0]);
9306
val=grp.readEntry("ButtonsOnRight");
9309
itsMdiButtons[1].clear();
9310
parseWindowLine(val, itsMdiButtons[1]);
9313
// Read in KWin settings...
9314
QFile f(kdeHome()+QLatin1String("/share/config/kwinrc"));
9316
if(f.open(QIODevice::ReadOnly))
9319
bool inStyle(false);
9323
QString line(in.readLine());
9484
if(grp.readEntry("CustomButtonPositions", false))
9486
QString val=grp.readEntry("ButtonsOnLeft");
9489
itsMdiButtons[0].clear();
9490
parseWindowLine(val, itsMdiButtons[0]);
9493
val=grp.readEntry("ButtonsOnRight");
9496
itsMdiButtons[1].clear();
9497
parseWindowLine(val, itsMdiButtons[1]);
9500
// Designer uses shade buttons, not min/max - so if we dont have shade in our kwin config. then add this
9501
// button near the max button...
9502
if(-1==itsMdiButtons[0].indexOf(SC_TitleBarShadeButton) && -1==itsMdiButtons[1].indexOf(SC_TitleBarShadeButton))
9504
int maxPos=itsMdiButtons[0].indexOf(SC_TitleBarMaxButton);
9506
if(-1==maxPos) // Left doesnt have max button, assume right does and add shade there
9327
if(0==line.indexOf("ButtonsOnLeft=", Qt::CaseInsensitive))
9329
itsMdiButtons[0].clear();
9330
parseWindowLine(line.mid(14), itsMdiButtons[0]);
9332
else if(0==line.indexOf("ButtonsOnRight=", Qt::CaseInsensitive))
9334
itsMdiButtons[1].clear();
9335
parseWindowLine(line.mid(15), itsMdiButtons[1]);
9337
else if (-1!=line.indexOf('['))
9508
int minPos=itsMdiButtons[1].indexOf(SC_TitleBarMinButton);
9509
maxPos=itsMdiButtons[1].indexOf(SC_TitleBarMaxButton);
9511
itsMdiButtons[1].insert(minPos<maxPos ? (minPos==-1 ? 0 : minPos)
9512
: (maxPos==-1 ? 0 : maxPos), SC_TitleBarShadeButton);
9340
else if(0==line.indexOf("[Style]", Qt::CaseInsensitive))
9347
// Designer uses shade buttons, not min/max - so if we dont have shade in our kwin config. then add this
9348
// button near the max button...
9349
if(-1==itsMdiButtons[0].indexOf(SC_TitleBarShadeButton) && -1==itsMdiButtons[1].indexOf(SC_TitleBarShadeButton))
9351
int maxPos=itsMdiButtons[0].indexOf(SC_TitleBarMaxButton);
9353
if(-1==maxPos) // Left doesnt have max button, assume right does and add shade there
9355
int minPos=itsMdiButtons[1].indexOf(SC_TitleBarMinButton);
9356
maxPos=itsMdiButtons[1].indexOf(SC_TitleBarMaxButton);
9358
itsMdiButtons[1].insert(minPos<maxPos ? (minPos==-1 ? 0 : minPos)
9514
else // Add to left button
9516
int minPos=itsMdiButtons[0].indexOf(SC_TitleBarMinButton);
9518
itsMdiButtons[1].insert(minPos>maxPos ? (minPos==-1 ? 0 : minPos)
9359
9519
: (maxPos==-1 ? 0 : maxPos), SC_TitleBarShadeButton);
9361
else // Add to left button
9363
int minPos=itsMdiButtons[0].indexOf(SC_TitleBarMinButton);
9365
itsMdiButtons[1].insert(minPos>maxPos ? (minPos==-1 ? 0 : minPos)
9366
: (maxPos==-1 ? 0 : maxPos), SC_TitleBarShadeButton);
9372
const QColor & QtCurveStyle::getFill(const QStyleOption *option, const QColor *use, bool cr) const
9527
const QColor & QtCurveStyle::getFill(const QStyleOption *option, const QColor *use, bool cr, bool darker) const
9374
9529
return !option || !(option->state&State_Enabled)
9375
? use[ORIGINAL_SHADE]
9530
? use[darker ? 2 : ORIGINAL_SHADE]
9376
9531
: option->state&State_Sunken // State_Down ????
9532
? use[darker ? 5 : 4]
9378
9533
: option->state&State_MouseOver
9379
9534
? !cr && option->state&State_On
9380
? use[SHADE_4_HIGHLIGHT]
9381
: use[SHADE_ORIG_HIGHLIGHT]
9535
? use[darker ? 3 : SHADE_4_HIGHLIGHT]
9536
: use[darker ? SHADE_2_HIGHLIGHT : SHADE_ORIG_HIGHLIGHT]
9382
9537
: !cr && option->state&State_On
9384
: use[ORIGINAL_SHADE];
9538
? use[darker ? 5 : 4]
9539
: use[darker ? 2 : ORIGINAL_SHADE];
9387
9542
static QImage rotateImage(const QImage &img, double angle=90.0)