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

View File

@ -93,7 +93,7 @@ void FMenu::init(FWidget* parent)
xmin = 1 + rootObj->getLeftPadding();
ymin = 1 + rootObj->getTopPadding();
xmax = rootObj->getWidth();
ymax = rootObj->getHeight();
ymax = rootObj->getHeight();
width = 10;
height = 2;
client_xmin = 1;
@ -107,7 +107,8 @@ void FMenu::init(FWidget* parent)
createArea (vwin);
setGeometry (1, 1 , 10, 2, false); // initialize geometry values
setTransparentShadow();
window_object = true;
window_object = true;
menu_object = true;
addWindow(this);
hide();

View File

@ -306,7 +306,7 @@ void FTerm::identifyTermType()
{
type = name = 0; // 0 == not found
p = str;
while ( *p )
{
if ( isspace(uChar(*p)) )

View File

@ -54,6 +54,7 @@ FWidget::FWidget (FWidget* parent)
, adjustWidgetSizeGlobalShadow()
, ignore_padding(false)
, window_object(false)
, menu_object(false)
, flags(0)
, foregroundColor()
, backgroundColor()
@ -1408,7 +1409,10 @@ bool FWidget::focusFirstChild (void)
while ( iter != end )
{
FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() && widget->acceptFocus() )
if ( widget->isEnabled()
&& widget->acceptFocus()
&& ! widget->isMenu() )
{
widget->setFocus();
if ( widget->numOfChildren() >= 1 )
@ -1445,7 +1449,10 @@ bool FWidget::focusLastChild (void)
{
--iter;
FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() && widget->acceptFocus() )
if ( widget->isEnabled()
&& widget->acceptFocus()
&& ! widget->isMenu() )
{
widget->setFocus();
if ( widget->numOfChildren() >= 1 )
@ -1716,7 +1723,7 @@ void FWidget::getTermGeometry()
getTermSize();
closeConsole();
}
r_obj->width = term->getWidth();
r_obj->height = term->getHeight();
r_obj->xmin = 1;

View File

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