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::getActiveWindow()->getFocusWidget()->setFocus();
FWindow::getActiveWindow()->redraw();
}
if ( statusBar() )
statusBar()->drawMessage();
updateTerminal();
flush_out();
}
}
}
if ( ! open_menu && menuBar()
&& menuBar()->hasSelectedItem()

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ FObject::~FObject() // destructor
if ( parentObj )
parentObj->delChild(this);
delAllTimer(); // delete all timers of this object
delOwnTimer(); // delete all timers of this object
if ( ! has_parent && timer_list )
{
@ -201,6 +201,31 @@ bool FObject::delTimer (int id)
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()
{

View File

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

View File

@ -95,7 +95,7 @@ ProgressDialog::ProgressDialog (FWidget* parent)
//----------------------------------------------------------------------
ProgressDialog::~ProgressDialog()
{
delAllTimer();
delOwnTimer();
delCallback(quit);
delCallback(more);
delCallback(reset);
@ -120,7 +120,7 @@ void ProgressDialog::onTimer (FTimerEvent*)
if ( p == 100 )
{
delAllTimer();
delOwnTimer();
activateWindow();
raiseWindow();
reset->setEnable();
@ -807,14 +807,14 @@ int main (int argc, char* 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.setTermGeometry(94,30);
//app.setNewFont();
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.setShadow();

View File

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