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;
|
||||
button_down = false;
|
||||
click_animation = true;
|
||||
this->text = "";
|
||||
|
||||
if ( hasFocus() )
|
||||
|
@ -492,9 +493,12 @@ void FButton::onKeyPress (FKeyEvent* event)
|
|||
case fc::Fkey_return:
|
||||
case fc::Fkey_enter:
|
||||
case fc::Fkey_space:
|
||||
setDown();
|
||||
usleep(150000);
|
||||
setUp();
|
||||
if ( click_animation )
|
||||
{
|
||||
setDown();
|
||||
usleep(150000);
|
||||
setUp();
|
||||
}
|
||||
processClick();
|
||||
event->accept();
|
||||
break;
|
||||
|
@ -566,14 +570,20 @@ void FButton::onAccel (FAccelEvent* event)
|
|||
setFocus();
|
||||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
setDown();
|
||||
if ( click_animation )
|
||||
setDown();
|
||||
else
|
||||
redraw();
|
||||
if ( statusBar() )
|
||||
statusBar()->drawMessage();
|
||||
}
|
||||
else
|
||||
else if ( click_animation )
|
||||
setDown();
|
||||
usleep(150000);
|
||||
setUp();
|
||||
if ( click_animation )
|
||||
{
|
||||
usleep(150000);
|
||||
setUp();
|
||||
}
|
||||
processClick();
|
||||
event->accept();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ class FButton : public FWidget
|
|||
private:
|
||||
FString text;
|
||||
bool button_down;
|
||||
bool click_animation;
|
||||
|
||||
private:
|
||||
FButton (const FButton&);
|
||||
|
@ -70,6 +71,10 @@ class FButton : public FWidget
|
|||
bool setDown();
|
||||
bool setUp();
|
||||
bool isDown() const;
|
||||
bool setClickAnimation(bool);
|
||||
bool setClickAnimation();
|
||||
bool unsetClickAnimation();
|
||||
bool hasClickAnimation();
|
||||
|
||||
void setText (const FString&);
|
||||
FString& getText();
|
||||
|
@ -146,6 +151,22 @@ inline bool FButton::setUp()
|
|||
inline bool FButton::isDown() const
|
||||
{ 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()
|
||||
{ return this->text; }
|
||||
|
|
Loading…
Reference in New Issue