2
* Kivio - Visual Modelling and Flowcharting
3
* Copyright (C) 2000-2001 theKompany.com & Dave Marotti
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#include "kivio_lineendsaction.h"
20
#include "kivio_lineendspix.h"
21
#include "tkcombobox.h"
27
LineEndsAction::LineEndsAction( bool isRightEnds, QObject* parent, const char* name )
28
: TKBaseSelectAction(parent,name)
30
m_rightends = isRightEnds;
33
LineEndsAction::~LineEndsAction()
37
void LineEndsAction::initComboBox(TKComboBox* combo)
39
TKBaseSelectAction::initComboBox(combo);
43
int tw = combo->fontMetrics().width(" 99:");
46
QPixmap pixAll(lineedns);
48
QPixmap tpix(pixAll.width(),pixAll.height());
51
tp.drawPixmap(-pixAll.width()+1,0,pixAll);
56
QPixmap pix(pixAll.width()+tw+3,17);
57
QPainter p(&pix,combo);
59
// insert item "0: None"
61
p.drawText(0,0,tw,pix.height(),AlignRight|AlignVCenter,QString("%1:").arg(cindex));
62
p.drawText(tw+3,0,pix.width()-tw-3,pix.height(),AlignLeft|AlignVCenter,"None");
65
combo->insertItem(pix,cindex++);
67
for (int y=0; y<pixAll.height(); y+= 17 ) {
69
p.drawText(0,0,tw,pix.height(),AlignRight|AlignVCenter,QString("%1:").arg(cindex));
70
p.drawPixmap(tw+3,0,pixAll,0,y,pix.width(),pix.height());
74
combo->insertItem(pix,cindex++);
79
#include "kivio_lineendsaction.moc"