chalk

kis_pattern_chooser.cpp
1/*
2 * Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#include <tqlabel.h>
19#include <tqlayout.h>
20#include <tdelocale.h>
21#include <koIconChooser.h>
22
23#include "kis_colorspace.h"
24#include "kis_pattern_chooser.h"
25#include "kis_global.h"
26#include "kis_icon_item.h"
27#include "kis_pattern.h"
28
29KisPatternChooser::KisPatternChooser(TQWidget *parent, const char *name) : super(parent, name)
30{
31 m_lbName = new TQLabel(this);
32
33 TQVBoxLayout *mainLayout = new TQVBoxLayout(this, 2, -1, "main layout");
34
35 mainLayout->addWidget(m_lbName);
36 mainLayout->addWidget(chooserWidget(), 10);
37}
38
39KisPatternChooser::~KisPatternChooser()
40{
41}
42
43void KisPatternChooser::update(KoIconItem *item)
44{
45 KisIconItem *kisItem = static_cast<KisIconItem *>(item);
46
47 if (item) {
48 KisPattern *pattern = static_cast<KisPattern *>(kisItem->resource());
49
50 TQString text = TQString("%1 (%2 x %3)").arg(pattern->name()).arg(pattern->width()).arg(pattern->height());
51
52 m_lbName->setText(text);
53 }
54}
55
56#include "kis_pattern_chooser.moc"
57