summaryrefslogtreecommitdiffstats
path: root/src/VButton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VButton.cpp')
-rw-r--r--src/VButton.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/VButton.cpp b/src/VButton.cpp
index 58b2a1b..c5763ab 100644
--- a/src/VButton.cpp
+++ b/src/VButton.cpp
@@ -11,16 +11,16 @@ VButton::VButton(TQWidget *parent, const char *name): TQPushButton (parent,name)
{
TDEConfig *cfg = TDEApplication::kApplication()->config();
TQString keysC = cfg->readEntry("keysColor", "#f0f0f0");
- setPaletteBackgroundColor(TQColor(keysC));
-
+ setColor(TQColor(keysC));
setFocusPolicy(TQ_NoFocus);
resize(30,30);
press=false;
}
+
VButton::~VButton()
{
-
}
+
void VButton::shiftPressed(bool press)
{
if (press==true){
@@ -32,12 +32,12 @@ void VButton::shiftPressed(bool press)
else{
TQPushButton::setText(tu);
}
-
}
else{
TQPushButton::setText(l);
}
}
+
void VButton::capsPressed(bool press)
{
if (press==true){
@@ -59,20 +59,40 @@ void VButton::setText(const TQString& text)
TQPushButton::setText(text);
l=text;
}
+
void VButton::setShiftText(const TQString& text)
{
u=text;
}
+void VButton::setColor(const TQColor &color)
+{
+ setPaletteBackgroundColor(color);
+ // Need to set TQColorGroup::Button color as well, otherwise the actual
+ // color of the key does not change until the next restart of the application.
+ TQPalette plt = palette();
+ TQColorGroup cg = plt.active();
+ cg.setColor(TQColorGroup::Button, color);
+ plt.setActive(cg);
+ cg = plt.inactive();
+ cg.setColor(TQColorGroup::Button, color);
+ plt.setInactive(cg);
+ cg = plt.disabled();
+ cg.setColor(TQColorGroup::Button, color);
+ plt.setDisabled(cg);
+ setPalette(plt);
+}
+
void VButton::setKeyCode(unsigned int keycode)
{
this->keycode=keycode;
-
}
+
unsigned int VButton::getKeyCode()
{
return this->keycode;
}
+
void VButton::sendKey()
{
emit keyClick(keycode);
@@ -86,8 +106,8 @@ void VButton::reposition(int width, int height)
double sdy=ph/orig_size.height();
move((int)(width/dx),(int)(height/dy));
resize((int)(width/sdx), (int)(height/sdy));
-
}
+
void VButton::res()
{
orig_size=geometry();