summaryrefslogtreecommitdiffstats
path: root/superkaramba/src/input.cpp
blob: 63290cc2a65004b4c809d7869d82b533393e2099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/****************************************************************************
 * Copyright (c) 2005 Alexander Wiedenbruch <[email protected]>
 *
 * This file is part of SuperKaramba.
 *
 *  SuperKaramba is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  SuperKaramba is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with SuperKaramba; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 ****************************************************************************/

#include "input.h"
#include "kdebug.h"

Input::Input(karamba* k, int x, int y, int w, int h):
  Meter(k, x, y, w, h)
{
  edit = new SKLineEdit((TQWidget*)k, this);
  edit->setGeometry(x,y,w,h);
}

Input::~Input()
{
  delete edit;
}

void Input::mUpdate(TQPainter*)
{
  edit->tqrepaint();
}

void Input::setValue(TQString text)
{
  edit->setText(text);
}

TQString Input::getStringValue() const
{
  return edit->text();
}

void Input::setBGColor(TQColor c)
{
  edit->setBackgroundColor(c);
}

void Input::setColor(TQColor c)
{
  Meter::setColor(c);
  edit->setFrameColor(c);
}

TQColor Input::getBGColor() const
{
  return edit->backgroundColor();
}

TQColor Input::getColor() const
{
  return edit->getFrameColor();
}

void Input::hide()
{
  Meter::hide();
  edit->setHidden(true);
}

void Input::show()
{
  Meter::show();
  edit->setHidden(false);
}

void Input::setSize(int ix, int iy, int iw, int ih)
{
  Meter::setSize(ix, iy, iw, ih);
  edit->setGeometry(ix, iy, iw, ih);
}

void Input::setX(int ix)
{
  Meter::setX(ix);
  edit->setGeometry(ix, getY(), getWidth(), getHeight());
}

void Input::setY(int iy)
{
  Meter::setY(iy);
  edit->setGeometry(getX(), iy, getWidth(), getHeight());
}

void Input::setWidth(int iw)
{
  Meter::setWidth(iw);
  edit->setGeometry(getX(), getY(), iw, getHeight());
}

void Input::setHeight(int ih)
{
  Meter::setHeight(ih);
  edit->setGeometry(getX(), getY(), getWidth(), ih);
}

void Input::setFont(TQString f)
{
  font.setFamily(f);
  edit->setFont(font);
}

TQString Input::getFont() const
{
  return font.family();
}

void Input::setFontColor(TQColor fontColor)
{
  TQPalette palette = edit->palette();
  palette.setColor(TQColorGroup::Text, fontColor);
  edit->setPalette(palette);
}

TQColor Input::getFontColor() const
{
  const TQColorGroup &color = edit->tqcolorGroup();
  return color.text();
}

void Input::setSelectionColor(TQColor selectionColor)
{
  TQPalette palette = edit->palette();
  palette.setColor(TQColorGroup::Highlight, selectionColor);
  edit->setPalette(palette);
}

TQColor Input::getSelectionColor() const
{
  const TQColorGroup &color = edit->tqcolorGroup();
  return color.highlight();
}

void Input::setSelectedTextColor(TQColor selectedTextColor)
{
  TQPalette palette = edit->palette();
  palette.setColor(TQColorGroup::HighlightedText, selectedTextColor);
  edit->setPalette(palette);
}

TQColor Input::getSelectedTextColor() const
{
  const TQColorGroup &color = edit->tqcolorGroup();
  return color.highlightedText();
}

void Input::setFontSize(int size)
{
  font.setPixelSize(size);
  edit->setFont(font);
}

int Input::getFontSize() const
{
  return font.pixelSize();
}

void Input::setTextProps(TextField* t)
{
  if(t)
  {
    setFontSize(t->getFontSize());
    setFont(t->getFont());
    setColor(t->getColor());
    setBGColor(t->getBGColor());
  }
}

void Input::setInputFocus()
{
  edit->setFocus();
}

void Input::clearInputFocus()
{
  edit->clearFocus();
}

#include "input.moc"