krita

kis_pattern_chooser.cc

00001 /*
00002  *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 #include <qlabel.h>
00019 #include <qlayout.h>
00020 #include <klocale.h>
00021 #include <koIconChooser.h>
00022 
00023 #include "kis_colorspace.h"
00024 #include "kis_pattern_chooser.h"
00025 #include "kis_global.h"
00026 #include "kis_icon_item.h"
00027 #include "kis_pattern.h"
00028 
00029 KisPatternChooser::KisPatternChooser(QWidget *parent, const char *name) : super(parent, name)
00030 {
00031     m_lbName = new QLabel(this);
00032 
00033     QVBoxLayout *mainLayout = new QVBoxLayout(this, 2, -1, "main layout");
00034 
00035     mainLayout->addWidget(m_lbName);
00036     mainLayout->addWidget(chooserWidget(), 10);
00037 }
00038 
00039 KisPatternChooser::~KisPatternChooser()
00040 {
00041 }
00042 
00043 void KisPatternChooser::update(KoIconItem *item)
00044 {
00045     KisIconItem *kisItem = static_cast<KisIconItem *>(item);
00046 
00047     if (item) {
00048         KisPattern *pattern = static_cast<KisPattern *>(kisItem->resource());
00049 
00050         QString text = QString("%1 (%2 x %3)").arg(pattern->name()).arg(pattern->width()).arg(pattern->height());
00051 
00052         m_lbName->setText(text);
00053     }
00054 }
00055 
00056 #include "kis_pattern_chooser.moc"
00057 
KDE Home | KDE Accessibility Home | Description of Access Keys