Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Name_wdgt.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
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  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef __NAME_WDGT_H
00022 #define __NAME_WDGT_H
00023 
00024 #include <QtGui>
00025 
00026 #include "ui_Name_wdgt.h"
00027 
00028 class NameWidget : public QWidget
00029 {
00030     Q_OBJECT
00031 
00032 public: // methods
00033         NameWidget(int textWidth
00034                   ,QString textLabel
00035              ,QWidget * widgetParent
00036              ,QBoxLayout * layoutParent
00037              ,QDialog * dialogParent);
00038         inline QString getName () {return wdgt.edtName->text();}
00039         inline void setName (QString name) {wdgt.edtName->setText(name);}
00040         inline void setLabel (QString label) {wdgt.lblName->setText(label);}
00041         inline QWidget * getNameWdgt(){return wdgt.edtName;}
00042         inline void setNameLength(int len);
00043         inline void disableControls(){disableName();}
00044         inline void disableName()
00045         {
00046                 wdgt.edtName->setEnabled(false);
00047                 wdgt.edtName->setFrame(false);
00048         }
00049 protected: // Properties
00050         QVBoxLayout * vboxLayout;
00051         Ui::Name_wdgt wdgt;
00052         
00053 private: // Methods
00054 
00055 private slots:
00056 };
00057 
00058 inline void NameWidget::setNameLength(int len)
00059 {
00060         wdgt.edtName->setMaxLength(len);
00061 //      wdgt.edtName->setMinLength(len);
00062         int newWidth = len * 6;
00063         if (wdgt.edtName->width() < newWidth)
00064         {
00065                 wdgt.edtName->resize(newWidth, wdgt.edtName->height());
00066                 resize(newWidth + 105, height());
00067         }
00068 }
00069 #endif

Generated on Thu Apr 6 16:27:17 2006 for time-table by  doxygen 1.4.4