Add delOwnTimer() for FObject

This commit is contained in:
Markus Gans 2015-12-19 20:49:01 +01:00
parent bf606f3f23
commit 16a2477b74
9 changed files with 50 additions and 22 deletions

View File

@ -987,13 +987,13 @@ void FApplication::processMouseEvent()
FWindow::raiseWindow (FWindow::getActiveWindow()); FWindow::raiseWindow (FWindow::getActiveWindow());
FWindow::getActiveWindow()->getFocusWidget()->setFocus(); FWindow::getActiveWindow()->getFocusWidget()->setFocus();
FWindow::getActiveWindow()->redraw(); FWindow::getActiveWindow()->redraw();
}
if ( statusBar() ) if ( statusBar() )
statusBar()->drawMessage(); statusBar()->drawMessage();
updateTerminal(); updateTerminal();
flush_out(); flush_out();
} }
} }
}
if ( ! open_menu && menuBar() if ( ! open_menu && menuBar()
&& menuBar()->hasSelectedItem() && menuBar()->hasSelectedItem()

View File

@ -52,7 +52,7 @@ FButton::FButton (const FString& txt, FWidget* parent)
FButton::~FButton() // destructor FButton::~FButton() // destructor
{ {
delAccelerator(); delAccelerator();
delAllTimer(); delOwnTimer();
} }

View File

@ -578,7 +578,7 @@ void FLineEdit::onMouseUp (FMouseEvent*)
{ {
if ( dragScroll != FLineEdit::noScroll ) if ( dragScroll != FLineEdit::noScroll )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FLineEdit::noScroll; dragScroll = FLineEdit::noScroll;
scrollTimer = false; scrollTimer = false;
} }
@ -618,7 +618,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
} }
if ( offset == 0 ) if ( offset == 0 )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FLineEdit::noScroll; dragScroll = FLineEdit::noScroll;
} }
} }
@ -633,14 +633,14 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
} }
if ( offset == len-width+2 ) if ( offset == len-width+2 )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FLineEdit::noScroll; dragScroll = FLineEdit::noScroll;
} }
} }
else else
{ {
// no dragging // no dragging
delAllTimer(); delOwnTimer();
scrollTimer = false; scrollTimer = false;
dragScroll = FLineEdit::noScroll; dragScroll = FLineEdit::noScroll;
} }

View File

@ -80,7 +80,7 @@ FListBox::FListBox(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBox::~FListBox() // destructor FListBox::~FListBox() // destructor
{ {
delAllTimer(); delOwnTimer();
delete VBar; delete VBar;
delete HBar; delete HBar;
} }
@ -972,7 +972,7 @@ void FListBox::onMouseUp (FMouseEvent* ev)
{ {
if ( dragScroll != FListBox::noScroll ) if ( dragScroll != FListBox::noScroll )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FListBox::noScroll; dragScroll = FListBox::noScroll;
scrollDistance = 1; scrollDistance = 1;
scrollTimer = false; scrollTimer = false;
@ -1077,7 +1077,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
} }
if ( current == 1 ) if ( current == 1 )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FListBox::noScroll; dragScroll = FListBox::noScroll;
} }
} }
@ -1097,14 +1097,14 @@ void FListBox::onMouseMove (FMouseEvent* ev)
} }
if ( current == int(count()) ) if ( current == int(count()) )
{ {
delAllTimer(); delOwnTimer();
dragScroll = FListBox::noScroll; dragScroll = FListBox::noScroll;
} }
} }
else else
{ {
// no dragging // no dragging
delAllTimer(); delOwnTimer();
scrollTimer = false; scrollTimer = false;
scrollDistance = 1; scrollDistance = 1;
dragScroll = FListBox::noScroll; dragScroll = FListBox::noScroll;
@ -1239,7 +1239,7 @@ void FListBox::onWheel (FWheelEvent* ev)
if ( dragScroll != FListBox::noScroll ) if ( dragScroll != FListBox::noScroll )
{ {
delAllTimer(); delOwnTimer();
scrollTimer = false; scrollTimer = false;
scrollDistance = 1; scrollDistance = 1;
dragScroll = FListBox::noScroll; dragScroll = FListBox::noScroll;
@ -1316,7 +1316,7 @@ void FListBox::onFocusOut (FFocusEvent*)
statusBar()->clearMessage(); statusBar()->clearMessage();
statusBar()->drawMessage(); statusBar()->drawMessage();
} }
delAllTimer(); delOwnTimer();
inc_search.clear(); inc_search.clear();
} }

