• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

keduca

kcheckeduca.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kcheckeduca.cpp  -  description
00003                              -------------------
00004     begin                : Tue Sep 5 2000
00005     copyright            : (C) 2000 by Javier Campos Morales
00006     email                : javi@asyris.org
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "kcheckeduca.h"
00019 #include "kcheckeduca.moc"
00020 
00021 #include <qstyle.h>
00022 #include <kaccelmanager.h>
00023 
00024 KCheckEduca::KCheckEduca(QWidget *parent, const char *name ) : QCheckBox(parent,name)
00025 {
00026     _doc = 0;
00027     KAcceleratorManager::setNoAccel( this );
00028 }
00029 
00030 KCheckEduca::~KCheckEduca()
00031 {
00032     delete _doc;
00033 }
00034 
00036 void KCheckEduca::drawButtonLabel( QPainter *p){
00037     int x, y, w, h;
00038     int extra_width, indicator_width;
00039 
00040     extra_width = 8;
00041     indicator_width = style().pixelMetric(QStyle::PM_IndicatorWidth, 0);
00042 
00043     y = 0;
00044     x = indicator_width + extra_width; //###
00045     w = width() - x;
00046     h = height();
00047 
00048     QRect cr(x,y,w,h);
00049 
00050     _doc = new QSimpleRichText( text(), font() );
00051     _doc->setWidth( 10 );
00052 
00053     _doc->setWidth(p, cr.width() );
00054     int rw = _doc->widthUsed() + extra_width;
00055     int rh = _doc->height();
00056     int xo = 0;
00057     int yo = 0;
00058 
00059     resize( width(), rh);
00060 
00061     yo = (cr.height()-rh)/2;
00062 
00063     if ( !isEnabled() ) {
00064         QColorGroup cg = colorGroup();
00065         cg.setColor( QColorGroup::Text, cg.light() );
00066         _doc->draw(p, cr.x()+xo+1, cr.y()+yo+1, cr, cg, 0);
00067     }
00068     _doc->draw(p, cr.x()+xo, cr.y()+yo, cr, colorGroup(), 0);
00069 
00070     if ( hasFocus() ) {
00071 //  QRect br = style().itemRect( p, x, y, rw, rh+yo,
00072 //                 AlignLeft|AlignVCenter|ShowPrefix,
00073 //                 isEnabled(),
00074 //                 pixmap(), text().visual() );
00075         QRect br(x,y,rw,rh+yo);
00076 
00077         br.setLeft( br.left()-3 );
00078         br.setRight( br.right()+2 );
00079         br.setTop( br.top()-2 );
00080         br.setBottom( br.bottom()+2);
00081         br = br.intersect( QRect(0,0,rw, rh+yo ) );
00082 
00083         style().drawPrimitive( QStyle::PE_FocusRect, p, br, colorGroup());
00084     }
00085 }

keduca

Skip menu "keduca"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal