summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
Unidiff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 4653639..2b6eaa4 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -115,105 +115,96 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
115 pix->fill(Qt::black.rgb()); 115 pix->fill(Qt::black.rgb());
116 } 116 }
117 if(type == TransStippleBg){ 117 if(type == TransStippleBg){
118 stripePixmap(*pix, p->colorGroup().background()); 118 stripePixmap(*pix, p->colorGroup().background());
119 } 119 }
120 else if(type == TransStippleBtn){ 120 else if(type == TransStippleBtn){
121 stripePixmap(*pix, p->colorGroup().button()); 121 stripePixmap(*pix, p->colorGroup().button());
122 } 122 }
123 else{ 123 else{
124 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 124 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
125 } 125 }
126 126
127 if (p->inherits("QPopupMenu")) 127 if (p->inherits("QPopupMenu"))
128 pixDict.insert(p->winId(), pix); 128 pixDict.insert(p->winId(), pix);
129 else { 129 else {
130 p->setBackgroundPixmap(*pix); 130 p->setBackgroundPixmap(*pix);
131 131
132 QObjectList *ol = p-> queryList("QWidget"); 132 QObjectList *ol = p-> queryList("QWidget");
133 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 133 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
134 QWidget *wid = (QWidget *) it.current ( ); 134 QWidget *wid = (QWidget *) it.current ( );
135 135
136 wid-> setBackgroundPixmap(*pix); 136 wid-> setBackgroundPixmap(*pix);
137 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 137 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
138 } 138 }
139 delete ol; 139 delete ol;
140 } 140 }
141 } 141 }
142 } 142 }
143 else if(ev->type() == QEvent::Hide){ 143 else if(ev->type() == QEvent::Hide){
144 if(type == TransStippleBg || type == TransStippleBtn || 144 if(type == TransStippleBg || type == TransStippleBtn ||
145 type == Custom){ 145 type == Custom){
146// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 146// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
147 147
148 if (p->inherits("QPopupMenu")) 148 if (p->inherits("QPopupMenu"))
149 pixDict.remove(p->winId()); 149 pixDict.remove(p->winId());
150 else { 150 else {
151 p->setBackgroundMode(QWidget::PaletteBackground); 151 p->setBackgroundMode(QWidget::PaletteBackground);
152 152
153 QObjectList *ol = p-> queryList("QWidget"); 153 QObjectList *ol = p-> queryList("QWidget");
154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
155 QWidget *wid = (QWidget *) it.current ( ); 155 QWidget *wid = (QWidget *) it.current ( );
156 156
157 wid-> setBackgroundMode( QWidget::PaletteBackground ); 157 wid-> setBackgroundMode( QWidget::PaletteBackground );
158 } 158 }
159 delete ol; 159 delete ol;
160 } 160 }
161 } 161 }
162 } 162 }
163 else if(ev->type() == QEvent::Paint){
164 if(type == TransStippleBg || type == TransStippleBtn ||
165 type == Custom){
166// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
167
168 if (!p->inherits("QPopupMenu"))
169 p->erase();
170 }
171 }
172 return(false); 163 return(false);
173} 164}
174 165
175 166
176LiquidStyle::LiquidStyle() 167LiquidStyle::LiquidStyle()
177 :QWindowsStyle() 168 :QWindowsStyle()
178{ 169{
179 setName ( "LiquidStyle" ); 170 setName ( "LiquidStyle" );
180 171
181 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 172 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
182 btnMaskBmp.setMask(btnMaskBmp); 173 btnMaskBmp.setMask(btnMaskBmp);
183 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 174 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
184 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 175 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
185 headerHoverID = -1; 176 headerHoverID = -1;
186 highlightWidget = NULL; 177 highlightWidget = NULL;
187 setButtonDefaultIndicatorWidth(0); 178 setButtonDefaultIndicatorWidth(0);
188 btnDict.setAutoDelete(true); 179 btnDict.setAutoDelete(true);
189 bevelFillDict.setAutoDelete(true); 180 bevelFillDict.setAutoDelete(true);
190 smallBevelFillDict.setAutoDelete(true); 181 smallBevelFillDict.setAutoDelete(true);
191 customBtnColorList.setAutoDelete(true); 182 customBtnColorList.setAutoDelete(true);
192 customBtnIconList.setAutoDelete(true); 183 customBtnIconList.setAutoDelete(true);
193 customBtnLabelList.setAutoDelete(true); 184 customBtnLabelList.setAutoDelete(true);
194 185
195 rMatrix.rotate(270.0); 186 rMatrix.rotate(270.0);
196 highcolor = QPixmap::defaultDepth() > 8; 187 highcolor = QPixmap::defaultDepth() > 8;
197 btnBorderPix = new QPixmap; 188 btnBorderPix = new QPixmap;
198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 189 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
199 btnBlendPix = new QPixmap; 190 btnBlendPix = new QPixmap;
200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 191 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
201 bevelFillPix = new QPixmap; 192 bevelFillPix = new QPixmap;
202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 193 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
203 smallBevelFillPix = new QPixmap; 194 smallBevelFillPix = new QPixmap;
204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 195 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
205 // new stuff 196 // new stuff
206 vsbSliderFillPix = menuPix = NULL; 197 vsbSliderFillPix = menuPix = NULL;
207 menuHandler = new TransMenuHandler(this); 198 menuHandler = new TransMenuHandler(this);
208 setScrollBarExtent(15, 15); 199 setScrollBarExtent(15, 15);
209 int i; 200 int i;
210 for(i=0; i < BITMAP_ITEMS; ++i){ 201 for(i=0; i < BITMAP_ITEMS; ++i){
211 pixmaps[i] = NULL; 202 pixmaps[i] = NULL;
212 } 203 }
213 oldSliderThickness = sliderThickness(); 204 oldSliderThickness = sliderThickness();
214 setSliderThickness(11); 205 setSliderThickness(11);
215} 206}
216 207
217LiquidStyle::~LiquidStyle() 208LiquidStyle::~LiquidStyle()
218{ 209{
219 if(btnBorderPix) 210 if(btnBorderPix)
@@ -792,192 +783,191 @@ void LiquidStyle::polish(QPalette &appPal)
792 painter.setPen(c.dark(105)); 783 painter.setPen(c.dark(105));
793 painter.drawLine(0, i, 32, i); 784 painter.drawLine(0, i, 32, i);
794 painter.setPen(c.dark(103)); 785 painter.setPen(c.dark(103));
795 painter.drawLine(0, i+1, 32, i+1); 786 painter.drawLine(0, i+1, 32, i+1);
796 }; 787 };
797 painter.end(); 788 painter.end();
798 bgBrush.setColor(c); 789 bgBrush.setColor(c);
799 bgBrush.setPixmap(wallPaper); 790 bgBrush.setPixmap(wallPaper);
800 appPal.setBrush(QColorGroup::Background, bgBrush); 791 appPal.setBrush(QColorGroup::Background, bgBrush);
801 792
802 // lineedits 793 // lineedits
803 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 794 c = QColor ( config. readEntry("Base", ( Qt::white). name ( )));
804 QPixmap basePix; 795 QPixmap basePix;
805 basePix.resize(32, 32); 796 basePix.resize(32, 32);
806 basePix.fill(c.rgb()); 797 basePix.fill(c.rgb());
807 painter.begin(&basePix); 798 painter.begin(&basePix);
808 painter.setPen(c.dark(105)); 799 painter.setPen(c.dark(105));
809 for(i=0; i < 32; i+=4){ 800 for(i=0; i < 32; i+=4){
810 painter.drawLine(0, i, 32, i); 801 painter.drawLine(0, i, 32, i);
811 painter.drawLine(0, i+1, 32, i+1); 802 painter.drawLine(0, i+1, 32, i+1);
812 }; 803 };
813 painter.end(); 804 painter.end();
814 baseBrush.setColor(c); 805 baseBrush.setColor(c);
815 baseBrush.setPixmap(basePix); 806 baseBrush.setPixmap(basePix);
816 it.toFirst(); 807 it.toFirst();
817 while ((w=it.current()) != 0 ){ 808 while ((w=it.current()) != 0 ){
818 ++it; 809 ++it;
819 if(w->inherits("QLineEdit")){ 810 if(w->inherits("QLineEdit")){
820 QPalette pal = w->palette(); 811 QPalette pal = w->palette();
821 pal.setBrush(QColorGroup::Base, baseBrush); 812 pal.setBrush(QColorGroup::Base, baseBrush);
822 w->setPalette(pal); 813 w->setPalette(pal);
823 } 814 }
824 else if(w->inherits("QPushButton")){ 815 else if(w->inherits("QPushButton")){
825 applyCustomAttributes((QPushButton *)w); 816 applyCustomAttributes((QPushButton *)w);
826 } 817 }
827 } 818 }
828 819
829} 820}
830 821
831void LiquidStyle::polish(QWidget *w) 822void LiquidStyle::polish(QWidget *w)
832{ 823{
833 if(w->inherits("QMenuBar")){ 824 if(w->inherits("QMenuBar")){
834 //((QFrame*)w)->setLineWidth(0); 825 //((QFrame*)w)->setLineWidth(0);
835 w->setBackgroundMode(QWidget::PaletteBackground); 826 w->setBackgroundMode(QWidget::PaletteBackground);
836 return; 827 return;
837 } 828 }
838 if(w->inherits("QPopupMenu")) 829 if(w->inherits("QPopupMenu"))
839 w->setBackgroundMode(QWidget::NoBackground); 830 w->setBackgroundMode(QWidget::NoBackground);
840 else if(w-> testWFlags(Qt::WType_Popup)) { 831 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
841 printf("install popup: %s\n", w-> className ( ));
842 w->installEventFilter(menuHandler); 832 w->installEventFilter(menuHandler);
843 } 833 }
844 834
845 if(w->isTopLevel()){ 835 if(w->isTopLevel()){
846 return; 836 return;
847 } 837 }
848 838
849 839
850 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 840 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
851 841
852 if(w->inherits("QComboBox") || 842 if(w->inherits("QComboBox") ||
853 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 843 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
854 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 844 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
855 w->installEventFilter(this); 845 w->installEventFilter(this);
856 } 846 }
857 if(w->inherits("QLineEdit")){ 847 if(w->inherits("QLineEdit")){
858 QPalette pal = w->palette(); 848 QPalette pal = w->palette();
859 pal.setBrush(QColorGroup::Base, baseBrush); 849 pal.setBrush(QColorGroup::Base, baseBrush);
860 w->setPalette(pal); 850 w->setPalette(pal);
861 } 851 }
862 if(w->inherits("QPushButton")){ 852 if(w->inherits("QPushButton")){
863 applyCustomAttributes((QPushButton *)w); 853 applyCustomAttributes((QPushButton *)w);
864 w->installEventFilter(this); 854 w->installEventFilter(this);
865 } 855 }
866 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 856 if(w->inherits("QButton") || w-> inherits("QComboBox")){
867 w-> setBackgroundMode ( QWidget::PaletteBackground ); 857 w-> setBackgroundMode ( QWidget::PaletteBackground );
868 } 858 }
869 859
870 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 860 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
871 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 861 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
872 bool isViewportChild = w->parent() && 862 bool isViewportChild = w->parent() &&
873 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 863 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
874 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 864 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
875 865
876 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 866 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
877 w->setBackgroundMode(QWidget::X11ParentRelative); 867 w->setBackgroundMode(QWidget::X11ParentRelative);
878 return; 868 return;
879 } 869 }
880 if(isViewportChild){ 870 if(isViewportChild){
881 if(w->inherits("QButton") || w->inherits("QComboBox")){ 871 if(w->inherits("QButton") || w->inherits("QComboBox")){
882 if(w->parent()){ // heh, only way to test for KHTML children ;-) 872 if(w->parent()){ // heh, only way to test for KHTML children ;-)
883 if(w->parent()->parent()){ 873 if(w->parent()->parent()){
884 if(w->parent()->parent()->parent() && 874 if(w->parent()->parent()->parent() &&
885 w->parent()->parent()->parent()->inherits("KHTMLView")){ 875 w->parent()->parent()->parent()->inherits("KHTMLView")){
886 w->setAutoMask(true); 876 w->setAutoMask(true);
887 w->setBackgroundMode(QWidget::NoBackground); 877 w->setBackgroundMode(QWidget::NoBackground);
888 } 878 }
889 } 879 }
890 } 880 }
891 return; 881 return;
892 } 882 }
893 } 883 }
894 if(w->inherits("QHeader")){ 884 if(w->inherits("QHeader")){
895 w->setMouseTracking(true); 885 w->setMouseTracking(true);
896 w->installEventFilter(this); 886 w->installEventFilter(this);
897 } 887 }
898 if(w-> inherits("QToolButton")) { 888 if(w-> inherits("QToolButton")) {
899 ((QToolButton*)w)->setAutoRaise (false); 889 ((QToolButton*)w)->setAutoRaise (false);
900 } 890 }
901 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 891 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
902 return; 892 return;
903 } 893 }
904 894
905 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 895 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
906 palette().active().brush(QColorGroup::Background).pixmap()){ 896 palette().active().brush(QColorGroup::Background).pixmap()){
907 qWarning("No parent pixmap for child widget %s", w->className()); 897 qWarning("No parent pixmap for child widget %s", w->className());
908 return; 898 return;
909 } 899 }
910 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 900 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
911 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 901 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
912 if(w->backgroundMode() == QWidget::PaletteBackground || 902 if(w->backgroundMode() == QWidget::PaletteBackground ||
913 w->backgroundMode() == QWidget::PaletteButton){ 903 w->backgroundMode() == QWidget::PaletteButton){
914 w->setBackgroundMode(QWidget::X11ParentRelative); 904 w->setBackgroundMode(QWidget::X11ParentRelative);
915 } 905 }
916 } 906 }
917 if(w->inherits("QToolBar")){ 907 if(w->inherits("QToolBar")){
918 w->installEventFilter(this); 908 w->installEventFilter(this);
919 w->setBackgroundMode(QWidget::PaletteBackground); 909 w->setBackgroundMode(QWidget::PaletteBackground);
920 return; 910 return;
921 } 911 }
922 912
923} 913}
924 914
925void LiquidStyle::unPolish(QWidget *w) 915void LiquidStyle::unPolish(QWidget *w)
926{ 916{
927 if(w->inherits("QMenuBar")){ 917 if(w->inherits("QMenuBar")){
928 ((QFrame *)w)->setLineWidth(1); 918 ((QFrame *)w)->setLineWidth(1);
929 w->setBackgroundMode(QWidget::PaletteBackground); 919 w->setBackgroundMode(QWidget::PaletteBackground);
930 return; 920 return;
931 } 921 }
932 922
933 if(w->inherits("QPopupMenu")) 923 if(w->inherits("QPopupMenu"))
934 w->setBackgroundMode(QWidget::PaletteButton); 924 w->setBackgroundMode(QWidget::PaletteButton);
935 else if(w-> testWFlags(Qt::WType_Popup)) { 925 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
936 w->removeEventFilter(menuHandler); 926 w->removeEventFilter(menuHandler);
937 } 927 }
938 928
939 if(w->isTopLevel()) 929 if(w->isTopLevel())
940 return; 930 return;
941 931
942 // for viewport children, don't just check for NoBackground.... 932 // for viewport children, don't just check for NoBackground....
943 bool isViewportChild = w->parent() && 933 bool isViewportChild = w->parent() &&
944 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 934 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
945 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 935 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
946 936
947 w->setPalette(QApplication::palette()); 937 w->setPalette(QApplication::palette());
948 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 938 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
949 if(w->inherits("QPushButton")) 939 if(w->inherits("QPushButton"))
950 w->setBackgroundMode(QWidget::PaletteButton); 940 w->setBackgroundMode(QWidget::PaletteButton);
951 else 941 else
952 w->setBackgroundMode(QWidget::PaletteBackground); 942 w->setBackgroundMode(QWidget::PaletteBackground);
953 } 943 }
954 944
955 if(isViewportChild) 945 if(isViewportChild)
956 w->setAutoMask(false); 946 w->setAutoMask(false);
957 947
958 if(w->inherits("QPushButton")){ 948 if(w->inherits("QPushButton")){
959 unapplyCustomAttributes((QPushButton *)w); 949 unapplyCustomAttributes((QPushButton *)w);
960 w->removeEventFilter(this); 950 w->removeEventFilter(this);
961 } 951 }
962/* 952/*
963 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 953 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
964 w-> setBackgroundMode ( PaletteBackground ); 954 w-> setBackgroundMode ( PaletteBackground );
965 } 955 }
966*/ 956*/
967 if(w->inherits("QComboBox") || 957 if(w->inherits("QComboBox") ||
968 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 958 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
969 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 959 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
970 w->removeEventFilter(this); 960 w->removeEventFilter(this);
971 } 961 }
972 if(w->inherits("QButton") || w->inherits("QComboBox")){ 962 if(w->inherits("QButton") || w->inherits("QComboBox")){
973 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 963 if(w->parent() && w->parent()->inherits("KHTMLPart")){
974 w->setAutoMask(false); 964 w->setAutoMask(false);
975 } 965 }
976 } 966 }
977 if(w->inherits("QToolBar")){ 967 if(w->inherits("QToolBar")){
978 w->removeEventFilter(this); 968 w->removeEventFilter(this);
979 w->setBackgroundMode(QWidget::PaletteBackground); 969 w->setBackgroundMode(QWidget::PaletteBackground);
980 return; 970 return;
981 } 971 }
982 if(w->inherits("QHeader")){ 972 if(w->inherits("QHeader")){
983 w->setMouseTracking(false); 973 w->setMouseTracking(false);