Add the possibility to turn off click animation on Fbutton
This commit is contained in:
parent
e87e0ceb94
commit
749e8914c2
|
@ -37,6 +37,7 @@ void FButton::init()
|
||||||
{
|
{
|
||||||
flags = 0;
|
flags = 0;
|
||||||
button_down = false;
|
button_down = false;
|
||||||
|
click_animation = true;
|
||||||
this->text = "";
|
this->text = "";
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
|
@ -492,9 +493,12 @@ void FButton::onKeyPress (FKeyEvent* event)
|
||||||
case fc::Fkey_return:
|
case fc::Fkey_return:
|
||||||
case fc::Fkey_enter:
|
case fc::Fkey_enter:
|
||||||
case fc::Fkey_space:
|
case fc::Fkey_space:
|
||||||
setDown();
|
if ( click_animation )
|
||||||
usleep(150000);
|
{
|
||||||
setUp();
|
setDown();
|
||||||
|
usleep(150000);
|
||||||
|
setUp();
|
||||||
|
}
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
event->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -566,14 +570,20 @@ void FButton::onAccel (FAccelEvent* event)
|
||||||
setFocus();
|
setFocus();
|
||||||
if ( focused_widget )
|
if ( focused_widget )
|
||||||
focused_widget->redraw();
|
focused_widget->redraw();
|
||||||
setDown();
|
if ( click_animation )
|
||||||
|
setDown();
|
||||||
|
else
|
||||||
|
redraw();
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
else
|
else if ( click_animation )
|
||||||
setDown();
|
setDown();
|
||||||
usleep(150000);
|
if ( click_animation )
|
||||||
setUp();
|
{
|
||||||
|
usleep(150000);
|
||||||
|
setUp();
|
||||||
|
}
|
||||||
processClick();
|
processClick();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ class FButton : public FWidget
|
||||||
private:
|
private:
|
||||||
FString text;
|
FString text;
|
||||||
bool button_down;
|
bool button_down;
|
||||||
|
bool click_animation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FButton (const FButton&);
|
FButton (const FButton&);
|
||||||
|
@ -70,6 +71,10 @@ class FButton : public FWidget
|
||||||
bool setDown();
|
bool setDown();
|
||||||
bool setUp();
|
bool setUp();
|
||||||
bool isDown() const;
|
bool isDown() const;
|
||||||
|
bool setClickAnimation(bool);
|
||||||
|
bool setClickAnimation();
|
||||||
|
bool unsetClickAnimation();
|
||||||
|
bool hasClickAnimation();
|
||||||
|
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
@ -146,6 +151,22 @@ inline bool FButton::setUp()
|
||||||
inline bool FButton::isDown() const
|
inline bool FButton::isDown() const
|
||||||
{ return button_down; }
|
{ return button_down; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FButton::setClickAnimation(bool on)
|
||||||
|
{ return click_animation = on; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FButton::setClickAnimation()
|
||||||
|
{ return setClickAnimation(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FButton::unsetClickAnimation()
|
||||||
|
{ return setClickAnimation(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FButton::hasClickAnimation()
|
||||||
|
{ return click_animation; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString& FButton::getText()
|
inline FString& FButton::getText()
|
||||||
{ return this->text; }
|
{ return this->text; }
|
||||||
|
|
Loading…
Reference in New Issue