View File

@ -545,6 +545,8 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
mouse_down = false; mouse_down = false;
if ( ! itemlist.empty() ) if ( ! itemlist.empty() )
leaveMenuBar(); leaveMenuBar();
if ( statusBar() )
statusBar()->clearMessage();
return; return;
} }

View File

@ -39,7 +39,7 @@ FObject::~FObject() // destructor
if ( parentObj ) if ( parentObj )
parentObj->delChild(this); parentObj->delChild(this);
delAllTimer(); // delete all timers of this object delOwnTimer(); // delete all timers of this object
if ( ! has_parent && timer_list ) if ( ! has_parent && timer_list )
{ {
@ -201,6 +201,31 @@ bool FObject::delTimer (int id)
return false; return false;
} }
//----------------------------------------------------------------------
bool FObject::delOwnTimer()
{
FObject::TimerList::iterator iter, end;
if ( ! timer_list )
return false;
if ( timer_list->empty() )
return false;
modify_timer = true;
iter = timer_list->begin();
while ( iter != timer_list->end() )
{
if ( (*iter).object == this )
iter = timer_list->erase(iter);
else
++iter;
}
modify_timer = false;
return true;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FObject::delAllTimer() bool FObject::delAllTimer()
{ {

View File

@ -83,6 +83,7 @@ class FObject
static void getCurrentTime (timeval&); static void getCurrentTime (timeval&);
int addTimer (int); int addTimer (int);
bool delTimer (int); bool delTimer (int);
bool delOwnTimer();
bool delAllTimer(); bool delAllTimer();
virtual bool event (FEvent*); virtual bool event (FEvent*);

View File

@ -95,7 +95,7 @@ ProgressDialog::ProgressDialog (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
ProgressDialog::~ProgressDialog() ProgressDialog::~ProgressDialog()
{ {
delAllTimer(); delOwnTimer();
delCallback(quit); delCallback(quit);
delCallback(more); delCallback(more);
delCallback(reset); delCallback(reset);
@ -120,7 +120,7 @@ void ProgressDialog::onTimer (FTimerEvent*)
if ( p == 100 ) if ( p == 100 )
{ {
delAllTimer(); delOwnTimer();
activateWindow(); activateWindow();
raiseWindow(); raiseWindow();
reset->setEnable(); reset->setEnable();
@ -807,14 +807,14 @@ int main (int argc, char* argv[])
} }
FApplication app(argc, argv); FApplication app(argc, argv);
app.setXTermTitle ("The FINAL CUT 0.1.1 (C) 2015 by Markus Gans"); app.setXTermTitle ("The FINAL CUT 0.2.0 (C) 2015 by Markus Gans");
//app.setEncoding("VT100"); //app.setEncoding("VT100");
//app.setTermGeometry(94,30); //app.setTermGeometry(94,30);
//app.setNewFont(); //app.setNewFont();
MyDialog d(&app); MyDialog d(&app);
d.setText ("The FINAL CUT 0.1.1 (C) 2015 by Markus Gans"); d.setText ("The FINAL CUT 0.2.0 (C) 2015 by Markus Gans");
d.setGeometry (int((app.getWidth()-56)/2), 2, 56, app.getHeight()-4); d.setGeometry (int((app.getWidth()-56)/2), 2, 56, app.getHeight()-4);
d.setShadow(); d.setShadow();

View File

@ -104,7 +104,7 @@ watch::watch (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
watch::~watch() watch::~watch()
{ {
delAllTimer(); delOwnTimer();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------