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

keduca

kradioeduca.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kradioeduca.cpp  -  description
00003                              -------------------
00004     begin                : Wed Sep 6 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 "kradioeduca.h"
00019 #include "kradioeduca.moc"
00020 #include <qstyle.h>
00021 #include <kaccelmanager.h>
00022 
00023 KRadioEduca::KRadioEduca(QWidget *parent, const char *name) : QRadioButton(parent,name)
00024 {
00025     _doc=0;
00026     KAcceleratorManager::setNoAccel(this);
00027 }
00028 
00029 KRadioEduca::~KRadioEduca()
00030 {
00031     delete _doc;
00032 }
00033 
00035 void KRadioEduca::drawButtonLabel( QPainter *p)
00036 {
00037     int x, y, w, h;
00038     int extra_width, indicator_width;
00039     extra_width = 8;
00040     indicator_width = style().pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0);
00041 
00042     y = 0;
00043     x = indicator_width + extra_width; //###
00044     w = width() - x;
00045     h = height();
00046 
00047     QRect cr(x,y,w,h);
00048 
00049     _doc = new QSimpleRichText( text(), font() );
00050     _doc->setWidth( 10 );
00051 
00052     _doc->setWidth(p, cr.width() );
00053     int rw = _doc->widthUsed() + extra_width;
00054     int rh = _doc->height();
00055     int xo = 0;
00056     int yo = 0;
00057 
00058     resize( width(), rh);
00059 
00060     yo = (cr.height()-rh)/2;
00061 
00062     if (!isEnabled() ) {
00063         QColorGroup cg = colorGroup();
00064         cg.setColor( QColorGroup::Text, cg.light() );
00065         _doc->draw(p, cr.x()+xo+1, cr.y()+yo+1, cr, cg, 0);
00066     }
00067     _doc->draw(p, cr.x()+xo, cr.y()+yo, cr, colorGroup(), 0);
00068 
00069     if ( hasFocus() ) {
00070 //  QRect br = style().itemRect( p, x, y, rw, rh+yo,
00071 //                 AlignLeft|AlignVCenter|ShowPrefix,
00072 //                 isEnabled(),
00073 //                 pixmap(), text().visual() );
00074         QRect br(x,y,rw,rh+yo);
00075 
00076         br.setLeft( br.left()-3 );
00077         br.setRight( br.right()+2 );
00078         br.setTop( br.top()-2 );
00079         br.setBottom( br.bottom()+2);
00080         br = br.intersect( QRect(0,0,rw, rh+yo ) );
00081         style().drawPrimitive( QStyle::PE_FocusRect, p, br, colorGroup());
00082     }
00083 }

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