From 201a8d8b68caed33c6343acaa4ae52935752f2d9 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Sat, 4 Aug 2007 00:37:20 +0000 Subject: [PATCH] copy kDrawButton into ourself, as we are the only active user svn path=/trunk/KDE/kdebase/workspace/; revision=696157 --- clients/modernsystem/modernsys.cpp | 61 ++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/clients/modernsystem/modernsys.cpp b/clients/modernsystem/modernsys.cpp index 52108a00b5..962966c5de 100644 --- a/clients/modernsystem/modernsys.cpp +++ b/clients/modernsystem/modernsys.cpp @@ -1,3 +1,22 @@ +/* + Copyright (C) 1999 Daniel M. Duley + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + // Daniel M. DULEY original work // Melchior FRANZ configuration options @@ -11,7 +30,6 @@ #include #include #include -#include #include #include @@ -216,6 +234,44 @@ static void delete_pixmaps() pixmaps_created = false; } +static void draw_button(QPainter &p, int x, int y, int w, int h, const QPalette &pal) +{ + if (w > 16 && h > 16){ + int x2 = x+w, y2 = y+h; + QPen oldPen = p.pen(); + QPolygon hPntArray, lPntArray; + hPntArray.putPoints(0, 12, x+4,y+1, x+5,y+1, // top left + x+3,y+2, x+2,y+3, x+1,y+4, x+1,y+5, + x+1,y2-5, x+1,y2-4, x+2,y2-3, // half corners + x2-5,y+1, x2-4,y+1, x2-3,y+2); + + lPntArray.putPoints(0, 17, x2-5,y2-1, x2-4,y2-1, // btm right + x2-3,y2-2, x2-2,y2-3, x2-1,y2-5, x2-1,y2-4, + + x+3,y2-2, x+4,y2-1, x+5,y2-1, //half corners + x2-2,y+3, x2-1,y+4, x2-1,y+5, + + x2-5,y2-2, x2-4,y2-2, // testing + x2-3,y2-3, + x2-2,y2-5, x2-2,y2-4); + + p.setPen(pal.color(QPalette::Light)); + p.drawLine(x+6, y, x2-6, y); + p.drawLine(0, y+6, 0, y2-6); + p.drawPoints(hPntArray); + + p.setPen(pal.color(QPalette::Dark)); + p.drawLine(x+6, y2, x2-6, y2); + p.drawLine(x+6, y2-1, x2-6, y2-1); + p.drawLine(x2, y+6, x2, y2-6); + p.drawLine(x2-1, y+6, x2-1, y2-6); + p.drawPoints(lPntArray); + p.setPen(oldPen); + } + else + qDrawWinPanel(&p, x, y, w, h, pal, false); +} + void ModernSysFactory::read_config() { bool showh; @@ -567,8 +623,7 @@ void ModernSys::drawRoundFrame(QPainter &p, int x, int y, int w, int h) { QPalette pt = options()->palette(ColorFrame, isActive()); pt.setCurrentColorGroup( QPalette::Active ); - kDrawRoundButton(&p, x, y, w, h, - pt, false); + draw_button(p, x, y, w, h, pt); }