summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp25
-rw-r--r--noncore/styles/liquid/opie-liquid.diff100
2 files changed, 95 insertions, 30 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 9a7d2dd..313d52c 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1638,593 +1638,592 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1638 *getPixmap(HSBSliderBtm)); 1638 *getPixmap(HSBSliderBtm));
1639 } 1639 }
1640 else if(sliderR.width() >= 8){ 1640 else if(sliderR.width() >= 8){
1641 int m = sliderR.width()/2; 1641 int m = sliderR.width()/2;
1642 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1642 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1643 isHover ? *getPixmap(HSBSliderTopHover) : 1643 isHover ? *getPixmap(HSBSliderTopHover) :
1644 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1644 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1645 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1645 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1646 *getPixmap(HSBSliderBtmHover) : 1646 *getPixmap(HSBSliderBtmHover) :
1647 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1647 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1648 } 1648 }
1649 else{ 1649 else{
1650 painter.setPen(g.button().dark(210)); 1650 painter.setPen(g.button().dark(210));
1651 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1651 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1652 sliderR.width(), 13); 1652 sliderR.width(), 13);
1653 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1653 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1654 sliderR.width()-2, 11, isHover ? 1654 sliderR.width()-2, 11, isHover ?
1655 *getPixmap(HSBSliderMidHover) : 1655 *getPixmap(HSBSliderMidHover) :
1656 *getPixmap(HSBSliderMid), 0, 1); 1656 *getPixmap(HSBSliderMid), 0, 1);
1657 } 1657 }
1658 } 1658 }
1659 painter.setPen(g.mid()); 1659 painter.setPen(g.mid());
1660 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y()); 1660 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
1661 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); 1661 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
1662 if(brokenApp && (controls & Slider)){ 1662 if(brokenApp && (controls & Slider)){
1663 painter.setPen(g.background()); 1663 painter.setPen(g.background());
1664 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(), 1664 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
1665 bgR.bottom()-1); 1665 bgR.bottom()-1);
1666 } 1666 }
1667 painter.end(); 1667 painter.end();
1668 } 1668 }
1669 1669
1670 if ( controls & AddLine ) { 1670 if ( controls & AddLine ) {
1671 drawSBButton(p, addB, g, activeControl == AddLine); 1671 drawSBButton(p, addB, g, activeControl == AddLine);
1672 drawArrow( p, horiz ? RightArrow : DownArrow, 1672 drawArrow( p, horiz ? RightArrow : DownArrow,
1673 false, addB.x()+4, addB.y()+4, 1673 false, addB.x()+4, addB.y()+4,
1674 addB.width()-8, addB.height()-8, g, !maxed); 1674 addB.width()-8, addB.height()-8, g, !maxed);
1675 } 1675 }
1676 if ( controls & SubLine ) { 1676 if ( controls & SubLine ) {
1677 drawSBButton(p, subB, g, activeControl == SubLine); 1677 drawSBButton(p, subB, g, activeControl == SubLine);
1678 drawArrow( p, horiz ? LeftArrow : UpArrow, 1678 drawArrow( p, horiz ? LeftArrow : UpArrow,
1679 false, subB.x()+4, subB.y()+4, 1679 false, subB.x()+4, subB.y()+4,
1680 subB.width()-8, subB.height()-8, g, !maxed); 1680 subB.width()-8, subB.height()-8, g, !maxed);
1681 drawSBButton(p, subHC, g, activeControl == SubLine); 1681 drawSBButton(p, subHC, g, activeControl == SubLine);
1682 drawArrow( p, horiz ? LeftArrow : UpArrow, 1682 drawArrow( p, horiz ? LeftArrow : UpArrow,
1683 false, subHC.x()+4, subHC.y()+4, 1683 false, subHC.x()+4, subHC.y()+4,
1684 subHC.width()-8, subHC.height()-8, g, !maxed); 1684 subHC.width()-8, subHC.height()-8, g, !maxed);
1685 } 1685 }
1686 1686
1687 if(controls & AddPage){ 1687 if(controls & AddPage){
1688 if(addPageR.width()){ 1688 if(addPageR.width()){
1689 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer, 1689 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
1690 addPageR.x(), addPageR.y(), addPageR.width(), 1690 addPageR.x(), addPageR.y(), addPageR.width(),
1691 addPageR.height()); 1691 addPageR.height());
1692 } 1692 }
1693 } 1693 }
1694 if(controls & SubPage){ 1694 if(controls & SubPage){
1695 if(subPageR.height()){ 1695 if(subPageR.height()){
1696 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer, 1696 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
1697 subPageR.x(), subPageR.y(), subPageR.width(), 1697 subPageR.x(), subPageR.y(), subPageR.width(),
1698 subPageR.height()); 1698 subPageR.height());
1699 } 1699 }
1700 } 1700 }
1701 if ( controls & Slider ) { 1701 if ( controls & Slider ) {
1702 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer, 1702 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
1703 sliderR.x(), sliderR.y(), sliderR.width(), 1703 sliderR.x(), sliderR.y(), sliderR.width(),
1704 sliderR.height()); 1704 sliderR.height());
1705 } 1705 }
1706} 1706}
1707 1707
1708void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 1708void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
1709 bool down, bool /*fast*/) 1709 bool down, bool /*fast*/)
1710{ 1710{
1711 p->setPen(g.mid()); 1711 p->setPen(g.mid());
1712 p->drawRect(r); 1712 p->drawRect(r);
1713 QColor c(down ? g.button() : g.background()); 1713 QColor c(down ? g.button() : g.background());
1714 QPixmap *pix = bevelFillDict.find(c.rgb()); 1714 QPixmap *pix = bevelFillDict.find(c.rgb());
1715 if(!pix){ 1715 if(!pix){
1716 int h, s, v; 1716 int h, s, v;
1717 c.hsv(&h, &s, &v); 1717 c.hsv(&h, &s, &v);
1718 pix = new QPixmap(*bevelFillPix); 1718 pix = new QPixmap(*bevelFillPix);
1719 adjustHSV(*pix, h, s, v); 1719 adjustHSV(*pix, h, s, v);
1720 bevelFillDict.insert(c.rgb(), pix); 1720 bevelFillDict.insert(c.rgb(), pix);
1721 } 1721 }
1722 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1722 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1723 1723
1724} 1724}
1725 1725
1726void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, 1726void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
1727 bool horiz) 1727 bool horiz)
1728{ 1728{
1729 if(horiz){ 1729 if(horiz){
1730 if(r.width() >= 15){ 1730 if(r.width() >= 15){
1731 int y = r.y()+3; 1731 int y = r.y()+3;
1732 int x = r.x() + (r.width()-7)/2; 1732 int x = r.x() + (r.width()-7)/2;
1733 int y2 = r.bottom()-3; 1733 int y2 = r.bottom()-3;
1734 p->setPen(g.light()); 1734 p->setPen(g.light());
1735 p->drawLine(x, y, x, y2); 1735 p->drawLine(x, y, x, y2);
1736 p->drawLine(x+3, y, x+3, y2); 1736 p->drawLine(x+3, y, x+3, y2);
1737 p->drawLine(x+6, y, x+6, y2); 1737 p->drawLine(x+6, y, x+6, y2);
1738 1738
1739 p->setPen(g.mid()); 1739 p->setPen(g.mid());
1740 p->drawLine(x+1, y, x+1, y2); 1740 p->drawLine(x+1, y, x+1, y2);
1741 p->drawLine(x+4, y, x+4, y2); 1741 p->drawLine(x+4, y, x+4, y2);
1742 p->drawLine(x+7, y, x+7, y2); 1742 p->drawLine(x+7, y, x+7, y2);
1743 } 1743 }
1744 } 1744 }
1745 else{ 1745 else{
1746 if(r.height() >= 15){ 1746 if(r.height() >= 15){
1747 int x = r.x()+3; 1747 int x = r.x()+3;
1748 int y = r.y() + (r.height()-7)/2; 1748 int y = r.y() + (r.height()-7)/2;
1749 int x2 = r.right()-3; 1749 int x2 = r.right()-3;
1750 p->setPen(g.light()); 1750 p->setPen(g.light());
1751 p->drawLine(x, y, x2, y); 1751 p->drawLine(x, y, x2, y);
1752 p->drawLine(x, y+3, x2, y+3); 1752 p->drawLine(x, y+3, x2, y+3);
1753 p->drawLine(x, y+6, x2, y+6); 1753 p->drawLine(x, y+6, x2, y+6);
1754 1754
1755 p->setPen(g.mid()); 1755 p->setPen(g.mid());
1756 p->drawLine(x, y+1, x2, y+1); 1756 p->drawLine(x, y+1, x2, y+1);
1757 p->drawLine(x, y+4, x2, y+4); 1757 p->drawLine(x, y+4, x2, y+4);
1758 p->drawLine(x, y+7, x2, y+7); 1758 p->drawLine(x, y+7, x2, y+7);
1759 } 1759 }
1760 } 1760 }
1761 1761
1762} 1762}
1763 1763
1764 1764
1765void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, 1765void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
1766 int &sliderMax, int &sliderLength, 1766 int &sliderMax, int &sliderLength,
1767 int &buttonDim) 1767 int &buttonDim)
1768{ 1768{
1769 1769
1770 int maxLength; 1770 int maxLength;
1771 int b = 0; 1771 int b = 0;
1772 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1772 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1773 int length = horiz ? sb->width() : sb->height(); 1773 int length = horiz ? sb->width() : sb->height();
1774 int extent = horiz ? sb->height() : sb->width(); 1774 int extent = horiz ? sb->height() : sb->width();
1775 1775
1776 if ( length > ( extent - b*2 - 1 )*2 + b*2 ) 1776 if ( length > ( extent - b*2 - 1 )*2 + b*2 )
1777 buttonDim = extent - b*2; 1777 buttonDim = extent - b*2;
1778 else 1778 else
1779 buttonDim = ( length - b*2 )/2 - 1; 1779 buttonDim = ( length - b*2 )/2 - 1;
1780 1780
1781 sliderMin = b + buttonDim; 1781 sliderMin = b + buttonDim;
1782 maxLength = length - b*2 - buttonDim*3; 1782 maxLength = length - b*2 - buttonDim*3;
1783 1783
1784 if ( sb->maxValue() == sb->minValue() ) { 1784 if ( sb->maxValue() == sb->minValue() ) {
1785 sliderLength = maxLength; 1785 sliderLength = maxLength;
1786 } else { 1786 } else {
1787 sliderLength = (sb->pageStep()*maxLength)/ 1787 sliderLength = (sb->pageStep()*maxLength)/
1788 (sb->maxValue()-sb->minValue()+sb->pageStep()); 1788 (sb->maxValue()-sb->minValue()+sb->pageStep());
1789 uint range = sb->maxValue()-sb->minValue(); 1789 uint range = sb->maxValue()-sb->minValue();
1790 if ( sliderLength < 9 || range > INT_MAX/2 ) 1790 if ( sliderLength < 9 || range > INT_MAX/2 )
1791 sliderLength = 9; 1791 sliderLength = 9;
1792 if ( sliderLength > maxLength ) 1792 if ( sliderLength > maxLength )
1793 sliderLength = maxLength; 1793 sliderLength = maxLength;
1794 } 1794 }
1795 sliderMax = sliderMin + maxLength - sliderLength; 1795 sliderMax = sliderMin + maxLength - sliderLength;
1796 1796
1797} 1797}
1798 1798
1799QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb, 1799QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
1800 int sliderStart, 1800 int sliderStart,
1801 const QPoint &p) 1801 const QPoint &p)
1802{ 1802{
1803 if ( !sb->rect().contains( p ) ) 1803 if ( !sb->rect().contains( p ) )
1804 return NoScroll; 1804 return NoScroll;
1805 int sliderMin, sliderMax, sliderLength, buttonDim, pos; 1805 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
1806 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1806 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1807 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); 1807 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y();
1808 if ( pos < sliderMin ) 1808 if ( pos < sliderMin )
1809 return SubLine; 1809 return SubLine;
1810 if ( pos < sliderStart ) 1810 if ( pos < sliderStart )
1811 return SubPage; 1811 return SubPage;
1812 if ( pos < sliderStart + sliderLength ) 1812 if ( pos < sliderStart + sliderLength )
1813 return Slider; 1813 return Slider;
1814 if ( pos < sliderMax + sliderLength) 1814 if ( pos < sliderMax + sliderLength)
1815 return AddPage; 1815 return AddPage;
1816 if(pos > sliderMax + sliderLength + 16) 1816 if(pos > sliderMax + sliderLength + 16)
1817 return AddLine; 1817 return AddLine;
1818 1818
1819 return SubLine; 1819 return SubLine;
1820} 1820}
1821 1821
1822#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1822#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1823 1823
1824 1824
1825QSize LiquidStyle::exclusiveIndicatorSize() const 1825QSize LiquidStyle::exclusiveIndicatorSize() const
1826{ 1826{
1827 return(QSize(16, 16)); 1827 return(QSize(16, 16));
1828} 1828}
1829 1829
1830void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, 1830void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1831 int h, const QColorGroup &g, bool on, 1831 int /*h*/, const QColorGroup &/*g*/, bool on,
1832 bool down, bool) 1832 bool down, bool)
1833{ 1833{
1834 bool isHover = highlightWidget == p->device(); 1834 bool isHover = highlightWidget == p->device();
1835 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1835 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1836 && ((QWidget*)p->device())->autoMask(); 1836 && ((QWidget*)p->device())->autoMask();
1837 1837
1838 if(isMasked){ 1838 if(isMasked){
1839 if(on || down){ 1839 if(on || down){
1840 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : 1840 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) :
1841 *getPixmap(HTMLRadioDown)); 1841 *getPixmap(HTMLRadioDown));
1842 } 1842 }
1843 else 1843 else
1844 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : 1844 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) :
1845 *getPixmap(HTMLRadio)); 1845 *getPixmap(HTMLRadio));
1846 1846
1847 } 1847 }
1848 else{ 1848 else{
1849 if(on || down){ 1849 if(on || down){
1850 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : 1850 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) :
1851 *getPixmap(RadioOn)); 1851 *getPixmap(RadioOn));
1852 } 1852 }
1853 else 1853 else
1854 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : 1854 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) :
1855 *getPixmap(RadioOff)); 1855 *getPixmap(RadioOff));
1856 } 1856 }
1857} 1857}
1858 1858
1859void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, 1859void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
1860 int h, bool) 1860 int h, bool)
1861{ 1861{
1862 p->fillRect(x, y, w, h, Qt::color0); 1862 p->fillRect(x, y, w, h, Qt::color0);
1863 p->setPen(Qt::color1); 1863 p->setPen(Qt::color1);
1864 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); 1864 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask());
1865} 1865}
1866 1866
1867 1867
1868QSize LiquidStyle::indicatorSize() const 1868QSize LiquidStyle::indicatorSize() const
1869{ 1869{
1870 return(QSize(20, 22)); 1870 return(QSize(20, 22));
1871} 1871}
1872 1872
1873void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, 1873void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1874 const QColorGroup &g, int state, bool down, bool) 1874 const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1875{ 1875{
1876 bool isHover = highlightWidget == p->device(); 1876 bool isHover = highlightWidget == p->device();
1877 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1877 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1878 && ((QWidget*)p->device())->autoMask(); 1878 && ((QWidget*)p->device())->autoMask();
1879 if(isMasked){ 1879 if(isMasked){
1880 if(state != QButton::Off){ 1880 if(state != QButton::Off){
1881 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : 1881 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) :
1882 *getPixmap(HTMLCBDown)); 1882 *getPixmap(HTMLCBDown));
1883 } 1883 }
1884 else 1884 else
1885 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : 1885 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) :
1886 *getPixmap(HTMLCB)); 1886 *getPixmap(HTMLCB));
1887 1887
1888 } 1888 }
1889 else{ 1889 else{
1890 if(state != QButton::Off){ 1890 if(state != QButton::Off){
1891 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : 1891 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) :
1892 *getPixmap(CBDown)); 1892 *getPixmap(CBDown));
1893 /* Todo - tristate 1893 /* Todo - tristate
1894 if(state == QButton::On){ 1894 if(state == QButton::On){
1895 p->setPen(Qt::black); 1895 p->setPen(Qt::black);
1896 p->drawPixmap(3, 3, xBmp); 1896 p->drawPixmap(3, 3, xBmp);
1897 } 1897 }
1898 else{ 1898 else{
1899 p->setPen(g.dark()); 1899 p->setPen(g.dark());
1900 p->drawRect(x+2, y+2, w-4, h-4); 1900 p->drawRect(x+2, y+2, w-4, h-4);
1901 p->setPen(Qt::black); 1901 p->setPen(Qt::black);
1902 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); 1902 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
1903 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); 1903 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
1904 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); 1904 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
1905 }*/ 1905 }*/
1906 } 1906 }
1907 else 1907 else
1908 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); 1908 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB));
1909 } 1909 }
1910} 1910}
1911 1911
1912void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, 1912void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1913 int state) 1913 int /*state*/)
1914{ 1914{
1915 // needed for some reason by KHtml, even tho it's all filled ;P 1915 // needed for some reason by KHtml, even tho it's all filled ;P
1916 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1916 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1917 1917
1918} 1918}
1919 1919
1920void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1920void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1921 const QColorGroup &g, Orientation orient, 1921 const QColorGroup &/*g*/, Orientation orient,
1922 bool, bool) 1922 bool, bool)
1923{ 1923{
1924 QWidget *parent = (QWidget *)p->device(); 1924 QWidget *parent = (QWidget *)p->device();
1925 p->setBrushOrigin(parent->pos()); 1925 p->setBrushOrigin(parent->pos());
1926 p->fillRect(x, y, w, h, 1926 parent->erase(x, y, w, h);
1927 QApplication::palette().active().brush(QColorGroup::Background));
1928 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1927 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1929 *getPixmap(VSlider)); 1928 *getPixmap(VSlider));
1930} 1929}
1931 1930
1932void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, 1931void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1933 Orientation orient, bool, bool) 1932 Orientation orient, bool, bool)
1934{ 1933{
1935 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1934 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1936 *getPixmap(VSlider)->mask()); 1935 *getPixmap(VSlider)->mask());
1937} 1936}
1938 1937
1939int LiquidStyle::sliderLength() const 1938int LiquidStyle::sliderLength() const
1940{ 1939{
1941 return(10); 1940 return(10);
1942} 1941}
1943 1942
1944#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1943#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1945 1944
1946void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 1945void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1947 int y, int w, int h, const QColorGroup &g, 1946 int y, int w, int h, const QColorGroup &g,
1948 bool enabled, const QBrush *) 1947 bool enabled, const QBrush *)
1949{ 1948{
1950 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; 1949 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5};
1951 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; 1950 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6};
1952 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; 1951 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7};
1953 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; 1952 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4};
1954 1953
1955 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); 1954 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid());
1956 if(w > 8){ 1955 if(w > 8){
1957 x = x + (w-8)/2; 1956 x = x + (w-8)/2;
1958 y = y + (h-8)/2; 1957 y = y + (h-8)/2;
1959 } 1958 }
1960 1959
1961 QPointArray a; 1960 QPointArray a;
1962 switch(type){ 1961 switch(type){
1963 case Qt::UpArrow: 1962 case Qt::UpArrow:
1964 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); 1963 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
1965 break; 1964 break;
1966 case Qt::DownArrow: 1965 case Qt::DownArrow:
1967 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); 1966 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
1968 break; 1967 break;
1969 case Qt::LeftArrow: 1968 case Qt::LeftArrow:
1970 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); 1969 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
1971 break; 1970 break;
1972 default: 1971 default:
1973 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); 1972 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
1974 break; 1973 break;
1975 } 1974 }
1976 1975
1977 a.translate(x, y); 1976 a.translate(x, y);
1978 p->drawLineSegments(a); 1977 p->drawLineSegments(a);
1979} 1978}
1980 1979
1981 1980
1982void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1981void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1983 QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) 1982 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1984 { 1983 {
1985 x -= 2; // Bug in Qt/E 1984 x -= 2; // Bug in Qt/E
1986 y -= 2; 1985 y -= 2;
1987 w += 2; 1986 w += 2;
1988 h += 2; 1987 h += 2;
1989 1988
1990 p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); 1989 p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background));
1991 1990
1992 w -= 2; 1991 w -= 2;
1993 1992
1994 if(menuHandler->useShadowText()){ 1993 if(menuHandler->useShadowText()){
1995 QColor shadow; 1994 QColor shadow;
1996 if(p->device() && p->device()->devType() == QInternal::Widget && 1995 if(p->device() && p->device()->devType() == QInternal::Widget &&
1997 ((QWidget *)p->device())->inherits("QMenuBar")){ 1996 ((QWidget *)p->device())->inherits("QMenuBar")){
1998 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1997 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1999 g.background().dark(130); 1998 g.background().dark(130);
2000 } 1999 }
2001 else 2000 else
2002 shadow = g.background().dark(130); 2001 shadow = g.background().dark(130);
2003 2002
2004 if(active){ 2003 if(active){
2005 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2004 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2006 QApplication::style().drawItem(p, x+1, y+1, w, h, 2005 QApplication::style().drawItem(p, x+1, y+1, w, h,
2007 AlignCenter|ShowPrefix|DontClip|SingleLine, 2006 AlignCenter|ShowPrefix|DontClip|SingleLine,
2008 g, mi->isEnabled(), NULL, mi->text(), 2007 g, mi->isEnabled(), NULL, mi->text(),
2009 -1, &shadow); 2008 -1, &shadow);
2010 QApplication::style().drawItem(p, x, y, w, h, 2009 QApplication::style().drawItem(p, x, y, w, h,
2011 AlignCenter|ShowPrefix|DontClip|SingleLine, 2010 AlignCenter|ShowPrefix|DontClip|SingleLine,
2012 g, mi->isEnabled(), NULL, mi->text(), 2011 g, mi->isEnabled(), NULL, mi->text(),
2013 -1, &g.text()); 2012 -1, &g.text());
2014 } 2013 }
2015 else{ 2014 else{
2016 QApplication::style().drawItem(p, x+1, y+1, w, h, 2015 QApplication::style().drawItem(p, x+1, y+1, w, h,
2017 AlignCenter|ShowPrefix|DontClip|SingleLine, 2016 AlignCenter|ShowPrefix|DontClip|SingleLine,
2018 g, mi->isEnabled(), NULL, mi->text(), 2017 g, mi->isEnabled(), NULL, mi->text(),
2019 -1, &shadow); 2018 -1, &shadow);
2020 QApplication::style().drawItem(p, x, y, w, h, 2019 QApplication::style().drawItem(p, x, y, w, h,
2021 AlignCenter|ShowPrefix|DontClip|SingleLine, 2020 AlignCenter|ShowPrefix|DontClip|SingleLine,
2022 g, mi->isEnabled(), NULL, mi->text(), 2021 g, mi->isEnabled(), NULL, mi->text(),
2023 -1, &g.text()); 2022 -1, &g.text());
2024 } 2023 }
2025 } 2024 }
2026 else{ 2025 else{
2027 if(active) 2026 if(active)
2028 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2027 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2029 QApplication::style().drawItem(p, x, y, w, h, 2028 QApplication::style().drawItem(p, x, y, w, h,
2030 AlignCenter|ShowPrefix|DontClip|SingleLine, 2029 AlignCenter|ShowPrefix|DontClip|SingleLine,
2031 g, mi->isEnabled(), NULL, mi->text(), 2030 g, mi->isEnabled(), NULL, mi->text(),
2032 -1, &g.text()); 2031 -1, &g.text());
2033 } 2032 }
2034} 2033}
2035 2034
2036void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 2035void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
2037 const QColorGroup &g, int lineWidth, 2036 const QColorGroup &g, int /*lineWidth*/,
2038 const QBrush * fill) 2037 const QBrush * /*fill*/)
2039{ 2038{
2040 QColor c; 2039 QColor c;
2041 switch(menuHandler->transType()){ 2040 switch(menuHandler->transType()){
2042 case None: 2041 case None:
2043 case StippledBg: 2042 case StippledBg:
2044 case TransStippleBg: 2043 case TransStippleBg:
2045 c = g.background(); 2044 c = g.background();
2046 break; 2045 break;
2047 case StippledBtn: 2046 case StippledBtn:
2048 case TransStippleBtn: 2047 case TransStippleBtn:
2049 c = g.button(); 2048 c = g.button();
2050 break; 2049 break;
2051 default: 2050 default:
2052 c = menuHandler->bgColor(); 2051 c = menuHandler->bgColor();
2053 } 2052 }
2054 p->setPen(c.dark(140)); 2053 p->setPen(c.dark(140));
2055 p->drawRect(x, y, w, h); 2054 p->drawRect(x, y, w, h);
2056 p->setPen(c.light(120)); 2055 p->setPen(c.light(120));
2057 p->drawRect(x+1, y+1, w-2, h-2); 2056 p->drawRect(x+1, y+1, w-2, h-2);
2058} 2057}
2059 2058
2060void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, 2059void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw,
2061 int tab, QMenuItem* mi, 2060 int tab, QMenuItem* mi,
2062 const QPalette& pal, bool act, 2061 const QPalette& pal, bool act,
2063 bool enabled, int x, int y, int w, int h) 2062 bool enabled, int x, int y, int w, int h)
2064{ 2063{
2065static const int motifItemFrame = 2; 2064static const int motifItemFrame = 2;
2066static const int motifItemHMargin = 3; 2065static const int motifItemHMargin = 3;
2067static const int motifItemVMargin = 2; 2066static const int motifItemVMargin = 2;
2068static const int motifArrowHMargin = 6; 2067static const int motifArrowHMargin = 6;
2069static const int windowsRightBorder = 12; 2068static const int windowsRightBorder = 12;
2070 2069
2071 maxpmw = QMAX( maxpmw, 20 ); 2070 maxpmw = QMAX( maxpmw, 20 );
2072 2071
2073 2072
2074 bool dis = !enabled; 2073 bool dis = !enabled;
2075 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 2074 QColorGroup itemg = dis ? pal.disabled() : pal.active();
2076 2075
2077 int checkcol = maxpmw; 2076 int checkcol = maxpmw;
2078 if(act){ 2077 if(act){
2079 2078
2080 // FIXME 2079 // FIXME
2081 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); 2080 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background());
2082 } 2081 }
2083 //else if(((QWidget*)p->device())->backgroundPixmap()){ 2082 //else if(((QWidget*)p->device())->backgroundPixmap()){
2084 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), 2083 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(),
2085 // x, y, w, h); 2084 // x, y, w, h);
2086 //} 2085 //}
2087 else{ 2086 else{
2088 if(menuHandler->transType() == None){ 2087 if(menuHandler->transType() == None){
2089 p->fillRect(x, y, w, h, pal.active().background()); 2088 p->fillRect(x, y, w, h, pal.active().background());
2090 } 2089 }
2091 else if(menuHandler->transType() == StippledBg){ 2090 else if(menuHandler->transType() == StippledBg){
2092 p->fillRect(x, y, w, h, bgBrush); 2091 p->fillRect(x, y, w, h, bgBrush);
2093 } 2092 }
2094 else if(menuHandler->transType() == StippledBtn){ 2093 else if(menuHandler->transType() == StippledBtn){
2095 p->fillRect(x, y, w, h, menuBrush); 2094 p->fillRect(x, y, w, h, menuBrush);
2096 } 2095 }
2097 else{ 2096 else{
2098 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 2097 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
2099 if(pix) 2098 if(pix)
2100 p->drawPixmap(x, y, *pix, x, y, w, h); 2099 p->drawPixmap(x, y, *pix, x, y, w, h);
2101 } 2100 }
2102 } 2101 }
2103 2102
2104 if(!mi) 2103 if(!mi)
2105 return; 2104 return;
2106 2105
2107 QColor discol; 2106 QColor discol;
2108 if (dis) { 2107 if (dis) {
2109 discol = itemg.mid(); 2108 discol = itemg.mid();
2110 p->setPen(discol); 2109 p->setPen(discol);
2111 } 2110 }
2112 2111
2113 QColorGroup cg2(itemg); 2112 QColorGroup cg2(itemg);
2114 2113
2115 if(menuHandler->transType() == Custom){ 2114 if(menuHandler->transType() == Custom){
2116 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor()); 2115 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor());
2117 cg2.setColor(QColorGroup::Text, menuHandler->textColor()); 2116 cg2.setColor(QColorGroup::Text, menuHandler->textColor());
2118 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120)); 2117 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120));
2119 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120)); 2118 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120));
2120 } 2119 }
2121 else{ 2120 else{
2122 cg2 = QColorGroup(discol, itemg.highlight(), black, black, 2121 cg2 = QColorGroup(discol, itemg.highlight(), black, black,
2123 dis ? discol : black, discol, black); 2122 dis ? discol : black, discol, black);
2124 } 2123 }
2125 2124
2126 if(mi->isSeparator()){ 2125 if(mi->isSeparator()){
2127 QColor c; 2126 QColor c;
2128 switch(menuHandler->transType()){ 2127 switch(menuHandler->transType()){
2129 case None: 2128 case None:
2130 case StippledBg: 2129 case StippledBg:
2131 case TransStippleBg: 2130 case TransStippleBg:
2132 c = QApplication::palette().active().background(); 2131 c = QApplication::palette().active().background();
2133 break; 2132 break;
2134 case StippledBtn: 2133 case StippledBtn:
2135 case TransStippleBtn: 2134 case TransStippleBtn:
2136 c = QApplication::palette().active().button(); 2135 c = QApplication::palette().active().button();
2137 break; 2136 break;
2138 default: 2137 default:
2139 c = menuHandler->bgColor(); 2138 c = menuHandler->bgColor();
2140 } 2139 }
2141 p->setPen(c.dark(140)); 2140 p->setPen(c.dark(140));
2142 p->drawLine(x, y, x+w, y ); 2141 p->drawLine(x, y, x+w, y );
2143 p->setPen(c.light(115)); 2142 p->setPen(c.light(115));
2144 p->drawLine(x, y+1, x+w, y+1 ); 2143 p->drawLine(x, y+1, x+w, y+1 );
2145 return; 2144 return;
2146 } 2145 }
2147 if(mi->iconSet()) { 2146 if(mi->iconSet()) {
2148 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; 2147 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal;
2149 if (!dis) 2148 if (!dis)
2150 mode = QIconSet::Active; 2149 mode = QIconSet::Active;
2151 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); 2150 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode);
2152 int pixw = pixmap.width(); 2151 int pixw = pixmap.width();
2153 int pixh = pixmap.height(); 2152 int pixh = pixmap.height();
2154 QRect cr(x, y, checkcol, h); 2153 QRect cr(x, y, checkcol, h);
2155 QRect pmr(0, 0, pixw, pixh); 2154 QRect pmr(0, 0, pixw, pixh);
2156 pmr.moveCenter( cr.center() ); 2155 pmr.moveCenter( cr.center() );
2157 p->setPen(itemg.highlightedText()); 2156 p->setPen(itemg.highlightedText());
2158 p->drawPixmap(pmr.topLeft(), pixmap ); 2157 p->drawPixmap(pmr.topLeft(), pixmap );
2159 2158
2160 } 2159 }
2161 else if(checkable) { 2160 else if(checkable) {
2162 int mw = checkcol + motifItemFrame; 2161 int mw = checkcol + motifItemFrame;
2163 int mh = h - 2*motifItemFrame; 2162 int mh = h - 2*motifItemFrame;
2164 if (mi->isChecked()){ 2163 if (mi->isChecked()){
2165 drawCheckMark( p, x + motifItemFrame, 2164 drawCheckMark( p, x + motifItemFrame,
2166 y+motifItemFrame, mw, mh, cg2, act, dis ); 2165 y+motifItemFrame, mw, mh, cg2, act, dis );
2167 } 2166 }
2168 } 2167 }
2169 if(menuHandler->transType() == Custom) 2168 if(menuHandler->transType() == Custom)
2170 p->setPen(menuHandler->textColor()); 2169 p->setPen(menuHandler->textColor());
2171 else 2170 else
2172 p->setPen(itemg.text()); 2171 p->setPen(itemg.text());
2173 2172
2174 2173
2175 int xm = motifItemFrame + checkcol + motifItemHMargin; 2174 int xm = motifItemFrame + checkcol + motifItemHMargin;
2176 QString s = mi->text(); 2175 QString s = mi->text();
2177 if (!s.isNull()) { 2176 if (!s.isNull()) {
2178 int t = s.find( '\t' ); 2177 int t = s.find( '\t' );
2179 int m = motifItemVMargin; 2178 int m = motifItemVMargin;
2180 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; 2179 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
2181 QPen oldPen = p->pen(); 2180 QPen oldPen = p->pen();
2182 if(menuHandler->useShadowText()){ 2181 if(menuHandler->useShadowText()){
2183 if(menuHandler->transType() == Custom) 2182 if(menuHandler->transType() == Custom)
2184 p->setPen(menuHandler->bgColor().dark(130)); 2183 p->setPen(menuHandler->bgColor().dark(130));
2185 else if(menuHandler->transType() == StippledBtn || 2184 else if(menuHandler->transType() == StippledBtn ||
2186 menuHandler->transType() == TransStippleBtn) 2185 menuHandler->transType() == TransStippleBtn)
2187 p->setPen(itemg.button().dark(130)); 2186 p->setPen(itemg.button().dark(130));
2188 else 2187 else
2189 p->setPen(bgBrush.color().dark(130)); 2188 p->setPen(bgBrush.color().dark(130));
2190 2189
2191 if (t >= 0) { 2190 if (t >= 0) {
2192 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2, 2191 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2,
2193 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 )); 2192 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 ));
2194 } 2193 }
2195 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t); 2194 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t);
2196 } 2195 }
2197 p->setPen(oldPen); 2196 p->setPen(oldPen);
2198 if (t >= 0) { 2197 if (t >= 0) {
2199 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, 2198 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1,
2200 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); 2199 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ));
2201 } 2200 }
2202 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t); 2201 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t);
2203 2202
2204 } 2203 }
2205 else if (mi->pixmap()) { 2204 else if (mi->pixmap()) {
2206 QPixmap *pixmap = mi->pixmap(); 2205 QPixmap *pixmap = mi->pixmap();
2207 if (pixmap->depth() == 1) 2206 if (pixmap->depth() == 1)
2208 p->setBackgroundMode(OpaqueMode); 2207 p->setBackgroundMode(OpaqueMode);
2209 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap); 2208 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap);
2210 if (pixmap->depth() == 1) 2209 if (pixmap->depth() == 1)
2211 p->setBackgroundMode(TransparentMode); 2210 p->setBackgroundMode(TransparentMode);
2212 } 2211 }
2213 if (mi->popup()) { 2212 if (mi->popup()) {
2214 int dim = (h-2*motifItemFrame) / 2; 2213 int dim = (h-2*motifItemFrame) / 2;
2215 drawArrow(p, RightArrow, true, 2214 drawArrow(p, RightArrow, true,
2216 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, 2215 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2,
2217 dim, dim, cg2, TRUE); 2216 dim, dim, cg2, TRUE);
2218 } 2217 }
2219} 2218}
2220 2219
2221int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, 2220int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi,
2222 const QFontMetrics &fm) 2221 const QFontMetrics &fm)
2223{ 2222{
2224 if (mi->isSeparator()) 2223 if (mi->isSeparator())
2225 return 2; 2224 return 2;
2226 2225
2227 int h = 0; 2226 int h = 0;
2228 if (mi->pixmap()) 2227 if (mi->pixmap())
2229 h = mi->pixmap()->height(); 2228 h = mi->pixmap()->height();
2230 2229
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff
index ef7300d..bcbdc8d 100644
--- a/noncore/styles/liquid/opie-liquid.diff
+++ b/noncore/styles/liquid/opie-liquid.diff
@@ -1,298 +1,298 @@
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 --- -Sun Jun 30 22:38:02 2002 6 --- -Mon Jul 1 11:38:05 2002
7 +++ liquid.hMon Jun 24 19:07:45 2002 7 +++ liquid.hMon Jun 24 19:07:45 2002
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 --- -Sun Jun 30 22:38:02 2002 105 --- -Mon Jul 1 11:38:05 2002
106 +++ liquid.cppSun Jun 30 22:37:56 2002 106 +++ liquid.cppMon Jul 1 03:45:28 2002
107@@ -10,12 +10,10 @@ 107@@ -10,12 +10,10 @@
108 108
109 #include <qmenudata.h> 109 #include <qmenudata.h>
110 #include "liquid.h" 110 #include "liquid.h"
111-#include <kapp.h> 111-#include <kapp.h>
112-#include <kglobal.h> 112-#include <kglobal.h>
113-#include <kconfig.h> 113-#include <kconfig.h>
114-#include <kdrawutil.h> 114-#include <kdrawutil.h>
115-#include <kglobalsettings.h> 115-#include <kglobalsettings.h>
116-#include <kpixmapeffect.h> 116-#include <kpixmapeffect.h>
117+#include "liquiddeco.h" 117+#include "liquiddeco.h"
118+#include <qapplication.h> 118+#include <qapplication.h>
119+#include <qpe/config.h> 119+#include <qpe/config.h>
120+#include "effects.h" 120+#include "effects.h"
121 #include <qpalette.h> 121 #include <qpalette.h>
122 #include <qbitmap.h> 122 #include <qbitmap.h>
123 #include <qtabbar.h> 123 #include <qtabbar.h>
124@@ -25,28 +23,29 @@ 124@@ -25,28 +23,29 @@
125 #include <qtimer.h> 125 #include <qtimer.h>
126 #include <qpixmapcache.h> 126 #include <qpixmapcache.h>
127 #include <qradiobutton.h> 127 #include <qradiobutton.h>
128-#include <kimageeffect.h> 128-#include <kimageeffect.h>
129-#include <ktoolbar.h> 129-#include <ktoolbar.h>
130+#include <qcombobox.h> 130+#include <qcombobox.h>
131 #include <qdrawutil.h> 131 #include <qdrawutil.h>
132 #include <qwidgetlist.h> 132 #include <qwidgetlist.h>
133 #include <qtoolbutton.h> 133 #include <qtoolbutton.h>
134 #include <qheader.h> 134 #include <qheader.h>
135 #include <unistd.h> 135 #include <unistd.h>
136-#include <klocale.h> 136-#include <klocale.h>
137-#include <kiconloader.h> 137-#include <kiconloader.h>
138-#include <kmenubar.h> 138-#include <kmenubar.h>
139-#include <kipc.h> 139-#include <kipc.h>
140+#include <qmenubar.h> 140+#include <qmenubar.h>
141 141
142-#include <X11/X.h> 142-#include <X11/X.h>
143-#include <X11/Xlib.h> 143-#include <X11/Xlib.h>
144+ 144+
145+#include <stdio.h> 145+#include <stdio.h>
146 146
147 #include "htmlmasks.h" 147 #include "htmlmasks.h"
148 #include "embeddata.h" 148 #include "embeddata.h"
149 149
150-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) 150-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color)
151+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 151+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
152+ QColorGroup &, bool, bool); 152+ QColorGroup &, bool, bool);
153+ 153+
154+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 154+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
155+ 155+
156+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 156+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
157 { 157 {
158 QImage img(pix.convertToImage()); 158 QImage img(pix.convertToImage());
159- KImageEffect::fade(img, 0.9, color); 159- KImageEffect::fade(img, 0.9, color);
160+ QImageEffect::fade(img, 0.9, color); 160+ QImageEffect::fade(img, 0.9, color);
161 int x, y; 161 int x, y;
162 int r, g, b; 162 int r, g, b;
163 for(y=0; y < img.height(); y+=3){ 163 for(y=0; y < img.height(); y+=3){
164@@ -71,35 +70,37 @@ 164@@ -71,35 +70,37 @@
165 : QObject(parent) 165 : QObject(parent)
166 { 166 {
167 pixDict.setAutoDelete(true); 167 pixDict.setAutoDelete(true);
168- connect(kapp, SIGNAL(kipcMessage(int, int)), this, 168- connect(kapp, SIGNAL(kipcMessage(int, int)), this,
169- SLOT(slotKIPCMessage(int, int))); 169- SLOT(slotKIPCMessage(int, int)));
170 reloadSettings(); 170 reloadSettings();
171 } 171 }
172 172
173 void TransMenuHandler::reloadSettings() 173 void TransMenuHandler::reloadSettings()
174 { 174 {
175 pixDict.clear(); 175 pixDict.clear();
176- KConfig *config = KGlobal::config(); 176- KConfig *config = KGlobal::config();
177- config->setGroup("MosfetMenus"); 177- config->setGroup("MosfetMenus");
178 178
179- type = config->readNumEntry("Type", TransStippleBg); 179- type = config->readNumEntry("Type", TransStippleBg);
180- color = config->readColorEntry("Color", 180- color = config->readColorEntry("Color",
181- &QApplication::palette().active().button()); 181- &QApplication::palette().active().button());
182- fgColor = config->readColorEntry("TextColor", 182- fgColor = config->readColorEntry("TextColor",
183- &QApplication::palette().active().text()); 183- &QApplication::palette().active().text());
184- opacity = config->readNumEntry("Opacity", 10); 184- opacity = config->readNumEntry("Opacity", 10);
185- shadowText = config->readBoolEntry("ShadowText", true); 185- shadowText = config->readBoolEntry("ShadowText", true);
186+ Config config ( "qpe" ); 186+ Config config ( "qpe" );
187+ config. setGroup ( "MosfetMenus" ); 187+ config. setGroup ( "MosfetMenus" );
188+ 188+
189+ type = config. readNumEntry("Type", TransStippleBg); 189+ type = config. readNumEntry("Type", TransStippleBg);
190+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 190+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
191+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 191+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
192+ opacity = config. readNumEntry("Opacity", 10); 192+ opacity = config. readNumEntry("Opacity", 10);
193+ if ( opacity < -20 ) 193+ if ( opacity < -20 )
194 + opacity = 20; 194 + opacity = 20;
195+ else if ( opacity > 20 ) 195+ else if ( opacity > 20 )
196 + opacity = 20; 196 + opacity = 20;
197+ 197+
198+ shadowText = config. readBoolEntry("ShadowText", true); 198+ shadowText = config. readBoolEntry("ShadowText", true);
199 } 199 }
200 200
201 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 201 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
202 { 202 {
203- QPopupMenu *p = (QPopupMenu *)obj; 203- QPopupMenu *p = (QPopupMenu *)obj;
204+ QWidget *p = (QWidget *)obj; 204+ QWidget *p = (QWidget *)obj;
205 205
206 if(ev->type() == QEvent::Show){ 206 if(ev->type() == QEvent::Show){
207 if(type == TransStippleBg || type == TransStippleBtn || 207 if(type == TransStippleBg || type == TransStippleBtn ||
208 type == Custom){ 208 type == Custom){
209 QApplication::syncX(); 209 QApplication::syncX();
210- KPixmap *pix = new KPixmap; 210- KPixmap *pix = new KPixmap;
211+ QPixmap *pix = new QPixmap; 211+ QPixmap *pix = new QPixmap;
212 if(p->testWFlags(Qt::WType_Popup)){ 212 if(p->testWFlags(Qt::WType_Popup)){
213 QRect r(p->x(), p->y(), p->width(), p->height()); 213 QRect r(p->x(), p->y(), p->width(), p->height());
214 QRect deskR = QApplication::desktop()->rect(); 214 QRect deskR = QApplication::desktop()->rect();
215@@ -107,7 +108,7 @@ 215@@ -107,7 +108,7 @@
216 r.setBottom(deskR.bottom()); 216 r.setBottom(deskR.bottom());
217 r.setRight(deskR.right()); 217 r.setRight(deskR.right());
218 } 218 }
219- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), 219- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(),
220+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 220+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
221 r.width(), r.height()); 221 r.width(), r.height());
222 } 222 }
223 else{ // tear off menu 223 else{ // tear off menu
224@@ -121,82 +122,54 @@ 224@@ -121,82 +122,54 @@
225 stripePixmap(*pix, p->colorGroup().button()); 225 stripePixmap(*pix, p->colorGroup().button());
226 } 226 }
227 else{ 227 else{
228- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 228- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
229+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 229+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
230 } 230 }
231+ 231+
232+ if (p->inherits("QPopupMenu")) 232+ if (p->inherits("QPopupMenu"))
233 pixDict.insert(p->winId(), pix); 233 pixDict.insert(p->winId(), pix);
234+ else { 234+ else {
235 + p->setBackgroundPixmap(*pix); 235 + p->setBackgroundPixmap(*pix);
236 + 236 +
237 + QObjectList *ol = p-> queryList("QWidget"); 237 + QObjectList *ol = p-> queryList("QWidget");
238 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 238 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
239 + QWidget *wid = (QWidget *) it.current ( ); 239 + QWidget *wid = (QWidget *) it.current ( );
240 + 240 +
241 + wid-> setBackgroundPixmap(*pix); 241 + wid-> setBackgroundPixmap(*pix);
242 + wid-> setBackgroundOrigin(QWidget::ParentOrigin); 242 + wid-> setBackgroundOrigin(QWidget::ParentOrigin);
243+ } 243+ }
244 + delete ol; 244 + delete ol;
245 + } 245 + }
246 } 246 }
247 } 247 }
248 else if(ev->type() == QEvent::Hide){ 248 else if(ev->type() == QEvent::Hide){
249 if(type == TransStippleBg || type == TransStippleBtn || 249 if(type == TransStippleBg || type == TransStippleBtn ||
250 type == Custom){ 250 type == Custom){
251- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 251- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
252- pixDict.remove(p->winId()); 252- pixDict.remove(p->winId());
253- } 253- }
254- } 254- }
255- return(false); 255- return(false);
256-} 256-}
257+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 257+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
258 258
259-void TransMenuHandler::slotKIPCMessage(int id, int) 259-void TransMenuHandler::slotKIPCMessage(int id, int)
260-{ 260-{
261- if(id == LIQUID_MENU_CHANGE){ 261- if(id == LIQUID_MENU_CHANGE){
262- bool oldShadow = shadowText; 262- bool oldShadow = shadowText;
263- 263-
264- KConfig *config = KGlobal::config(); 264- KConfig *config = KGlobal::config();
265- config->reparseConfiguration(); // in case KControl changed values 265- config->reparseConfiguration(); // in case KControl changed values
266- 266-
267- // Make sure no popupmenus are shown. There shouldn't be any because 267- // Make sure no popupmenus are shown. There shouldn't be any because
268- // the user just clicked "Apply", but there can be tear offs ;-) 268- // the user just clicked "Apply", but there can be tear offs ;-)
269- // We just close them so the pixmaps are deleted and regenerated. 269- // We just close them so the pixmaps are deleted and regenerated.
270- QWidgetList *list = QApplication::topLevelWidgets(); 270- QWidgetList *list = QApplication::topLevelWidgets();
271- QWidgetListIt it( *list ); 271- QWidgetListIt it( *list );
272- QWidget *w; 272- QWidget *w;
273- while ((w=it.current()) != 0 ){ 273- while ((w=it.current()) != 0 ){
274- ++it; 274- ++it;
275- if(w->inherits("QPopupMenu")){ 275- if(w->inherits("QPopupMenu")){
276- w->close(); 276- w->close();
277- } 277- }
278- } 278- }
279+ if (p->inherits("QPopupMenu")) 279+ if (p->inherits("QPopupMenu"))
280+ pixDict.remove(p->winId()); 280+ pixDict.remove(p->winId());
281+ else { 281+ else {
282 + p->setBackgroundMode(QWidget::PaletteBackground); 282 + p->setBackgroundMode(QWidget::PaletteBackground);
283 283
284- reloadSettings(); 284- reloadSettings();
285 + QObjectList *ol = p-> queryList("QWidget"); 285 + QObjectList *ol = p-> queryList("QWidget");
286 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 286 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
287 + QWidget *wid = (QWidget *) it.current ( ); 287 + QWidget *wid = (QWidget *) it.current ( );
288 288
289- // Now repaint menubar if needed 289- // Now repaint menubar if needed
290- if(shadowText != oldShadow){ 290- if(shadowText != oldShadow){
291- it.toFirst(); 291- it.toFirst();
292- while ((w=it.current()) != 0 ){ 292- while ((w=it.current()) != 0 ){
293- ++it; 293- ++it;
294- if(w->inherits("QMenuBar")){ 294- if(w->inherits("QMenuBar")){
295- w->repaint(); 295- w->repaint();
296- } 296- }
297- } 297- }
298- } 298- }
@@ -463,705 +463,771 @@ Features:
463 463
464 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 464 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
465 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 465 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
466@@ -942,11 +886,12 @@ 466@@ -942,11 +886,12 @@
467 w->setMouseTracking(true); 467 w->setMouseTracking(true);
468 w->installEventFilter(this); 468 w->installEventFilter(this);
469 } 469 }
470+ if(w-> inherits("QToolButton")) { 470+ if(w-> inherits("QToolButton")) {
471 + ((QToolButton*)w)->setAutoRaise (false); 471 + ((QToolButton*)w)->setAutoRaise (false);
472+ } 472+ }
473 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 473 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
474 return; 474 return;
475 } 475 }
476- if(w->inherits("PanelButtonBase")) 476- if(w->inherits("PanelButtonBase"))
477- return; 477- return;
478 478
479 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 479 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
480 palette().active().brush(QColorGroup::Background).pixmap()){ 480 palette().active().brush(QColorGroup::Background).pixmap()){
481@@ -954,17 +899,18 @@ 481@@ -954,17 +899,18 @@
482 return; 482 return;
483 } 483 }
484 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 484 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
485- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ 485- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){
486 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 486 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
487 if(w->backgroundMode() == QWidget::PaletteBackground || 487 if(w->backgroundMode() == QWidget::PaletteBackground ||
488 w->backgroundMode() == QWidget::PaletteButton){ 488 w->backgroundMode() == QWidget::PaletteButton){
489 w->setBackgroundMode(QWidget::X11ParentRelative); 489 w->setBackgroundMode(QWidget::X11ParentRelative);
490 } 490 }
491 } 491 }
492- if(w->inherits("KToolBar")){ 492- if(w->inherits("KToolBar")){
493+ if(w->inherits("QToolBar")){ 493+ if(w->inherits("QToolBar")){
494 w->installEventFilter(this); 494 w->installEventFilter(this);
495- //w->setBackgroundMode(QWidget::NoBackground); 495- //w->setBackgroundMode(QWidget::NoBackground);
496+ w->setBackgroundMode(QWidget::PaletteBackground); 496+ w->setBackgroundMode(QWidget::PaletteBackground);
497 return; 497 return;
498 } 498 }
499+ 499+
500 } 500 }
501 501
502 void LiquidStyle::unPolish(QWidget *w) 502 void LiquidStyle::unPolish(QWidget *w)
503@@ -977,6 +923,9 @@ 503@@ -977,6 +923,9 @@
504 504
505 if(w->inherits("QPopupMenu")) 505 if(w->inherits("QPopupMenu"))
506 w->setBackgroundMode(QWidget::PaletteButton); 506 w->setBackgroundMode(QWidget::PaletteButton);
507+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 507+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
508 + w->removeEventFilter(menuHandler); 508 + w->removeEventFilter(menuHandler);
509+ } 509+ }
510 510
511 if(w->isTopLevel()) 511 if(w->isTopLevel())
512 return; 512 return;
513@@ -1001,12 +950,14 @@ 513@@ -1001,12 +950,14 @@
514 unapplyCustomAttributes((QPushButton *)w); 514 unapplyCustomAttributes((QPushButton *)w);
515 w->removeEventFilter(this); 515 w->removeEventFilter(this);
516 } 516 }
517- 517-
518+/* 518+/*
519+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 519+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
520 + w-> setBackgroundMode ( PaletteBackground ); 520 + w-> setBackgroundMode ( PaletteBackground );
521+ } 521+ }
522+*/ 522+*/
523 if(w->inherits("QComboBox") || 523 if(w->inherits("QComboBox") ||
524 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 524 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
525- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 525- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
526- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 526- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
527- w->inherits("TaskContainer")){ 527- w->inherits("TaskContainer")){
528+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 528+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
529 w->removeEventFilter(this); 529 w->removeEventFilter(this);
530 } 530 }
531 if(w->inherits("QButton") || w->inherits("QComboBox")){ 531 if(w->inherits("QButton") || w->inherits("QComboBox")){
532@@ -1014,9 +965,9 @@ 532@@ -1014,9 +965,9 @@
533 w->setAutoMask(false); 533 w->setAutoMask(false);
534 } 534 }
535 } 535 }
536- if(w->inherits("KToolBar")){ 536- if(w->inherits("KToolBar")){
537+ if(w->inherits("QToolBar")){ 537+ if(w->inherits("QToolBar")){
538 w->removeEventFilter(this); 538 w->removeEventFilter(this);
539- //w->setBackgroundMode(QWidget::PaletteBackground); 539- //w->setBackgroundMode(QWidget::PaletteBackground);
540+ w->setBackgroundMode(QWidget::PaletteBackground); 540+ w->setBackgroundMode(QWidget::PaletteBackground);
541 return; 541 return;
542 } 542 }
543 if(w->inherits("QHeader")){ 543 if(w->inherits("QHeader")){
544@@ -1028,20 +979,28 @@ 544@@ -1028,20 +979,28 @@
545 void LiquidStyle::polish(QApplication *app) 545 void LiquidStyle::polish(QApplication *app)
546 { 546 {
547 547
548- KStyle::polish(app); 548- KStyle::polish(app);
549+ QWindowsStyle::polish(app); 549+ QWindowsStyle::polish(app);
550 menuAni = app->isEffectEnabled(UI_AnimateMenu); 550 menuAni = app->isEffectEnabled(UI_AnimateMenu);
551 menuFade = app->isEffectEnabled(UI_FadeMenu); 551 menuFade = app->isEffectEnabled(UI_FadeMenu);
552 if(menuAni) 552 if(menuAni)
553 app->setEffectEnabled(UI_AnimateMenu, false); 553 app->setEffectEnabled(UI_AnimateMenu, false);
554 if(menuFade) 554 if(menuFade)
555 app->setEffectEnabled(UI_FadeMenu, false); 555 app->setEffectEnabled(UI_FadeMenu, false);
556 + 556 +
557+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 557+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
558+ 558+
559+ QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 559+ QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
560 } 560 }
561 561
562 void LiquidStyle::unPolish(QApplication *app) 562 void LiquidStyle::unPolish(QApplication *app)
563 { 563 {
564- KStyle::unPolish(app); 564- KStyle::unPolish(app);
565+ QWindowsStyle::unPolish(app); 565+ QWindowsStyle::unPolish(app);
566 app->setEffectEnabled(UI_AnimateMenu, menuAni); 566 app->setEffectEnabled(UI_AnimateMenu, menuAni);
567 app->setEffectEnabled(UI_FadeMenu, menuFade); 567 app->setEffectEnabled(UI_FadeMenu, menuFade);
568+ 568+
569+ qt_set_draw_menu_bar_impl ( 0 ); 569+ qt_set_draw_menu_bar_impl ( 0 );
570+ 570+
571+ QApplication::qwsSetDecoration ( new QPEDecoration ( )); 571+ QApplication::qwsSetDecoration ( new QPEDecoration ( ));
572 } 572 }
573 573
574 /* 574 /*
575@@ -1063,7 +1022,7 @@ 575@@ -1063,7 +1022,7 @@
576 */ 576 */
577 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 577 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
578 { 578 {
579- if(obj->inherits("KToolBar")){ 579- if(obj->inherits("KToolBar")){
580+ if(obj->inherits("QToolBar")){ 580+ if(obj->inherits("QToolBar")){
581 if(ev->type() == QEvent::Resize){ 581 if(ev->type() == QEvent::Resize){
582 const QObjectList *tbChildList = obj->children(); 582 const QObjectList *tbChildList = obj->children();
583 QObjectListIt it(*tbChildList); 583 QObjectListIt it(*tbChildList);
584@@ -1076,35 +1035,7 @@ 584@@ -1076,35 +1035,7 @@
585 585
586 } 586 }
587 } 587 }
588- else if(obj->inherits("KMiniPagerButton")){ 588- else if(obj->inherits("KMiniPagerButton")){
589- QButton *btn = (QButton *)obj; 589- QButton *btn = (QButton *)obj;
590- if(ev->type() == QEvent::Paint){ 590- if(ev->type() == QEvent::Paint){
591- if(!(btn->isOn() || btn->isDown())){ 591- if(!(btn->isOn() || btn->isDown())){
592- QPalette pal = btn->palette(); 592- QPalette pal = btn->palette();
593- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? 593- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ?
594- pagerHoverBrush : pagerBrush); 594- pagerHoverBrush : pagerBrush);
595- btn->setPalette(pal); 595- btn->setPalette(pal);
596- } 596- }
597- else{ 597- else{
598- QPalette pal = btn->palette(); 598- QPalette pal = btn->palette();
599- pal.setBrush(QColorGroup::Dark, 599- pal.setBrush(QColorGroup::Dark,
600- QApplication::palette().active().brush(QColorGroup::Dark)); 600- QApplication::palette().active().brush(QColorGroup::Dark));
601- btn->setPalette(pal); 601- btn->setPalette(pal);
602- 602-
603- } 603- }
604- } 604- }
605- else if(ev->type() == QEvent::Enter){ 605- else if(ev->type() == QEvent::Enter){
606- highlightWidget = btn; 606- highlightWidget = btn;
607- btn->repaint(false); 607- btn->repaint(false);
608- } 608- }
609- else if(ev->type() == QEvent::Leave){ 609- else if(ev->type() == QEvent::Leave){
610- highlightWidget = NULL; 610- highlightWidget = NULL;
611- btn->repaint(false); 611- btn->repaint(false);
612- } 612- }
613- 613-
614- } 614- }
615- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || 615- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") ||
616- obj->isA("AppletHandle")){ 616- obj->isA("AppletHandle")){
617+ else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 617+ else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
618 QWidget *btn = (QWidget *)obj; 618 QWidget *btn = (QWidget *)obj;
619 if(ev->type() == QEvent::Enter){ 619 if(ev->type() == QEvent::Enter){
620 if(btn->isEnabled()){ 620 if(btn->isEnabled()){
621@@ -1119,20 +1050,7 @@ 621@@ -1119,20 +1050,7 @@
622 } 622 }
623 } 623 }
624 } 624 }
625- else if(obj->inherits("TaskContainer")){ 625- else if(obj->inherits("TaskContainer")){
626- QButton *btn = (QButton *)obj; 626- QButton *btn = (QButton *)obj;
627- QPalette pal = btn->palette(); 627- QPalette pal = btn->palette();
628- if(ev->type() == QEvent::Enter){ 628- if(ev->type() == QEvent::Enter){
629- pal.setColor(QColorGroup::Background, pal.active().button().light(110)); 629- pal.setColor(QColorGroup::Background, pal.active().button().light(110));
630- btn->setPalette(pal); 630- btn->setPalette(pal);
631- } 631- }
632- else if(ev->type() == QEvent::Leave){ 632- else if(ev->type() == QEvent::Leave){
633- pal.setColor(QColorGroup::Background, 633- pal.setColor(QColorGroup::Background,
634- QApplication::palette().active().background()); 634- QApplication::palette().active().background());
635- btn->setPalette(pal); 635- btn->setPalette(pal);
636- } 636- }
637- } 637- }
638- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ 638- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){
639+ else if(obj->inherits("QToolButton")){ 639+ else if(obj->inherits("QToolButton")){
640 QToolButton *btn = (QToolButton *)btn; 640 QToolButton *btn = (QToolButton *)btn;
641 if(!btn->autoRaise()){ 641 if(!btn->autoRaise()){
642 if(btn->isEnabled()){ 642 if(btn->isEnabled()){
643@@ -1340,11 +1258,6 @@ 643@@ -1340,11 +1258,6 @@
644 QColorGroup g = btn->colorGroup(); 644 QColorGroup g = btn->colorGroup();
645 645
646 646
647- QColor testColor; 647- QColor testColor;
648- if(btn->parent() && btn->parent()->isWidgetType()){ 648- if(btn->parent() && btn->parent()->isWidgetType()){
649- testColor = p->backgroundColor(); // remove me 649- testColor = p->backgroundColor(); // remove me
650- } 650- }
651- 651-
652 //int dw = buttonDefaultIndicatorWidth(); 652 //int dw = buttonDefaultIndicatorWidth();
653 if(btn->hasFocus() || btn->isDefault()){ 653 if(btn->hasFocus() || btn->isDefault()){
654 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 654 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
655@@ -2065,203 +1978,24 @@ 655@@ -1914,8 +1827,8 @@
656 return(QSize(16, 16));
657 }
658
659-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w,
660- int h, const QColorGroup &g, bool on,
661+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
662+ int /*h*/, const QColorGroup &/*g*/, bool on,
663 bool down, bool)
664 {
665 bool isHover = highlightWidget == p->device();
666@@ -1957,8 +1870,8 @@
667 return(QSize(20, 22));
668 }
669
670-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h,
671- const QColorGroup &g, int state, bool down, bool)
672+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
673+ const QColorGroup &/*g*/, int state, bool /*down*/, bool)
674 {
675 bool isHover = highlightWidget == p->device();
676 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
677@@ -1996,8 +1909,8 @@
678 }
679 }
680
681-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h,
682- int state)
683+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
684+ int /*state*/)
685 {
686 // needed for some reason by KHtml, even tho it's all filled ;P
687 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
688@@ -2005,18 +1918,17 @@
689 }
690
691 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
692- const QColorGroup &g, Orientation orient,
693+ const QColorGroup &/*g*/, Orientation orient,
694 bool, bool)
695 {
696 QWidget *parent = (QWidget *)p->device();
697 p->setBrushOrigin(parent->pos());
698- p->fillRect(x, y, w, h,
699- QApplication::palette().active().brush(QColorGroup::Background));
700+ parent->erase(x, y, w, h);
701 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
702 *getPixmap(VSlider));
703 }
704
705-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h,
706+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
707 Orientation orient, bool, bool)
708 {
709 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
710@@ -2065,203 +1977,24 @@
656 p->drawLineSegments(a); 711 p->drawLineSegments(a);
657 } 712 }
658 713
659-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, 714-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h,
660- const QColorGroup &g, KToolBarPos, 715- const QColorGroup &g, KToolBarPos,
661- QBrush *) 716- QBrush *)
662-{ 717-{
663- p->setPen(g.button().dark(120)); 718- p->setPen(g.button().dark(120));
664- int x2 = x+w-1; 719- int x2 = x+w-1;
665- int y2 = y+h-1; 720- int y2 = y+h-1;
666- p->drawLine(x+1, y, x2-1, y); 721- p->drawLine(x+1, y, x2-1, y);
667- p->drawLine(x+1, y2, x2-1, y2); 722- p->drawLine(x+1, y2, x2-1, y2);
668- p->drawLine(x, y+1, x, y2-1); 723- p->drawLine(x, y+1, x, y2-1);
669- p->drawLine(x2, y+1, x2, y2-1); 724- p->drawLine(x2, y+1, x2, y2-1);
670- 725-
671- p->setPen(g.background()); 726- p->setPen(g.background());
672- p->drawPoint(x, y); 727- p->drawPoint(x, y);
673- p->drawPoint(x2, y); 728- p->drawPoint(x2, y);
674- p->drawPoint(x, y2); 729- p->drawPoint(x, y2);
675- p->drawPoint(x2, y2); 730- p->drawPoint(x2, y2);
676- 731-
677- 732-
678- 733-
679- // p->drawRect(x, y, w, h); 734- // p->drawRect(x, y, w, h);
680- QPixmap *pix = bevelFillDict.find(g.button().rgb()); 735- QPixmap *pix = bevelFillDict.find(g.button().rgb());
681- if(!pix){ 736- if(!pix){
682- int h, s, v; 737- int h, s, v;
683- g.button().hsv(&h, &s, &v); 738- g.button().hsv(&h, &s, &v);
684- pix = new QPixmap(*bevelFillPix); 739- pix = new QPixmap(*bevelFillPix);
685- adjustHSV(*pix, h, s, v); 740- adjustHSV(*pix, h, s, v);
686- bevelFillDict.insert(g.button().rgb(), pix); 741- bevelFillDict.insert(g.button().rgb(), pix);
687- } 742- }
688- 743-
689- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); 744- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix);
690-} 745-}
691- 746-
692-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, 747-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h,
693- const QColorGroup &g, bool mac, QBrush *) 748- const QColorGroup &g, bool mac, QBrush *)
694-{ 749-{
695- if(p->device() && p->device()->devType() == QInternal::Widget && 750- if(p->device() && p->device()->devType() == QInternal::Widget &&
696- ((KMenuBar *)p->device())->isTopLevelMenu()){ 751- ((KMenuBar *)p->device())->isTopLevelMenu()){
697- p->setPen(Qt::black); 752- p->setPen(Qt::black);
698- p->drawRect(x, y, w, h); 753- p->drawRect(x, y, w, h);
699- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); 754- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix);
700- // left 755- // left
701- p->drawLine(x+1, y+1, x+1, y+5); 756- p->drawLine(x+1, y+1, x+1, y+5);
702- p->drawLine(x+2, y+1, x+2, y+3); 757- p->drawLine(x+2, y+1, x+2, y+3);
703- p->drawLine(x+3, y+1, x+3, y+2); 758- p->drawLine(x+3, y+1, x+3, y+2);
704- p->drawLine(x+4, y+1, x+6, y+1); 759- p->drawLine(x+4, y+1, x+6, y+1);
705- // right 760- // right
706- int x2 = x+w-1; 761- int x2 = x+w-1;
707- p->drawLine(x2-1, y+1, x2-1, y+5); 762- p->drawLine(x2-1, y+1, x2-1, y+5);
708- p->drawLine(x2-2, y+1, x2-2, y+3); 763- p->drawLine(x2-2, y+1, x2-2, y+3);
709- p->drawLine(x2-3, y+1, x2-3, y+2); 764- p->drawLine(x2-3, y+1, x2-3, y+2);
710- p->drawLine(x2-4, y+1, x2-6, y+1); 765- p->drawLine(x2-4, y+1, x2-6, y+1);
711- } 766- }
712- else{ 767- else{
713- qDrawShadePanel(p, x, y, w, h, g, false, 1, 768- qDrawShadePanel(p, x, y, w, h, g, false, 1,
714- &g.brush(QColorGroup::Background)); 769- &g.brush(QColorGroup::Background));
715- } 770- }
716- 771-
717-} 772-}
718 773
719-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, 774-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h,
720- const QColorGroup &g, KToolBarPos, QBrush *) 775- const QColorGroup &g, KToolBarPos, QBrush *)
721+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 776+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
722+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) 777+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
723 { 778 {
724- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 779- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
725-} 780-}
726+ x -= 2; // Bug in Qt/E 781+ x -= 2; // Bug in Qt/E
727+ y -= 2; 782+ y -= 2;
728+ w += 2; 783+ w += 2;
729+ h += 2; 784+ h += 2;
730 785
731-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 786-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
732- const QColorGroup &g, bool sunken, 787- const QColorGroup &g, bool sunken,
733- bool raised, bool enabled, bool popup, 788- bool raised, bool enabled, bool popup,
734- KToolButtonType icontext, 789- KToolButtonType icontext,
735- const QString& btext, const QPixmap *pixmap, 790- const QString& btext, const QPixmap *pixmap,
736- QFont *font, QWidget *btn) 791- QFont *font, QWidget *btn)
737-{ 792-{
738- int dx, dy; 793- int dx, dy;
739- 794-
740- QFontMetrics fm(*font); 795- QFontMetrics fm(*font);
741- 796-
742- QToolBar* toolbar = 0; 797- QToolBar* toolbar = 0;
743- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) 798- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar"))
744- toolbar = static_cast<QToolBar*>(btn->parent()); 799- toolbar = static_cast<QToolBar*>(btn->parent());
745- 800-
746- --w, --h; 801- --w, --h;
747- if(sunken) 802- if(sunken)
748- ++x, ++y; 803- ++x, ++y;
749- 804-
750- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : 805- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) :
751- g.background()); 806- g.background());
752- drawClearBevel(p, x, y, w, h, btnColor, g.background()); 807- drawClearBevel(p, x, y, w, h, btnColor, g.background());
753- 808-
754- p->setPen(g.text()); 809- p->setPen(g.text());
755- 810-
756- if (icontext == Icon){ // icon only 811- if (icontext == Icon){ // icon only
757- if (pixmap){ 812- if (pixmap){
758- dx = ( w - pixmap->width() ) / 2; 813- dx = ( w - pixmap->width() ) / 2;
759- dy = ( h - pixmap->height() ) / 2; 814- dy = ( h - pixmap->height() ) / 2;
760- if ( sunken ) 815- if ( sunken )
761- { 816- {
762- ++dx; 817- ++dx;
763- ++dy; 818- ++dy;
764- } 819- }
765- p->drawPixmap( x+dx, y+dy, *pixmap ); 820- p->drawPixmap( x+dx, y+dy, *pixmap );
766- } 821- }
767- } 822- }
768- else if (icontext == IconTextRight){ // icon and text (if any) 823- else if (icontext == IconTextRight){ // icon and text (if any)
769- if (pixmap){ 824- if (pixmap){
770- dx = 4; 825- dx = 4;
771- dy = ( h - pixmap->height() ) / 2; 826- dy = ( h - pixmap->height() ) / 2;
772- if ( sunken ){ 827- if ( sunken ){
773- ++dx; 828- ++dx;
774- ++dy; 829- ++dy;
775- } 830- }
776- p->drawPixmap( x+dx, y+dy, *pixmap ); 831- p->drawPixmap( x+dx, y+dy, *pixmap );
777- } 832- }
778- if (!btext.isNull()){ 833- if (!btext.isNull()){
779- int tf = AlignVCenter|AlignLeft; 834- int tf = AlignVCenter|AlignLeft;
780- if (pixmap) 835- if (pixmap)
781- dx= 4 + pixmap->width() + 2; 836- dx= 4 + pixmap->width() + 2;
782- else 837- else
783- dx= 4; 838- dx= 4;
784- dy = 0; 839- dy = 0;
785- if ( sunken ){ 840- if ( sunken ){
786- ++dx; 841- ++dx;
787- ++dy; 842- ++dy;
788- } 843- }
789- if (font) 844- if (font)
790- p->setFont(*font); 845- p->setFont(*font);
791- if(raised) 846- if(raised)
792- p->setPen(KGlobalSettings::toolBarHighlightColor()); 847- p->setPen(KGlobalSettings::toolBarHighlightColor());
793- p->drawText(x+dx, y+dy, w-dx, h, tf, btext); 848- p->drawText(x+dx, y+dy, w-dx, h, tf, btext);
794- } 849- }
795- } 850- }
796- else if (icontext == Text){ // only text, even if there is a icon 851- else if (icontext == Text){ // only text, even if there is a icon
797- if (!btext.isNull()){ 852- if (!btext.isNull()){
798- int tf = AlignVCenter|AlignLeft; 853- int tf = AlignVCenter|AlignLeft;
799- if (!enabled) 854- if (!enabled)
800- p->setPen(g.dark()); 855- p->setPen(g.dark());
801- dx= (w - fm.width(btext)) / 2; 856- dx= (w - fm.width(btext)) / 2;
802- dy= (h - fm.lineSpacing()) / 2; 857- dy= (h - fm.lineSpacing()) / 2;
803- if ( sunken ){ 858- if ( sunken ){
804- ++dx; 859- ++dx;
805- ++dy; 860- ++dy;
806- } 861- }
807- if (font) 862- if (font)
808- p->setFont(*font); 863- p->setFont(*font);
809- if(raised) 864- if(raised)
810- p->setPen(KGlobalSettings::toolBarHighlightColor()); 865- p->setPen(KGlobalSettings::toolBarHighlightColor());
811- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); 866- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext);
812- } 867- }
813- } 868- }
814- else if (icontext == IconTextBottom){ 869- else if (icontext == IconTextBottom){
815- if (pixmap){ 870- if (pixmap){
816- dx = (w - pixmap->width()) / 2; 871- dx = (w - pixmap->width()) / 2;
817- dy = (h - fm.lineSpacing() - pixmap->height()) / 2; 872- dy = (h - fm.lineSpacing() - pixmap->height()) / 2;
818- if ( sunken ){ 873- if ( sunken ){
819- ++dx; 874- ++dx;
820- ++dy; 875- ++dy;
821- } 876- }
822- p->drawPixmap( x+dx, y+dy, *pixmap ); 877- p->drawPixmap( x+dx, y+dy, *pixmap );
823- } 878- }
824- if (!btext.isNull()){ 879- if (!btext.isNull()){
825- int tf = AlignBottom|AlignHCenter; 880- int tf = AlignBottom|AlignHCenter;
826- dy= pixmap->height(); 881- dy= pixmap->height();
827- dx = 2; 882- dx = 2;
828- if ( sunken ){ 883- if ( sunken ){
829- ++dx; 884- ++dx;
830- ++dy; 885- ++dy;
831- } 886- }
832- if (font) 887- if (font)
833- p->setFont(*font); 888- p->setFont(*font);
834- if(raised) 889- if(raised)
835- p->setPen(KGlobalSettings::toolBarHighlightColor()); 890- p->setPen(KGlobalSettings::toolBarHighlightColor());
836- p->drawText(x, y, w, h-3, tf, btext); 891- p->drawText(x, y, w, h-3, tf, btext);
837- } 892- }
838- } 893- }
839- if (popup){ 894- if (popup){
840- if (enabled) 895- if (enabled)
841- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, 896- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0,
842- g, true); 897- g, true);
843- else 898- else
844- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 899- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5,
845- 0, 0, g, false); 900- 0, 0, g, false);
846- } 901- }
847-} 902-}
848+ p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); 903+ p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background));
849 904
850- 905-
851-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, 906-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h,
852- const QColorGroup &g, bool active, QMenuItem *mi, 907- const QColorGroup &g, bool active, QMenuItem *mi,
853- QBrush *) 908- QBrush *)
854-{ 909-{
855- if ( p->font() == KGlobalSettings::generalFont() ) 910- if ( p->font() == KGlobalSettings::generalFont() )
856- p->setFont( KGlobalSettings::menuFont() ); 911- p->setFont( KGlobalSettings::menuFont() );
857+ w -= 2; 912+ w -= 2;
858 913
859 if(menuHandler->useShadowText()){ 914 if(menuHandler->useShadowText()){
860 QColor shadow; 915 QColor shadow;
861 if(p->device() && p->device()->devType() == QInternal::Widget && 916 if(p->device() && p->device()->devType() == QInternal::Widget &&
862- ((QWidget *)p->device())->inherits("KMenuBar")){ 917- ((QWidget *)p->device())->inherits("KMenuBar")){
863- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 918- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
864+ ((QWidget *)p->device())->inherits("QMenuBar")){ 919+ ((QWidget *)p->device())->inherits("QMenuBar")){
865+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 920+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
866 g.background().dark(130); 921 g.background().dark(130);
867 } 922 }
868 else 923 else
869@@ -2336,8 +2070,6 @@ 924@@ -2300,8 +2033,8 @@
925 }
926
927 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
928- const QColorGroup &g, int lineWidth,
929- const QBrush * fill)
930+ const QColorGroup &g, int /*lineWidth*/,
931+ const QBrush * /*fill*/)
932 {
933 QColor c;
934 switch(menuHandler->transType()){
935@@ -2336,8 +2069,6 @@
870 936
871 maxpmw = QMAX( maxpmw, 20 ); 937 maxpmw = QMAX( maxpmw, 20 );
872 938
873- if ( p->font() == KGlobalSettings::generalFont() ) 939- if ( p->font() == KGlobalSettings::generalFont() )
874- p->setFont( KGlobalSettings::menuFont() ); 940- p->setFont( KGlobalSettings::menuFont() );
875 941
876 bool dis = !enabled; 942 bool dis = !enabled;
877 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 943 QColorGroup itemg = dis ? pal.disabled() : pal.active();
878@@ -2363,7 +2095,7 @@ 944@@ -2363,7 +2094,7 @@
879 p->fillRect(x, y, w, h, menuBrush); 945 p->fillRect(x, y, w, h, menuBrush);
880 } 946 }
881 else{ 947 else{
882- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 948- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
883+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 949+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
884 if(pix) 950 if(pix)
885 p->drawPixmap(x, y, *pix, x, y, w, h); 951 p->drawPixmap(x, y, *pix, x, y, w, h);
886 } 952 }
887@@ -2508,25 +2240,6 @@ 953@@ -2508,25 +2239,6 @@
888 return h; 954 return h;
889 } 955 }
890 956
891-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 957-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
892- const QColorGroup &g, QBrush *fill) 958- const QColorGroup &g, QBrush *fill)
893-{ 959-{
894- p->setPen(g.button().dark(130)); 960- p->setPen(g.button().dark(130));
895- p->drawRect(x, y, w, h); 961- p->drawRect(x, y, w, h);
896- p->setPen(g.button().light(120)); 962- p->setPen(g.button().light(120));
897- p->drawRect(x+1, y+1, w-2, h-2); 963- p->drawRect(x+1, y+1, w-2, h-2);
898- if(w >= 4 && h >= 4){ 964- if(w >= 4 && h >= 4){
899- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 965- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
900- if(!pix){ 966- if(!pix){
901- int h, s, v; 967- int h, s, v;
902- g.button().dark(120).hsv(&h, &s, &v); 968- g.button().dark(120).hsv(&h, &s, &v);
903- pix = new QPixmap(*bevelFillPix); 969- pix = new QPixmap(*bevelFillPix);
904- adjustHSV(*pix, h, s, v); 970- adjustHSV(*pix, h, s, v);
905- bevelFillDict.insert(g.button().dark(120).rgb(), pix); 971- bevelFillDict.insert(g.button().dark(120).rgb(), pix);
906- } 972- }
907- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 973- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
908- } 974- }
909-} 975-}
910 976
911 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 977 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
912 const QColorGroup &g, const QColor *c, 978 const QColorGroup &g, const QColor *c,
913@@ -2540,25 +2253,25 @@ 979@@ -2540,25 +2252,25 @@
914 return; 980 return;
915 } 981 }
916 else{ 982 else{
917- KStyle::drawFocusRect(p, r, g, c, atBorder); 983- KStyle::drawFocusRect(p, r, g, c, atBorder);
918+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 984+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
919 } 985 }
920 } 986 }
921 else 987 else
922- KStyle::drawFocusRect(p, r, g, c, atBorder); 988- KStyle::drawFocusRect(p, r, g, c, atBorder);
923+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 989+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
924 990
925 } 991 }
926 992
927 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 993 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
928 { 994 {
929 mnu->installEventFilter(menuHandler); 995 mnu->installEventFilter(menuHandler);
930- KStyle::polishPopupMenu(mnu); 996- KStyle::polishPopupMenu(mnu);
931+ QWindowsStyle::polishPopupMenu(mnu); 997+ QWindowsStyle::polishPopupMenu(mnu);
932 } 998 }
933 999
934 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 1000 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
935 bool selected) 1001 bool selected)
936 { 1002 {
937 if(tabBar->shape() != QTabBar::RoundedAbove){ 1003 if(tabBar->shape() != QTabBar::RoundedAbove){
938- KStyle::drawTab(p, tabBar, tab, selected); 1004- KStyle::drawTab(p, tabBar, tab, selected);
939+ QWindowsStyle::drawTab(p, tabBar, tab, selected); 1005+ QWindowsStyle::drawTab(p, tabBar, tab, selected);
940 return; 1006 return;
941 } 1007 }
942 QPixmap tilePix; 1008 QPixmap tilePix;
943@@ -2671,7 +2384,7 @@ 1009@@ -2671,7 +2383,7 @@
944 vFrame = 8; // was 10 1010 vFrame = 8; // was 10
945 } 1011 }
946 else 1012 else
947- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1013- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
948+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1014+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
949 } 1015 }
950 1016
951 1017
952@@ -2699,7 +2412,7 @@ 1018@@ -2699,7 +2411,7 @@
953 p->drawLine(x+1, y+1, x+1, y2-1); 1019 p->drawLine(x+1, y+1, x+1, y2-1);
954 } 1020 }
955 else if(lineWidth != 2 || !sunken) 1021 else if(lineWidth != 2 || !sunken)
956- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1022- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
957+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1023+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
958 else{ 1024 else{
959 QPen oldPen = p->pen(); 1025 QPen oldPen = p->pen();
960 int x2 = x+w-1; 1026 int x2 = x+w-1;
961@@ -2726,105 +2439,6 @@ 1027@@ -2726,105 +2438,6 @@
962 } 1028 }
963 } 1029 }
964 1030
965-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 1031-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
966- const QColorGroup &g, QBrush *) 1032- const QColorGroup &g, QBrush *)
967-{ 1033-{
968- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1034- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
969- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 1035- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
970- g.button().light(120) : g.button(), g.button()); 1036- g.button().light(120) : g.button(), g.button());
971- /* 1037- /*
972- if(h > w){ 1038- if(h > w){
973- int y2 = y+h-1; 1039- int y2 = y+h-1;
974- 1040-
975- p->setPen(g.light()); 1041- p->setPen(g.light());
976- 1042-
977- p->drawLine(x+1, y+2, x+1, y2-2); 1043- p->drawLine(x+1, y+2, x+1, y2-2);
978- p->drawLine(x+4, y+2, x+4, y2-2); 1044- p->drawLine(x+4, y+2, x+4, y2-2);
979- 1045-
980- p->setPen(g.dark()); 1046- p->setPen(g.dark());
981- p->drawLine(x+2, y+2, x+2, y2-2); 1047- p->drawLine(x+2, y+2, x+2, y2-2);
982- p->drawLine(x+5, y+2, x+5, y2-2); 1048- p->drawLine(x+5, y+2, x+5, y2-2);
983- 1049-
984- } 1050- }
985- else{ 1051- else{
986- int x2 = x+w-1; 1052- int x2 = x+w-1;
987- 1053-
988- p->setPen(g.light()); 1054- p->setPen(g.light());
989- 1055-
990- p->drawLine(x+2, y+1, x2-2, y+1); 1056- p->drawLine(x+2, y+1, x2-2, y+1);
991- p->drawLine(x+2, y+4, x2-2, y+4); 1057- p->drawLine(x+2, y+4, x2-2, y+4);
992- 1058-
993- p->setPen(g.dark()); 1059- p->setPen(g.dark());
994- p->drawLine(x+2, y+2, x2-2, y+2); 1060- p->drawLine(x+2, y+2, x2-2, y+2);
995- p->drawLine(x+2, y+5, x2-2, y+5); 1061- p->drawLine(x+2, y+5, x2-2, y+5);
996- }*/ 1062- }*/
997- 1063-
998-} 1064-}
999- 1065-
1000-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 1066-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
1001- const QColorGroup &g, 1067- const QColorGroup &g,
1002- const QString &text, bool sunken, 1068- const QString &text, bool sunken,
1003- QPixmap *pixmap, QBrush *) 1069- QPixmap *pixmap, QBrush *)
1004-{ 1070-{
1005- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); 1071- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button));
1006- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); 1072- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button());
1007- p->setPen(g.buttonText()); // Kicker doesn't set this ;-) 1073- p->setPen(g.buttonText()); // Kicker doesn't set this ;-)
1008- 1074-
1009- if(text.isNull() && !pixmap) 1075- if(text.isNull() && !pixmap)
1010- return; 1076- return;
1011- 1077-
1012- const int pxWidth = 20; 1078- const int pxWidth = 20;
1013- int textPos = pxWidth; 1079- int textPos = pxWidth;
1014- QRect br(buttonRect(x, y, w, h)); 1080- QRect br(buttonRect(x, y, w, h));
1015- 1081-
1016- if (sunken) 1082- if (sunken)
1017- p->translate(1,1); 1083- p->translate(1,1);
1018- 1084-
1019- if ( pixmap && !pixmap->isNull() ) { 1085- if ( pixmap && !pixmap->isNull() ) {
1020- int dx = ( pxWidth - pixmap->width() ) / 2; 1086- int dx = ( pxWidth - pixmap->width() ) / 2;
1021- int dy = ( h - pixmap->height() ) / 2; 1087- int dy = ( h - pixmap->height() ) / 2;
1022- p->drawPixmap( br.x()+dx, dy, *pixmap ); 1088- p->drawPixmap( br.x()+dx, dy, *pixmap );
1023- } 1089- }
1024- 1090-
1025- QString s = text; 1091- QString s = text;
1026- static const QString &modStr = KGlobal::staticQString( 1092- static const QString &modStr = KGlobal::staticQString(
1027- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); 1093- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]"));
1028- 1094-
1029- int modStrPos = s.find(modStr); 1095- int modStrPos = s.find(modStr);
1030- 1096-
1031- if (-1 != modStrPos) { 1097- if (-1 != modStrPos) {
1032- 1098-
1033- // +1 because we include a space after the closing brace. 1099- // +1 because we include a space after the closing brace.
1034- s.remove(modStrPos, modStr.length()+1); 1100- s.remove(modStrPos, modStr.length()+1);
1035- 1101-
1036- QPixmap modPixmap = SmallIcon("modified"); 1102- QPixmap modPixmap = SmallIcon("modified");
1037- 1103-
1038- int dx = (pxWidth - modPixmap.width()) / 2; 1104- int dx = (pxWidth - modPixmap.width()) / 2;
1039- int dy = (h - modPixmap.height()) / 2; 1105- int dy = (h - modPixmap.height()) / 2;
1040- 1106-
1041- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); 1107- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
1042- 1108-
1043- textPos += pxWidth; 1109- textPos += pxWidth;
1044- } 1110- }
1045- 1111-
1046- if (!s.isEmpty()){ 1112- if (!s.isEmpty()){
1047- if (p->fontMetrics().width(s) > br.width() - textPos) { 1113- if (p->fontMetrics().width(s) > br.width() - textPos) {
1048- 1114-
1049- int maxLen = br.width() - textPos - p->fontMetrics().width("..."); 1115- int maxLen = br.width() - textPos - p->fontMetrics().width("...");
1050- 1116-
1051- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) 1117- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
1052- s.truncate(s.length() - 1); 1118- s.truncate(s.length() - 1);
1053- 1119-
1054- s.append("..."); 1120- s.append("...");
1055- } 1121- }
1056- 1122-
1057- p->setPen(g.buttonText()); 1123- p->setPen(g.buttonText());
1058- 1124-
1059- p->drawText(br.x()+ textPos, -1, w-textPos, h, 1125- p->drawText(br.x()+ textPos, -1, w-textPos, h,
1060- AlignLeft|AlignVCenter, s); 1126- AlignLeft|AlignVCenter, s);
1061- } 1127- }
1062- 1128-
1063-} 1129-}
1064 1130
1065 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 1131 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
1066 { 1132 {
1067@@ -2998,22 +2612,22 @@ 1133@@ -2998,22 +2611,22 @@
1068 customBtnIconList.clear(); 1134 customBtnIconList.clear();
1069 customBtnLabelList.clear(); 1135 customBtnLabelList.clear();
1070 1136
1071- KConfig *config = KGlobal::config(); 1137- KConfig *config = KGlobal::config();
1072- QString oldGrp = config->group(); 1138- QString oldGrp = config->group();
1073- config->setGroup("MosfetButtons"); 1139- config->setGroup("MosfetButtons");
1074+// KConfig *config = KGlobal::config(); 1140+// KConfig *config = KGlobal::config();
1075+// QString oldGrp = config->group(); 1141+// QString oldGrp = config->group();
1076+// config->setGroup("MosfetButtons"); 1142+// config->setGroup("MosfetButtons");
1077 1143
1078 QStrList iconList, colorList; //temp, we store QPixmaps and QColors 1144 QStrList iconList, colorList; //temp, we store QPixmaps and QColors
1079 iconList.setAutoDelete(true); 1145 iconList.setAutoDelete(true);
1080 colorList.setAutoDelete(true); 1146 colorList.setAutoDelete(true);
1081- config->readListEntry("Labels", customBtnLabelList); 1147- config->readListEntry("Labels", customBtnLabelList);
1082- config->readListEntry("Icons", iconList); 1148- config->readListEntry("Icons", iconList);
1083- config->readListEntry("Colors", colorList); 1149- config->readListEntry("Colors", colorList);
1084+// config->readListEntry("Labels", customBtnLabelList); 1150+// config->readListEntry("Labels", customBtnLabelList);
1085+// config->readListEntry("Icons", iconList); 1151+// config->readListEntry("Icons", iconList);
1086+// config->readListEntry("Colors", colorList); 1152+// config->readListEntry("Colors", colorList);
1087 1153
1088 const char *labelStr = customBtnLabelList.first(); 1154 const char *labelStr = customBtnLabelList.first();
1089 const char *colorStr = colorList.first(); 1155 const char *colorStr = colorList.first();
1090 const char *iconStr = iconList.first(); 1156 const char *iconStr = iconList.first();
1091 1157
1092- KIconLoader *ldr = KGlobal::iconLoader(); 1158- KIconLoader *ldr = KGlobal::iconLoader();
1093+// KIconLoader *ldr = KGlobal::iconLoader(); 1159+// KIconLoader *ldr = KGlobal::iconLoader();
1094 while(labelStr != NULL){ 1160 while(labelStr != NULL){
1095 QColor *c = new QColor; 1161 QColor *c = new QColor;
1096 c->setNamedColor(QString(colorStr)); 1162 c->setNamedColor(QString(colorStr));
1097@@ -3022,7 +2636,7 @@ 1163@@ -3022,7 +2635,7 @@
1098 QString tmpStr(iconStr); 1164 QString tmpStr(iconStr);
1099 if(!tmpStr.isEmpty()){ 1165 if(!tmpStr.isEmpty()){
1100 QPixmap *pixmap = 1166 QPixmap *pixmap =
1101- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); 1167- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small));
1102+ new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); 1168+ new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small));
1103 if(pixmap->isNull()){ 1169 if(pixmap->isNull()){
1104 delete pixmap; 1170 delete pixmap;
1105 customBtnIconList.append(NULL); 1171 customBtnIconList.append(NULL);
1106@@ -3037,7 +2651,6 @@ 1172@@ -3037,7 +2650,6 @@
1107 colorStr = colorList.next(); 1173 colorStr = colorList.next();
1108 iconStr = iconList.next(); 1174 iconStr = iconList.next();
1109 } 1175 }
1110- config->setGroup(oldGrp); 1176- config->setGroup(oldGrp);
1111 } 1177 }
1112 1178
1113 void LiquidStyle::applyCustomAttributes(QPushButton *btn) 1179 void LiquidStyle::applyCustomAttributes(QPushButton *btn)
1114@@ -3087,7 +2700,7 @@ 1180@@ -3087,7 +2699,7 @@
1115 } 1181 }
1116 } 1182 }
1117 1183
1118-#include "liquid.moc" 1184-#include "liquid.moc"
1119+// #include "liquid.moc" 1185+// #include "liquid.moc"
1120 1186
1121 1187
1122 1188
1123 --- -Sun Jun 30 22:38:02 2002 1189 --- -Mon Jul 1 11:38:05 2002
1124 +++ plugin.cppFri Jun 28 13:25:25 2002 1190 +++ plugin.cppFri Jun 28 13:25:25 2002
1125@@ -1,29 +1,29 @@ 1191@@ -1,29 +1,29 @@
1126 #include "liquid.h" 1192 #include "liquid.h"
1127-#include <klocale.h> 1193-#include <klocale.h>
1128+ 1194+
1129 1195
1130 extern "C" { 1196 extern "C" {
1131- KStyle* allocate(); 1197- KStyle* allocate();
1132- int minor_version(); 1198- int minor_version();
1133- int major_version(); 1199- int major_version();
1134- const char *description(); 1200- const char *description();
1135+ QStyle* allocate ( ); 1201+ QStyle* allocate ( );
1136+ int minor_version ( ); 1202+ int minor_version ( );
1137+ int major_version ( ); 1203+ int major_version ( );
1138+ const char *description ( ); 1204+ const char *description ( );
1139 } 1205 }
1140 1206
1141-KStyle* allocate() 1207-KStyle* allocate()
1142+QStyle* allocate ( ) 1208+QStyle* allocate ( )
1143 { 1209 {
1144- return(new LiquidStyle); 1210- return(new LiquidStyle);
1145+ return new LiquidStyle ( ); 1211+ return new LiquidStyle ( );
1146 } 1212 }
1147 1213
1148-int minor_version() 1214-int minor_version()
1149+int minor_version ( ) 1215+int minor_version ( )
1150 { 1216 {
1151- return(0); 1217- return(0);
1152+ return 0; 1218+ return 0;
1153 } 1219 }
1154 1220
1155-int major_version() 1221-int major_version()
1156+int major_version ( ) 1222+int major_version ( )
1157 { 1223 {
1158- return(1); 1224- return(1);
1159+ return 1; 1225+ return 1;
1160 } 1226 }
1161 1227
1162-const char *description() 1228-const char *description()
1163+const char *description ( ) 1229+const char *description ( )
1164 { 1230 {
1165- return(i18n("High performance liquid plugin").utf8()); 1231- return(i18n("High performance liquid plugin").utf8());
1166+ return "High Performance Liquid"; 1232+ return "High Performance Liquid";
1167 } 1233 }