input.cpp
00001 /**************************************************************************** 00002 * Copyright (c) 2005 Alexander Wiedenbruch <mail@wiedenbruch.de> 00003 * 00004 * This file is part of SuperKaramba. 00005 * 00006 * SuperKaramba is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * SuperKaramba is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with SuperKaramba; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 ****************************************************************************/ 00020 00021 #include "input.h" 00022 #include "kdebug.h" 00023 00024 Input::Input(karamba* k, int x, int y, int w, int h): 00025 Meter(k, x, y, w, h) 00026 { 00027 edit = new SKLineEdit((TQWidget*)k, this); 00028 edit->setGeometry(x,y,w,h); 00029 } 00030 00031 Input::~Input() 00032 { 00033 delete edit; 00034 } 00035 00036 void Input::mUpdate(TQPainter*) 00037 { 00038 edit->repaint(); 00039 } 00040 00041 void Input::setValue(TQString text) 00042 { 00043 edit->setText(text); 00044 } 00045 00046 TQString Input::getStringValue() const 00047 { 00048 return edit->text(); 00049 } 00050 00051 void Input::setBGColor(TQColor c) 00052 { 00053 edit->setBackgroundColor(c); 00054 } 00055 00056 void Input::setColor(TQColor c) 00057 { 00058 Meter::setColor(c); 00059 edit->setFrameColor(c); 00060 } 00061 00062 TQColor Input::getBGColor() const 00063 { 00064 return edit->backgroundColor(); 00065 } 00066 00067 TQColor Input::getColor() const 00068 { 00069 return edit->getFrameColor(); 00070 } 00071 00072 void Input::hide() 00073 { 00074 Meter::hide(); 00075 edit->setHidden(true); 00076 } 00077 00078 void Input::show() 00079 { 00080 Meter::show(); 00081 edit->setHidden(false); 00082 } 00083 00084 void Input::setSize(int ix, int iy, int iw, int ih) 00085 { 00086 Meter::setSize(ix, iy, iw, ih); 00087 edit->setGeometry(ix, iy, iw, ih); 00088 } 00089 00090 void Input::setX(int ix) 00091 { 00092 Meter::setX(ix); 00093 edit->setGeometry(ix, getY(), getWidth(), getHeight()); 00094 } 00095 00096 void Input::setY(int iy) 00097 { 00098 Meter::setY(iy); 00099 edit->setGeometry(getX(), iy, getWidth(), getHeight()); 00100 } 00101 00102 void Input::setWidth(int iw) 00103 { 00104 Meter::setWidth(iw); 00105 edit->setGeometry(getX(), getY(), iw, getHeight()); 00106 } 00107 00108 void Input::setHeight(int ih) 00109 { 00110 Meter::setHeight(ih); 00111 edit->setGeometry(getX(), getY(), getWidth(), ih); 00112 } 00113 00114 void Input::setFont(TQString f) 00115 { 00116 font.setFamily(f); 00117 edit->setFont(font); 00118 } 00119 00120 TQString Input::getFont() const 00121 { 00122 return font.family(); 00123 } 00124 00125 void Input::setFontColor(TQColor fontColor) 00126 { 00127 TQPalette palette = edit->palette(); 00128 palette.setColor(TQColorGroup::Text, fontColor); 00129 edit->setPalette(palette); 00130 } 00131 00132 TQColor Input::getFontColor() const 00133 { 00134 const TQColorGroup &color = edit->colorGroup(); 00135 return color.text(); 00136 } 00137 00138 void Input::setSelectionColor(TQColor selectionColor) 00139 { 00140 TQPalette palette = edit->palette(); 00141 palette.setColor(TQColorGroup::Highlight, selectionColor); 00142 edit->setPalette(palette); 00143 } 00144 00145 TQColor Input::getSelectionColor() const 00146 { 00147 const TQColorGroup &color = edit->colorGroup(); 00148 return color.highlight(); 00149 } 00150 00151 void Input::setSelectedTextColor(TQColor selectedTextColor) 00152 { 00153 TQPalette palette = edit->palette(); 00154 palette.setColor(TQColorGroup::HighlightedText, selectedTextColor); 00155 edit->setPalette(palette); 00156 } 00157 00158 TQColor Input::getSelectedTextColor() const 00159 { 00160 const TQColorGroup &color = edit->colorGroup(); 00161 return color.highlightedText(); 00162 } 00163 00164 void Input::setFontSize(int size) 00165 { 00166 font.setPixelSize(size); 00167 edit->setFont(font); 00168 } 00169 00170 int Input::getFontSize() const 00171 { 00172 return font.pixelSize(); 00173 } 00174 00175 void Input::setTextProps(TextField* t) 00176 { 00177 if(t) 00178 { 00179 setFontSize(t->getFontSize()); 00180 setFont(t->getFont()); 00181 setColor(t->getColor()); 00182 setBGColor(t->getBGColor()); 00183 } 00184 } 00185 00186 void Input::setInputFocus() 00187 { 00188 edit->setFocus(); 00189 } 00190 00191 void Input::clearInputFocus() 00192 { 00193 edit->clearFocus(); 00194 } 00195 00196 #include "input.moc"