init() method for the FStatusKey constructor to avoid code duplication

This commit is contained in:
Markus Gans 2015-07-26 18:24:10 +02:00
parent 8c467d0f30
commit 44c8be0224
3 changed files with 34 additions and 50 deletions

View File

@ -1,27 +1,31 @@
2015-06-18 Markus Gans <guru.mail@muenster.de>
2015-07-26 Markus Gans <guru.mail@muenster.de>
* init() method for the FStatusKey constructor
to avoid code duplication
2015-07-18 Markus Gans <guru.mail@muenster.de>
* Add multiple lines support for FLabel
2015-06-12 Markus Gans <guru.mail@muenster.de>
2015-07-12 Markus Gans <guru.mail@muenster.de>
* Improve focusFirstChild() and focusLastChild()
2015-06-09 Markus Gans <guru.mail@muenster.de>
2015-07-09 Markus Gans <guru.mail@muenster.de>
* Better contrast on 8 color terminals
2015-06-07 Markus Gans <guru.mail@muenster.de>
2015-07-06 Markus Gans <guru.mail@muenster.de>
* Bug fix disable cursor on focus FSwitch
* Hold down the mouse button displays FSwitch in a different color.
2015-04-07 Markus Gans <guru.mail@muenster.de>
2015-07-04 Markus Gans <guru.mail@muenster.de>
* New class FSwitch
* Add the watch example to demonstrate FSwitch
* Version 0.1.1
2015-02-07 Markus Gans <guru.mail@muenster.de>
2015-07-02 Markus Gans <guru.mail@muenster.de>
* 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 <guru.mail@muenster.de>
2015-07-01 Markus Gans <guru.mail@muenster.de>
* Use the object timer for the click animation in FButton
2015-28-06 Markus Gans <guru.mail@muenster.de>

View File

@ -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<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(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<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(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<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(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<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(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<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(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);
}
//----------------------------------------------------------------------

View File

@ -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*);