diff --git a/ChangeLog b/ChangeLog index 8ca5048c..3c4f05d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,31 @@ -2015-06-18 Markus Gans +2015-07-26 Markus Gans + * init() method for the FStatusKey constructor + to avoid code duplication + +2015-07-18 Markus Gans * Add multiple lines support for FLabel -2015-06-12 Markus Gans +2015-07-12 Markus Gans * Improve focusFirstChild() and focusLastChild() -2015-06-09 Markus Gans +2015-07-09 Markus Gans * Better contrast on 8 color terminals -2015-06-07 Markus Gans +2015-07-06 Markus Gans * Bug fix disable cursor on focus FSwitch * Hold down the mouse button displays FSwitch in a different color. -2015-04-07 Markus Gans +2015-07-04 Markus Gans * New class FSwitch * Add the watch example to demonstrate FSwitch * Version 0.1.1 -2015-02-07 Markus Gans +2015-07-02 Markus Gans * Add a joined right-left-line character to the newfont * Use the object timer for the progress bar animation in the ui example program -2015-01-07 Markus Gans +2015-07-01 Markus Gans * Use the object timer for the click animation in FButton 2015-28-06 Markus Gans diff --git a/src/fstatusbar.cpp b/src/fstatusbar.cpp index 5b402434..f1dcdb11 100644 --- a/src/fstatusbar.cpp +++ b/src/fstatusbar.cpp @@ -12,16 +12,7 @@ //---------------------------------------------------------------------- FStatusKey::FStatusKey(FWidget* parent) : FWidget(parent) { - this->active = false; - this->mouse_focus = false; - setGeometry (1,1,1,1); - - if ( parent && strcmp ( parent->getClassName(), - const_cast("FStatusBar") ) == 0 ) - { - setStatusbar( static_cast(parent) ); - statusbar()->insert(this); - } + init (parent); } //---------------------------------------------------------------------- @@ -29,18 +20,9 @@ FStatusKey::FStatusKey ( int k, FString& txt, FWidget* parent ) : FWidget(parent) { - this->active = false; - this->mouse_focus = false; setKey(k); setText(txt); - setGeometry (1,1,1,1); - - if ( parent && strcmp ( parent->getClassName(), - const_cast("FStatusBar") ) == 0 ) - { - setStatusbar( static_cast(parent) ); - statusbar()->insert(this); - } + init (parent); } //---------------------------------------------------------------------- @@ -48,18 +30,9 @@ FStatusKey::FStatusKey ( int k, const std::string& txt, FWidget* parent) : FWidget(parent) { - this->active = false; - this->mouse_focus = false; setKey(k); setText(txt); - setGeometry (1,1,1,1); - - if ( parent && strcmp ( parent->getClassName(), - const_cast("FStatusBar") ) == 0 ) - { - setStatusbar( static_cast(parent) ); - statusbar()->insert(this); - } + init (parent); } //---------------------------------------------------------------------- @@ -67,18 +40,9 @@ FStatusKey::FStatusKey ( int k, const char* txt, FWidget* parent ) : FWidget(parent) { - this->active = false; - this->mouse_focus = false; setKey(k); setText(txt); - - setGeometry (1,1,1,1); - if ( parent && strcmp ( parent->getClassName(), - const_cast("FStatusBar") ) == 0 ) - { - setStatusbar( static_cast(parent) ); - statusbar()->insert(this); - } + init (parent); } //---------------------------------------------------------------------- @@ -91,6 +55,21 @@ FStatusKey::~FStatusKey() // destructor // private methods of FStatusKey +//---------------------------------------------------------------------- +void FStatusKey::init (FWidget* parent) +{ + this->active = false; + this->mouse_focus = false; + setGeometry (1,1,1,1); + + if ( parent && strcmp ( parent->getClassName(), + const_cast("FStatusBar") ) == 0 ) + { + setStatusbar( static_cast(parent) ); + statusbar()->insert(this); + } +} + //---------------------------------------------------------------------- void FStatusKey::processActivate() { @@ -662,12 +641,12 @@ void FStatusBar::remove (FStatusKey* skey) } //---------------------------------------------------------------------- -void FStatusBar::remove (int skey) +void FStatusBar::remove (int pos) { - if ( int(count()) < skey ) + if ( int(count()) < pos ) return; - keylist.erase (keylist.begin()+skey-1); + keylist.erase (keylist.begin()+pos-1); } //---------------------------------------------------------------------- diff --git a/src/fstatusbar.h b/src/fstatusbar.h index 7108f5d1..18858a26 100644 --- a/src/fstatusbar.h +++ b/src/fstatusbar.h @@ -28,6 +28,7 @@ class FStatusKey : public FWidget private: FStatusKey (const FStatusKey&); FStatusKey& operator = (const FStatusKey&); + void init (FWidget*); void processActivate(); FStatusBar* statusbar() const; void setStatusbar (FStatusBar*);