• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

pageRangeWidget.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Stefan Kebekus                                  *
00003  *   kebekus@kde.org                                                       *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <kdebug.h>
00022 
00023 #include "pageRangeWidget.h"
00024 
00025 
00026 PageRangeWidget::PageRangeWidget( Q_UINT16 _from, Q_UINT16 _to, Q_UINT16 _current, QWidget *parent, const char *name) : PageRangeWidget_base(parent, name)
00027 {
00028   // Paranoid security checks
00029   if ((from == 0) || (to == 0))
00030     return;
00031   if (_from > _to) {
00032     kdError() << "PageRangeWidget::PageRangeWidget(..): from > to" << endl;
00033     _to = _from;
00034   }
00035   if (_current < _from) {
00036     kdError() << "PageRangeWidget::PageRangeWidget(..): _current < _from" << endl;
00037     _current = _from;
00038   }
00039   if (_current > _to) {
00040     kdError() << "PageRangeWidget::PageRangeWidget(..): _current > _to" << endl;
00041     _current = _to;
00042   }
00043 
00044   connect(from, SIGNAL(valueChanged(int)), this, SLOT(fromValueChanged(int)));
00045   connect(to, SIGNAL(valueChanged(int)), this, SLOT(toValueChanged(int)));
00046 
00047   from->setRange(_from, _to);
00048   from->setValue(_current);
00049   to->setRange(_from, _to);
00050   to->setValue(_current);
00051 }
00052 
00053 
00054 void PageRangeWidget::toValueChanged(int val)
00055 {
00056   if (val < from->value())
00057     from->setValue(val);
00058 }
00059 
00060 
00061 void PageRangeWidget::fromValueChanged(int val)
00062 {
00063   if (val > to->value())
00064     to->setValue(val);
00065 }
00066 
00067 #include "pageRangeWidget.moc"
00068 

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal