summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp7
-rw-r--r--noncore/styles/liquid/opie-liquid.diff137
2 files changed, 61 insertions, 83 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index daac22c..e6d8310 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -915,532 +915,525 @@ void LiquidStyle::unPolish(QWidget *w)
915 915
916 w->unsetPalette(); 916 w->unsetPalette();
917 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 917 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
918 if(w->inherits("QPushButton")) 918 if(w->inherits("QPushButton"))
919 w->setBackgroundMode(QWidget::PaletteButton); 919 w->setBackgroundMode(QWidget::PaletteButton);
920 else 920 else
921 w->setBackgroundMode(QWidget::PaletteBackground); 921 w->setBackgroundMode(QWidget::PaletteBackground);
922 } 922 }
923 923
924 if(isViewportChild) 924 if(isViewportChild)
925 w->setAutoMask(false); 925 w->setAutoMask(false);
926 926
927/* 927/*
928 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 928 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
929 w-> setBackgroundMode ( PaletteBackground ); 929 w-> setBackgroundMode ( PaletteBackground );
930 } 930 }
931*/ 931*/
932 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 932 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
933 w->removeEventFilter(this); 933 w->removeEventFilter(this);
934 } 934 }
935 if(w->inherits("QButton") || w->inherits("QComboBox")){ 935 if(w->inherits("QButton") || w->inherits("QComboBox")){
936 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 936 if(w->parent() && w->parent()->inherits("KHTMLPart")){
937 w->setAutoMask(false); 937 w->setAutoMask(false);
938 } 938 }
939 } 939 }
940 if(w-> inherits("QToolButton")) { 940 if(w-> inherits("QToolButton")) {
941 w-> removeEventFilter ( this ); 941 w-> removeEventFilter ( this );
942 } 942 }
943 if(w->inherits("QToolBar")){ 943 if(w->inherits("QToolBar")){
944 w->removeEventFilter(this); 944 w->removeEventFilter(this);
945 w->setBackgroundMode(QWidget::PaletteBackground); 945 w->setBackgroundMode(QWidget::PaletteBackground);
946 return; 946 return;
947 } 947 }
948 if(w->inherits("QHeader")){ 948 if(w->inherits("QHeader")){
949 w->setMouseTracking(false); 949 w->setMouseTracking(false);
950 w->removeEventFilter(this); 950 w->removeEventFilter(this);
951 } 951 }
952} 952}
953 953
954void LiquidStyle::polish(QApplication *app) 954void LiquidStyle::polish(QApplication *app)
955{ 955{
956 956
957 QWindowsStyle::polish(app); 957 QWindowsStyle::polish(app);
958 menuAni = app->isEffectEnabled(UI_AnimateMenu); 958 menuAni = app->isEffectEnabled(UI_AnimateMenu);
959 menuFade = app->isEffectEnabled(UI_FadeMenu); 959 menuFade = app->isEffectEnabled(UI_FadeMenu);
960 if(menuAni) 960 if(menuAni)
961 app->setEffectEnabled(UI_AnimateMenu, false); 961 app->setEffectEnabled(UI_AnimateMenu, false);
962 if(menuFade) 962 if(menuFade)
963 app->setEffectEnabled(UI_FadeMenu, false); 963 app->setEffectEnabled(UI_FadeMenu, false);
964 964
965 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 965 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
966 966
967 Config config ( "qpe" ); 967 Config config ( "qpe" );
968 config. setGroup ( "Liquid-Style" ); 968 config. setGroup ( "Liquid-Style" );
969 969
970 // if ( config. readBoolEntry ( "WinDecoration", true )) 970 // if ( config. readBoolEntry ( "WinDecoration", true ))
971 // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 971 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
972 972
973 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 973 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
974} 974}
975 975
976void LiquidStyle::unPolish(QApplication *app) 976void LiquidStyle::unPolish(QApplication *app)
977{ 977{
978 QWindowsStyle::unPolish(app); 978 QWindowsStyle::unPolish(app);
979 app->setEffectEnabled(UI_AnimateMenu, menuAni); 979 app->setEffectEnabled(UI_AnimateMenu, menuAni);
980 app->setEffectEnabled(UI_FadeMenu, menuFade); 980 app->setEffectEnabled(UI_FadeMenu, menuFade);
981 981
982 qt_set_draw_menu_bar_impl ( 0 ); 982 qt_set_draw_menu_bar_impl ( 0 );
983 983
984// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 984// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
985} 985}
986 986
987 987
988/* !! HACK !! Beware 988/* !! HACK !! Beware
989 * 989 *
990 * TT forgot to make the QProgressBar widget styleable in Qt 2.x 990 * TT forgot to make the QProgressBar widget styleable in Qt 2.x
991 * So the only way to customize the drawing, is to intercept the 991 * So the only way to customize the drawing, is to intercept the
992 * paint event - since we have to use protected functions, we need 992 * paint event - since we have to use protected functions, we need
993 * to derive a "hack" class from QProgressBar and do the painting 993 * to derive a "hack" class from QProgressBar and do the painting
994 * in there. 994 * in there.
995 * 995 *
996 * - sandman 996 * - sandman
997 */ 997 */
998 998
999class HackProgressBar : public QProgressBar { 999class HackProgressBar : public QProgressBar {
1000public: 1000public:
1001 HackProgressBar ( ); 1001 HackProgressBar ( );
1002 1002
1003 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 1003 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
1004 { 1004 {
1005 QPainter p( this ); 1005 QPainter p( this );
1006 1006
1007 if ( !contentsRect().contains( event->rect() ) ) { 1007 if ( !contentsRect().contains( event->rect() ) ) {
1008 p.save(); 1008 p.save();
1009 p.setClipRegion( event->region().intersect(frameRect()) ); 1009 p.setClipRegion( event->region().intersect(frameRect()) );
1010 drawFrame( &p); 1010 drawFrame( &p);
1011 p.restore(); 1011 p.restore();
1012 } 1012 }
1013 if ( event->rect().intersects( contentsRect() )) { 1013 if ( event->rect().intersects( contentsRect() )) {
1014 p.setClipRegion( event->region().intersect( contentsRect() ) ); 1014 p.setClipRegion( event->region().intersect( contentsRect() ) );
1015 1015
1016 int x, y, w, h; 1016 int x, y, w, h;
1017 contentsRect ( ). rect ( &x, &y, &w, &h ); 1017 contentsRect ( ). rect ( &x, &y, &w, &h );
1018 1018
1019 int prog = progress ( ); 1019 int prog = progress ( );
1020 int total = totalSteps ( ); 1020 int total = totalSteps ( );
1021 if ( prog < 0 ) 1021 if ( prog < 0 )
1022 prog = 0; 1022 prog = 0;
1023 if ( total <= 0 ) 1023 if ( total <= 0 )
1024 total = 1; 1024 total = 1;
1025 int bw = w * prog / total; 1025 int bw = w * prog / total;
1026 if ( bw > w ) 1026 if ( bw > w )
1027 bw = w; 1027 bw = w;
1028 1028
1029 p.setPen(g.button().dark(130)); 1029 p.setPen(g.button().dark(130));
1030 p.drawRect(x, y, bw, h); 1030 p.drawRect(x, y, bw, h);
1031 p.setPen(g.button().light(120)); 1031 p.setPen(g.button().light(120));
1032 p.drawRect(x+1, y+1, bw-2, h-2); 1032 p.drawRect(x+1, y+1, bw-2, h-2);
1033 1033
1034 if(bw >= 4 && h >= 4 && pix) 1034 if(bw >= 4 && h >= 4 && pix)
1035 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1035 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1036 1036
1037 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1037 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1038 QString pstr; 1038 QString pstr;
1039 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1039 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1040 p. setPen ( g.text());//g.highlightedText ( )); 1040 p. setPen ( g.text());//g.highlightedText ( ));
1041 p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1041 p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045}; 1045};
1046 1046
1047 1047
1048/* 1048/*
1049 * The same for QToolButton: 1049 * The same for QToolButton:
1050 * TT hardcoded the drawing of the focus rect ... 1050 * TT hardcoded the drawing of the focus rect ...
1051 * 1051 *
1052 * - sandman 1052 * - sandman
1053 */ 1053 */
1054 1054
1055 1055
1056class HackToolButton : public QToolButton { 1056class HackToolButton : public QToolButton {
1057public: 1057public:
1058 HackToolButton ( ); 1058 HackToolButton ( );
1059 1059
1060 void paint ( QPaintEvent *ev ) 1060 void paint ( QPaintEvent *ev )
1061 { 1061 {
1062 erase ( ev-> region ( )); 1062 erase ( ev-> region ( ));
1063 QPainter p ( this ); 1063 QPainter p ( this );
1064 style ( ). drawToolButton ( this, &p ); 1064 style ( ). drawToolButton ( this, &p );
1065 drawButtonLabel ( &p ); 1065 drawButtonLabel ( &p );
1066 } 1066 }
1067}; 1067};
1068 1068
1069/* 1069/*
1070 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1070 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1071 * force everything to erase and repaint on resize. This is going away, I'm 1071 * force everything to erase and repaint on resize. This is going away, I'm
1072 * trying to get shaped widgets to work right without masking. QPushButton, 1072 * trying to get shaped widgets to work right without masking. QPushButton,
1073 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1073 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1074 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1074 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1075 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1075 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1076 * caches them in QPixmapCache, which is bad for doing things like hover 1076 * caches them in QPixmapCache, which is bad for doing things like hover
1077 * because the style methods aren't called in paintEvents if everything 1077 * because the style methods aren't called in paintEvents if everything
1078 * is cached. We use our own Paint event handler instead. Taskbuttons and 1078 * is cached. We use our own Paint event handler instead. Taskbuttons and
1079 * pager buttons draw into a pixmap buffer, so we handle those with palette 1079 * pager buttons draw into a pixmap buffer, so we handle those with palette
1080 * modifications. For QHeader, different header items are actually one widget 1080 * modifications. For QHeader, different header items are actually one widget
1081 * that draws multiple items, so we need to check which ID is hightlighted 1081 * that draws multiple items, so we need to check which ID is hightlighted
1082 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1082 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1083 * since if it's inside a combobox we want to highlight the combobox during 1083 * since if it's inside a combobox we want to highlight the combobox during
1084 * hovering in the edit. 1084 * hovering in the edit.
1085 */ 1085 */
1086bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1086bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1087{ 1087{
1088 if(obj->inherits("QToolBar")){ 1088 if(obj->inherits("QToolBar")){
1089 if(ev->type() == QEvent::Resize){ 1089 if(ev->type() == QEvent::Resize){
1090 const QObjectList *tbChildList = obj->children(); 1090 const QObjectList *tbChildList = obj->children();
1091 QObjectListIt it(*tbChildList); 1091 QObjectListIt it(*tbChildList);
1092 QObject *child; 1092 QObject *child;
1093 while((child = it.current()) != NULL){ 1093 while((child = it.current()) != NULL){
1094 ++it; 1094 ++it;
1095 if(child->isWidgetType()) 1095 if(child->isWidgetType())
1096 ((QWidget *)child)->repaint(true); 1096 ((QWidget *)child)->repaint(true);
1097 } 1097 }
1098 1098
1099 } 1099 }
1100 } 1100 }
1101 else if(obj->inherits("QToolButton")){ 1101 else if(obj->inherits("QToolButton")){
1102 QToolButton *btn = (QToolButton *)obj; 1102 QToolButton *btn = (QToolButton *)obj;
1103 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () 1103 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
1104 if(btn->isEnabled()){ 1104 if(btn->isEnabled()){
1105 highlightWidget = btn; 1105 highlightWidget = btn;
1106 btn->repaint(false); 1106 btn->repaint(false);
1107
1108 qDebug ( "TB FOCUS IN [%p]", btn );
1109 } 1107 }
1110 } 1108 }
1111 else if(ev->type() == QEvent::FocusOut ){ 1109 else if(ev->type() == QEvent::FocusOut ){
1112 if(btn == highlightWidget){ 1110 if(btn == highlightWidget){
1113 highlightWidget = NULL; 1111 highlightWidget = NULL;
1114 btn->repaint(false); 1112 btn->repaint(false);
1115
1116 qDebug ( "TB FOCUS OUT [%p]", btn );
1117 } 1113 }
1118 } 1114 }
1119 else if(ev->type() == QEvent::Paint) { 1115 else if(ev->type() == QEvent::Paint) {
1120 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); 1116 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev );
1121 return true; 1117 return true;
1122 } 1118 }
1123 } 1119 }
1124 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1120 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1125 QButton *btn = (QButton *)obj; 1121 QButton *btn = (QButton *)obj;
1126 bool isRadio = obj->inherits("QRadioButton"); 1122 bool isRadio = obj->inherits("QRadioButton");
1127 if(ev->type() == QEvent::Paint){ 1123 if(ev->type() == QEvent::Paint){
1128 //if(btn->autoMask()) 1124 //if(btn->autoMask())
1129 btn->erase(); 1125 btn->erase();
1130 QPainter p; 1126 QPainter p;
1131 p.begin(btn); 1127 p.begin(btn);
1132 QFontMetrics fm = btn->fontMetrics(); 1128 QFontMetrics fm = btn->fontMetrics();
1133 QSize lsz = fm.size(ShowPrefix, btn->text()); 1129 QSize lsz = fm.size(ShowPrefix, btn->text());
1134 QSize sz = isRadio ? exclusiveIndicatorSize() 1130 QSize sz = isRadio ? exclusiveIndicatorSize()
1135 : indicatorSize(); 1131 : indicatorSize();
1136 1132
1137/* 1133/*
1138 if(btn->hasFocus()){ 1134 if(btn->hasFocus()){
1139 QRect r = QRect(0, 0, btn->width(), btn->height()); 1135 QRect r = QRect(0, 0, btn->width(), btn->height());
1140 p.setPen(btn->colorGroup().button().dark(140)); 1136 p.setPen(btn->colorGroup().button().dark(140));
1141 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1137 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1142 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1138 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1143 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1139 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1144 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1140 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1145 } 1141 }
1146*/ 1142*/
1147 int x = 0; 1143 int x = 0;
1148 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1144 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1149 if(isRadio) 1145 if(isRadio)
1150 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1146 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1151 btn->colorGroup(), btn->isOn(), 1147 btn->colorGroup(), btn->isOn(),
1152 btn->isDown(), btn->isEnabled()); 1148 btn->isDown(), btn->isEnabled());
1153 else 1149 else
1154 drawIndicator(&p, x, y, sz.width(), sz.height(), 1150 drawIndicator(&p, x, y, sz.width(), sz.height(),
1155 btn->colorGroup(), btn->state(), btn->isDown(), 1151 btn->colorGroup(), btn->state(), btn->isDown(),
1156 btn->isEnabled()); 1152 btn->isEnabled());
1157 x = sz.width() + 6; 1153 x = sz.width() + 6;
1158 y = 0; 1154 y = 0;
1159 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), 1155 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1),
1160 btn->height(), AlignLeft|AlignVCenter|ShowPrefix, 1156 btn->height(), AlignLeft|AlignVCenter|ShowPrefix,
1161 btn->colorGroup(), btn->isEnabled(), 1157 btn->colorGroup(), btn->isEnabled(),
1162 btn->pixmap(), btn->text()); 1158 btn->pixmap(), btn->text());
1163 p.end(); 1159 p.end();
1164 return(true); 1160 return(true);
1165 } 1161 }
1166 } 1162 }
1167 else if(obj->inherits("QHeader")){ 1163 else if(obj->inherits("QHeader")){
1168 QHeader *hw = (QHeader *)obj; 1164 QHeader *hw = (QHeader *)obj;
1169 if(ev->type() == QEvent::Enter){ 1165 if(ev->type() == QEvent::Enter){
1170 currentHeader = hw; 1166 currentHeader = hw;
1171 headerHoverID = -1; 1167 headerHoverID = -1;
1172 } 1168 }
1173 else if(ev->type() == QEvent::Leave){ 1169 else if(ev->type() == QEvent::Leave){
1174 currentHeader = NULL; 1170 currentHeader = NULL;
1175 if(headerHoverID != -1){ 1171 if(headerHoverID != -1){
1176 hw->repaint(hw->sectionPos(headerHoverID), 0, 1172 hw->repaint(hw->sectionPos(headerHoverID), 0,
1177 hw->sectionSize(headerHoverID), hw->height()); 1173 hw->sectionSize(headerHoverID), hw->height());
1178 } 1174 }
1179 headerHoverID = -1; 1175 headerHoverID = -1;
1180 } 1176 }
1181 else if(ev->type() == QEvent::MouseMove){ 1177 else if(ev->type() == QEvent::MouseMove){
1182 QMouseEvent *me = (QMouseEvent *)ev; 1178 QMouseEvent *me = (QMouseEvent *)ev;
1183 int oldHeader = headerHoverID; 1179 int oldHeader = headerHoverID;
1184 headerHoverID = hw->sectionAt(me->x()); 1180 headerHoverID = hw->sectionAt(me->x());
1185 if(oldHeader != headerHoverID){ 1181 if(oldHeader != headerHoverID){
1186 // reset old header 1182 // reset old header
1187 if(oldHeader != -1){ 1183 if(oldHeader != -1){
1188 hw->repaint(hw->sectionPos(oldHeader), 0, 1184 hw->repaint(hw->sectionPos(oldHeader), 0,
1189 hw->sectionSize(oldHeader), hw->height()); 1185 hw->sectionSize(oldHeader), hw->height());
1190 } 1186 }
1191 if(headerHoverID != -1){ 1187 if(headerHoverID != -1){
1192 hw->repaint(hw->sectionPos(headerHoverID), 0, 1188 hw->repaint(hw->sectionPos(headerHoverID), 0,
1193 hw->sectionSize(headerHoverID), hw->height()); 1189 hw->sectionSize(headerHoverID), hw->height());
1194 } 1190 }
1195 } 1191 }
1196 } 1192 }
1197 } 1193 }
1198 else if (obj-> inherits( "QProgressBar" )) { 1194 else if (obj-> inherits( "QProgressBar" )) {
1199 if ( ev->type() == QEvent::Paint ) { 1195 if ( ev->type() == QEvent::Paint ) {
1200 HackProgressBar *p = (HackProgressBar *) obj; 1196 HackProgressBar *p = (HackProgressBar *) obj;
1201 const QColorGroup &g = p-> colorGroup ( ); 1197 const QColorGroup &g = p-> colorGroup ( );
1202 1198
1203 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1199 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1204 if(!pix){ 1200 if(!pix){
1205 int h, s, v; 1201 int h, s, v;
1206 g.button().dark(120).hsv(&h, &s, &v); 1202 g.button().dark(120).hsv(&h, &s, &v);
1207 pix = new QPixmap(*bevelFillPix); 1203 pix = new QPixmap(*bevelFillPix);
1208 adjustHSV(*pix, h, s, v); 1204 adjustHSV(*pix, h, s, v);
1209 bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1205 bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1210 } 1206 }
1211 p-> paint ((QPaintEvent *) ev, g, pix ); 1207 p-> paint ((QPaintEvent *) ev, g, pix );
1212 return true; 1208 return true;
1213 } 1209 }
1214 } 1210 }
1215 return false ; 1211 return false ;
1216} 1212}
1217 1213
1218void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1214void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1219 const QColorGroup &g, bool sunken, 1215 const QColorGroup &g, bool sunken,
1220 const QBrush *) 1216 const QBrush *)
1221{ 1217{
1222 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), 1218 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(),
1223 x, y, w, h); 1219 x, y, w, h);
1224} 1220}
1225 1221
1226void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, 1222void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h,
1227 const QColorGroup &g, bool sunken, 1223 const QColorGroup &g, bool sunken,
1228 const QBrush *) 1224 const QBrush *)
1229{ 1225{
1230 if(p->device()->devType() != QInternal::Widget){ 1226 if(p->device()->devType() != QInternal::Widget){
1231 // drawing into a temp pixmap, don't use mask 1227 // drawing into a temp pixmap, don't use mask
1232 QColor c = sunken ? g.button() : g.background(); 1228 QColor c = sunken ? g.button() : g.background();
1233 p->setPen(c.dark(130)); 1229 p->setPen(c.dark(130));
1234 p->drawRect(x, y, w, h); 1230 p->drawRect(x, y, w, h);
1235 p->setPen(c.light(105)); 1231 p->setPen(c.light(105));
1236 p->drawRect(x+1, y+1, w-2, h-2); 1232 p->drawRect(x+1, y+1, w-2, h-2);
1237 1233
1238 1234
1239 // fill 1235 // fill
1240 QPixmap *pix = bevelFillDict.find(c.rgb()); 1236 QPixmap *pix = bevelFillDict.find(c.rgb());
1241 if(!pix){ 1237 if(!pix){
1242 int h, s, v; 1238 int h, s, v;
1243 c.hsv(&h, &s, &v); 1239 c.hsv(&h, &s, &v);
1244 pix = new QPixmap(*bevelFillPix); 1240 pix = new QPixmap(*bevelFillPix);
1245 adjustHSV(*pix, h, s, v); 1241 adjustHSV(*pix, h, s, v);
1246 bevelFillDict.insert(c.rgb(), pix); 1242 bevelFillDict.insert(c.rgb(), pix);
1247 } 1243 }
1248 1244
1249 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1245 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1250 qDebug ( "DRAW TOOLBUTTON IN PIXMAP" );
1251 } 1246 }
1252 else{ 1247 else{
1253 qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() );
1254
1255 drawClearBevel(p, x, y, w, h, sunken ? g.button() : 1248 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1256 highlightWidget == p->device() ? g.button().light(110) : 1249 highlightWidget == p->device() ? g.button().light(110) :
1257 g.background(), g.background()); 1250 g.background(), g.background());
1258 } 1251 }
1259} 1252}
1260 1253
1261void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) 1254void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p)
1262{ 1255{
1263 QRect r = btn->rect(); 1256 QRect r = btn->rect();
1264 bool sunken = btn->isOn() || btn->isDown(); 1257 bool sunken = btn->isOn() || btn->isDown();
1265 QColorGroup g = btn->colorGroup(); 1258 QColorGroup g = btn->colorGroup();
1266 1259
1267 1260
1268 //int dw = buttonDefaultIndicatorWidth(); 1261 //int dw = buttonDefaultIndicatorWidth();
1269 if(btn->hasFocus() || btn->isDefault()){ 1262 if(btn->hasFocus() || btn->isDefault()){
1270 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1263 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1271 QPixmap *pix = bevelFillDict.find(c.rgb()); 1264 QPixmap *pix = bevelFillDict.find(c.rgb());
1272 if(!pix){ 1265 if(!pix){
1273 int h, s, v; 1266 int h, s, v;
1274 c.hsv(&h, &s, &v); 1267 c.hsv(&h, &s, &v);
1275 pix = new QPixmap(*bevelFillPix); 1268 pix = new QPixmap(*bevelFillPix);
1276 adjustHSV(*pix, h, s, v); 1269 adjustHSV(*pix, h, s, v);
1277 bevelFillDict.insert(c.rgb(), pix); 1270 bevelFillDict.insert(c.rgb(), pix);
1278 } 1271 }
1279 p->setPen(c.dark(150)); 1272 p->setPen(c.dark(150));
1280 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1273 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1281 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1274 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1282 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1275 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1283 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1276 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1284 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1277 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1285 } 1278 }
1286 1279
1287 QColor newColor = btn == highlightWidget || sunken ? 1280 QColor newColor = btn == highlightWidget || sunken ?
1288 g.button().light(120) : g.button(); 1281 g.button().light(120) : g.button();
1289 1282
1290 drawRoundButton(p, newColor, g.background(), 1283 drawRoundButton(p, newColor, g.background(),
1291 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), 1284 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(),
1292 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), 1285 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(),
1293 btn->autoMask()); 1286 btn->autoMask());
1294} 1287}
1295 1288
1296void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) 1289void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
1297{ 1290{
1298 int x1, y1, x2, y2, w, h; 1291 int x1, y1, x2, y2, w, h;
1299 btn->rect().coords(&x1, &y1, &x2, &y2); 1292 btn->rect().coords(&x1, &y1, &x2, &y2);
1300 w = btn->width(); 1293 w = btn->width();
1301 h = btn->height(); 1294 h = btn->height();
1302 1295
1303 bool act = btn->isOn() || btn->isDown(); 1296 bool act = btn->isOn() || btn->isDown();
1304 if(act){ 1297 if(act){
1305 ++x1, ++y1; 1298 ++x1, ++y1;
1306 } 1299 }
1307 1300
1308 // Draw iconset first, if any 1301 // Draw iconset first, if any
1309 if ( btn->iconSet() && !btn->iconSet()->isNull() ) 1302 if ( btn->iconSet() && !btn->iconSet()->isNull() )
1310 { 1303 {
1311 QIconSet::Mode mode = btn->isEnabled() 1304 QIconSet::Mode mode = btn->isEnabled()
1312 ? QIconSet::Normal : QIconSet::Disabled; 1305 ? QIconSet::Normal : QIconSet::Disabled;
1313 if ( mode == QIconSet::Normal && btn->hasFocus() ) 1306 if ( mode == QIconSet::Normal && btn->hasFocus() )
1314 mode = QIconSet::Active; 1307 mode = QIconSet::Active;
1315 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); 1308 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode );
1316 int pixw = pixmap.width(); 1309 int pixw = pixmap.width();
1317 int pixh = pixmap.height(); 1310 int pixh = pixmap.height();
1318 1311
1319 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); 1312 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap );
1320 x1 += pixw + 8; 1313 x1 += pixw + 8;
1321 w -= pixw + 8; 1314 w -= pixw + 8;
1322 } 1315 }
1323 1316
1324 if(act){ 1317 if(act){
1325 QFont font = btn->font(); 1318 QFont font = btn->font();
1326 font.setBold(true); 1319 font.setBold(true);
1327 p->setFont(font); 1320 p->setFont(font);
1328 QColor shadow(btn->colorGroup().button().dark(130)); 1321 QColor shadow(btn->colorGroup().button().dark(130));
1329 drawItem( p, x1+1, y1+1, w, h, 1322 drawItem( p, x1+1, y1+1, w, h,
1330 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1323 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1331 btn->pixmap(), btn->text(), -1, 1324 btn->pixmap(), btn->text(), -1,
1332 &shadow); 1325 &shadow);
1333 1326
1334 drawItem( p, x1, y1, w, h, 1327 drawItem( p, x1, y1, w, h,
1335 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1328 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1336 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); 1329 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light());
1337 } 1330 }
1338 else{ 1331 else{
1339 /* Too blurry 1332 /* Too blurry
1340 drawItem( p, x1+1, y1+1, w, h, 1333 drawItem( p, x1+1, y1+1, w, h,
1341 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1334 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1342 btn->pixmap(), btn->text(), -1, 1335 btn->pixmap(), btn->text(), -1,
1343 &btn->colorGroup().button().dark(115)); 1336 &btn->colorGroup().button().dark(115));
1344 */ 1337 */
1345 drawItem( p, x1, y1, w, h, 1338 drawItem( p, x1, y1, w, h,
1346 AlignCenter | ShowPrefix, 1339 AlignCenter | ShowPrefix,
1347 btn->colorGroup(), btn->isEnabled(), 1340 btn->colorGroup(), btn->isEnabled(),
1348 btn->pixmap(), btn->text(), -1, 1341 btn->pixmap(), btn->text(), -1,
1349 &btn->colorGroup().buttonText()); 1342 &btn->colorGroup().buttonText());
1350 } 1343 }
1351} 1344}
1352 1345
1353void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) 1346void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
1354{ 1347{
1355 int x2 = x+w-1; 1348 int x2 = x+w-1;
1356 int y2 = y+h-1; 1349 int y2 = y+h-1;
1357 1350
1358 p->setPen(Qt::color1); 1351 p->setPen(Qt::color1);
1359 p->fillRect(x, y, w, h, Qt::color0); 1352 p->fillRect(x, y, w, h, Qt::color0);
1360 if(w < 21 || h < 21){ 1353 if(w < 21 || h < 21){
1361 // outer rect 1354 // outer rect
1362 p->drawLine(x, y+2, x, y2-2); // l 1355 p->drawLine(x, y+2, x, y2-2); // l
1363 p->drawLine(x2, y+2, x2, y2-2); // r 1356 p->drawLine(x2, y+2, x2, y2-2); // r
1364 p->drawLine(x+2, y, x2-2, y); // t 1357 p->drawLine(x+2, y, x2-2, y); // t
1365 p->drawLine(x+2, y2, x2-2, y2); // b 1358 p->drawLine(x+2, y2, x2-2, y2); // b
1366 p->drawLine(x+1, y+1, x2-1, y+1); // top second line 1359 p->drawLine(x+1, y+1, x2-1, y+1); // top second line
1367 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line 1360 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line
1368 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); 1361 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1);
1369 } 1362 }
1370 else{ 1363 else{
1371 int x2 = x+w-1; 1364 int x2 = x+w-1;
1372 int y2 = y+h-1; 1365 int y2 = y+h-1;
1373 int bx2 = htmlBtnMaskBmp.width()-1; 1366 int bx2 = htmlBtnMaskBmp.width()-1;
1374 int by2 = htmlBtnMaskBmp.height()-1; 1367 int by2 = htmlBtnMaskBmp.height()-1;
1375 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl 1368 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
1376 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr 1369 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
1377 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl 1370 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
1378 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br 1371 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
1379 // fills 1372 // fills
1380 p->fillRect(10, 0, w-20, 10, Qt::color1); // top 1373 p->fillRect(10, 0, w-20, 10, Qt::color1); // top
1381 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1374 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1382 p->fillRect(0, 10, w, h-20, Qt::color1); // middle 1375 p->fillRect(0, 10, w, h-20, Qt::color1); // middle
1383 } 1376 }
1384} 1377}
1385 1378
1386void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 1379void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
1387 const QColorGroup &g, bool sunken, 1380 const QColorGroup &g, bool sunken,
1388 const QBrush */*fill*/) 1381 const QBrush */*fill*/)
1389{ 1382{
1390 if(currentHeader && p->device() == currentHeader){ 1383 if(currentHeader && p->device() == currentHeader){
1391 int id = currentHeader->sectionAt(x); 1384 int id = currentHeader->sectionAt(x);
1392 bool isHeaderHover = id != -1 && id == headerHoverID; 1385 bool isHeaderHover = id != -1 && id == headerHoverID;
1393 drawClearBevel(p, x, y, w, h, sunken ? 1386 drawClearBevel(p, x, y, w, h, sunken ?
1394 g.button() : isHeaderHover ? g.button().light(110) : 1387 g.button() : isHeaderHover ? g.button().light(110) :
1395 g.background(), g.background()); 1388 g.background(), g.background());
1396 } 1389 }
1397 else 1390 else
1398 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), 1391 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
1399 g.background()); 1392 g.background());
1400} 1393}
1401 1394
1402QRect LiquidStyle::buttonRect(int x, int y, int w, int h) 1395QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
1403{ 1396{
1404 return(QRect(x+5, y+5, w-10, h-10)); 1397 return(QRect(x+5, y+5, w-10, h-10));
1405} 1398}
1406 1399
1407void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 1400void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
1408 const QColorGroup &g, bool sunken, 1401 const QColorGroup &g, bool sunken,
1409 bool edit, bool, const QBrush *) 1402 bool edit, bool, const QBrush *)
1410{ 1403{
1411 bool isActive = false; 1404 bool isActive = false;
1412 if (( painter->device()->devType() == QInternal::Widget ) && 1405 if (( painter->device()->devType() == QInternal::Widget ) &&
1413 ( 1406 (
1414 ( qApp-> focusWidget ( ) == painter-> device ( )) || 1407 ( qApp-> focusWidget ( ) == painter-> device ( )) ||
1415 ( 1408 (
1416 edit && 1409 edit &&
1417 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && 1410 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
1418 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) 1411 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ))
1419 ) 1412 )
1420 ) 1413 )
1421 ) { 1414 ) {
1422 isActive = true; 1415 isActive = true;
1423 } 1416 }
1424 1417
1425 bool isMasked = false; 1418 bool isMasked = false;
1426 if(painter->device()->devType() == QInternal::Widget) 1419 if(painter->device()->devType() == QInternal::Widget)
1427 isMasked = ((QWidget*)painter->device())->autoMask(); 1420 isMasked = ((QWidget*)painter->device())->autoMask();
1428 // TODO: Do custom code, don't just call drawRoundButton into a pixmap 1421 // TODO: Do custom code, don't just call drawRoundButton into a pixmap
1429 QPixmap tmpPix(w, h); 1422 QPixmap tmpPix(w, h);
1430 QPainter p(&tmpPix); 1423 QPainter p(&tmpPix);
1431 1424
1432 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1425 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1433 sunken, false, isMasked); 1426 sunken, false, isMasked);
1434 if(!isActive){ 1427 if(!isActive){
1435 p.setClipRect(0, 0, w-17, h); 1428 p.setClipRect(0, 0, w-17, h);
1436 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1429 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1437 sunken, false, isMasked); 1430 sunken, false, isMasked);
1438 } 1431 }
1439 p.end(); 1432 p.end();
1440 int x2 = x+w-1; 1433 int x2 = x+w-1;
1441 int y2 = y+h-1; 1434 int y2 = y+h-1;
1442 int bx2 = btnMaskBmp.width()-1; 1435 int bx2 = btnMaskBmp.width()-1;
1443 int by2 = btnMaskBmp.height()-1; 1436 int by2 = btnMaskBmp.height()-1;
1444 QBitmap btnMask(w, h); 1437 QBitmap btnMask(w, h);
1445 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 1438 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
1446 p.begin(&btnMask); 1439 p.begin(&btnMask);
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff
index d90433c..9ae24cc 100644
--- a/noncore/styles/liquid/opie-liquid.diff
+++ b/noncore/styles/liquid/opie-liquid.diff
@@ -1,2262 +1,2247 @@
1This is a patch to mosfet's liquid 0.7. 1This is a patch to mosfet's liquid 0.7.
2Features: 2Features:
3 - Qt-only 3 - Qt-only
4 - works with Qt/E on QPE/OPIE 4 - works with Qt/E on QPE/OPIE
5 5
6 --- -2002-11-21 20:45:47.000000000 +0100 6 --- -2002-11-29 12:30:34.000000000 +0100
7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100 7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100
8@@ -2,7 +2,7 @@ 8@@ -2,7 +2,7 @@
9 #define LIQUID_STYLE_H 9 #define LIQUID_STYLE_H
10 10
11 11
12-#include <kstyle.h> 12-#include <kstyle.h>
13+#include <qwindowsstyle.h> 13+#include <qwindowsstyle.h>
14 #include <qpainter.h> 14 #include <qpainter.h>
15 #include <qdrawutil.h> 15 #include <qdrawutil.h>
16 #include <qpalette.h> 16 #include <qpalette.h>
17@@ -20,7 +20,7 @@ 17@@ -20,7 +20,7 @@
18 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 18 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
19 */ 19 */
20 20
21-class KPixmap; 21-class KPixmap;
22+class QPixmap; 22+class QPixmap;
23 23
24 #define BITMAP_ITEMS 41 24 #define BITMAP_ITEMS 41
25 #define LIQUID_MENU_CHANGE 667 25 #define LIQUID_MENU_CHANGE 667
26@@ -50,24 +50,22 @@ 26@@ -50,24 +50,22 @@
27 ~TransMenuHandler(){;} 27 ~TransMenuHandler(){;}
28 void reloadSettings(); 28 void reloadSettings();
29 int transType(){return(type);} 29 int transType(){return(type);}
30- KPixmap *pixmap(WId id){return(pixDict.find(id));} 30- KPixmap *pixmap(WId id){return(pixDict.find(id));}
31+ QPixmap *pixmap(WId id){return(pixDict.find(id));} 31+ QPixmap *pixmap(WId id){return(pixDict.find(id));}
32 const QColor& textColor(){return(fgColor);} 32 const QColor& textColor(){return(fgColor);}
33 const QColor& bgColor(){return(color);} 33 const QColor& bgColor(){return(color);}
34 bool useShadowText(){return(shadowText);} 34 bool useShadowText(){return(shadowText);}
35-protected slots: 35-protected slots:
36- void slotKIPCMessage(int id, int arg); 36- void slotKIPCMessage(int id, int arg);
37 protected: 37 protected:
38 bool eventFilter(QObject *obj, QEvent *ev); 38 bool eventFilter(QObject *obj, QEvent *ev);
39- void stripePixmap(KPixmap &pix, const QColor &color); 39- void stripePixmap(KPixmap &pix, const QColor &color);
40+ void stripePixmap(QPixmap &pix, const QColor &color); 40+ void stripePixmap(QPixmap &pix, const QColor &color);
41 41
42 QColor color, fgColor; 42 QColor color, fgColor;
43 int opacity; 43 int opacity;
44 int type; 44 int type;
45 bool shadowText; 45 bool shadowText;
46- QIntDict<KPixmap>pixDict; 46- QIntDict<KPixmap>pixDict;
47+ QIntDict<QPixmap>pixDict; 47+ QIntDict<QPixmap>pixDict;
48 }; 48 };
49 49
50-class LiquidStyle : public KStyle 50-class LiquidStyle : public KStyle
51+class LiquidStyle : public QWindowsStyle 51+class LiquidStyle : public QWindowsStyle
52 { 52 {
53 friend class TransMenuHandler; 53 friend class TransMenuHandler;
54 public: 54 public:
55@@ -121,33 +119,14 @@ 55@@ -121,33 +119,14 @@
56 bool tickAbove, bool tickBelow); 56 bool tickAbove, bool tickBelow);
57 void drawSliderMask(QPainter *p, int x, int y, int w, int h, 57 void drawSliderMask(QPainter *p, int x, int y, int w, int h,
58 Orientation orient, bool, bool); 58 Orientation orient, bool, bool);
59- void drawKToolBar(QPainter *p, int x, int y, int w, int h, 59- void drawKToolBar(QPainter *p, int x, int y, int w, int h,
60- const QColorGroup &g, KToolBarPos type, 60- const QColorGroup &g, KToolBarPos type,
61- QBrush *fill=NULL); 61- QBrush *fill=NULL);
62- void drawKBarHandle(QPainter *p, int x, int y, int w, int h, 62- void drawKBarHandle(QPainter *p, int x, int y, int w, int h,
63- const QColorGroup &g, 63- const QColorGroup &g,
64- KToolBarPos type, QBrush *fill=NULL); 64- KToolBarPos type, QBrush *fill=NULL);
65- void drawKMenuBar(QPainter *p, int x, int y, int w, int h, 65- void drawKMenuBar(QPainter *p, int x, int y, int w, int h,
66- const QColorGroup &g, bool macMode, 66- const QColorGroup &g, bool macMode,
67- QBrush *fill=NULL); 67- QBrush *fill=NULL);
68- void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 68- void drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
69- const QColorGroup &g, bool sunken=false, 69- const QColorGroup &g, bool sunken=false,
70- bool raised = true, bool enabled = true, 70- bool raised = true, bool enabled = true,
71- bool popup = false, 71- bool popup = false,
72- KToolButtonType icontext = Icon, 72- KToolButtonType icontext = Icon,
73- const QString& btext=QString::null, 73- const QString& btext=QString::null,
74- const QPixmap *icon=NULL, 74- const QPixmap *icon=NULL,
75- QFont *font=NULL, QWidget *btn=NULL); 75- QFont *font=NULL, QWidget *btn=NULL);
76- void drawKMenuItem(QPainter *p, int x, int y, int w, int h, 76- void drawKMenuItem(QPainter *p, int x, int y, int w, int h,
77- const QColorGroup &g, bool active, 77- const QColorGroup &g, bool active,
78- QMenuItem *item, QBrush *fill=NULL); 78- QMenuItem *item, QBrush *fill=NULL);
79 +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 79 +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
80+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); 80+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active );
81+ 81+
82 void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, 82 void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw,
83 int tab, QMenuItem *mi, const QPalette &pal, 83 int tab, QMenuItem *mi, const QPalette &pal,
84 bool act, bool enabled, int x, int y, int w, 84 bool act, bool enabled, int x, int y, int w,
85 int h); 85 int h);
86 int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); 86 int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm);
87- void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 87- void drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
88- const QColorGroup &g, QBrush *fill); 88- const QColorGroup &g, QBrush *fill);
89 void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, 89 void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g,
90 const QColor *pen, bool atBorder); 90 const QColor *pen, bool atBorder);
91 int defaultFrameWidth() const {return(2);} 91 int defaultFrameWidth() const {return(2);}
92@@ -167,12 +146,6 @@ 92@@ -167,12 +146,6 @@
93 void drawToolButton(QPainter *p, int x, int y, int w, 93 void drawToolButton(QPainter *p, int x, int y, int w,
94 int h, const QColorGroup &g, 94 int h, const QColorGroup &g,
95 bool sunken, const QBrush *fill); 95 bool sunken, const QBrush *fill);
96- void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 96- void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
97- const QColorGroup &g, QBrush *); 97- const QColorGroup &g, QBrush *);
98- void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 98- void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
99- const QColorGroup &g, 99- const QColorGroup &g,
100- const QString &title, bool active, 100- const QString &title, bool active,
101- QPixmap *icon, QBrush *fill); 101- QPixmap *icon, QBrush *fill);
102 // for repainting toolbuttons when the toolbar is resized 102 // for repainting toolbuttons when the toolbar is resized
103 bool eventFilter(QObject *obj, QEvent *ev); 103 bool eventFilter(QObject *obj, QEvent *ev);
104 void drawSliderGroove(QPainter * p, int x, int y, int w, int h, 104 void drawSliderGroove(QPainter * p, int x, int y, int w, int h,
105@@ -198,25 +171,15 @@ 105@@ -198,25 +171,15 @@
106 void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 106 void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
107 bool down=false, bool fast = true); 107 bool down=false, bool fast = true);
108 void drawRoundRect(QPainter *p, int x, int y, int w, int h); 108 void drawRoundRect(QPainter *p, int x, int y, int w, int h);
109- void loadCustomButtons(); 109- void loadCustomButtons();
110- void applyCustomAttributes(QPushButton *btn); 110- void applyCustomAttributes(QPushButton *btn);
111- void unapplyCustomAttributes(QPushButton *btn); 111- void unapplyCustomAttributes(QPushButton *btn);
112 QPixmap* getPixmap(BitmapData item); 112 QPixmap* getPixmap(BitmapData item);
113 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); 113 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false);
114 private: 114 private:
115- bool highcolor; 115- bool highcolor;
116- QColorGroup radioOnGrp; 116- QColorGroup radioOnGrp;
117 +bool oldqte; 117 +bool oldqte;
118 +bool flatTBButtons; 118 +bool flatTBButtons;
119 QWidget *highlightWidget; 119 QWidget *highlightWidget;
120- QBrush wallpaper; 120- QBrush wallpaper;
121- QBitmap lightBmp; 121- QBitmap lightBmp;
122- QBitmap grayBmp; 122- QBitmap grayBmp;
123- QBitmap dgrayBmp; 123- QBitmap dgrayBmp;
124- QBitmap maskBmp; 124- QBitmap maskBmp;
125- QBitmap xBmp; 125- QBitmap xBmp;
126 QBitmap btnMaskBmp, htmlBtnMaskBmp; 126 QBitmap btnMaskBmp, htmlBtnMaskBmp;
127 QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; 127 QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix;
128- QBitmap paper1, paper2, paper3; 128- QBitmap paper1, paper2, paper3;
129- QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; 129- QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush;
130+ QBrush bgBrush, menuBrush; 130+ QBrush bgBrush, menuBrush;
131 bool menuAni, menuFade; 131 bool menuAni, menuFade;
132 132
133 QIntDict<QPixmap>btnDict; 133 QIntDict<QPixmap>btnDict;
134@@ -224,9 +187,6 @@ 134@@ -224,9 +187,6 @@
135 QIntDict<QPixmap>bevelFillDict; 135 QIntDict<QPixmap>bevelFillDict;
136 QIntDict<QPixmap>smallBevelFillDict; 136 QIntDict<QPixmap>smallBevelFillDict;
137 137
138- QList<QColor>customBtnColorList; 138- QList<QColor>customBtnColorList;
139- QList<QPixmap>customBtnIconList; 139- QList<QPixmap>customBtnIconList;
140- QStrList customBtnLabelList; 140- QStrList customBtnLabelList;
141 QPixmap *vsbSliderFillPix; 141 QPixmap *vsbSliderFillPix;
142 TransMenuHandler *menuHandler; 142 TransMenuHandler *menuHandler;
143 QPixmap *pixmaps[BITMAP_ITEMS]; 143 QPixmap *pixmaps[BITMAP_ITEMS];
144 --- -2002-11-21 20:45:47.000000000 +0100 144 --- -2002-11-29 12:30:34.000000000 +0100
145 +++ liquid.cpp2002-11-21 20:27:48.000000000 +0100 145 +++ liquid.cpp2002-11-29 12:30:24.000000000 +0100
146@@ -2,6 +2,9 @@ 146@@ -2,6 +2,9 @@
147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
148 */ 148 */
149 149
150+// 150+//
151+// (c) 2002 Robert 'sandman' Griebl 151+// (c) 2002 Robert 'sandman' Griebl
152+// 152+//
153 153
154 154
155 #ifndef INCLUDE_MENUITEM_DEF 155 #ifndef INCLUDE_MENUITEM_DEF
156@@ -10,12 +13,10 @@ 156@@ -10,12 +13,10 @@
157 157
158 #include <qmenudata.h> 158 #include <qmenudata.h>
159 #include "liquid.h" 159 #include "liquid.h"
160-#include <kapp.h> 160-#include <kapp.h>
161-#include <kglobal.h> 161-#include <kglobal.h>
162-#include <kconfig.h> 162-#include <kconfig.h>
163-#include <kdrawutil.h> 163-#include <kdrawutil.h>
164-#include <kglobalsettings.h> 164-#include <kglobalsettings.h>
165-#include <kpixmapeffect.h> 165-#include <kpixmapeffect.h>
166+//#include "liquiddeco.h" 166+//#include "liquiddeco.h"
167+#include <qapplication.h> 167+#include <qapplication.h>
168+#include <qpe/config.h> 168+#include <qpe/config.h>
169+#include "effects.h" 169+#include "effects.h"
170 #include <qpalette.h> 170 #include <qpalette.h>
171 #include <qbitmap.h> 171 #include <qbitmap.h>
172 #include <qtabbar.h> 172 #include <qtabbar.h>
173@@ -25,28 +26,30 @@ 173@@ -25,28 +26,30 @@
174 #include <qtimer.h> 174 #include <qtimer.h>
175 #include <qpixmapcache.h> 175 #include <qpixmapcache.h>
176 #include <qradiobutton.h> 176 #include <qradiobutton.h>
177-#include <kimageeffect.h> 177-#include <kimageeffect.h>
178-#include <ktoolbar.h> 178-#include <ktoolbar.h>
179+#include <qcombobox.h> 179+#include <qcombobox.h>
180 #include <qdrawutil.h> 180 #include <qdrawutil.h>
181 #include <qwidgetlist.h> 181 #include <qwidgetlist.h>
182 #include <qtoolbutton.h> 182 #include <qtoolbutton.h>
183 #include <qheader.h> 183 #include <qheader.h>
184 #include <unistd.h> 184 #include <unistd.h>
185-#include <klocale.h> 185-#include <klocale.h>
186-#include <kiconloader.h> 186-#include <kiconloader.h>
187-#include <kmenubar.h> 187-#include <kmenubar.h>
188-#include <kipc.h> 188-#include <kipc.h>
189+#include <qmenubar.h> 189+#include <qmenubar.h>
190+#include <qprogressbar.h> 190+#include <qprogressbar.h>
191+#include <qlineedit.h> 191+#include <qlineedit.h>
192 192
193-#include <X11/X.h> 193-#include <X11/X.h>
194-#include <X11/Xlib.h> 194-#include <X11/Xlib.h>
195+#include <stdio.h> 195+#include <stdio.h>
196 196
197 #include "htmlmasks.h" 197 #include "htmlmasks.h"
198 #include "embeddata.h" 198 #include "embeddata.h"
199 199
200-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) 200-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color)
201+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 201+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
202+ QColorGroup &, bool, bool); 202+ QColorGroup &, bool, bool);
203+ 203+
204+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 204+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
205+ 205+
206+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 206+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
207 { 207 {
208 QImage img(pix.convertToImage()); 208 QImage img(pix.convertToImage());
209- KImageEffect::fade(img, 0.9, color); 209- KImageEffect::fade(img, 0.9, color);
210+ QImageEffect::fade(img, 0.9, color); 210+ QImageEffect::fade(img, 0.9, color);
211 int x, y; 211 int x, y;
212 int r, g, b; 212 int r, g, b;
213 for(y=0; y < img.height(); y+=3){ 213 for(y=0; y < img.height(); y+=3){
214@@ -71,35 +74,37 @@ 214@@ -71,35 +74,37 @@
215 : QObject(parent) 215 : QObject(parent)
216 { 216 {
217 pixDict.setAutoDelete(true); 217 pixDict.setAutoDelete(true);
218- connect(kapp, SIGNAL(kipcMessage(int, int)), this, 218- connect(kapp, SIGNAL(kipcMessage(int, int)), this,
219- SLOT(slotKIPCMessage(int, int))); 219- SLOT(slotKIPCMessage(int, int)));
220 reloadSettings(); 220 reloadSettings();
221 } 221 }
222 222
223 void TransMenuHandler::reloadSettings() 223 void TransMenuHandler::reloadSettings()
224 { 224 {
225 pixDict.clear(); 225 pixDict.clear();
226- KConfig *config = KGlobal::config(); 226- KConfig *config = KGlobal::config();
227- config->setGroup("MosfetMenus"); 227- config->setGroup("MosfetMenus");
228 228
229- type = config->readNumEntry("Type", TransStippleBg); 229- type = config->readNumEntry("Type", TransStippleBg);
230- color = config->readColorEntry("Color", 230- color = config->readColorEntry("Color",
231- &QApplication::palette().active().button()); 231- &QApplication::palette().active().button());
232- fgColor = config->readColorEntry("TextColor", 232- fgColor = config->readColorEntry("TextColor",
233- &QApplication::palette().active().text()); 233- &QApplication::palette().active().text());
234- opacity = config->readNumEntry("Opacity", 10); 234- opacity = config->readNumEntry("Opacity", 10);
235- shadowText = config->readBoolEntry("ShadowText", true); 235- shadowText = config->readBoolEntry("ShadowText", true);
236+ Config config ( "qpe" ); 236+ Config config ( "qpe" );
237+ config. setGroup ( "Liquid-Style" ); 237+ config. setGroup ( "Liquid-Style" );
238+ 238+
239+ type = config. readNumEntry("Type", TransStippleBg); 239+ type = config. readNumEntry("Type", TransStippleBg);
240+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 240+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
241+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 241+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
242+ opacity = config. readNumEntry("Opacity", 10); 242+ opacity = config. readNumEntry("Opacity", 10);
243+ if ( opacity < -20 ) 243+ if ( opacity < -20 )
244 + opacity = 20; 244 + opacity = 20;
245+ else if ( opacity > 20 ) 245+ else if ( opacity > 20 )
246 + opacity = 20; 246 + opacity = 20;
247+ 247+
248+ shadowText = config. readBoolEntry("ShadowText", true); 248+ shadowText = config. readBoolEntry("ShadowText", true);
249 } 249 }
250 250
251 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 251 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
252 { 252 {
253- QPopupMenu *p = (QPopupMenu *)obj; 253- QPopupMenu *p = (QPopupMenu *)obj;
254+ QWidget *p = (QWidget *)obj; 254+ QWidget *p = (QWidget *)obj;
255 255
256 if(ev->type() == QEvent::Show){ 256 if(ev->type() == QEvent::Show){
257 if(type == TransStippleBg || type == TransStippleBtn || 257 if(type == TransStippleBg || type == TransStippleBtn ||
258 type == Custom){ 258 type == Custom){
259 QApplication::syncX(); 259 QApplication::syncX();
260- KPixmap *pix = new KPixmap; 260- KPixmap *pix = new KPixmap;
261+ QPixmap *pix = new QPixmap; 261+ QPixmap *pix = new QPixmap;
262 if(p->testWFlags(Qt::WType_Popup)){ 262 if(p->testWFlags(Qt::WType_Popup)){
263 QRect r(p->x(), p->y(), p->width(), p->height()); 263 QRect r(p->x(), p->y(), p->width(), p->height());
264 QRect deskR = QApplication::desktop()->rect(); 264 QRect deskR = QApplication::desktop()->rect();
265@@ -107,7 +112,7 @@ 265@@ -107,7 +112,7 @@
266 r.setBottom(deskR.bottom()); 266 r.setBottom(deskR.bottom());
267 r.setRight(deskR.right()); 267 r.setRight(deskR.right());
268 } 268 }
269- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), 269- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(),
270+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 270+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
271 r.width(), r.height()); 271 r.width(), r.height());
272 } 272 }
273 else{ // tear off menu 273 else{ // tear off menu
274@@ -121,82 +126,61 @@ 274@@ -121,82 +126,62 @@
275 stripePixmap(*pix, p->colorGroup().button()); 275 stripePixmap(*pix, p->colorGroup().button());
276 } 276 }
277 else{ 277 else{
278- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 278- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
279+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 279+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
280 } 280 }
281+ 281+
282 pixDict.insert(p->winId(), pix); 282 pixDict.insert(p->winId(), pix);
283+ 283+
284+ if ( !p->inherits("QPopupMenu")) 284+ if ( !p->inherits("QPopupMenu"))
285 + p->setBackgroundPixmap(*pix); 285 + p->setBackgroundPixmap(*pix);
286 + 286 +
287+ QObjectList *ol = p-> queryList("QWidget"); 287+ QObjectList *ol = p-> queryList("QWidget");
288 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 288 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
289 + QWidget *wid = (QWidget *) it.current ( ); 289 + QWidget *wid = (QWidget *) it.current ( );
290 + 290 +
291 + wid-> setBackgroundPixmap(*pix); 291 + wid-> setBackgroundPixmap(*pix);
292 + wid-> setBackgroundOrigin(QWidget::ParentOrigin); 292 + wid-> setBackgroundOrigin(QWidget::ParentOrigin);
293+ } 293+ }
294 + delete ol; 294 + delete ol;
295 } 295 }
296 } 296 }
297 else if(ev->type() == QEvent::Hide){ 297 else if(ev->type() == QEvent::Hide){
298 if(type == TransStippleBg || type == TransStippleBtn || 298 if(type == TransStippleBg || type == TransStippleBtn ||
299 type == Custom){ 299 type == Custom){
300- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 300- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
301- pixDict.remove(p->winId()); 301- pixDict.remove(p->winId());
302- } 302- }
303- } 303- }
304- return(false); 304- return(false);
305-} 305-}
306- 306-
307-void TransMenuHandler::slotKIPCMessage(int id, int) 307-void TransMenuHandler::slotKIPCMessage(int id, int)
308-{ 308-{
309- if(id == LIQUID_MENU_CHANGE){ 309- if(id == LIQUID_MENU_CHANGE){
310- bool oldShadow = shadowText; 310- bool oldShadow = shadowText;
311- 311-
312- KConfig *config = KGlobal::config(); 312- KConfig *config = KGlobal::config();
313- config->reparseConfiguration(); // in case KControl changed values 313- config->reparseConfiguration(); // in case KControl changed values
314+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 314+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
315 315
316- // Make sure no popupmenus are shown. There shouldn't be any because 316- // Make sure no popupmenus are shown. There shouldn't be any because
317- // the user just clicked "Apply", but there can be tear offs ;-) 317- // the user just clicked "Apply", but there can be tear offs ;-)
318- // We just close them so the pixmaps are deleted and regenerated. 318- // We just close them so the pixmaps are deleted and regenerated.
319- QWidgetList *list = QApplication::topLevelWidgets(); 319- QWidgetList *list = QApplication::topLevelWidgets();
320- QWidgetListIt it( *list ); 320- QWidgetListIt it( *list );
321- QWidget *w; 321- QWidget *w;
322- while ((w=it.current()) != 0 ){ 322- while ((w=it.current()) != 0 ){
323- ++it; 323- ++it;
324- if(w->inherits("QPopupMenu")){ 324- if(w->inherits("QPopupMenu")){
325- w->close(); 325- w->close();
326- } 326- }
327- } 327- }
328+ pixDict.remove(p->winId()); 328+ pixDict.remove(p->winId());
329+ if ( !p->inherits("QPopupMenu")) 329+ if ( !p->inherits("QPopupMenu"))
330+ p->setBackgroundMode(QWidget::PaletteBackground); 330+ p->setBackgroundMode(QWidget::PaletteBackground);
331 331
332- reloadSettings(); 332- reloadSettings();
333 + QObjectList *ol = p-> queryList("QWidget"); 333 + QObjectList *ol = p-> queryList("QWidget");
334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
335 + QWidget *wid = (QWidget *) it.current ( ); 335 + QWidget *wid = (QWidget *) it.current ( );
336 336
337- // Now repaint menubar if needed 337- // Now repaint menubar if needed
338- if(shadowText != oldShadow){ 338- if(shadowText != oldShadow){
339- it.toFirst(); 339- it.toFirst();
340- while ((w=it.current()) != 0 ){ 340- while ((w=it.current()) != 0 ){
341- ++it; 341- ++it;
342- if(w->inherits("QMenuBar")){ 342- if(w->inherits("QMenuBar")){
343- w->repaint(); 343- w->repaint();
344- }
345- }
344 + wid-> setBackgroundMode( QWidget::PaletteBackground ); 346 + wid-> setBackgroundMode( QWidget::PaletteBackground );
345 }
346 + delete ol;
347 }
348 } 347 }
349- } 348- }
350- else if(id == MOSFET_BUTTON_CHANGE){ 349- else if(id == MOSFET_BUTTON_CHANGE){
351- qWarning("In mosfet button change"); 350- qWarning("In mosfet button change");
352- // really, this should be in LiquidStyle, but what the hell? ;-) 351- // really, this should be in LiquidStyle, but what the hell? ;-)
353- QWidgetList *list = QApplication::allWidgets(); 352- QWidgetList *list = QApplication::allWidgets();
354- QWidgetListIt it( *list ); 353- QWidgetListIt it( *list );
355- QWidget *w; 354- QWidget *w;
356- while ((w=it.current()) != 0 ){ 355- while ((w=it.current()) != 0 ){
357- ++it; 356- ++it;
358- if(w->inherits("QPushButton")){ 357- if(w->inherits("QPushButton")){
359- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); 358- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w);
360- } 359- }
361- } 360- }
362- ((LiquidStyle*)parent())->loadCustomButtons(); 361- ((LiquidStyle*)parent())->loadCustomButtons();
363- it.toFirst(); 362- it.toFirst();
364- while ((w=it.current()) != 0 ){ 363- while ((w=it.current()) != 0 ){
365- ++it; 364- ++it;
366- if(w->inherits("QPushButton")){ 365- if(w->inherits("QPushButton")){
367- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); 366- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w);
368- } 367 + delete ol;
369- } 368 }
369 }
370+ return(false); 370+ return(false);
371+} 371+}
372 372
373- } 373- }
374+ 374+
375+static int qt_version ( ) 375+static int qt_version ( )
376+{ 376+{
377 +const char *qver = qVersion ( ); 377 +const char *qver = qVersion ( );
378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
379 } 379 }
380 380
381+ 381+
382 LiquidStyle::LiquidStyle() 382 LiquidStyle::LiquidStyle()
383- :KStyle() 383- :KStyle()
384+ :QWindowsStyle() 384+ :QWindowsStyle()
385 { 385 {
386+ setName ( "LiquidStyle" ); 386+ setName ( "LiquidStyle" );
387+ 387+
388 +oldqte = ( qt_version ( ) < 234 ); 388 +oldqte = ( qt_version ( ) < 234 );
389 +flatTBButtons = false; 389 +flatTBButtons = false;
390 +currentHeader = 0;
390+ 391+
391 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 392 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
392 btnMaskBmp.setMask(btnMaskBmp); 393 btnMaskBmp.setMask(btnMaskBmp);
393 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 394 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
394@@ -207,12 +191,8 @@ 395@@ -207,12 +192,8 @@
395 btnDict.setAutoDelete(true); 396 btnDict.setAutoDelete(true);
396 bevelFillDict.setAutoDelete(true); 397 bevelFillDict.setAutoDelete(true);
397 smallBevelFillDict.setAutoDelete(true); 398 smallBevelFillDict.setAutoDelete(true);
398- customBtnColorList.setAutoDelete(true); 399- customBtnColorList.setAutoDelete(true);
399- customBtnIconList.setAutoDelete(true); 400- customBtnIconList.setAutoDelete(true);
400- customBtnLabelList.setAutoDelete(true); 401- customBtnLabelList.setAutoDelete(true);
401 402
402 rMatrix.rotate(270.0); 403 rMatrix.rotate(270.0);
403- highcolor = QPixmap::defaultDepth() > 8; 404- highcolor = QPixmap::defaultDepth() > 8;
404 btnBorderPix = new QPixmap; 405 btnBorderPix = new QPixmap;
405 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 406 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
406 btnBlendPix = new QPixmap; 407 btnBlendPix = new QPixmap;
407@@ -572,131 +552,119 @@ 408@@ -572,131 +553,119 @@
408 case HTMLBtnBorderDown: 409 case HTMLBtnBorderDown:
409 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 410 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
410 break; 411 break;
411+ 412+
412 case HTMLCB: 413 case HTMLCB:
413 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 414 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
414 break; 415 break;
415+ case HTMLCBHover: 416+ case HTMLCBHover:
416+ pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); 417+ pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV);
417+ break; 418+ break;
418 case HTMLCBDown: 419 case HTMLCBDown:
419 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 420 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
420 break; 421 break;
421- case HTMLCBHover: 422- case HTMLCBHover:
422- pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); 423- pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV);
423- break; 424- break;
424 case HTMLCBDownHover: 425 case HTMLCBDownHover:
425- pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", 426- pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown",
426- btnHoverH, btnHoverS, 427- btnHoverH, btnHoverS,
427- btnHoverV); 428- btnHoverV);
428+ pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); 429+ pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV);
429 break; 430 break;
430+ 431+
431 case HTMLRadio: 432 case HTMLRadio:
432 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 433 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
433 + break; 434 + break;
434+ case HTMLRadioHover: 435+ case HTMLRadioHover:
435+ pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); 436+ pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV);
436 + break; 437 + break;
437 case HTMLRadioDown: 438 case HTMLRadioDown:
438 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 439 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
439- case HTMLRadioHover: 440- case HTMLRadioHover:
440- pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); 441- pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV);
441 + break; 442 + break;
442 case HTMLRadioDownHover: 443 case HTMLRadioDownHover:
443- pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", 444- pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown",
444- btnHoverH, btnHoverS, 445- btnHoverH, btnHoverS,
445- btnHoverV); 446- btnHoverV);
446+ pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 447+ pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
447 + break; 448 + break;
448+ 449+
449+ case RadioOff: 450+ case RadioOff:
450+ pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 451+ pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
451+ break; 452+ break;
452+ case RadioOffHover: 453+ case RadioOffHover:
453+ pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 454+ pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
454+ break; 455+ break;
455 case RadioOn: 456 case RadioOn:
456- pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); 457- pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true);
457+ pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 458+ pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
458 break; 459 break;
459 case RadioOnHover: 460 case RadioOnHover:
460- pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, 461- pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS,
461- btnHoverV, true); 462- btnHoverV, true);
462+ pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 463+ pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
463 break; 464 break;
464- case RadioOffHover: 465- case RadioOffHover:
465- pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); 466- pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true);
466+ 467+
467+ case Tab: 468+ case Tab:
468+ pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 469+ pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
469 break; 470 break;
470 case TabDown: 471 case TabDown:
471- pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); 472- pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true);
472+ pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 473+ pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
473 break; 474 break;
474 case TabFocus: 475 case TabFocus:
475- pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, 476- pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS,
476- btnHoverS, true); 477- btnHoverS, true);
477- break; 478- break;
478- case CBDown: 479- case CBDown:
479- pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); 480- pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true);
480+ pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 481+ pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
481 break; 482 break;
482- case CBDownHover: 483- case CBDownHover:
483- pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, 484- pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH,
484- btnHoverS, btnHoverV, true); 485- btnHoverS, btnHoverV, true);
485+ 486+
486 +case CB: 487 +case CB:
487+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 488+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
488 break; 489 break;
489 case CBHover: 490 case CBHover:
490- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 491- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
491+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 492+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
492 break; 493 break;
493- case HSlider: 494- case HSlider:
494- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 495- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
495+ case CBDown: 496+ case CBDown:
496+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 497+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
497+ break; 498 break;
498+ case CBDownHover: 499+ case CBDownHover:
499+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 500+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
500 break; 501+ break;
501+ 502+
502 case VSlider: 503 case VSlider:
503- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 504- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
504+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 505+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
505 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 506 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
506 break; 507 break;
507- case RadioOff: 508- case RadioOff:
508- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 509- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
509- break; 510- break;
510- case Tab: 511- case Tab:
511- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 512- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
512- break; 513- break;
513- case CB: 514- case CB:
514- pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); 515- pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true);
515- break; 516- break;
516 case VSBSliderTop: 517 case VSBSliderTop:
517- pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 518- pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
518+ case VSBSliderTopHover: 519+ case VSBSliderTopHover:
519+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 520+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
520 break; 521 break;
521 case VSBSliderBtm: 522 case VSBSliderBtm:
522- pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 523- pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
523+ case VSBSliderBtmHover: 524+ case VSBSliderBtmHover:
524+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 525+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
525 break; 526 break;
526 case VSBSliderMid: 527 case VSBSliderMid:
527- pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 528- pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
528+ case VSBSliderMidHover: 529+ case VSBSliderMidHover:
529+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 530+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
530 break; 531 break;
531- case VSBSliderTopHover: 532- case VSBSliderTopHover:
532- pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 533- pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
533 +case VSBSliderTopBg: 534 +case VSBSliderTopBg:
534+ pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 535+ pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
535 break; 536 break;
536- case VSBSliderBtmHover: 537- case VSBSliderBtmHover:
537- pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 538- pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
538+ case VSBSliderBtmBg: 539+ case VSBSliderBtmBg:
539+ pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 540+ pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
540 break; 541 break;
541- case VSBSliderMidHover: 542- case VSBSliderMidHover:
542- pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 543- pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
543+ case VSBSliderMidBg: 544+ case VSBSliderMidBg:
544+ pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 545+ pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
545 break; 546 break;
546 547
547- case HSBSliderTop: 548- case HSBSliderTop:
548- pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 549- pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
549- *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); 550- *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix);
550- break; 551- break;
551- case HSBSliderBtm: 552- case HSBSliderBtm:
552- pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 553- pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
553- *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); 554- *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix);
554- break; 555- break;
555- case HSBSliderMid: 556- case HSBSliderMid:
556- pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 557- pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
557- *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); 558- *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix);
558 +case HSlider: 559 +case HSlider:
559+ pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 560+ pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
560 break; 561 break;
561+ case HSBSliderTop: 562+ case HSBSliderTop:
562 case HSBSliderTopHover: 563 case HSBSliderTopHover:
563- pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 564- pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
564- *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); 565- *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix);
565+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 566+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
566+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 567+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
567 break; 568 break;
568+ case HSBSliderBtm: 569+ case HSBSliderBtm:
569 case HSBSliderBtmHover: 570 case HSBSliderBtmHover:
570- pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 571- pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
571- *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); 572- *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix);
572+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 573+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
573+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 574+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
574 break; 575 break;
575+ case HSBSliderMid: 576+ case HSBSliderMid:
576 case HSBSliderMidHover: 577 case HSBSliderMidHover:
577- pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 578- pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
578- *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); 579- *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix);
579- break; 580- break;
580- case VSBSliderTopBg: 581- case VSBSliderTopBg:
581- pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 582- pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
582- break; 583- break;
583- case VSBSliderBtmBg: 584- case VSBSliderBtmBg:
584- pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 585- pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
585- break; 586- break;
586- case VSBSliderMidBg: 587- case VSBSliderMidBg:
587- pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 588- pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
588+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 589+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
589+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 590+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
590 break; 591 break;
591 case HSBSliderTopBg: 592 case HSBSliderTopBg:
592- pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 593- pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
593+ pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 594+ pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
594 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 595 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
595 break; 596 break;
596 case HSBSliderBtmBg: 597 case HSBSliderBtmBg:
597- pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 598- pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
598+ pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 599+ pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
599 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 600 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
600 break; 601 break;
601 case HSBSliderMidBg: 602 case HSBSliderMidBg:
602@@ -711,7 +679,6 @@ 603@@ -711,7 +680,6 @@
603 604
604 void LiquidStyle::polish(QPalette &appPal) 605 void LiquidStyle::polish(QPalette &appPal)
605 { 606 {
606- 607-
607 int i; 608 int i;
608 for(i=0; i < BITMAP_ITEMS; ++i){ 609 for(i=0; i < BITMAP_ITEMS; ++i){
609 if(pixmaps[i]){ 610 if(pixmaps[i]){
610@@ -719,31 +686,28 @@ 611@@ -719,31 +687,28 @@
611 pixmaps[i] = NULL; 612 pixmaps[i] = NULL;
612 } 613 }
613 } 614 }
614- QWidgetList *list = QApplication::allWidgets(); 615- QWidgetList *list = QApplication::allWidgets();
615- QWidgetListIt it( *list ); 616- QWidgetListIt it( *list );
616- QWidget *w; 617- QWidget *w;
617- while ((w=it.current()) != 0 ){ 618- while ((w=it.current()) != 0 ){
618- ++it; 619- ++it;
619- if(w->inherits("QPushButton")){ 620- if(w->inherits("QPushButton")){
620- unapplyCustomAttributes((QPushButton *)w); 621- unapplyCustomAttributes((QPushButton *)w);
621- } 622- }
622- } 623- }
623- 624-
624- loadCustomButtons(); 625- loadCustomButtons();
625- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; 626- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10;
626+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 627+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
627 btnDict.clear(); 628 btnDict.clear();
628 btnBorderDict.clear(); 629 btnBorderDict.clear();
629 bevelFillDict.clear(); 630 bevelFillDict.clear();
630 smallBevelFillDict.clear(); 631 smallBevelFillDict.clear();
631 632
632- KConfig *config = KGlobal::config(); 633- KConfig *config = KGlobal::config();
633- QString oldGrp = config->group(); 634- QString oldGrp = config->group();
634- QPalette pal = QApplication::palette(); 635- QPalette pal = QApplication::palette();
635+ Config config ( "qpe" ); 636+ Config config ( "qpe" );
636+ config. setGroup ( "Liquid-Style" ); 637+ config. setGroup ( "Liquid-Style" );
637 +int contrast = config. readNumEntry ( "StippleContrast", 5 ); 638 +int contrast = config. readNumEntry ( "StippleContrast", 5 );
638 +if ( contrast < 0 ) 639 +if ( contrast < 0 )
639 + contrast = 0; 640 + contrast = 0;
640 +else if ( contrast > 10 ) 641 +else if ( contrast > 10 )
641 + contrast = 10; 642 + contrast = 10;
642+ 643+
643+// QPalette pal = QApplication::palette(); 644+// QPalette pal = QApplication::palette();
644 645
645 // button color stuff 646 // button color stuff
646- config->setGroup("General"); 647- config->setGroup("General");
647- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); 648- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray);
648- if(c == config->readColorEntry("background", &Qt::lightGray)){ 649- if(c == config->readColorEntry("background", &Qt::lightGray)){
649+ config. setGroup ( "Appearance" ); 650+ config. setGroup ( "Appearance" );
650+ QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 651+ QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )))
651+ : appPal. color ( QPalette::Active, QColorGroup::Button ); 652+ : appPal. color ( QPalette::Active, QColorGroup::Button );
652+ if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 653+ if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
653+ : appPal. color ( QPalette::Active, QColorGroup::Background ))) { 654+ : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
654 // force button color to be different from background 655 // force button color to be different from background
655 QBrush btnBrush(QColor(200, 202, 228)); 656 QBrush btnBrush(QColor(200, 202, 228));
656 appPal.setBrush(QColorGroup::Button, btnBrush); 657 appPal.setBrush(QColorGroup::Button, btnBrush);
657@@ -778,8 +742,8 @@ 658@@ -778,8 +743,8 @@
658 adjustHSV(*pix, h, s, v); 659 adjustHSV(*pix, h, s, v);
659 smallBevelFillDict.insert(c.rgb(), pix); 660 smallBevelFillDict.insert(c.rgb(), pix);
660 } 661 }
661- pagerHoverBrush.setColor(c); 662- pagerHoverBrush.setColor(c);
662- pagerHoverBrush.setPixmap(*pix); 663- pagerHoverBrush.setPixmap(*pix);
663+// pagerHoverBrush.setColor(c); 664+// pagerHoverBrush.setColor(c);
664+// pagerHoverBrush.setPixmap(*pix); 665+// pagerHoverBrush.setPixmap(*pix);
665 666
666 c = c.dark(120); 667 c = c.dark(120);
667 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 668 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
668@@ -790,19 +754,13 @@ 669@@ -790,19 +755,13 @@
669 adjustHSV(*pix, h, s, v); 670 adjustHSV(*pix, h, s, v);
670 smallBevelFillDict.insert(c.rgb(), pix); 671 smallBevelFillDict.insert(c.rgb(), pix);
671 } 672 }
672- pagerBrush.setColor(c); 673- pagerBrush.setColor(c);
673- pagerBrush.setPixmap(*pix); 674- pagerBrush.setPixmap(*pix);
674+// pagerBrush.setColor(c); 675+// pagerBrush.setColor(c);
675+// pagerBrush.setPixmap(*pix); 676+// pagerBrush.setPixmap(*pix);
676 677
677 // background color stuff 678 // background color stuff
678- c = config->readColorEntry("background", &Qt::lightGray); 679- c = config->readColorEntry("background", &Qt::lightGray);
679- if(qstrcmp(kapp->argv()[0], "kicker") == 0){ 680- if(qstrcmp(kapp->argv()[0], "kicker") == 0){
680- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); 681- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110));
681- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); 682- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130));
682- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); 683- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110));
683- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); 684- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115));
684- menuBrush.setColor(c); // hack - used for kicker applets 685- menuBrush.setColor(c); // hack - used for kicker applets
685- appPal.setBrush(QColorGroup::Background, menuBrush); 686- appPal.setBrush(QColorGroup::Background, menuBrush);
686- } 687- }
687+ c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 688+ c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )))
688+ : appPal. color ( QPalette::Active, QColorGroup::Background ); 689+ : appPal. color ( QPalette::Active, QColorGroup::Background );
689+ 690+
690 c.hsv(&bH, &bS, &bV); 691 c.hsv(&bH, &bS, &bV);
691 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 692 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
692 693
693@@ -817,101 +775,50 @@ 694@@ -817,101 +776,50 @@
694 wallPaper.fill(c.rgb()); 695 wallPaper.fill(c.rgb());
695 painter.begin(&wallPaper); 696 painter.begin(&wallPaper);
696 for(i=0; i < 32; i+=4){ 697 for(i=0; i < 32; i+=4){
697- painter.setPen(c.dark(105)); 698- painter.setPen(c.dark(105));
698+ painter.setPen(c.dark(100 + contrast)); 699+ painter.setPen(c.dark(100 + contrast));
699 painter.drawLine(0, i, 32, i); 700 painter.drawLine(0, i, 32, i);
700- painter.setPen(c.dark(103)); 701- painter.setPen(c.dark(103));
701+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 702+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
702 painter.drawLine(0, i+1, 32, i+1); 703 painter.drawLine(0, i+1, 32, i+1);
703 }; 704 };
704 painter.end(); 705 painter.end();
705 bgBrush.setColor(c); 706 bgBrush.setColor(c);
706 bgBrush.setPixmap(wallPaper); 707 bgBrush.setPixmap(wallPaper);
707- if(qstrcmp(kapp->argv()[0], "kicker") != 0 && 708- if(qstrcmp(kapp->argv()[0], "kicker") != 0 &&
708- qstrcmp(kapp->argv()[0], "ksplash") != 0){ 709- qstrcmp(kapp->argv()[0], "ksplash") != 0){
709 appPal.setBrush(QColorGroup::Background, bgBrush); 710 appPal.setBrush(QColorGroup::Background, bgBrush);
710- } 711- }
711- 712-
712- // lineedits 713- // lineedits
713- c = config->readColorEntry("windowBackground", &Qt::white); 714- c = config->readColorEntry("windowBackground", &Qt::white);
714- QPixmap basePix; 715- QPixmap basePix;
715- basePix.resize(32, 32); 716- basePix.resize(32, 32);
716- basePix.fill(c.rgb()); 717- basePix.fill(c.rgb());
717- painter.begin(&basePix); 718- painter.begin(&basePix);
718- painter.setPen(c.dark(105)); 719- painter.setPen(c.dark(105));
719- for(i=0; i < 32; i+=4){ 720- for(i=0; i < 32; i+=4){
720- painter.drawLine(0, i, 32, i); 721- painter.drawLine(0, i, 32, i);
721- painter.drawLine(0, i+1, 32, i+1); 722- painter.drawLine(0, i+1, 32, i+1);
722- }; 723- };
723- painter.end(); 724- painter.end();
724- baseBrush.setColor(c); 725- baseBrush.setColor(c);
725- baseBrush.setPixmap(basePix); 726- baseBrush.setPixmap(basePix);
726- it.toFirst(); 727- it.toFirst();
727- while ((w=it.current()) != 0 ){ 728- while ((w=it.current()) != 0 ){
728- ++it; 729- ++it;
729- if(w->inherits("QLineEdit")){ 730- if(w->inherits("QLineEdit")){
730- QPalette pal = w->palette(); 731- QPalette pal = w->palette();
731- pal.setBrush(QColorGroup::Base, baseBrush); 732- pal.setBrush(QColorGroup::Base, baseBrush);
732- w->setPalette(pal); 733- w->setPalette(pal);
733- } 734- }
734- else if(w->inherits("QPushButton")){ 735- else if(w->inherits("QPushButton")){
735- applyCustomAttributes((QPushButton *)w); 736- applyCustomAttributes((QPushButton *)w);
736- } 737- }
737- } 738- }
738- 739-
739- config->setGroup(oldGrp); 740- config->setGroup(oldGrp);
740 } 741 }
741 742
742 void LiquidStyle::polish(QWidget *w) 743 void LiquidStyle::polish(QWidget *w)
743 { 744 {
744 if(w->inherits("QMenuBar")){ 745 if(w->inherits("QMenuBar")){
745- ((QFrame*)w)->setLineWidth(0); 746- ((QFrame*)w)->setLineWidth(0);
746- w->setBackgroundMode(QWidget::NoBackground); 747- w->setBackgroundMode(QWidget::NoBackground);
747+ //((QFrame*)w)->setLineWidth(0); 748+ //((QFrame*)w)->setLineWidth(0);
748+ w->setBackgroundMode(QWidget::PaletteBackground); 749+ w->setBackgroundMode(QWidget::PaletteBackground);
749+ w->setBackgroundOrigin(QWidget::ParentOrigin); 750+ w->setBackgroundOrigin(QWidget::ParentOrigin);
750+ return; 751+ return;
751+ } 752+ }
752+ if(w->inherits("QToolBar")){ 753+ if(w->inherits("QToolBar")){
753+ w->installEventFilter(this); 754+ w->installEventFilter(this);
754+ w->setBackgroundMode(QWidget::PaletteBackground); 755+ w->setBackgroundMode(QWidget::PaletteBackground);
755+ w->setBackgroundOrigin(QWidget::WidgetOrigin); 756+ w->setBackgroundOrigin(QWidget::WidgetOrigin);
756 return; 757 return;
757 } 758 }
758 if(w->inherits("QPopupMenu")) 759 if(w->inherits("QPopupMenu"))
759 w->setBackgroundMode(QWidget::NoBackground); 760 w->setBackgroundMode(QWidget::NoBackground);
760+ else if(w-> testWFlags(Qt::WType_Popup) && 761+ else if(w-> testWFlags(Qt::WType_Popup) &&
761+ !w->inherits("QListBox") && 762+ !w->inherits("QListBox") &&
762+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 763+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
763 + w->installEventFilter(menuHandler); 764 + w->installEventFilter(menuHandler);
764+ } 765+ }
765 766
766 if(w->isTopLevel()){ 767 if(w->isTopLevel()){
767- if(!w->inherits("QPopupMenu") && 768- if(!w->inherits("QPopupMenu") &&
768- qstrcmp(kapp->argv()[0], "kicker") == 0){ 769- qstrcmp(kapp->argv()[0], "kicker") == 0){
769- qWarning("Got panel toplevel %s", w->className()); 770- qWarning("Got panel toplevel %s", w->className());
770- // force extensions and child panels to use proper palette. 771- // force extensions and child panels to use proper palette.
771- if(w->inherits("Panel")){ 772- if(w->inherits("Panel")){
772- qWarning("Setting panel palette"); 773- qWarning("Setting panel palette");
773- w->setPalette(kapp->palette()); 774- w->setPalette(kapp->palette());
774- } 775- }
775- else{ 776- else{
776- // reset palette for everything else 777- // reset palette for everything else
777- QPalette pal = kapp->palette(); 778- QPalette pal = kapp->palette();
778- pal.setBrush(QColorGroup::Background, bgBrush); 779- pal.setBrush(QColorGroup::Background, bgBrush);
779- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); 780- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130));
780- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); 781- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150));
781- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); 782- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110));
782- pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); 783- pal.setColor(QColorGroup::Light, bgBrush.color().light(120));
783- w->setPalette(pal); 784- w->setPalette(pal);
784- } 785- }
785- } 786- }
786 return; 787 return;
787 } 788 }
788- if(qstrcmp(kapp->argv()[0], "kicker") == 0 && 789- if(qstrcmp(kapp->argv()[0], "kicker") == 0 &&
789- w->inherits("KPanelExtension")){ // FIXME - doesn't work 790- w->inherits("KPanelExtension")){ // FIXME - doesn't work
790- w->setPalette(kapp->palette()); 791- w->setPalette(kapp->palette());
791- } 792- }
792 793
793- if(w->inherits("QComboBox") || 794- if(w->inherits("QComboBox") ||
794- w->inherits("QLineEdit") || w->inherits("QRadioButton") || 795- w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
795- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 796- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
796- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 797- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
797- w->inherits("TaskContainer")){ 798- w->inherits("TaskContainer")){
798+ if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 799+ if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
799 w->installEventFilter(this); 800 w->installEventFilter(this);
800 } 801 }
801- if(w->inherits("QLineEdit")){ 802- if(w->inherits("QLineEdit")){
802- QPalette pal = w->palette(); 803- QPalette pal = w->palette();
803- pal.setBrush(QColorGroup::Base, baseBrush); 804- pal.setBrush(QColorGroup::Base, baseBrush);
804- w->setPalette(pal); 805- w->setPalette(pal);
805- } 806- }
806- if(w->inherits("QPushButton")){ 807- if(w->inherits("QPushButton")){
807- applyCustomAttributes((QPushButton *)w); 808- applyCustomAttributes((QPushButton *)w);
808- w->installEventFilter(this); 809- w->installEventFilter(this);
809+ 810+
810+ if(w->inherits("QButton") || w-> inherits("QComboBox")){ 811+ if(w->inherits("QButton") || w-> inherits("QComboBox")){
811 + w-> setBackgroundMode ( QWidget::PaletteBackground ); 812 + w-> setBackgroundMode ( QWidget::PaletteBackground );
812 + w->setBackgroundOrigin ( QWidget::ParentOrigin); 813 + w->setBackgroundOrigin ( QWidget::ParentOrigin);
813 } 814 }
814 815
815 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 816 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
816@@ -942,11 +849,20 @@ 817@@ -942,11 +850,20 @@
817 w->setMouseTracking(true); 818 w->setMouseTracking(true);
818 w->installEventFilter(this); 819 w->installEventFilter(this);
819 } 820 }
820+ if(w-> inherits("QToolButton")) { 821+ if(w-> inherits("QToolButton")) {
821+ if (w->parent()->inherits("QToolBar")) { 822+ if (w->parent()->inherits("QToolBar")) {
822 + ((QToolButton*)w)->setAutoRaise (flatTBButtons); 823 + ((QToolButton*)w)->setAutoRaise (flatTBButtons);
823 + if ( flatTBButtons ) 824 + if ( flatTBButtons )
824 + w->setBackgroundOrigin(QWidget::ParentOrigin); 825 + w->setBackgroundOrigin(QWidget::ParentOrigin);
825 + } 826 + }
826 + w-> installEventFilter ( this ); 827 + w-> installEventFilter ( this );
827+ } 828+ }
828+ if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 829+ if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
829 + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 830 + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
830+ } 831+ }
831 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 832 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
832 return; 833 return;
833 } 834 }
834- if(w->inherits("PanelButtonBase")) 835- if(w->inherits("PanelButtonBase"))
835- return; 836- return;
836 837
837 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 838 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
838 palette().active().brush(QColorGroup::Background).pixmap()){ 839 palette().active().brush(QColorGroup::Background).pixmap()){
839@@ -954,16 +870,21 @@ 840@@ -954,16 +871,21 @@
840 return; 841 return;
841 } 842 }
842 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 843 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
843- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ 844- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){
844 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 845 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
845 if(w->backgroundMode() == QWidget::PaletteBackground || 846 if(w->backgroundMode() == QWidget::PaletteBackground ||
846 w->backgroundMode() == QWidget::PaletteButton){ 847 w->backgroundMode() == QWidget::PaletteButton){
847- w->setBackgroundMode(QWidget::X11ParentRelative); 848- w->setBackgroundMode(QWidget::X11ParentRelative);
848+ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 849+ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
849+ w->setBackgroundOrigin(QWidget::ParentOrigin); 850+ w->setBackgroundOrigin(QWidget::ParentOrigin);
850 +// w->setBackgroundMode(QWidget::NoBackground); 851 +// w->setBackgroundMode(QWidget::NoBackground);
851 } 852 }
852 } 853 }
853- if(w->inherits("KToolBar")){ 854- if(w->inherits("KToolBar")){
854- w->installEventFilter(this); 855- w->installEventFilter(this);
855- //w->setBackgroundMode(QWidget::NoBackground); 856- //w->setBackgroundMode(QWidget::NoBackground);
856- return; 857- return;
857+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 858+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
858 + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 859 + w-> setBackgroundOrigin ( QWidget::ParentOrigin );
859 +else if ( w-> inherits("QFrame") ) 860 +else if ( w-> inherits("QFrame") )
860 + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 861 + w->setBackgroundOrigin ( QWidget::WidgetOrigin );
861+ 862+
862 +if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 863 +if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
863 + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 864 + w->setBackgroundOrigin ( QWidget::WidgetOrigin );
864 } 865 }
865 } 866 }
866 867
867@@ -977,6 +898,11 @@ 868@@ -977,6 +899,11 @@
868 869
869 if(w->inherits("QPopupMenu")) 870 if(w->inherits("QPopupMenu"))
870 w->setBackgroundMode(QWidget::PaletteButton); 871 w->setBackgroundMode(QWidget::PaletteButton);
871+ else if(w-> testWFlags(Qt::WType_Popup) && 872+ else if(w-> testWFlags(Qt::WType_Popup) &&
872+ !w->inherits("QListBox") && 873+ !w->inherits("QListBox") &&
873+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 874+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
874 + w->removeEventFilter(menuHandler); 875 + w->removeEventFilter(menuHandler);
875+ } 876+ }
876 877
877 if(w->isTopLevel()) 878 if(w->isTopLevel())
878 return; 879 return;
879@@ -986,7 +912,7 @@ 880@@ -986,7 +913,7 @@
880 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 881 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
881 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 882 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
882 883
883- w->setPalette(QApplication::palette()); 884- w->setPalette(QApplication::palette());
884+ w->unsetPalette(); 885+ w->unsetPalette();
885 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 886 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
886 if(w->inherits("QPushButton")) 887 if(w->inherits("QPushButton"))
887 w->setBackgroundMode(QWidget::PaletteButton); 888 w->setBackgroundMode(QWidget::PaletteButton);
888@@ -997,16 +923,12 @@ 889@@ -997,16 +924,12 @@
889 if(isViewportChild) 890 if(isViewportChild)
890 w->setAutoMask(false); 891 w->setAutoMask(false);
891 892
892- if(w->inherits("QPushButton")){ 893- if(w->inherits("QPushButton")){
893- unapplyCustomAttributes((QPushButton *)w); 894- unapplyCustomAttributes((QPushButton *)w);
894- w->removeEventFilter(this); 895- w->removeEventFilter(this);
895+/* 896+/*
896+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 897+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
897 + w-> setBackgroundMode ( PaletteBackground ); 898 + w-> setBackgroundMode ( PaletteBackground );
898 } 899 }
899- 900-
900- if(w->inherits("QComboBox") || 901- if(w->inherits("QComboBox") ||
901- w->inherits("QLineEdit") || w->inherits("QRadioButton") || 902- w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
902- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 903- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
903- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 904- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
904- w->inherits("TaskContainer")){ 905- w->inherits("TaskContainer")){
905+*/ 906+*/
906+ if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 907+ if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
907 w->removeEventFilter(this); 908 w->removeEventFilter(this);
908 } 909 }
909 if(w->inherits("QButton") || w->inherits("QComboBox")){ 910 if(w->inherits("QButton") || w->inherits("QComboBox")){
910@@ -1014,9 +936,12 @@ 911@@ -1014,9 +937,12 @@
911 w->setAutoMask(false); 912 w->setAutoMask(false);
912 } 913 }
913 } 914 }
914- if(w->inherits("KToolBar")){ 915- if(w->inherits("KToolBar")){
915+ if(w-> inherits("QToolButton")) { 916+ if(w-> inherits("QToolButton")) {
916 + w-> removeEventFilter ( this ); 917 + w-> removeEventFilter ( this );
917+ } 918+ }
918+ if(w->inherits("QToolBar")){ 919+ if(w->inherits("QToolBar")){
919 w->removeEventFilter(this); 920 w->removeEventFilter(this);
920- //w->setBackgroundMode(QWidget::PaletteBackground); 921- //w->setBackgroundMode(QWidget::PaletteBackground);
921+ w->setBackgroundMode(QWidget::PaletteBackground); 922+ w->setBackgroundMode(QWidget::PaletteBackground);
922 return; 923 return;
923 } 924 }
924 if(w->inherits("QHeader")){ 925 if(w->inherits("QHeader")){
925@@ -1028,22 +953,118 @@ 926@@ -1028,22 +954,118 @@
926 void LiquidStyle::polish(QApplication *app) 927 void LiquidStyle::polish(QApplication *app)
927 { 928 {
928 929
929- KStyle::polish(app); 930- KStyle::polish(app);
930+ QWindowsStyle::polish(app); 931+ QWindowsStyle::polish(app);
931 menuAni = app->isEffectEnabled(UI_AnimateMenu); 932 menuAni = app->isEffectEnabled(UI_AnimateMenu);
932 menuFade = app->isEffectEnabled(UI_FadeMenu); 933 menuFade = app->isEffectEnabled(UI_FadeMenu);
933 if(menuAni) 934 if(menuAni)
934 app->setEffectEnabled(UI_AnimateMenu, false); 935 app->setEffectEnabled(UI_AnimateMenu, false);
935 if(menuFade) 936 if(menuFade)
936 app->setEffectEnabled(UI_FadeMenu, false); 937 app->setEffectEnabled(UI_FadeMenu, false);
937 + 938 +
938+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 939+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
939+ 940+
940+ Config config ( "qpe" ); 941+ Config config ( "qpe" );
941+ config. setGroup ( "Liquid-Style" ); 942+ config. setGroup ( "Liquid-Style" );
942+ 943+
943 +// if ( config. readBoolEntry ( "WinDecoration", true )) 944 +// if ( config. readBoolEntry ( "WinDecoration", true ))
944 +// QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 945 +// QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
945 + 946 +
946 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 947 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
947 } 948 }
948 949
949 void LiquidStyle::unPolish(QApplication *app) 950 void LiquidStyle::unPolish(QApplication *app)
950 { 951 {
951- KStyle::unPolish(app); 952- KStyle::unPolish(app);
952+ QWindowsStyle::unPolish(app); 953+ QWindowsStyle::unPolish(app);
953 app->setEffectEnabled(UI_AnimateMenu, menuAni); 954 app->setEffectEnabled(UI_AnimateMenu, menuAni);
954 app->setEffectEnabled(UI_FadeMenu, menuFade); 955 app->setEffectEnabled(UI_FadeMenu, menuFade);
955+ 956+
956+ qt_set_draw_menu_bar_impl ( 0 ); 957+ qt_set_draw_menu_bar_impl ( 0 );
957+ 958+
958+// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 959+// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
959 } 960 }
960 961
961+ 962+
962+/* !! HACK !! Beware 963+/* !! HACK !! Beware
963+ * 964+ *
964+ * TT forgot to make the QProgressBar widget styleable in Qt 2.x 965+ * TT forgot to make the QProgressBar widget styleable in Qt 2.x
965+ * So the only way to customize the drawing, is to intercept the 966+ * So the only way to customize the drawing, is to intercept the
966+ * paint event - since we have to use protected functions, we need 967+ * paint event - since we have to use protected functions, we need
967+ * to derive a "hack" class from QProgressBar and do the painting 968+ * to derive a "hack" class from QProgressBar and do the painting
968+ * in there. 969+ * in there.
969+ * 970+ *
970+ * - sandman 971+ * - sandman
971+ */ 972+ */
972+ 973+
973+class HackProgressBar : public QProgressBar { 974+class HackProgressBar : public QProgressBar {
974+public: 975+public:
975 +HackProgressBar ( ); 976 +HackProgressBar ( );
976 + 977 +
977 +void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 978 +void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
978 +{ 979 +{
979 + QPainter p( this ); 980 + QPainter p( this );
980+ 981+
981 + if ( !contentsRect().contains( event->rect() ) ) { 982 + if ( !contentsRect().contains( event->rect() ) ) {
982 + p.save(); 983 + p.save();
983 + p.setClipRegion( event->region().intersect(frameRect()) ); 984 + p.setClipRegion( event->region().intersect(frameRect()) );
984 + drawFrame( &p); 985 + drawFrame( &p);
985 + p.restore(); 986 + p.restore();
986 + } 987 + }
987 + if ( event->rect().intersects( contentsRect() )) { 988 + if ( event->rect().intersects( contentsRect() )) {
988 + p.setClipRegion( event->region().intersect( contentsRect() ) ); 989 + p.setClipRegion( event->region().intersect( contentsRect() ) );
989+ 990+
990 + int x, y, w, h; 991 + int x, y, w, h;
991 + contentsRect ( ). rect ( &x, &y, &w, &h ); 992 + contentsRect ( ). rect ( &x, &y, &w, &h );
992+ 993+
993 + int prog = progress ( ); 994 + int prog = progress ( );
994 + int total = totalSteps ( ); 995 + int total = totalSteps ( );
995 + if ( prog < 0 ) 996 + if ( prog < 0 )
996 + prog = 0; 997 + prog = 0;
997 + if ( total <= 0 ) 998 + if ( total <= 0 )
998 + total = 1; 999 + total = 1;
999 + int bw = w * prog / total; 1000 + int bw = w * prog / total;
1000 + if ( bw > w ) 1001 + if ( bw > w )
1001 + bw = w; 1002 + bw = w;
1002+ 1003+
1003 + p.setPen(g.button().dark(130)); 1004 + p.setPen(g.button().dark(130));
1004 + p.drawRect(x, y, bw, h); 1005 + p.drawRect(x, y, bw, h);
1005 + p.setPen(g.button().light(120)); 1006 + p.setPen(g.button().light(120));
1006 + p.drawRect(x+1, y+1, bw-2, h-2); 1007 + p.drawRect(x+1, y+1, bw-2, h-2);
1007+ 1008+
1008 + if(bw >= 4 && h >= 4 && pix) 1009 + if(bw >= 4 && h >= 4 && pix)
1009 + p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1010 + p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1010 + 1011 +
1011 + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1012 + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1012 + QString pstr; 1013 + QString pstr;
1013 + pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1014 + pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1014 + p. setPen ( g.text());//g.highlightedText ( )); 1015 + p. setPen ( g.text());//g.highlightedText ( ));
1015 + p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1016 + p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1016 + } 1017 + }
1017 + } 1018 + }
1018 +} 1019 +}
1019+}; 1020+};
1020+ 1021+
1021+ 1022+
1022+/* 1023+/*
1023+ * The same for QToolButton: 1024+ * The same for QToolButton:
1024+ * TT hardcoded the drawing of the focus rect ... 1025+ * TT hardcoded the drawing of the focus rect ...
1025+ * 1026+ *
1026+ * - sandman 1027+ * - sandman
1027+ */ 1028+ */
1028+ 1029+
1029+ 1030+
1030+class HackToolButton : public QToolButton { 1031+class HackToolButton : public QToolButton {
1031+public: 1032+public:
1032 +HackToolButton ( ); 1033 +HackToolButton ( );
1033 + 1034 +
1034 +void paint ( QPaintEvent *ev ) 1035 +void paint ( QPaintEvent *ev )
1035 +{ 1036 +{
1036 + erase ( ev-> region ( )); 1037 + erase ( ev-> region ( ));
1037 + QPainter p ( this ); 1038 + QPainter p ( this );
1038 + style ( ). drawToolButton ( this, &p ); 1039 + style ( ). drawToolButton ( this, &p );
1039 + drawButtonLabel ( &p ); 1040 + drawButtonLabel ( &p );
1040 +} 1041 +}
1041+}; 1042+};
1042+ 1043+
1043 /* 1044 /*
1044 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1045 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1045 * force everything to erase and repaint on resize. This is going away, I'm 1046 * force everything to erase and repaint on resize. This is going away, I'm
1046@@ -1063,7 +1084,7 @@ 1047@@ -1063,7 +1085,7 @@
1047 */ 1048 */
1048 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1049 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1049 { 1050 {
1050- if(obj->inherits("KToolBar")){ 1051- if(obj->inherits("KToolBar")){
1051+ if(obj->inherits("QToolBar")){ 1052+ if(obj->inherits("QToolBar")){
1052 if(ev->type() == QEvent::Resize){ 1053 if(ev->type() == QEvent::Resize){
1053 const QObjectList *tbChildList = obj->children(); 1054 const QObjectList *tbChildList = obj->children();
1054 QObjectListIt it(*tbChildList); 1055 QObjectListIt it(*tbChildList);
1055@@ -1076,116 +1097,27 @@ 1056@@ -1076,116 +1098,23 @@
1056 1057
1057 } 1058 }
1058 } 1059 }
1059- else if(obj->inherits("KMiniPagerButton")){ 1060- else if(obj->inherits("KMiniPagerButton")){
1060- QButton *btn = (QButton *)obj; 1061- QButton *btn = (QButton *)obj;
1061- if(ev->type() == QEvent::Paint){ 1062- if(ev->type() == QEvent::Paint){
1062- if(!(btn->isOn() || btn->isDown())){ 1063- if(!(btn->isOn() || btn->isDown())){
1063- QPalette pal = btn->palette(); 1064- QPalette pal = btn->palette();
1064- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? 1065- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ?
1065- pagerHoverBrush : pagerBrush); 1066- pagerHoverBrush : pagerBrush);
1066- btn->setPalette(pal); 1067- btn->setPalette(pal);
1067- } 1068- }
1068- else{ 1069- else{
1069- QPalette pal = btn->palette(); 1070- QPalette pal = btn->palette();
1070- pal.setBrush(QColorGroup::Dark, 1071- pal.setBrush(QColorGroup::Dark,
1071- QApplication::palette().active().brush(QColorGroup::Dark)); 1072- QApplication::palette().active().brush(QColorGroup::Dark));
1072- btn->setPalette(pal); 1073- btn->setPalette(pal);
1073- 1074-
1074- } 1075- }
1075- } 1076- }
1076- else if(ev->type() == QEvent::Enter){ 1077- else if(ev->type() == QEvent::Enter){
1077- highlightWidget = btn; 1078- highlightWidget = btn;
1078- btn->repaint(false); 1079- btn->repaint(false);
1079- } 1080- }
1080- else if(ev->type() == QEvent::Leave){ 1081- else if(ev->type() == QEvent::Leave){
1081- highlightWidget = NULL; 1082- highlightWidget = NULL;
1082- btn->repaint(false); 1083- btn->repaint(false);
1083- } 1084- }
1084- 1085-
1085- } 1086- }
1086- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || 1087- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") ||
1087- obj->isA("AppletHandle")){ 1088- obj->isA("AppletHandle")){
1088- QWidget *btn = (QWidget *)obj; 1089- QWidget *btn = (QWidget *)obj;
1089- if(ev->type() == QEvent::Enter){ 1090- if(ev->type() == QEvent::Enter){
1090- if(btn->isEnabled()){ 1091- if(btn->isEnabled()){
1091- highlightWidget = btn; 1092- highlightWidget = btn;
1092- btn->repaint(false); 1093- btn->repaint(false);
1093- } 1094- }
1094- } 1095- }
1095- else if(ev->type() == QEvent::Leave){ 1096- else if(ev->type() == QEvent::Leave){
1096- if(btn == highlightWidget){ 1097- if(btn == highlightWidget){
1097- highlightWidget = NULL; 1098- highlightWidget = NULL;
1098- btn->repaint(false); 1099- btn->repaint(false);
1099- } 1100- }
1100- } 1101- }
1101- } 1102- }
1102- else if(obj->inherits("TaskContainer")){ 1103- else if(obj->inherits("TaskContainer")){
1103- QButton *btn = (QButton *)obj; 1104- QButton *btn = (QButton *)obj;
1104- QPalette pal = btn->palette(); 1105- QPalette pal = btn->palette();
1105- if(ev->type() == QEvent::Enter){ 1106- if(ev->type() == QEvent::Enter){
1106- pal.setColor(QColorGroup::Background, pal.active().button().light(110)); 1107- pal.setColor(QColorGroup::Background, pal.active().button().light(110));
1107- btn->setPalette(pal); 1108- btn->setPalette(pal);
1108- } 1109- }
1109- else if(ev->type() == QEvent::Leave){ 1110- else if(ev->type() == QEvent::Leave){
1110- pal.setColor(QColorGroup::Background, 1111- pal.setColor(QColorGroup::Background,
1111- QApplication::palette().active().background()); 1112- QApplication::palette().active().background());
1112- btn->setPalette(pal); 1113- btn->setPalette(pal);
1113- } 1114- }
1114- } 1115- }
1115- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ 1116- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){
1116- QToolButton *btn = (QToolButton *)btn; 1117- QToolButton *btn = (QToolButton *)btn;
1117- if(!btn->autoRaise()){ 1118- if(!btn->autoRaise()){
1118+ else if(obj->inherits("QToolButton")){ 1119+ else if(obj->inherits("QToolButton")){
1119+ QToolButton *btn = (QToolButton *)obj; 1120+ QToolButton *btn = (QToolButton *)obj;
1120+ if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () 1121+ if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
1121 if(btn->isEnabled()){ 1122 if(btn->isEnabled()){
1122 highlightWidget = btn; 1123 highlightWidget = btn;
1123 btn->repaint(false); 1124 btn->repaint(false);
1124+
1125 + qDebug ( "TB FOCUS IN [%p]", btn );
1126 } 1125 }
1127 } 1126 }
1128- else if(ev->type() == QEvent::Leave){ 1127- else if(ev->type() == QEvent::Leave){
1129- QWidget *btn = (QWidget *)obj; 1128- QWidget *btn = (QWidget *)obj;
1130+ else if(ev->type() == QEvent::FocusOut ){ 1129+ else if(ev->type() == QEvent::FocusOut ){
1131 if(btn == highlightWidget){ 1130 if(btn == highlightWidget){
1132 highlightWidget = NULL; 1131 highlightWidget = NULL;
1133 btn->repaint(false); 1132 btn->repaint(false);
1134+
1135+ qDebug ( "TB FOCUS OUT [%p]", btn );
1136 } 1133 }
1137 } 1134 }
1138- else 1135- else
1139- highlightWidget = NULL; 1136- highlightWidget = NULL;
1140- } 1137- }
1141- else if(obj->inherits("QScrollBar")){ 1138- else if(obj->inherits("QScrollBar")){
1142- QScrollBar *sb = (QScrollBar *)obj; 1139- QScrollBar *sb = (QScrollBar *)obj;
1143- if(ev->type() == QEvent::Enter){ 1140- if(ev->type() == QEvent::Enter){
1144- if(sb->isEnabled()){ 1141- if(sb->isEnabled()){
1145- highlightWidget = sb; 1142- highlightWidget = sb;
1146- sb->repaint(false); 1143- sb->repaint(false);
1147- } 1144- }
1148- } 1145- }
1149- else if(ev->type() == QEvent::Leave){ 1146- else if(ev->type() == QEvent::Leave){
1150- if(sb == highlightWidget && !sb->draggingSlider()){ 1147- if(sb == highlightWidget && !sb->draggingSlider()){
1151- highlightWidget = NULL; 1148- highlightWidget = NULL;
1152- sb->repaint(false); 1149- sb->repaint(false);
1153- } 1150- }
1154- } 1151- }
1155- else if(ev->type() == QEvent::MouseButtonRelease){ 1152- else if(ev->type() == QEvent::MouseButtonRelease){
1156- QMouseEvent *me = (QMouseEvent *)ev; 1153- QMouseEvent *me = (QMouseEvent *)ev;
1157- if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1154- if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1158- highlightWidget = NULL; 1155- highlightWidget = NULL;
1159- sb->repaint(false); 1156- sb->repaint(false);
1160- } 1157- }
1161- } 1158- }
1162- } 1159- }
1163- else if(obj->inherits("QLineEdit")){ 1160- else if(obj->inherits("QLineEdit")){
1164- if(obj->parent() && obj->parent()->inherits("QComboBox")){ 1161- if(obj->parent() && obj->parent()->inherits("QComboBox")){
1165- QWidget *btn = (QComboBox *)obj->parent(); 1162- QWidget *btn = (QComboBox *)obj->parent();
1166- if(ev->type() == QEvent::Enter){ 1163- if(ev->type() == QEvent::Enter){
1167- if (btn->isEnabled()){ 1164- if (btn->isEnabled()){
1168- highlightWidget = btn; 1165- highlightWidget = btn;
1169- btn->repaint(false); 1166- btn->repaint(false);
1170- } 1167- }
1171- } 1168- }
1172- else if(ev->type() == QEvent::Leave){ 1169- else if(ev->type() == QEvent::Leave){
1173- if (btn == highlightWidget) 1170- if (btn == highlightWidget)
1174- highlightWidget = NULL; 1171- highlightWidget = NULL;
1175- btn->repaint(false); 1172- btn->repaint(false);
1176- } 1173- }
1177+ else if(ev->type() == QEvent::Paint) { 1174+ else if(ev->type() == QEvent::Paint) {
1178 + (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); 1175 + (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev );
1179 + return true; 1176 + return true;
1180 } 1177 }
1181 } 1178 }
1182 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1179 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1183@@ -1201,6 +1133,7 @@ 1180@@ -1201,6 +1130,7 @@
1184 QSize sz = isRadio ? exclusiveIndicatorSize() 1181 QSize sz = isRadio ? exclusiveIndicatorSize()
1185 : indicatorSize(); 1182 : indicatorSize();
1186 1183
1187+/* 1184+/*
1188 if(btn->hasFocus()){ 1185 if(btn->hasFocus()){
1189 QRect r = QRect(0, 0, btn->width(), btn->height()); 1186 QRect r = QRect(0, 0, btn->width(), btn->height());
1190 p.setPen(btn->colorGroup().button().dark(140)); 1187 p.setPen(btn->colorGroup().button().dark(140));
1191@@ -1209,6 +1142,7 @@ 1188@@ -1209,6 +1139,7 @@
1192 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1189 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1193 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1190 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1194 } 1191 }
1195+*/ 1192+*/
1196 int x = 0; 1193 int x = 0;
1197 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1194 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1198 if(isRadio) 1195 if(isRadio)
1199@@ -1228,36 +1162,6 @@ 1196@@ -1228,36 +1159,6 @@
1200 p.end(); 1197 p.end();
1201 return(true); 1198 return(true);
1202 } 1199 }
1203- // for hover, just redraw the indicator (not the text) 1200- // for hover, just redraw the indicator (not the text)
1204- else if((ev->type() == QEvent::Enter && btn->isEnabled()) || 1201- else if((ev->type() == QEvent::Enter && btn->isEnabled()) ||
1205- (ev->type() == QEvent::Leave && btn == highlightWidget)){ 1202- (ev->type() == QEvent::Leave && btn == highlightWidget)){
1206- QButton *btn = (QButton *)obj; 1203- QButton *btn = (QButton *)obj;
1207- bool isRadio = obj->inherits("QRadioButton"); 1204- bool isRadio = obj->inherits("QRadioButton");
1208- 1205-
1209- if(ev->type() == QEvent::Enter) 1206- if(ev->type() == QEvent::Enter)
1210- highlightWidget = btn; 1207- highlightWidget = btn;
1211- else 1208- else
1212- highlightWidget = NULL; 1209- highlightWidget = NULL;
1213- QFontMetrics fm = btn->fontMetrics(); 1210- QFontMetrics fm = btn->fontMetrics();
1214- QSize lsz = fm.size(ShowPrefix, btn->text()); 1211- QSize lsz = fm.size(ShowPrefix, btn->text());
1215- QSize sz = isRadio ? exclusiveIndicatorSize() 1212- QSize sz = isRadio ? exclusiveIndicatorSize()
1216- : indicatorSize(); 1213- : indicatorSize();
1217- int x = 0; 1214- int x = 0;
1218- int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1215- int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1219- //if(btn->autoMask()) 1216- //if(btn->autoMask())
1220- // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); 1217- // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2);
1221- QPainter p; 1218- QPainter p;
1222- p.begin(btn); 1219- p.begin(btn);
1223- if(isRadio) 1220- if(isRadio)
1224- drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1221- drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1225- btn->colorGroup(), btn->isOn(), 1222- btn->colorGroup(), btn->isOn(),
1226- btn->isDown(), btn->isEnabled()); 1223- btn->isDown(), btn->isEnabled());
1227- else 1224- else
1228- drawIndicator(&p, x, y, sz.width(), sz.height(), 1225- drawIndicator(&p, x, y, sz.width(), sz.height(),
1229- btn->colorGroup(), btn->state(), btn->isDown(), 1226- btn->colorGroup(), btn->state(), btn->isDown(),
1230- btn->isEnabled()); 1227- btn->isEnabled());
1231- p.end(); 1228- p.end();
1232- } 1229- }
1233 } 1230 }
1234 else if(obj->inherits("QHeader")){ 1231 else if(obj->inherits("QHeader")){
1235 QHeader *hw = (QHeader *)obj; 1232 QHeader *hw = (QHeader *)obj;
1236@@ -1290,7 +1194,24 @@ 1233@@ -1290,7 +1191,24 @@
1237 } 1234 }
1238 } 1235 }
1239 } 1236 }
1240- return(false); 1237- return(false);
1241+ else if (obj-> inherits( "QProgressBar" )) { 1238+ else if (obj-> inherits( "QProgressBar" )) {
1242 + if ( ev->type() == QEvent::Paint ) { 1239 + if ( ev->type() == QEvent::Paint ) {
1243 + HackProgressBar *p = (HackProgressBar *) obj; 1240 + HackProgressBar *p = (HackProgressBar *) obj;
1244 + const QColorGroup &g = p-> colorGroup ( ); 1241 + const QColorGroup &g = p-> colorGroup ( );
1245 + 1242 +
1246 + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1243 + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1247 + if(!pix){ 1244 + if(!pix){
1248 + int h, s, v; 1245 + int h, s, v;
1249 + g.button().dark(120).hsv(&h, &s, &v); 1246 + g.button().dark(120).hsv(&h, &s, &v);
1250 + pix = new QPixmap(*bevelFillPix); 1247 + pix = new QPixmap(*bevelFillPix);
1251 + adjustHSV(*pix, h, s, v); 1248 + adjustHSV(*pix, h, s, v);
1252 + bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1249 + bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1253 + } 1250 + }
1254 + p-> paint ((QPaintEvent *) ev, g, pix ); 1251 + p-> paint ((QPaintEvent *) ev, g, pix );
1255 + return true; 1252 + return true;
1256 + } 1253 + }
1257 + } 1254 + }
1258 +return false ; 1255 +return false ;
1259 } 1256 }
1260 1257
1261 void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1258 void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1262@@ -1325,8 +1246,11 @@ 1259@@ -1340,11 +1258,6 @@
1263 }
1264
1265 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1266+ qDebug ( "DRAW TOOLBUTTON IN PIXMAP" );
1267 }
1268 else{
1269 + qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() );
1270+
1271 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1272 highlightWidget == p->device() ? g.button().light(110) :
1273 g.background(), g.background());
1274@@ -1340,11 +1264,6 @@
1275 QColorGroup g = btn->colorGroup(); 1260 QColorGroup g = btn->colorGroup();
1276 1261
1277 1262
1278- QColor testColor; 1263- QColor testColor;
1279- if(btn->parent() && btn->parent()->isWidgetType()){ 1264- if(btn->parent() && btn->parent()->isWidgetType()){
1280- testColor = p->backgroundColor(); // remove me 1265- testColor = p->backgroundColor(); // remove me
1281- } 1266- }
1282- 1267-
1283 //int dw = buttonDefaultIndicatorWidth(); 1268 //int dw = buttonDefaultIndicatorWidth();
1284 if(btn->hasFocus() || btn->isDefault()){ 1269 if(btn->hasFocus() || btn->isDefault()){
1285 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1270 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1286@@ -1488,7 +1407,20 @@ 1271@@ -1488,7 +1401,20 @@
1287 const QColorGroup &g, bool sunken, 1272 const QColorGroup &g, bool sunken,
1288 bool edit, bool, const QBrush *) 1273 bool edit, bool, const QBrush *)
1289 { 1274 {
1290- bool isHover = highlightWidget == painter->device(); 1275- bool isHover = highlightWidget == painter->device();
1291+ bool isActive = false; 1276+ bool isActive = false;
1292+ if (( painter->device()->devType() == QInternal::Widget ) && 1277+ if (( painter->device()->devType() == QInternal::Widget ) &&
1293+ ( 1278+ (
1294+ ( qApp-> focusWidget ( ) == painter-> device ( )) || 1279+ ( qApp-> focusWidget ( ) == painter-> device ( )) ||
1295+ ( 1280+ (
1296+ edit && 1281+ edit &&
1297+ ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && 1282+ ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
1298+ ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) 1283+ ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ))
1299+ ) 1284+ )
1300+ ) 1285+ )
1301+ ) { 1286+ ) {
1302 + isActive = true; 1287 + isActive = true;
1303+ } 1288+ }
1304 + 1289 +
1305 bool isMasked = false; 1290 bool isMasked = false;
1306 if(painter->device()->devType() == QInternal::Widget) 1291 if(painter->device()->devType() == QInternal::Widget)
1307 isMasked = ((QWidget*)painter->device())->autoMask(); 1292 isMasked = ((QWidget*)painter->device())->autoMask();
1308@@ -1498,7 +1430,7 @@ 1293@@ -1498,7 +1424,7 @@
1309 1294
1310 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1295 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1311 sunken, false, isMasked); 1296 sunken, false, isMasked);
1312- if(!isHover){ 1297- if(!isHover){
1313+ if(!isActive){ 1298+ if(!isActive){
1314 p.setClipRect(0, 0, w-17, h); 1299 p.setClipRect(0, 0, w-17, h);
1315 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1300 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1316 sunken, false, isMasked); 1301 sunken, false, isMasked);
1317@@ -1550,16 +1482,17 @@ 1302@@ -1550,16 +1476,17 @@
1318 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1303 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1319 } 1304 }
1320 1305
1321-QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) 1306-QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h)
1322+QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) 1307+QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/)
1323 { 1308 {
1324- return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1309- return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1325 +return QRect ( ); 1310 +return QRect ( );
1326 + 1311 +
1327+// return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1312+// return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1328 } 1313 }
1329 1314
1330 void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1315 void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1331 int sliderStart, uint controls, 1316 int sliderStart, uint controls,
1332 uint activeControl) 1317 uint activeControl)
1333 { 1318 {
1334- bool isHover = highlightWidget == p->device(); 1319- bool isHover = highlightWidget == p->device();
1335 int sliderMin, sliderMax, sliderLength, buttonDim; 1320 int sliderMin, sliderMax, sliderLength, buttonDim;
1336 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1321 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1337 1322
1338@@ -1596,7 +1529,7 @@ 1323@@ -1596,7 +1523,7 @@
1339 if(sbBuffer.size() != sb->size()) 1324 if(sbBuffer.size() != sb->size())
1340 sbBuffer.resize(sb->size()); 1325 sbBuffer.resize(sb->size());
1341 } 1326 }
1342- subB.setRect( subX,subY,buttonDim,buttonDim ); 1327- subB.setRect( subX,subY,buttonDim,buttonDim );
1343+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 1328+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1344 addB.setRect( addX,addY,buttonDim,buttonDim ); 1329 addB.setRect( addX,addY,buttonDim,buttonDim );
1345 if(horiz) 1330 if(horiz)
1346 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1331 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1347@@ -1624,7 +1557,7 @@ 1332@@ -1624,7 +1551,7 @@
1348 QPainter painter; 1333 QPainter painter;
1349 if(!horiz){ 1334 if(!horiz){
1350 painter.begin(&sbBuffer); 1335 painter.begin(&sbBuffer);
1351- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); 1336- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1);
1352+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 1337+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1353 if(sliderR.height() >= 8){ 1338 if(sliderR.height() >= 8){
1354 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1339 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1355 13, 8); 1340 13, 8);
1356@@ -1648,25 +1581,15 @@ 1341@@ -1648,25 +1575,15 @@
1357 } 1342 }
1358 if(controls & Slider){ 1343 if(controls & Slider){
1359 if(sliderR.height() >= 16){ 1344 if(sliderR.height() >= 16){
1360- painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1345- painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1361- isHover ? *getPixmap(VSBSliderTopHover): 1346- isHover ? *getPixmap(VSBSliderTopHover):
1362- *getPixmap(VSBSliderTop)); 1347- *getPixmap(VSBSliderTop));
1363+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); 1348+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop));
1364 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1349 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1365- sliderR.height()-16, isHover ? 1350- sliderR.height()-16, isHover ?
1366- *getPixmap(VSBSliderMidHover) : 1351- *getPixmap(VSBSliderMidHover) :
1367- *getPixmap(VSBSliderMid)); 1352- *getPixmap(VSBSliderMid));
1368- painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, 1353- painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8,
1369- isHover ? *getPixmap(VSBSliderBtmHover) : 1354- isHover ? *getPixmap(VSBSliderBtmHover) :
1370- *getPixmap(VSBSliderBtm)); 1355- *getPixmap(VSBSliderBtm));
1371+ sliderR.height()-16, *getPixmap(VSBSliderMid)); 1356+ sliderR.height()-16, *getPixmap(VSBSliderMid));
1372+ painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); 1357+ painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm));
1373 } 1358 }
1374 else if(sliderR.height() >= 8){ 1359 else if(sliderR.height() >= 8){
1375 int m = sliderR.height()/2; 1360 int m = sliderR.height()/2;
1376- painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1361- painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1377- isHover ? *getPixmap(VSBSliderTopHover): 1362- isHover ? *getPixmap(VSBSliderTopHover):
1378- *getPixmap(VSBSliderTop), 0, 0, 13, m); 1363- *getPixmap(VSBSliderTop), 0, 0, 13, m);
1379- painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, 1364- painter.drawPixmap(sliderR.x()+1, sliderR.y()+m,
1380- isHover ? *getPixmap(VSBSliderBtmHover): 1365- isHover ? *getPixmap(VSBSliderBtmHover):
1381- *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1366- *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1382+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); 1367+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m);
1383+ painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1368+ painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1384 } 1369 }
1385 else{ 1370 else{
1386 painter.setPen(g.button().dark(210)); 1371 painter.setPen(g.button().dark(210));
1387@@ -1674,7 +1597,6 @@ 1372@@ -1674,7 +1591,6 @@
1388 13, sliderR.height()); 1373 13, sliderR.height());
1389 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1374 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1390 11, sliderR.height()-2, 1375 11, sliderR.height()-2,
1391- isHover ? *getPixmap(VSBSliderMidHover) : 1376- isHover ? *getPixmap(VSBSliderMidHover) :
1392 *getPixmap(VSBSliderMid), 1, 0); 1377 *getPixmap(VSBSliderMid), 1, 0);
1393 } 1378 }
1394 } 1379 }
1395@@ -1690,7 +1612,7 @@ 1380@@ -1690,7 +1606,7 @@
1396 } 1381 }
1397 else{ 1382 else{
1398 painter.begin(&sbBuffer); 1383 painter.begin(&sbBuffer);
1399- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); 1384- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height());
1400+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 1385+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1401 if(sliderR.width() >= 8){ 1386 if(sliderR.width() >= 8){
1402 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1387 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1403 8, 13); 1388 8, 13);
1404@@ -1715,22 +1637,17 @@ 1389@@ -1715,22 +1631,17 @@
1405 if(controls & Slider){ 1390 if(controls & Slider){
1406 if(sliderR.width() >= 16){ 1391 if(sliderR.width() >= 16){
1407 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1392 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1408- isHover ? *getPixmap(HSBSliderTopHover) : 1393- isHover ? *getPixmap(HSBSliderTopHover) :
1409 *getPixmap(HSBSliderTop)); 1394 *getPixmap(HSBSliderTop));
1410 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1395 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1411- 13, isHover ? *getPixmap(HSBSliderMidHover) : 1396- 13, isHover ? *getPixmap(HSBSliderMidHover) :
1412- *getPixmap(HSBSliderMid)); 1397- *getPixmap(HSBSliderMid));
1413- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1398- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1414- *getPixmap(HSBSliderBtmHover) : 1399- *getPixmap(HSBSliderBtmHover) :
1415+ 13, *getPixmap(HSBSliderMid)); 1400+ 13, *getPixmap(HSBSliderMid));
1416+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1401+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1417 *getPixmap(HSBSliderBtm)); 1402 *getPixmap(HSBSliderBtm));
1418 } 1403 }
1419 else if(sliderR.width() >= 8){ 1404 else if(sliderR.width() >= 8){
1420 int m = sliderR.width()/2; 1405 int m = sliderR.width()/2;
1421 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1406 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1422- isHover ? *getPixmap(HSBSliderTopHover) : 1407- isHover ? *getPixmap(HSBSliderTopHover) :
1423 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1408 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1424- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1409- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1425- *getPixmap(HSBSliderBtmHover) : 1410- *getPixmap(HSBSliderBtmHover) :
1426+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1411+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1427 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1412 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1428 } 1413 }
1429 else{ 1414 else{
1430@@ -1738,8 +1655,7 @@ 1415@@ -1738,8 +1649,7 @@
1431 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1416 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1432 sliderR.width(), 13); 1417 sliderR.width(), 13);
1433 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1418 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1434- sliderR.width()-2, 11, isHover ? 1419- sliderR.width()-2, 11, isHover ?
1435- *getPixmap(HSBSliderMidHover) : 1420- *getPixmap(HSBSliderMidHover) :
1436+ sliderR.width()-2, 11, 1421+ sliderR.width()-2, 11,
1437 *getPixmap(HSBSliderMid), 0, 1); 1422 *getPixmap(HSBSliderMid), 0, 1);
1438 } 1423 }
1439 } 1424 }
1440@@ -1761,10 +1677,10 @@ 1425@@ -1761,10 +1671,10 @@
1441 addB.width()-8, addB.height()-8, g, !maxed); 1426 addB.width()-8, addB.height()-8, g, !maxed);
1442 } 1427 }
1443 if ( controls & SubLine ) { 1428 if ( controls & SubLine ) {
1444- drawSBButton(p, subB, g, activeControl == SubLine); 1429- drawSBButton(p, subB, g, activeControl == SubLine);
1445- drawArrow( p, horiz ? LeftArrow : UpArrow, 1430- drawArrow( p, horiz ? LeftArrow : UpArrow,
1446- false, subB.x()+4, subB.y()+4, 1431- false, subB.x()+4, subB.y()+4,
1447- subB.width()-8, subB.height()-8, g, !maxed); 1432- subB.width()-8, subB.height()-8, g, !maxed);
1448+ // drawSBButton(p, subB, g, activeControl == SubLine); 1433+ // drawSBButton(p, subB, g, activeControl == SubLine);
1449+ // drawArrow( p, horiz ? LeftArrow : UpArrow, 1434+ // drawArrow( p, horiz ? LeftArrow : UpArrow,
1450+ // false, subB.x()+4, subB.y()+4, 1435+ // false, subB.x()+4, subB.y()+4,
1451+ // subB.width()-8, subB.height()-8, g, !maxed); 1436+ // subB.width()-8, subB.height()-8, g, !maxed);
1452 drawSBButton(p, subHC, g, activeControl == SubLine); 1437 drawSBButton(p, subHC, g, activeControl == SubLine);
1453 drawArrow( p, horiz ? LeftArrow : UpArrow, 1438 drawArrow( p, horiz ? LeftArrow : UpArrow,
1454 false, subHC.x()+4, subHC.y()+4, 1439 false, subHC.x()+4, subHC.y()+4,
1455@@ -1865,8 +1781,8 @@ 1440@@ -1865,8 +1775,8 @@
1456 else 1441 else
1457 buttonDim = ( length - b*2 )/2 - 1; 1442 buttonDim = ( length - b*2 )/2 - 1;
1458 1443
1459- sliderMin = b + buttonDim; 1444- sliderMin = b + buttonDim;
1460- maxLength = length - b*2 - buttonDim*3; 1445- maxLength = length - b*2 - buttonDim*3;
1461+ sliderMin = b + 0; // buttonDim; 1446+ sliderMin = b + 0; // buttonDim;
1462+ maxLength = length - b*2 - buttonDim*2; // 3; 1447+ maxLength = length - b*2 - buttonDim*2; // 3;
1463 1448
1464 if ( sb->maxValue() == sb->minValue() ) { 1449 if ( sb->maxValue() == sb->minValue() ) {
1465 sliderLength = maxLength; 1450 sliderLength = maxLength;
1466@@ -1914,31 +1830,31 @@ 1451@@ -1914,31 +1824,31 @@
1467 return(QSize(16, 16)); 1452 return(QSize(16, 16));
1468 } 1453 }
1469 1454
1470-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, 1455-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w,
1471- int h, const QColorGroup &g, bool on, 1456- int h, const QColorGroup &g, bool on,
1472+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1457+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1473+ int /*h*/, const QColorGroup &/*g*/, bool on, 1458+ int /*h*/, const QColorGroup &/*g*/, bool on,
1474 bool down, bool) 1459 bool down, bool)
1475 { 1460 {
1476- bool isHover = highlightWidget == p->device(); 1461- bool isHover = highlightWidget == p->device();
1477+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1462+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1478 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1463 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1479 && ((QWidget*)p->device())->autoMask(); 1464 && ((QWidget*)p->device())->autoMask();
1480 1465
1481 if(isMasked){ 1466 if(isMasked){
1482 if(on || down){ 1467 if(on || down){
1483- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : 1468- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) :
1484+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : 1469+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) :
1485 *getPixmap(HTMLRadioDown)); 1470 *getPixmap(HTMLRadioDown));
1486 } 1471 }
1487 else 1472 else
1488- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : 1473- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) :
1489+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : 1474+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) :
1490 *getPixmap(HTMLRadio)); 1475 *getPixmap(HTMLRadio));
1491 1476
1492 } 1477 }
1493 else{ 1478 else{
1494 if(on || down){ 1479 if(on || down){
1495- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : 1480- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) :
1496+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : 1481+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) :
1497 *getPixmap(RadioOn)); 1482 *getPixmap(RadioOn));
1498 } 1483 }
1499 else 1484 else
1500- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : 1485- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) :
1501+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : 1486+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) :
1502 *getPixmap(RadioOff)); 1487 *getPixmap(RadioOff));
1503 } 1488 }
1504 } 1489 }
1505@@ -1957,25 +1873,25 @@ 1490@@ -1957,25 +1867,25 @@
1506 return(QSize(20, 22)); 1491 return(QSize(20, 22));
1507 } 1492 }
1508 1493
1509-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, 1494-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h,
1510- const QColorGroup &g, int state, bool down, bool) 1495- const QColorGroup &g, int state, bool down, bool)
1511+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1496+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1512+ const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1497+ const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1513 { 1498 {
1514- bool isHover = highlightWidget == p->device(); 1499- bool isHover = highlightWidget == p->device();
1515+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1500+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1516 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1501 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1517 && ((QWidget*)p->device())->autoMask(); 1502 && ((QWidget*)p->device())->autoMask();
1518 if(isMasked){ 1503 if(isMasked){
1519 if(state != QButton::Off){ 1504 if(state != QButton::Off){
1520- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : 1505- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) :
1521+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : 1506+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) :
1522 *getPixmap(HTMLCBDown)); 1507 *getPixmap(HTMLCBDown));
1523 } 1508 }
1524 else 1509 else
1525- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : 1510- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) :
1526+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : 1511+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) :
1527 *getPixmap(HTMLCB)); 1512 *getPixmap(HTMLCB));
1528 1513
1529 } 1514 }
1530 else{ 1515 else{
1531 if(state != QButton::Off){ 1516 if(state != QButton::Off){
1532- p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : 1517- p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) :
1533+ p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : 1518+ p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) :
1534 *getPixmap(CBDown)); 1519 *getPixmap(CBDown));
1535 /* Todo - tristate 1520 /* Todo - tristate
1536 if(state == QButton::On){ 1521 if(state == QButton::On){
1537@@ -1992,12 +1908,12 @@ 1522@@ -1992,12 +1902,12 @@
1538 }*/ 1523 }*/
1539 } 1524 }
1540 else 1525 else
1541- p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); 1526- p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB));
1542+ p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); 1527+ p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB));
1543 } 1528 }
1544 } 1529 }
1545 1530
1546-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, 1531-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h,
1547- int state) 1532- int state)
1548+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1533+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1549+ int /*state*/) 1534+ int /*state*/)
1550 { 1535 {
1551 // needed for some reason by KHtml, even tho it's all filled ;P 1536 // needed for some reason by KHtml, even tho it's all filled ;P
1552 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1537 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1553@@ -2005,18 +1921,17 @@ 1538@@ -2005,18 +1915,17 @@
1554 } 1539 }
1555 1540
1556 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1541 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1557- const QColorGroup &g, Orientation orient, 1542- const QColorGroup &g, Orientation orient,
1558+ const QColorGroup &/*g*/, Orientation orient, 1543+ const QColorGroup &/*g*/, Orientation orient,
1559 bool, bool) 1544 bool, bool)
1560 { 1545 {
1561 QWidget *parent = (QWidget *)p->device(); 1546 QWidget *parent = (QWidget *)p->device();
1562 p->setBrushOrigin(parent->pos()); 1547 p->setBrushOrigin(parent->pos());
1563- p->fillRect(x, y, w, h, 1548- p->fillRect(x, y, w, h,
1564- QApplication::palette().active().brush(QColorGroup::Background)); 1549- QApplication::palette().active().brush(QColorGroup::Background));
1565+ parent->erase(x, y, w, h); 1550+ parent->erase(x, y, w, h);
1566 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1551 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1567 *getPixmap(VSlider)); 1552 *getPixmap(VSlider));
1568 } 1553 }
1569 1554
1570-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, 1555-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h,
1571+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1556+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1572 Orientation orient, bool, bool) 1557 Orientation orient, bool, bool)
1573 { 1558 {
1574 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1559 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1575@@ -2065,243 +1980,76 @@ 1560@@ -2065,243 +1974,76 @@
1576 p->drawLineSegments(a); 1561 p->drawLineSegments(a);
1577 } 1562 }
1578 1563
1579-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, 1564-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h,
1580- const QColorGroup &g, KToolBarPos, 1565- const QColorGroup &g, KToolBarPos,
1581- QBrush *) 1566- QBrush *)
1582-{ 1567-{
1583- p->setPen(g.button().dark(120)); 1568- p->setPen(g.button().dark(120));
1584- int x2 = x+w-1; 1569- int x2 = x+w-1;
1585- int y2 = y+h-1; 1570- int y2 = y+h-1;
1586- p->drawLine(x+1, y, x2-1, y); 1571- p->drawLine(x+1, y, x2-1, y);
1587- p->drawLine(x+1, y2, x2-1, y2); 1572- p->drawLine(x+1, y2, x2-1, y2);
1588- p->drawLine(x, y+1, x, y2-1); 1573- p->drawLine(x, y+1, x, y2-1);
1589- p->drawLine(x2, y+1, x2, y2-1); 1574- p->drawLine(x2, y+1, x2, y2-1);
1590- 1575-
1591- p->setPen(g.background()); 1576- p->setPen(g.background());
1592- p->drawPoint(x, y); 1577- p->drawPoint(x, y);
1593- p->drawPoint(x2, y); 1578- p->drawPoint(x2, y);
1594- p->drawPoint(x, y2); 1579- p->drawPoint(x, y2);
1595- p->drawPoint(x2, y2); 1580- p->drawPoint(x2, y2);
1596- 1581-
1597- 1582-
1598- 1583-
1599- // p->drawRect(x, y, w, h); 1584- // p->drawRect(x, y, w, h);
1600- QPixmap *pix = bevelFillDict.find(g.button().rgb()); 1585- QPixmap *pix = bevelFillDict.find(g.button().rgb());
1601- if(!pix){ 1586- if(!pix){
1602- int h, s, v; 1587- int h, s, v;
1603- g.button().hsv(&h, &s, &v); 1588- g.button().hsv(&h, &s, &v);
1604- pix = new QPixmap(*bevelFillPix); 1589- pix = new QPixmap(*bevelFillPix);
1605- adjustHSV(*pix, h, s, v); 1590- adjustHSV(*pix, h, s, v);
1606- bevelFillDict.insert(g.button().rgb(), pix); 1591- bevelFillDict.insert(g.button().rgb(), pix);
1607- } 1592- }
1608- 1593-
1609- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); 1594- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix);
1610-} 1595-}
1611- 1596-
1612-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, 1597-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h,
1613- const QColorGroup &g, bool mac, QBrush *) 1598- const QColorGroup &g, bool mac, QBrush *)
1614-{ 1599-{
1615- if(p->device() && p->device()->devType() == QInternal::Widget && 1600- if(p->device() && p->device()->devType() == QInternal::Widget &&
1616- ((KMenuBar *)p->device())->isTopLevelMenu()){ 1601- ((KMenuBar *)p->device())->isTopLevelMenu()){
1617- p->setPen(Qt::black); 1602- p->setPen(Qt::black);
1618- p->drawRect(x, y, w, h); 1603- p->drawRect(x, y, w, h);
1619- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); 1604- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix);
1620- // left 1605- // left
1621- p->drawLine(x+1, y+1, x+1, y+5); 1606- p->drawLine(x+1, y+1, x+1, y+5);
1622- p->drawLine(x+2, y+1, x+2, y+3); 1607- p->drawLine(x+2, y+1, x+2, y+3);
1623- p->drawLine(x+3, y+1, x+3, y+2); 1608- p->drawLine(x+3, y+1, x+3, y+2);
1624- p->drawLine(x+4, y+1, x+6, y+1); 1609- p->drawLine(x+4, y+1, x+6, y+1);
1625- // right 1610- // right
1626- int x2 = x+w-1; 1611- int x2 = x+w-1;
1627- p->drawLine(x2-1, y+1, x2-1, y+5); 1612- p->drawLine(x2-1, y+1, x2-1, y+5);
1628- p->drawLine(x2-2, y+1, x2-2, y+3); 1613- p->drawLine(x2-2, y+1, x2-2, y+3);
1629- p->drawLine(x2-3, y+1, x2-3, y+2); 1614- p->drawLine(x2-3, y+1, x2-3, y+2);
1630- p->drawLine(x2-4, y+1, x2-6, y+1); 1615- p->drawLine(x2-4, y+1, x2-6, y+1);
1631- } 1616- }
1632- else{ 1617- else{
1633- qDrawShadePanel(p, x, y, w, h, g, false, 1, 1618- qDrawShadePanel(p, x, y, w, h, g, false, 1,
1634- &g.brush(QColorGroup::Background)); 1619- &g.brush(QColorGroup::Background));
1635- } 1620- }
1636
1637-}
1638- 1621-
1622-}
1623
1639-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, 1624-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h,
1640- const QColorGroup &g, KToolBarPos, QBrush *) 1625- const QColorGroup &g, KToolBarPos, QBrush *)
1641+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1626+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1642+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 1627+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1643 { 1628 {
1644- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1629- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1645-} 1630-}
1646- 1631-
1647-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 1632-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
1648- const QColorGroup &g, bool sunken, 1633- const QColorGroup &g, bool sunken,
1649- bool raised, bool enabled, bool popup, 1634- bool raised, bool enabled, bool popup,
1650- KToolButtonType icontext, 1635- KToolButtonType icontext,
1651- const QString& btext, const QPixmap *pixmap, 1636- const QString& btext, const QPixmap *pixmap,
1652- QFont *font, QWidget *btn) 1637- QFont *font, QWidget *btn)
1653-{ 1638-{
1654- int dx, dy; 1639- int dx, dy;
1655- 1640-
1656- QFontMetrics fm(*font); 1641- QFontMetrics fm(*font);
1657- 1642-
1658- QToolBar* toolbar = 0; 1643- QToolBar* toolbar = 0;
1659- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) 1644- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar"))
1660- toolbar = static_cast<QToolBar*>(btn->parent()); 1645- toolbar = static_cast<QToolBar*>(btn->parent());
1661- 1646-
1662- --w, --h; 1647- --w, --h;
1663- if(sunken) 1648- if(sunken)
1664- ++x, ++y; 1649- ++x, ++y;
1665- 1650-
1666- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : 1651- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) :
1667- g.background()); 1652- g.background());
1668- drawClearBevel(p, x, y, w, h, btnColor, g.background()); 1653- drawClearBevel(p, x, y, w, h, btnColor, g.background());
1669- 1654-
1670- p->setPen(g.text()); 1655- p->setPen(g.text());
1671- 1656-
1672- if (icontext == Icon){ // icon only 1657- if (icontext == Icon){ // icon only
1673- if (pixmap){ 1658- if (pixmap){
1674- dx = ( w - pixmap->width() ) / 2; 1659- dx = ( w - pixmap->width() ) / 2;
1675- dy = ( h - pixmap->height() ) / 2; 1660- dy = ( h - pixmap->height() ) / 2;
1676- if ( sunken ) 1661- if ( sunken )
1677- { 1662- {
1678- ++dx; 1663- ++dx;
1679- ++dy; 1664- ++dy;
1680- } 1665- }
1681- p->drawPixmap( x+dx, y+dy, *pixmap ); 1666- p->drawPixmap( x+dx, y+dy, *pixmap );
1682- } 1667- }
1683- } 1668- }
1684- else if (icontext == IconTextRight){ // icon and text (if any) 1669- else if (icontext == IconTextRight){ // icon and text (if any)
1685- if (pixmap){ 1670- if (pixmap){
1686- dx = 4; 1671- dx = 4;
1687- dy = ( h - pixmap->height() ) / 2; 1672- dy = ( h - pixmap->height() ) / 2;
1688- if ( sunken ){ 1673- if ( sunken ){
1689- ++dx; 1674- ++dx;
1690- ++dy; 1675- ++dy;
1691- } 1676- }
1692- p->drawPixmap( x+dx, y+dy, *pixmap ); 1677- p->drawPixmap( x+dx, y+dy, *pixmap );
1693- } 1678- }
1694- if (!btext.isNull()){ 1679- if (!btext.isNull()){
1695- int tf = AlignVCenter|AlignLeft; 1680- int tf = AlignVCenter|AlignLeft;
1696- if (pixmap) 1681- if (pixmap)
1697- dx= 4 + pixmap->width() + 2; 1682- dx= 4 + pixmap->width() + 2;
1698- else 1683- else
1699- dx= 4; 1684- dx= 4;
1700- dy = 0; 1685- dy = 0;
1701- if ( sunken ){ 1686- if ( sunken ){
1702- ++dx; 1687- ++dx;
1703- ++dy; 1688- ++dy;
1704- } 1689- }
1705- if (font) 1690- if (font)
1706- p->setFont(*font); 1691- p->setFont(*font);
1707- if(raised) 1692- if(raised)
1708- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1693- p->setPen(KGlobalSettings::toolBarHighlightColor());
1709- p->drawText(x+dx, y+dy, w-dx, h, tf, btext); 1694- p->drawText(x+dx, y+dy, w-dx, h, tf, btext);
1710- } 1695- }
1711- } 1696- }
1712- else if (icontext == Text){ // only text, even if there is a icon 1697- else if (icontext == Text){ // only text, even if there is a icon
1713- if (!btext.isNull()){ 1698- if (!btext.isNull()){
1714- int tf = AlignVCenter|AlignLeft; 1699- int tf = AlignVCenter|AlignLeft;
1715- if (!enabled) 1700- if (!enabled)
1716- p->setPen(g.dark()); 1701- p->setPen(g.dark());
1717- dx= (w - fm.width(btext)) / 2; 1702- dx= (w - fm.width(btext)) / 2;
1718- dy= (h - fm.lineSpacing()) / 2; 1703- dy= (h - fm.lineSpacing()) / 2;
1719- if ( sunken ){ 1704- if ( sunken ){
1720- ++dx; 1705- ++dx;
1721- ++dy; 1706- ++dy;
1722- } 1707- }
1723- if (font) 1708- if (font)
1724- p->setFont(*font); 1709- p->setFont(*font);
1725- if(raised) 1710- if(raised)
1726- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1711- p->setPen(KGlobalSettings::toolBarHighlightColor());
1727- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); 1712- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext);
1728- } 1713- }
1729- } 1714- }
1730- else if (icontext == IconTextBottom){ 1715- else if (icontext == IconTextBottom){
1731- if (pixmap){ 1716- if (pixmap){
1732- dx = (w - pixmap->width()) / 2; 1717- dx = (w - pixmap->width()) / 2;
1733- dy = (h - fm.lineSpacing() - pixmap->height()) / 2; 1718- dy = (h - fm.lineSpacing() - pixmap->height()) / 2;
1734- if ( sunken ){ 1719- if ( sunken ){
1735- ++dx; 1720- ++dx;
1736- ++dy; 1721- ++dy;
1737- } 1722- }
1738- p->drawPixmap( x+dx, y+dy, *pixmap ); 1723- p->drawPixmap( x+dx, y+dy, *pixmap );
1739- } 1724- }
1740- if (!btext.isNull()){ 1725- if (!btext.isNull()){
1741- int tf = AlignBottom|AlignHCenter; 1726- int tf = AlignBottom|AlignHCenter;
1742- dy= pixmap->height(); 1727- dy= pixmap->height();
1743- dx = 2; 1728- dx = 2;
1744- if ( sunken ){ 1729- if ( sunken ){
1745- ++dx; 1730- ++dx;
1746- ++dy; 1731- ++dy;
1747- } 1732- }
1748- if (font) 1733- if (font)
1749- p->setFont(*font); 1734- p->setFont(*font);
1750- if(raised) 1735- if(raised)
1751- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1736- p->setPen(KGlobalSettings::toolBarHighlightColor());
1752- p->drawText(x, y, w, h-3, tf, btext); 1737- p->drawText(x, y, w, h-3, tf, btext);
1753- } 1738- }
1754- } 1739- }
1755- if (popup){ 1740- if (popup){
1756- if (enabled) 1741- if (enabled)
1757- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, 1742- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0,
1758- g, true); 1743- g, true);
1759- else 1744- else
1760- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 1745- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5,
1761- 0, 0, g, false); 1746- 0, 0, g, false);
1762+ if(active){ 1747+ if(active){
1763+ x -= 2; // Bug in Qt/E 1748+ x -= 2; // Bug in Qt/E
1764+ y -= 2; 1749+ y -= 2;
1765+ w += 2; 1750+ w += 2;
1766+ h += 2; 1751+ h += 2;
1767 } 1752 }
1768-} 1753-}
1769- 1754-
1770 1755
1771-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, 1756-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h,
1772- const QColorGroup &g, bool active, QMenuItem *mi, 1757- const QColorGroup &g, bool active, QMenuItem *mi,
1773- QBrush *) 1758- QBrush *)
1774-{ 1759-{
1775- if ( p->font() == KGlobalSettings::generalFont() ) 1760- if ( p->font() == KGlobalSettings::generalFont() )
1776- p->setFont( KGlobalSettings::menuFont() ); 1761- p->setFont( KGlobalSettings::menuFont() );
1777+ QWidget *parent = (QWidget *)p->device(); 1762+ QWidget *parent = (QWidget *)p->device();
1778+ p->setBrushOrigin(parent->pos()); 1763+ p->setBrushOrigin(parent->pos());
1779+ parent->erase(x, y, w, h); 1764+ parent->erase(x, y, w, h);
1780 1765
1781 if(menuHandler->useShadowText()){ 1766 if(menuHandler->useShadowText()){
1782 QColor shadow; 1767 QColor shadow;
1783 if(p->device() && p->device()->devType() == QInternal::Widget && 1768 if(p->device() && p->device()->devType() == QInternal::Widget &&
1784- ((QWidget *)p->device())->inherits("KMenuBar")){ 1769- ((QWidget *)p->device())->inherits("KMenuBar")){
1785- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1770- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1786+ ((QWidget *)p->device())->inherits("QMenuBar")){ 1771+ ((QWidget *)p->device())->inherits("QMenuBar")){
1787+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1772+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1788 g.background().dark(130); 1773 g.background().dark(130);
1789 } 1774 }
1790 else 1775 else
1791 shadow = g.background().dark(130); 1776 shadow = g.background().dark(130);
1792 1777
1793 + QPixmap *dummy = 0; 1778 + QPixmap *dummy = 0;
1794 + 1779 +
1795 + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { 1780 + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
1796 + dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); 1781 + dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
1797 + QBitmap dummy_mask ( dummy-> size ( )); 1782 + QBitmap dummy_mask ( dummy-> size ( ));
1798 + dummy_mask. fill ( color1 ); 1783 + dummy_mask. fill ( color1 );
1799 + dummy-> setMask ( dummy_mask ); 1784 + dummy-> setMask ( dummy_mask );
1800 + } 1785 + }
1801+ 1786+
1802 if(active){ 1787 if(active){
1803 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 1788 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1804 QApplication::style().drawItem(p, x+1, y+1, w, h, 1789 QApplication::style().drawItem(p, x+1, y+1, w, h,
1805 AlignCenter|ShowPrefix|DontClip|SingleLine, 1790 AlignCenter|ShowPrefix|DontClip|SingleLine,
1806- g, mi->isEnabled(), NULL, mi->text(), 1791- g, mi->isEnabled(), NULL, mi->text(),
1807+ g, mi->isEnabled(), dummy, mi->text(), 1792+ g, mi->isEnabled(), dummy, mi->text(),
1808 -1, &shadow); 1793 -1, &shadow);
1809 QApplication::style().drawItem(p, x, y, w, h, 1794 QApplication::style().drawItem(p, x, y, w, h,
1810 AlignCenter|ShowPrefix|DontClip|SingleLine, 1795 AlignCenter|ShowPrefix|DontClip|SingleLine,
1811- g, mi->isEnabled(), NULL, mi->text(), 1796- g, mi->isEnabled(), NULL, mi->text(),
1812+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1797+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1813 -1, &g.text()); 1798 -1, &g.text());
1814 } 1799 }
1815 else{ 1800 else{
1816 QApplication::style().drawItem(p, x+1, y+1, w, h, 1801 QApplication::style().drawItem(p, x+1, y+1, w, h,
1817 AlignCenter|ShowPrefix|DontClip|SingleLine, 1802 AlignCenter|ShowPrefix|DontClip|SingleLine,
1818- g, mi->isEnabled(), NULL, mi->text(), 1803- g, mi->isEnabled(), NULL, mi->text(),
1819+ g, mi->isEnabled(), dummy, mi->text(), 1804+ g, mi->isEnabled(), dummy, mi->text(),
1820 -1, &shadow); 1805 -1, &shadow);
1821 QApplication::style().drawItem(p, x, y, w, h, 1806 QApplication::style().drawItem(p, x, y, w, h,
1822 AlignCenter|ShowPrefix|DontClip|SingleLine, 1807 AlignCenter|ShowPrefix|DontClip|SingleLine,
1823- g, mi->isEnabled(), NULL, mi->text(), 1808- g, mi->isEnabled(), NULL, mi->text(),
1824+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1809+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1825 -1, &g.text()); 1810 -1, &g.text());
1826 } 1811 }
1827+ delete dummy; 1812+ delete dummy;
1828 } 1813 }
1829 else{ 1814 else{
1830 if(active) 1815 if(active)
1831 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 1816 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1832 QApplication::style().drawItem(p, x, y, w, h, 1817 QApplication::style().drawItem(p, x, y, w, h,
1833 AlignCenter|ShowPrefix|DontClip|SingleLine, 1818 AlignCenter|ShowPrefix|DontClip|SingleLine,
1834- g, mi->isEnabled(), NULL, mi->text(), 1819- g, mi->isEnabled(), NULL, mi->text(),
1835+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1820+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1836 -1, &g.text()); 1821 -1, &g.text());
1837 } 1822 }
1838 } 1823 }
1839 1824
1840 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 1825 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
1841- const QColorGroup &g, int lineWidth, 1826- const QColorGroup &g, int lineWidth,
1842- const QBrush * fill) 1827- const QBrush * fill)
1843+ const QColorGroup &g, int /*lineWidth*/, 1828+ const QColorGroup &g, int /*lineWidth*/,
1844+ const QBrush * /*fill*/) 1829+ const QBrush * /*fill*/)
1845 { 1830 {
1846 QColor c; 1831 QColor c;
1847 switch(menuHandler->transType()){ 1832 switch(menuHandler->transType()){
1848@@ -2336,8 +2084,6 @@ 1833@@ -2336,8 +2078,6 @@
1849 1834
1850 maxpmw = QMAX( maxpmw, 20 ); 1835 maxpmw = QMAX( maxpmw, 20 );
1851 1836
1852- if ( p->font() == KGlobalSettings::generalFont() ) 1837- if ( p->font() == KGlobalSettings::generalFont() )
1853- p->setFont( KGlobalSettings::menuFont() ); 1838- p->setFont( KGlobalSettings::menuFont() );
1854 1839
1855 bool dis = !enabled; 1840 bool dis = !enabled;
1856 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 1841 QColorGroup itemg = dis ? pal.disabled() : pal.active();
1857@@ -2363,7 +2109,7 @@ 1842@@ -2363,7 +2103,7 @@
1858 p->fillRect(x, y, w, h, menuBrush); 1843 p->fillRect(x, y, w, h, menuBrush);
1859 } 1844 }
1860 else{ 1845 else{
1861- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1846- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1862+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1847+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1863 if(pix) 1848 if(pix)
1864 p->drawPixmap(x, y, *pix, x, y, w, h); 1849 p->drawPixmap(x, y, *pix, x, y, w, h);
1865 } 1850 }
1866@@ -2508,25 +2254,6 @@ 1851@@ -2508,25 +2248,6 @@
1867 return h; 1852 return h;
1868 } 1853 }
1869 1854
1870-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 1855-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
1871- const QColorGroup &g, QBrush *fill) 1856- const QColorGroup &g, QBrush *fill)
1872-{ 1857-{
1873- p->setPen(g.button().dark(130)); 1858- p->setPen(g.button().dark(130));
1874- p->drawRect(x, y, w, h); 1859- p->drawRect(x, y, w, h);
1875- p->setPen(g.button().light(120)); 1860- p->setPen(g.button().light(120));
1876- p->drawRect(x+1, y+1, w-2, h-2); 1861- p->drawRect(x+1, y+1, w-2, h-2);
1877- if(w >= 4 && h >= 4){ 1862- if(w >= 4 && h >= 4){
1878- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1863- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1879- if(!pix){ 1864- if(!pix){
1880- int h, s, v; 1865- int h, s, v;
1881- g.button().dark(120).hsv(&h, &s, &v); 1866- g.button().dark(120).hsv(&h, &s, &v);
1882- pix = new QPixmap(*bevelFillPix); 1867- pix = new QPixmap(*bevelFillPix);
1883- adjustHSV(*pix, h, s, v); 1868- adjustHSV(*pix, h, s, v);
1884- bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1869- bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1885- } 1870- }
1886- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1871- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1887- } 1872- }
1888-} 1873-}
1889 1874
1890 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 1875 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
1891 const QColorGroup &g, const QColor *c, 1876 const QColorGroup &g, const QColor *c,
1892@@ -2536,29 +2263,29 @@ 1877@@ -2536,29 +2257,29 @@
1893 if(p->device()->devType() == QInternal::Widget){ 1878 if(p->device()->devType() == QInternal::Widget){
1894 // if so does it use a special focus rectangle? 1879 // if so does it use a special focus rectangle?
1895 QWidget *w = (QWidget *)p->device(); 1880 QWidget *w = (QWidget *)p->device();
1896- if(w->inherits("QPushButton") || w->inherits("QSlider")){ 1881- if(w->inherits("QPushButton") || w->inherits("QSlider")){
1897+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ 1882+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){
1898 return; 1883 return;
1899 } 1884 }
1900 else{ 1885 else{
1901- KStyle::drawFocusRect(p, r, g, c, atBorder); 1886- KStyle::drawFocusRect(p, r, g, c, atBorder);
1902+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1887+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1903 } 1888 }
1904 } 1889 }
1905 else 1890 else
1906- KStyle::drawFocusRect(p, r, g, c, atBorder); 1891- KStyle::drawFocusRect(p, r, g, c, atBorder);
1907+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1892+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1908 1893
1909 } 1894 }
1910 1895
1911 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 1896 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
1912 { 1897 {
1913 mnu->installEventFilter(menuHandler); 1898 mnu->installEventFilter(menuHandler);
1914- KStyle::polishPopupMenu(mnu); 1899- KStyle::polishPopupMenu(mnu);
1915+ QWindowsStyle::polishPopupMenu(mnu); 1900+ QWindowsStyle::polishPopupMenu(mnu);
1916 } 1901 }
1917 1902
1918 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 1903 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
1919 bool selected) 1904 bool selected)
1920 { 1905 {
1921 if(tabBar->shape() != QTabBar::RoundedAbove){ 1906 if(tabBar->shape() != QTabBar::RoundedAbove){
1922- KStyle::drawTab(p, tabBar, tab, selected); 1907- KStyle::drawTab(p, tabBar, tab, selected);
1923+ QWindowsStyle::drawTab(p, tabBar, tab, selected); 1908+ QWindowsStyle::drawTab(p, tabBar, tab, selected);
1924 return; 1909 return;
1925 } 1910 }
1926 QPixmap tilePix; 1911 QPixmap tilePix;
1927@@ -2671,7 +2398,7 @@ 1912@@ -2671,7 +2392,7 @@
1928 vFrame = 8; // was 10 1913 vFrame = 8; // was 10
1929 } 1914 }
1930 else 1915 else
1931- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1916- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1932+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1917+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1933 } 1918 }
1934 1919
1935 1920
1936@@ -2699,7 +2426,7 @@ 1921@@ -2699,7 +2420,7 @@
1937 p->drawLine(x+1, y+1, x+1, y2-1); 1922 p->drawLine(x+1, y+1, x+1, y2-1);
1938 } 1923 }
1939 else if(lineWidth != 2 || !sunken) 1924 else if(lineWidth != 2 || !sunken)
1940- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1925- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1941+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1926+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1942 else{ 1927 else{
1943 QPen oldPen = p->pen(); 1928 QPen oldPen = p->pen();
1944 int x2 = x+w-1; 1929 int x2 = x+w-1;
1945@@ -2726,105 +2453,6 @@ 1930@@ -2726,105 +2447,6 @@
1946 } 1931 }
1947 } 1932 }
1948 1933
1949-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 1934-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
1950- const QColorGroup &g, QBrush *) 1935- const QColorGroup &g, QBrush *)
1951-{ 1936-{
1952- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1937- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1953- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 1938- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
1954- g.button().light(120) : g.button(), g.button()); 1939- g.button().light(120) : g.button(), g.button());
1955- /* 1940- /*
1956- if(h > w){ 1941- if(h > w){
1957- int y2 = y+h-1; 1942- int y2 = y+h-1;
1958- 1943-
1959- p->setPen(g.light()); 1944- p->setPen(g.light());
1960- 1945-
1961- p->drawLine(x+1, y+2, x+1, y2-2); 1946- p->drawLine(x+1, y+2, x+1, y2-2);
1962- p->drawLine(x+4, y+2, x+4, y2-2); 1947- p->drawLine(x+4, y+2, x+4, y2-2);
1963- 1948-
1964- p->setPen(g.dark()); 1949- p->setPen(g.dark());
1965- p->drawLine(x+2, y+2, x+2, y2-2); 1950- p->drawLine(x+2, y+2, x+2, y2-2);
1966- p->drawLine(x+5, y+2, x+5, y2-2); 1951- p->drawLine(x+5, y+2, x+5, y2-2);
1967- 1952-
1968- } 1953- }
1969- else{ 1954- else{
1970- int x2 = x+w-1; 1955- int x2 = x+w-1;
1971- 1956-
1972- p->setPen(g.light()); 1957- p->setPen(g.light());
1973- 1958-
1974- p->drawLine(x+2, y+1, x2-2, y+1); 1959- p->drawLine(x+2, y+1, x2-2, y+1);
1975- p->drawLine(x+2, y+4, x2-2, y+4); 1960- p->drawLine(x+2, y+4, x2-2, y+4);
1976- 1961-
1977- p->setPen(g.dark()); 1962- p->setPen(g.dark());
1978- p->drawLine(x+2, y+2, x2-2, y+2); 1963- p->drawLine(x+2, y+2, x2-2, y+2);
1979- p->drawLine(x+2, y+5, x2-2, y+5); 1964- p->drawLine(x+2, y+5, x2-2, y+5);
1980- }*/ 1965- }*/
1981- 1966-
1982-} 1967-}
1983- 1968-
1984-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 1969-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
1985- const QColorGroup &g, 1970- const QColorGroup &g,
1986- const QString &text, bool sunken, 1971- const QString &text, bool sunken,
1987- QPixmap *pixmap, QBrush *) 1972- QPixmap *pixmap, QBrush *)
1988-{ 1973-{
1989- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); 1974- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button));
1990- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); 1975- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button());
1991- p->setPen(g.buttonText()); // Kicker doesn't set this ;-) 1976- p->setPen(g.buttonText()); // Kicker doesn't set this ;-)
1992- 1977-
1993- if(text.isNull() && !pixmap) 1978- if(text.isNull() && !pixmap)
1994- return; 1979- return;
1995- 1980-
1996- const int pxWidth = 20; 1981- const int pxWidth = 20;
1997- int textPos = pxWidth; 1982- int textPos = pxWidth;
1998- QRect br(buttonRect(x, y, w, h)); 1983- QRect br(buttonRect(x, y, w, h));
1999- 1984-
2000- if (sunken) 1985- if (sunken)
2001- p->translate(1,1); 1986- p->translate(1,1);
2002- 1987-
2003- if ( pixmap && !pixmap->isNull() ) { 1988- if ( pixmap && !pixmap->isNull() ) {
2004- int dx = ( pxWidth - pixmap->width() ) / 2; 1989- int dx = ( pxWidth - pixmap->width() ) / 2;
2005- int dy = ( h - pixmap->height() ) / 2; 1990- int dy = ( h - pixmap->height() ) / 2;
2006- p->drawPixmap( br.x()+dx, dy, *pixmap ); 1991- p->drawPixmap( br.x()+dx, dy, *pixmap );
2007- } 1992- }
2008- 1993-
2009- QString s = text; 1994- QString s = text;
2010- static const QString &modStr = KGlobal::staticQString( 1995- static const QString &modStr = KGlobal::staticQString(
2011- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); 1996- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]"));
2012- 1997-
2013- int modStrPos = s.find(modStr); 1998- int modStrPos = s.find(modStr);
2014- 1999-
2015- if (-1 != modStrPos) { 2000- if (-1 != modStrPos) {
2016- 2001-
2017- // +1 because we include a space after the closing brace. 2002- // +1 because we include a space after the closing brace.
2018- s.remove(modStrPos, modStr.length()+1); 2003- s.remove(modStrPos, modStr.length()+1);
2019- 2004-
2020- QPixmap modPixmap = SmallIcon("modified"); 2005- QPixmap modPixmap = SmallIcon("modified");
2021- 2006-
2022- int dx = (pxWidth - modPixmap.width()) / 2; 2007- int dx = (pxWidth - modPixmap.width()) / 2;
2023- int dy = (h - modPixmap.height()) / 2; 2008- int dy = (h - modPixmap.height()) / 2;
2024- 2009-
2025- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); 2010- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
2026- 2011-
2027- textPos += pxWidth; 2012- textPos += pxWidth;
2028- } 2013- }
2029- 2014-
2030- if (!s.isEmpty()){ 2015- if (!s.isEmpty()){
2031- if (p->fontMetrics().width(s) > br.width() - textPos) { 2016- if (p->fontMetrics().width(s) > br.width() - textPos) {
2032- 2017-
2033- int maxLen = br.width() - textPos - p->fontMetrics().width("..."); 2018- int maxLen = br.width() - textPos - p->fontMetrics().width("...");
2034- 2019-
2035- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) 2020- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
2036- s.truncate(s.length() - 1); 2021- s.truncate(s.length() - 1);
2037- 2022-
2038- s.append("..."); 2023- s.append("...");
2039- } 2024- }
2040- 2025-
2041- p->setPen(g.buttonText()); 2026- p->setPen(g.buttonText());
2042- 2027-
2043- p->drawText(br.x()+ textPos, -1, w-textPos, h, 2028- p->drawText(br.x()+ textPos, -1, w-textPos, h,
2044- AlignLeft|AlignVCenter, s); 2029- AlignLeft|AlignVCenter, s);
2045- } 2030- }
2046- 2031-
2047-} 2032-}
2048 2033
2049 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 2034 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
2050 { 2035 {
2051@@ -2988,110 +2616,5 @@ 2036@@ -2988,110 +2610,5 @@
2052 } 2037 }
2053 } 2038 }
2054 2039
2055-// I'm debating if to use QValueList or QList here. I like QValueList better, 2040-// I'm debating if to use QValueList or QList here. I like QValueList better,
2056-// but QList handles pointers which is good for a lot of empty icons... 2041-// but QList handles pointers which is good for a lot of empty icons...
2057- 2042-
2058-void LiquidStyle::loadCustomButtons() 2043-void LiquidStyle::loadCustomButtons()
2059-{ 2044-{
2060- return; // TODO 2045- return; // TODO
2061- customBtnColorList.clear(); 2046- customBtnColorList.clear();
2062- customBtnIconList.clear(); 2047- customBtnIconList.clear();
2063- customBtnLabelList.clear(); 2048- customBtnLabelList.clear();
2064- 2049-
2065- KConfig *config = KGlobal::config(); 2050- KConfig *config = KGlobal::config();
2066- QString oldGrp = config->group(); 2051- QString oldGrp = config->group();
2067- config->setGroup("MosfetButtons"); 2052- config->setGroup("MosfetButtons");
2068- 2053-
2069- QStrList iconList, colorList; //temp, we store QPixmaps and QColors 2054- QStrList iconList, colorList; //temp, we store QPixmaps and QColors
2070- iconList.setAutoDelete(true); 2055- iconList.setAutoDelete(true);
2071- colorList.setAutoDelete(true); 2056- colorList.setAutoDelete(true);
2072- config->readListEntry("Labels", customBtnLabelList); 2057- config->readListEntry("Labels", customBtnLabelList);
2073- config->readListEntry("Icons", iconList); 2058- config->readListEntry("Icons", iconList);
2074- config->readListEntry("Colors", colorList); 2059- config->readListEntry("Colors", colorList);
2075- 2060-
2076- const char *labelStr = customBtnLabelList.first(); 2061- const char *labelStr = customBtnLabelList.first();
2077- const char *colorStr = colorList.first(); 2062- const char *colorStr = colorList.first();
2078- const char *iconStr = iconList.first(); 2063- const char *iconStr = iconList.first();
2079- 2064-
2080- KIconLoader *ldr = KGlobal::iconLoader(); 2065- KIconLoader *ldr = KGlobal::iconLoader();
2081- while(labelStr != NULL){ 2066- while(labelStr != NULL){
2082- QColor *c = new QColor; 2067- QColor *c = new QColor;
2083- c->setNamedColor(QString(colorStr)); 2068- c->setNamedColor(QString(colorStr));
2084- customBtnColorList.append(c); 2069- customBtnColorList.append(c);
2085- 2070-
2086- QString tmpStr(iconStr); 2071- QString tmpStr(iconStr);
2087- if(!tmpStr.isEmpty()){ 2072- if(!tmpStr.isEmpty()){
2088- QPixmap *pixmap = 2073- QPixmap *pixmap =
2089- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); 2074- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small));
2090- if(pixmap->isNull()){ 2075- if(pixmap->isNull()){
2091- delete pixmap; 2076- delete pixmap;
2092- customBtnIconList.append(NULL); 2077- customBtnIconList.append(NULL);
2093- } 2078- }
2094- else 2079- else
2095- customBtnIconList.append(pixmap); 2080- customBtnIconList.append(pixmap);
2096- } 2081- }
2097- else 2082- else
2098- customBtnIconList.append(NULL); 2083- customBtnIconList.append(NULL);
2099- 2084-
2100- labelStr = customBtnLabelList.next(); 2085- labelStr = customBtnLabelList.next();
2101- colorStr = colorList.next(); 2086- colorStr = colorList.next();
2102- iconStr = iconList.next(); 2087- iconStr = iconList.next();
2103- } 2088- }
2104- config->setGroup(oldGrp); 2089- config->setGroup(oldGrp);
2105-} 2090-}
2106- 2091-
2107-void LiquidStyle::applyCustomAttributes(QPushButton *btn) 2092-void LiquidStyle::applyCustomAttributes(QPushButton *btn)
2108-{ 2093-{
2109- return; // TODO 2094- return; // TODO
2110- QString str = btn->text(); 2095- QString str = btn->text();
2111- if(str.isEmpty()) 2096- if(str.isEmpty())
2112- return; 2097- return;
2113- while(str.contains('&') != 0) 2098- while(str.contains('&') != 0)
2114- str = str.remove(str.find('&'), 1); 2099- str = str.remove(str.find('&'), 1);
2115- 2100-
2116- const char *s; 2101- const char *s;
2117- int idx = 0; 2102- int idx = 0;
2118- for(s = customBtnLabelList.first(); s != NULL; 2103- for(s = customBtnLabelList.first(); s != NULL;
2119- ++idx, s = customBtnLabelList.next()){ 2104- ++idx, s = customBtnLabelList.next()){
2120- if(qstricmp(s, str.latin1()) == 0){ 2105- if(qstricmp(s, str.latin1()) == 0){
2121- QPalette pal = btn->palette(); 2106- QPalette pal = btn->palette();
2122- pal.setColor(QColorGroup::Button, 2107- pal.setColor(QColorGroup::Button,
2123- *customBtnColorList.at(idx)); 2108- *customBtnColorList.at(idx));
2124- btn->setPalette(pal); 2109- btn->setPalette(pal);
2125- /* 2110- /*
2126- if(customBtnIconList.at(idx) != NULL){ 2111- if(customBtnIconList.at(idx) != NULL){
2127- QPixmap *pix = customBtnIconList.at(idx); 2112- QPixmap *pix = customBtnIconList.at(idx);
2128- btn->setIconSet(QIconSet(*pix)); 2113- btn->setIconSet(QIconSet(*pix));
2129- }*/ 2114- }*/
2130- break; 2115- break;
2131- } 2116- }
2132- } 2117- }
2133-} 2118-}
2134- 2119-
2135-void LiquidStyle::unapplyCustomAttributes(QPushButton *btn) 2120-void LiquidStyle::unapplyCustomAttributes(QPushButton *btn)
2136-{ 2121-{
2137- return; // TODO 2122- return; // TODO
2138- QString str = btn->text(); 2123- QString str = btn->text();
2139- if(str.isEmpty()) 2124- if(str.isEmpty())
2140- return; 2125- return;
2141- while(str.contains('&') != 0) 2126- while(str.contains('&') != 0)
2142- str = str.remove(str.find('&'), 1); 2127- str = str.remove(str.find('&'), 1);
2143- 2128-
2144- const char *s; 2129- const char *s;
2145- for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){ 2130- for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){
2146- if(qstricmp(s, str.latin1()) == 0){ 2131- if(qstricmp(s, str.latin1()) == 0){
2147- btn->setPalette(QApplication::palette()); 2132- btn->setPalette(QApplication::palette());
2148- btn->setIconSet(QIconSet()); 2133- btn->setIconSet(QIconSet());
2149- break; 2134- break;
2150- } 2135- }
2151- } 2136- }
2152-} 2137-}
2153- 2138-
2154-#include "liquid.moc" 2139-#include "liquid.moc"
2155- 2140-
2156- 2141-
2157- 2142-
2158- 2143-
2159- 2144-
2160 2145
2161 /* vim: set noet sw=8 ts=8: */ 2146 /* vim: set noet sw=8 ts=8: */
2162 --- -2002-11-21 20:45:47.000000000 +0100 2147 --- -2002-11-29 12:30:35.000000000 +0100
2163 +++ plugin.cpp2002-11-18 18:11:41.000000000 +0100 2148 +++ plugin.cpp2002-11-18 18:11:41.000000000 +0100
2164@@ -1,29 +1,84 @@ 2149@@ -1,29 +1,84 @@
2165+#include <qapplication.h> 2150+#include <qapplication.h>
2166+ 2151+
2167 #include "liquid.h" 2152 #include "liquid.h"
2168-#include <klocale.h> 2153-#include <klocale.h>
2169+#include "liquidset.h" 2154+#include "liquidset.h"
2170+#include "plugin.h" 2155+#include "plugin.h"
2171+ 2156+
2172+ 2157+
2173+ 2158+
2174+LiquidInterface::LiquidInterface ( ) : ref ( 0 ) 2159+LiquidInterface::LiquidInterface ( ) : ref ( 0 )
2175+{ 2160+{
2176 +m_widget = 0; 2161 +m_widget = 0;
2177+} 2162+}
2178+ 2163+
2179+LiquidInterface::~LiquidInterface ( ) 2164+LiquidInterface::~LiquidInterface ( )
2180+{ 2165+{
2181+} 2166+}
2182+ 2167+
2183+QStyle *LiquidInterface::style ( ) 2168+QStyle *LiquidInterface::style ( )
2184+{ 2169+{
2185 +return new LiquidStyle ( ); 2170 +return new LiquidStyle ( );
2186+} 2171+}
2187 2172
2188-extern "C" { 2173-extern "C" {
2189- KStyle* allocate(); 2174- KStyle* allocate();
2190- int minor_version(); 2175- int minor_version();
2191- int major_version(); 2176- int major_version();
2192- const char *description(); 2177- const char *description();
2193+QString LiquidInterface::name ( ) const 2178+QString LiquidInterface::name ( ) const
2194+{ 2179+{
2195 +return qApp-> translate ( "Styles", "Liquid" ); 2180 +return qApp-> translate ( "Styles", "Liquid" );
2196 } 2181 }
2197 2182
2198-KStyle* allocate() 2183-KStyle* allocate()
2199+QString LiquidInterface::description ( ) const 2184+QString LiquidInterface::description ( ) const
2200 { 2185 {
2201- return(new LiquidStyle); 2186- return(new LiquidStyle);
2202 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); 2187 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" );
2203 } 2188 }
2204 2189
2205-int minor_version() 2190-int minor_version()
2206+bool LiquidInterface::hasSettings ( ) const 2191+bool LiquidInterface::hasSettings ( ) const
2207 { 2192 {
2208- return(0); 2193- return(0);
2209 +return true; 2194 +return true;
2210 } 2195 }
2211 2196
2212-int major_version() 2197-int major_version()
2213+QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) 2198+QWidget *LiquidInterface::create ( QWidget *parent, const char *name )
2214 { 2199 {
2215- return(1); 2200- return(1);
2216 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); 2201 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" );
2217 + 2202 +
2218 +return m_widget; 2203 +return m_widget;
2219 } 2204 }
2220 2205
2221-const char *description() 2206-const char *description()
2222+bool LiquidInterface::accept ( ) 2207+bool LiquidInterface::accept ( )
2223 { 2208 {
2224- return(i18n("High performance liquid plugin").utf8()); 2209- return(i18n("High performance liquid plugin").utf8());
2225 +if ( !m_widget ) 2210 +if ( !m_widget )
2226 + return false; 2211 + return false;
2227+ 2212+
2228 +return m_widget-> writeConfig ( ); 2213 +return m_widget-> writeConfig ( );
2229 } 2214 }
2230+ 2215+
2231+void LiquidInterface::reject ( ) 2216+void LiquidInterface::reject ( )
2232+{ 2217+{
2233+} 2218+}
2234+ 2219+
2235+ 2220+
2236+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 2221+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
2237+{ 2222+{
2238 +*iface = 0; 2223 +*iface = 0;
2239 + 2224 +
2240 +if ( uuid == IID_QUnknown ) 2225 +if ( uuid == IID_QUnknown )
2241 + *iface = this; 2226 + *iface = this;
2242 +else if ( uuid == IID_Style ) 2227 +else if ( uuid == IID_Style )
2243 + *iface = this; 2228 + *iface = this;
2244 +else if ( uuid == IID_StyleExtended ) 2229 +else if ( uuid == IID_StyleExtended )
2245 + *iface = this; 2230 + *iface = this;
2246 + 2231 +
2247 +if ( *iface ) 2232 +if ( *iface )
2248 + (*iface)-> addRef ( ); 2233 + (*iface)-> addRef ( );
2249 + 2234 +
2250 +return QS_OK; 2235 +return QS_OK;
2251+} 2236+}
2252+ 2237+
2253+Q_EXPORT_INTERFACE() 2238+Q_EXPORT_INTERFACE()
2254+{ 2239+{
2255 +Q_CREATE_INSTANCE( LiquidInterface ) 2240 +Q_CREATE_INSTANCE( LiquidInterface )
2256+} 2241+}
2257+ 2242+
2258+ 2243+
2259+// For Sharp ROM 2244+// For Sharp ROM
2260+ 2245+
2261+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } 2246+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } }
2262+extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } } 2247+extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } }