Don't focus menus with focusFirstChild() and focusLastChild()

This commit is contained in:
Markus Gans 2016-05-16 23:26:04 +02:00
parent e6c4fc9882
commit 8ca888b063
5 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,7 @@
2016-05-16 Markus Gans <guru.mail@muenster.de> 2016-05-16 Markus Gans <guru.mail@muenster.de>
* Improve adjustSize() * Improve adjustSize()
* Implement adjustSizeGlobal() for all widgets * Implement adjustSizeGlobal() for all widgets
* Don't focus menus with focusFirstChild() and focusLastChild()
2016-05-01 Markus Gans <guru.mail@muenster.de> 2016-05-01 Markus Gans <guru.mail@muenster.de>
* Better terminal identification * Better terminal identification

View File

@ -108,6 +108,7 @@ void FMenu::init(FWidget* parent)
setGeometry (1, 1 , 10, 2, false); // initialize geometry values setGeometry (1, 1 , 10, 2, false); // initialize geometry values
setTransparentShadow(); setTransparentShadow();
window_object = true; window_object = true;
menu_object = true;
addWindow(this); addWindow(this);
hide(); hide();

View File

@ -54,6 +54,7 @@ FWidget::FWidget (FWidget* parent)
, adjustWidgetSizeGlobalShadow() , adjustWidgetSizeGlobalShadow()
, ignore_padding(false) , ignore_padding(false)
, window_object(false) , window_object(false)
, menu_object(false)
, flags(0) , flags(0)
, foregroundColor() , foregroundColor()
, backgroundColor() , backgroundColor()
@ -1408,7 +1409,10 @@ bool FWidget::focusFirstChild (void)
while ( iter != end ) while ( iter != end )
{ {
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() && widget->acceptFocus() )
if ( widget->isEnabled()
&& widget->acceptFocus()
&& ! widget->isMenu() )
{ {
widget->setFocus(); widget->setFocus();
if ( widget->numOfChildren() >= 1 ) if ( widget->numOfChildren() >= 1 )
@ -1445,7 +1449,10 @@ bool FWidget::focusLastChild (void)
{ {
--iter; --iter;
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() && widget->acceptFocus() )
if ( widget->isEnabled()
&& widget->acceptFocus()
&& ! widget->isMenu() )
{ {
widget->setFocus(); widget->setFocus();
if ( widget->numOfChildren() >= 1 ) if ( widget->numOfChildren() >= 1 )

View File

@ -246,6 +246,7 @@ class FWidget : public FObject, public FTerm
FRect adjustWidgetSizeGlobalShadow; FRect adjustWidgetSizeGlobalShadow;
bool ignore_padding; bool ignore_padding;
bool window_object; bool window_object;
bool menu_object;
int flags; int flags;
short foregroundColor; short foregroundColor;
short backgroundColor; short backgroundColor;
@ -329,6 +330,7 @@ class FWidget : public FObject, public FTerm
FWidget* parentWidget() const; FWidget* parentWidget() const;
bool isRootWidget() const; bool isRootWidget() const;
bool isWindow() const; bool isWindow() const;
bool isMenu() const;
virtual bool close(); virtual bool close();
static FStatusBar* statusBar(); static FStatusBar* statusBar();
@ -577,6 +579,10 @@ inline bool FWidget::isShown() const
inline bool FWidget::isWindow() const inline bool FWidget::isWindow() const
{ return window_object; } { return window_object; }
//----------------------------------------------------------------------
inline bool FWidget::isMenu() const
{ return menu_object; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::isEnabled() const inline bool FWidget::isEnabled() const
{ return enable; } { return enable; }