kdeprint Library API Documentation

kmpropcontainer.cpp

00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library 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 GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 **/ 00019 00020 #include "kmpropcontainer.h" 00021 #include "kmpropwidget.h" 00022 00023 #include <kpushbutton.h> 00024 #include <qlayout.h> 00025 #include <klocale.h> 00026 #include <kseparator.h> 00027 #include <kguiitem.h> 00028 00029 KMPropContainer::KMPropContainer(QWidget *parent, const char *name) 00030 : QWidget(parent,name) 00031 { 00032 KSeparator* sep = new KSeparator( KSeparator::HLine, this); 00033 sep->setFixedHeight(5); 00034 00035 m_button = new KPushButton(KGuiItem(i18n("Change..."), "edit"), this); 00036 m_widget = 0; 00037 00038 QVBoxLayout *main_ = new QVBoxLayout(this, 0, 10); 00039 QHBoxLayout *btn_ = new QHBoxLayout(0, 0, 0); 00040 main_->addWidget(sep,0); 00041 main_->addLayout(btn_,0); 00042 btn_->addStretch(1); 00043 btn_->addWidget(m_button); 00044 } 00045 00046 KMPropContainer::~KMPropContainer() 00047 { 00048 } 00049 00050 void KMPropContainer::setWidget(KMPropWidget *w) 00051 { 00052 if (!m_widget) 00053 { 00054 m_widget = w; 00055 m_widget->reparent(this,QPoint(0,0)); 00056 connect(m_button,SIGNAL(clicked()),m_widget,SLOT(slotChange())); 00057 connect(m_widget,SIGNAL(enable(bool)),SIGNAL(enable(bool))); 00058 connect(m_widget,SIGNAL(enableChange(bool)),SLOT(slotEnableChange(bool))); 00059 QVBoxLayout *lay = dynamic_cast<QVBoxLayout*>(layout()); 00060 if (lay) 00061 { 00062 lay->insertWidget(0,m_widget,1); 00063 } 00064 } 00065 } 00066 00067 void KMPropContainer::setPrinter(KMPrinter *p) 00068 { 00069 if (m_widget) 00070 m_widget->setPrinterBase(p); 00071 } 00072 00073 void KMPropContainer::slotEnableChange(bool on) 00074 { 00075 m_button->setEnabled(on && (m_widget ? m_widget->canChange() : true)); 00076 } 00077 #include "kmpropcontainer.moc"
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 12 23:26:36 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003