00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <tqlineedit.h>
00022 #include "combobox.moc"
00023
00024
00025 ComboBox::ComboBox(TQWidget* parent, const char* name)
00026 : TQComboBox(parent, name),
00027 mReadOnly(false)
00028 { }
00029
00030 ComboBox::ComboBox(bool rw, TQWidget* parent, const char* name)
00031 : TQComboBox(rw, parent, name),
00032 mReadOnly(false)
00033 { }
00034
00035 void ComboBox::setReadOnly(bool ro)
00036 {
00037 if ((int)ro != (int)mReadOnly)
00038 {
00039 mReadOnly = ro;
00040 if (lineEdit())
00041 lineEdit()->setReadOnly(ro);
00042 }
00043 }
00044
00045 void ComboBox::mousePressEvent(TQMouseEvent* e)
00046 {
00047 if (mReadOnly)
00048 {
00049
00050 if (e->button() == Qt::LeftButton)
00051 return;
00052 }
00053 TQComboBox::mousePressEvent(e);
00054 }
00055
00056 void ComboBox::mouseReleaseEvent(TQMouseEvent* e)
00057 {
00058 if (!mReadOnly)
00059 TQComboBox::mouseReleaseEvent(e);
00060 }
00061
00062 void ComboBox::mouseMoveEvent(TQMouseEvent* e)
00063 {
00064 if (!mReadOnly)
00065 TQComboBox::mouseMoveEvent(e);
00066 }
00067
00068 void ComboBox::keyPressEvent(TQKeyEvent* e)
00069 {
00070 if (!mReadOnly || e->key() == TQt::Key_Escape)
00071 TQComboBox::keyPressEvent(e);
00072 }
00073
00074 void ComboBox::keyReleaseEvent(TQKeyEvent* e)
00075 {
00076 if (!mReadOnly)
00077 TQComboBox::keyReleaseEvent(e);
00078 }