1 /***************************************************************************
2 kradioeduca.cpp - description
5 copyright : (C) 2000 by Javier Campos Morales
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "kradioeduca.h"
19 #include "kradioeduca.moc"
21 #include <kaccelmanager.h>
23 KRadioEduca::KRadioEduca(QWidget
*parent
, const char *name
) : QRadioButton(parent
,name
)
26 KAcceleratorManager::setNoAccel(this);
29 KRadioEduca::~KRadioEduca()
35 void KRadioEduca::drawButtonLabel( QPainter
*p
)
38 int extra_width
, indicator_width
;
40 indicator_width
= style().pixelMetric(QStyle::PM_ExclusiveIndicatorWidth
, 0);
43 x
= indicator_width
+ extra_width
; //###
49 _doc
= new QSimpleRichText( text(), font() );
52 _doc
->setWidth(p
, cr
.width() );
53 int rw
= _doc
->widthUsed() + extra_width
;
54 int rh
= _doc
->height();
60 yo
= (cr
.height()-rh
)/2;
63 QColorGroup cg
= colorGroup();
64 cg
.setColor( QColorGroup::Text
, cg
.light() );
65 _doc
->draw(p
, cr
.x()+xo
+1, cr
.y()+yo
+1, cr
, cg
, 0);
67 _doc
->draw(p
, cr
.x()+xo
, cr
.y()+yo
, cr
, colorGroup(), 0);
70 // QRect br = style().itemRect( p, x, y, rw, rh+yo,
71 // AlignLeft|AlignVCenter|ShowPrefix,
73 // pixmap(), text().visual() );
74 QRect
br(x
,y
,rw
,rh
+yo
);
76 br
.setLeft( br
.left()-3 );
77 br
.setRight( br
.right()+2 );
78 br
.setTop( br
.top()-2 );
79 br
.setBottom( br
.bottom()+2);
80 br
= br
.intersect( QRect(0,0,rw
, rh
+yo
) );
81 style().drawPrimitive( QStyle::PE_FocusRect
, p
, br
, colorGroup());