kexi

kexiframeutils_p.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 /* This file is included by KexiDBLabel and KexiFrame */
00021 
00023 void ClassName::drawFrame( QPainter *p )
00024 {
00025     if (frameShape() == QFrame::Box) {
00026         if ( frameShadow() == Plain )
00027             qDrawPlainRect( p, frameRect(), d->frameColor, lineWidth() );
00028         else
00029             qDrawShadeRect( p, frameRect(), colorGroup(), frameShadow() == QFrame::Sunken, 
00030                 lineWidth(), midLineWidth() );
00031     }
00032     else {
00033         SuperClassName::drawFrame(p);
00034     }
00035 }
00036 
00037 void ClassName::setPalette( const QPalette &pal )
00038 {
00039     QPalette pal2(pal);
00040     QColorGroup cg( pal2.active() );
00041     cg.setColor(QColorGroup::Light, KexiUtils::bleachedColor( d->frameColor, 150 ));
00042     cg.setColor(QColorGroup::Mid, d->frameColor);
00043     cg.setColor(QColorGroup::Dark, d->frameColor.dark(150));
00044     pal2.setActive(cg);
00045     QColorGroup cg2( pal2.inactive() );
00046     cg2.setColor(QColorGroup::Light, cg.light() );
00047     cg2.setColor(QColorGroup::Mid, cg.mid());
00048     cg2.setColor(QColorGroup::Dark, cg.dark());
00049     pal2.setInactive(cg2);
00050     SuperClassName::setPalette(pal2);
00051 }
00052 
00053 const QColor& ClassName::frameColor() const
00054 {
00055     return d->frameColor;
00056 }
00057 
00058 void ClassName::setFrameColor(const QColor& color)
00059 {
00060     d->frameColor = color;
00061     //update light and dark colors
00062     setPalette( palette() );
00063 }
KDE Home | KDE Accessibility Home | Description of Access Keys