Port to qt4
[kdeaccessibility.git] / kmouth / phraselistitem.cpp
blob135193951f49d2c7fb2ad7904b869e569ba9d981
1 /***************************************************************************
2 phraselistitem.cpp - description
3 -------------------
4 begin : Fre Sep 6 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 #include "phraselistitem.h"
19 #include <qstyle.h>
20 #include <qpainter.h>
22 PhraseListItem::PhraseListItem (const QString & text)
23 : QListBoxText::Q3ListBoxText(text) {
26 PhraseListItem::~PhraseListItem() {
29 bool PhraseListItem::drawCursor() const {
30 if ((Q3ListBoxItem *)this != listBox()->item (listBox()->currentItem()))
31 return false;
33 for (Q3ListBoxItem *item = listBox()->firstItem(); item != 0; item = item->next() ) {
34 if (item->isSelected())
35 return true;
37 return false;
40 int PhraseListItem::rtti() const {
41 return RTTI;
44 void PhraseListItem::paint (QPainter *p) {
45 Q3ListBoxText::paint (p);
47 if (drawCursor()) {
48 QRect r (0, 0, listBox()->maxItemWidth(), height (listBox()));
49 listBox()->style().drawPrimitive (QStyle::PE_FocusRect, p, r,
50 listBox()->colorGroup());