The focus and active flag is set centrally in FWidget
This commit is contained in:
parent
b4b95f7b45
commit
526e193fb7
|
@ -1,3 +1,6 @@
|
|||
2017-06-05 Markus Gans <guru.mail@muenster.de>
|
||||
* The focus and active flag is set centrally in FWidget
|
||||
|
||||
2017-05-20 Markus Gans <guru.mail@muenster.de>
|
||||
* Recalculate the horizontal FListBox scroll bar size
|
||||
on lazy conversion
|
||||
|
|
|
@ -136,15 +136,9 @@ bool FButton::setEnable (bool on)
|
|||
FWidget::setEnable(on);
|
||||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
setHotkeyAccelerator();
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
delAccelerator();
|
||||
}
|
||||
|
||||
updateButtonColor();
|
||||
return on;
|
||||
|
@ -157,8 +151,6 @@ bool FButton::setFocus (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
|
@ -173,8 +165,6 @@ bool FButton::setFocus (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( isEnabled() && getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
@ -432,12 +422,6 @@ void FButton::init()
|
|||
setForegroundColor (wc.button_active_fg);
|
||||
setBackgroundColor (wc.button_active_bg);
|
||||
setShadow();
|
||||
|
||||
if ( hasFocus() )
|
||||
flags = fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -90,15 +90,9 @@ bool FButtonGroup::setEnable (bool on)
|
|||
FWidget::setEnable(on);
|
||||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
setHotkeyAccelerator();
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
delAccelerator();
|
||||
}
|
||||
|
||||
return on;
|
||||
}
|
||||
|
|
|
@ -72,19 +72,6 @@ FDialog::~FDialog() // destructor
|
|||
|
||||
|
||||
// public methods of FDialog
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setFocus (bool on)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
|
||||
if ( on )
|
||||
flags |= fc::focus;
|
||||
else
|
||||
flags &= ~fc::focus;
|
||||
|
||||
return on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setDialogWidget (bool on)
|
||||
{
|
||||
|
@ -1065,13 +1052,6 @@ void FDialog::init()
|
|||
setTransparentShadow();
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
|
||||
if ( hasFocus() )
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
|
||||
old_focus = FWidget::getFocusWidget();
|
||||
|
||||
if ( old_focus )
|
||||
|
|
|
@ -73,9 +73,6 @@ class FDialog : public FWindow
|
|||
FString getText() const;
|
||||
|
||||
// Mutators
|
||||
bool setFocus (bool);
|
||||
bool setFocus();
|
||||
bool unsetFocus();
|
||||
bool setDialogWidget (bool);
|
||||
bool setDialogWidget();
|
||||
bool unsetDialogWidget();
|
||||
|
@ -179,14 +176,6 @@ inline const char* FDialog::getClassName() const
|
|||
inline FString FDialog::getText() const
|
||||
{ return tb_text; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::setFocus()
|
||||
{ return setFocus(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::unsetFocus()
|
||||
{ return setFocus(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::setDialogWidget()
|
||||
{ return setDialogWidget(true); }
|
||||
|
|
|
@ -100,15 +100,9 @@ bool FLabel::setEnable (bool on)
|
|||
FWidget::setEnable(on);
|
||||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
setHotkeyAccelerator();
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
delAccelerator();
|
||||
}
|
||||
|
||||
return on;
|
||||
}
|
||||
|
@ -261,10 +255,6 @@ void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
|
|||
void FLabel::init()
|
||||
{
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
|
||||
unsetFocusable();
|
||||
|
||||
if ( parent_widget )
|
||||
|
|
|
@ -62,8 +62,6 @@ bool FLineEdit::setEnable (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
|
||||
if ( hasFocus() )
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||
|
@ -77,7 +75,6 @@ bool FLineEdit::setEnable (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
setForegroundColor (wc.inputfield_inactive_fg);
|
||||
setBackgroundColor (wc.inputfield_inactive_bg);
|
||||
}
|
||||
|
@ -92,8 +89,6 @@ bool FLineEdit::setFocus (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||
|
@ -111,8 +106,6 @@ bool FLineEdit::setFocus (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_fg);
|
||||
|
@ -645,13 +638,8 @@ void FLineEdit::init()
|
|||
setVisibleCursor();
|
||||
setShadow();
|
||||
|
||||
if ( hasFocus() )
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
flags |= fc::active;
|
||||
|
||||
if ( hasFocus() )
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||
|
|
|
@ -182,19 +182,6 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FListBox::setEnable (bool on)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
|
||||
if ( on )
|
||||
flags |= fc::active;
|
||||
else
|
||||
flags &= ~fc::active;
|
||||
|
||||
return on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FListBox::setFocus (bool on)
|
||||
{
|
||||
|
@ -202,8 +189,6 @@ bool FListBox::setFocus (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
|
@ -215,8 +200,6 @@ bool FListBox::setFocus (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
@ -1444,12 +1427,6 @@ inline FString& FListBox::getString (listBoxItems::iterator iter)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::init()
|
||||
{
|
||||
if ( hasFocus() )
|
||||
flags = fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
|
||||
|
|
|
@ -143,9 +143,6 @@ class FListBox : public FWidget
|
|||
void setMultiSelection (bool);
|
||||
void setMultiSelection ();
|
||||
void unsetMultiSelection ();
|
||||
bool setEnable (bool);
|
||||
bool setEnable();
|
||||
bool unsetEnable();
|
||||
bool setDisable();
|
||||
bool setFocus (bool);
|
||||
bool setFocus();
|
||||
|
@ -403,14 +400,6 @@ inline void FListBox::setMultiSelection()
|
|||
inline void FListBox::unsetMultiSelection()
|
||||
{ setMultiSelection(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::setEnable()
|
||||
{ return setEnable(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::unsetEnable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::setDisable()
|
||||
{ return setEnable(false); }
|
||||
|
|
|
@ -94,8 +94,6 @@ bool FMenuItem::setEnable (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
|
||||
if ( super && isMenuBar(super) )
|
||||
{
|
||||
// Meta + hotkey
|
||||
|
@ -104,8 +102,6 @@ bool FMenuItem::setEnable (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
|
||||
if ( super && isMenuBar(super) )
|
||||
super->delAccelerator (this);
|
||||
}
|
||||
|
@ -120,8 +116,6 @@ bool FMenuItem::setFocus (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( ! selected )
|
||||
|
@ -168,8 +162,6 @@ bool FMenuItem::setFocus (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( isEnabled() && getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
@ -690,12 +682,6 @@ void FMenuItem::init (FWidget* parent)
|
|||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasFocus() )
|
||||
flags = fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -53,19 +53,6 @@ void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
bar_length = w;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FProgressbar::setEnable (bool on)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
|
||||
if ( on )
|
||||
flags |= fc::active;
|
||||
else
|
||||
flags &= ~fc::active;
|
||||
|
||||
return on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FProgressbar::setShadow (bool on)
|
||||
{
|
||||
|
|
|
@ -57,10 +57,6 @@ class FProgressbar : public FWidget
|
|||
// Mutators
|
||||
void setPercentage (int);
|
||||
void setGeometry (int, int, int, int, bool = true);
|
||||
bool setEnable (bool);
|
||||
bool setEnable();
|
||||
bool unsetEnable();
|
||||
bool setDisable();
|
||||
bool setShadow (bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
|
@ -94,18 +90,6 @@ inline const char* FProgressbar::getClassName() const
|
|||
inline int FProgressbar::getPercentage()
|
||||
{ return percentage; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FProgressbar::setEnable()
|
||||
{ return setEnable(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FProgressbar::unsetEnable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FProgressbar::setDisable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FProgressbar::setShadow()
|
||||
{ return setShadow(true); }
|
||||
|
|
|
@ -466,12 +466,9 @@ wchar_t& FString::operator [] (uInt pos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString FString::operator () (uInt pos, uInt len)
|
||||
const FString& FString::operator () ()
|
||||
{
|
||||
assert ( (pos < length) && ((pos+len) <= length) );
|
||||
FString tmp(L"");
|
||||
tmp._insert (0, len, string + pos);
|
||||
return (tmp);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class FString
|
|||
|
||||
wchar_t& operator [] (int);
|
||||
wchar_t& operator [] (uInt);
|
||||
const FString operator () (uInt, uInt);
|
||||
const FString& operator () ();
|
||||
|
||||
bool operator < (const FString&) const;
|
||||
bool operator < (const std::wstring&) const;
|
||||
|
|
|
@ -102,7 +102,6 @@ bool FToggleButton::setEnable (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::active;
|
||||
setHotkeyAccelerator();
|
||||
|
||||
if ( hasFocus() )
|
||||
|
@ -118,7 +117,6 @@ bool FToggleButton::setEnable (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::active;
|
||||
delAccelerator();
|
||||
setForegroundColor (wc.toggle_button_inactive_fg);
|
||||
setBackgroundColor (wc.toggle_button_inactive_bg);
|
||||
|
@ -134,8 +132,6 @@ bool FToggleButton::setFocus (bool on)
|
|||
|
||||
if ( on )
|
||||
{
|
||||
flags |= fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( isRadioButton() )
|
||||
|
@ -156,8 +152,6 @@ bool FToggleButton::setFocus (bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
setForegroundColor (wc.toggle_button_active_fg);
|
||||
|
@ -633,13 +627,8 @@ void FToggleButton::init()
|
|||
{
|
||||
setGeometry (1, 1, 4, 1, false); // initialize geometry values
|
||||
|
||||
if ( hasFocus() )
|
||||
flags = fc::focus;
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
flags |= fc::active;
|
||||
|
||||
if ( hasFocus() )
|
||||
{
|
||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||
|
|
|
@ -61,6 +61,9 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
, background_color(fc::Default)
|
||||
, statusbar_message()
|
||||
{
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
|
||||
if ( ! parent )
|
||||
{
|
||||
assert ( ! rootObject
|
||||
|
@ -306,6 +309,17 @@ void FWidget::setStatusbarMessage (const FString& msg)
|
|||
statusbar_message = msg;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::setEnable (bool on)
|
||||
{
|
||||
if ( on )
|
||||
flags |= fc::active;
|
||||
else
|
||||
flags &= ~fc::active;
|
||||
|
||||
return enable = (on) ? true : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::setFocus (bool on)
|
||||
{
|
||||
|
@ -315,6 +329,11 @@ bool FWidget::setFocus (bool on)
|
|||
if ( ! enable )
|
||||
return false;
|
||||
|
||||
if ( on )
|
||||
flags |= fc::focus;
|
||||
else
|
||||
flags &= ~fc::focus;
|
||||
|
||||
if ( on == focus )
|
||||
return true;
|
||||
|
||||
|
|
|
@ -685,10 +685,6 @@ inline FPoint FWidget::getCursorPos()
|
|||
inline bool FWidget::setVisible()
|
||||
{ return visible = true; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setEnable (bool on)
|
||||
{ return enable = (on) ? true : false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setEnable()
|
||||
{ return setEnable(true); }
|
||||
|
|
Loading…
Reference in New Issue