Improvements for the window focus
This commit is contained in:
parent
cb468c59d2
commit
a91d0566fc
|
@ -1,4 +1,4 @@
|
|||
2016-07-25 Markus Gans <guru.mail@muenster.de>
|
||||
2016-07-27 Markus Gans <guru.mail@muenster.de>
|
||||
* Improvements for the window focus
|
||||
|
||||
2016-07-24 Markus Gans <guru.mail@muenster.de>
|
||||
|
|
|
@ -19,7 +19,6 @@ FDialog::FDialog(FWidget* parent)
|
|||
, maximized(false)
|
||||
, TitleBarClickPos()
|
||||
, oldGeometry()
|
||||
, focus_widget(0)
|
||||
, dialog_menu()
|
||||
, dgl_menuitem()
|
||||
{
|
||||
|
@ -34,7 +33,6 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
, maximized(false)
|
||||
, TitleBarClickPos()
|
||||
, oldGeometry()
|
||||
, focus_widget(0)
|
||||
, dialog_menu()
|
||||
, dgl_menuitem()
|
||||
{
|
||||
|
@ -306,7 +304,7 @@ void FDialog::leaveMenu()
|
|||
dialog_menu->hide();
|
||||
activateWindow();
|
||||
raiseWindow();
|
||||
getFocusWidget()->setFocus();
|
||||
getWindowFocusWidget()->setFocus();
|
||||
redraw();
|
||||
|
||||
if ( statusBar() )
|
||||
|
@ -734,7 +732,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
|||
dialog_menu->hide();
|
||||
activateWindow();
|
||||
raiseWindow();
|
||||
getFocusWidget()->setFocus();
|
||||
getWindowFocusWidget()->setFocus();
|
||||
setClickedWidget(0);
|
||||
|
||||
if ( isModal() )
|
||||
|
@ -767,10 +765,13 @@ void FDialog::onWindowActive (FEvent*)
|
|||
|
||||
if ( ! FWidget::getFocusWidget() )
|
||||
{
|
||||
if ( focus_widget && focus_widget->isVisible() && focus_widget->isShown() )
|
||||
if ( getWindowFocusWidget()
|
||||
&& getWindowFocusWidget()->isVisible()
|
||||
&& getWindowFocusWidget()->isShown() )
|
||||
{
|
||||
focus_widget->setFocus();
|
||||
focus_widget->redraw();
|
||||
FWidget* win_focus_widget = getWindowFocusWidget();
|
||||
win_focus_widget->setFocus();
|
||||
win_focus_widget->redraw();
|
||||
}
|
||||
else
|
||||
focusFirstChild();
|
||||
|
@ -1013,12 +1014,13 @@ void FDialog::move (int x, int y)
|
|||
void FDialog::activateDialog()
|
||||
{
|
||||
FWidget* old_focus = FWidget::getFocusWidget();
|
||||
FWidget* win_focus_widget = getWindowFocusWidget();
|
||||
setActiveWindow(this);
|
||||
|
||||
if ( focus_widget && numOfFocusableChildren() > 1 )
|
||||
if ( win_focus_widget && numOfFocusableChildren() > 1 )
|
||||
{
|
||||
focus_widget->setFocus();
|
||||
focus_widget->redraw();
|
||||
win_focus_widget->setFocus();
|
||||
win_focus_widget->redraw();
|
||||
|
||||
if ( old_focus )
|
||||
old_focus->redraw();
|
||||
|
@ -1068,18 +1070,6 @@ void FDialog::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
resizeArea (vwin);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidget* FDialog::getFocusWidget() const
|
||||
{
|
||||
return focus_widget;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::setFocusWidget (FWidget* obj)
|
||||
{
|
||||
focus_widget = obj;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setFocus (bool on)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,6 @@ class FDialog : public FWindow
|
|||
bool maximized;
|
||||
FPoint TitleBarClickPos;
|
||||
FRect oldGeometry; // required by move()
|
||||
FWidget* focus_widget;
|
||||
FMenu* dialog_menu;
|
||||
FMenuItem* dgl_menuitem;
|
||||
|
||||
|
@ -106,8 +105,6 @@ class FDialog : public FWindow
|
|||
// make every setGeometry from FWidget available
|
||||
using FWidget::setGeometry;
|
||||
void setGeometry (int, int, int, int, bool = true);
|
||||
FWidget* getFocusWidget() const;
|
||||
void setFocusWidget (FWidget*);
|
||||
bool setFocus(bool);
|
||||
bool setFocus();
|
||||
bool unsetFocus();
|
||||
|
|
|
@ -18,6 +18,7 @@ FWindow* FWindow::previous_widget = 0;
|
|||
FWindow::FWindow(FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, window_active(false)
|
||||
, win_focus_widget(0)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -332,6 +333,14 @@ bool FWindow::lowerWindow (FWidget* obj)
|
|||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWindow* FWindow::getActiveWindow()
|
||||
{
|
||||
// returns the active FWindow object
|
||||
FWindow* active_window = static_cast<FWindow*>(FApplication::active_window);
|
||||
return active_window;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setActiveWindow (FWindow* window)
|
||||
{
|
||||
|
@ -375,11 +384,17 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWindow* FWindow::getActiveWindow()
|
||||
FWidget* FWindow::getWindowFocusWidget() const
|
||||
{
|
||||
// returns the active FWindow object
|
||||
FWindow* active_window = static_cast<FWindow*>(FApplication::active_window);
|
||||
return active_window;
|
||||
// returns the focused widget of this window
|
||||
return win_focus_widget;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setWindowFocusWidget (FWidget* obj)
|
||||
{
|
||||
// set focus widget of this window
|
||||
win_focus_widget = obj;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -391,7 +406,7 @@ void FWindow::switchToPrevWindow()
|
|||
|
||||
if ( active_window )
|
||||
{
|
||||
FWidget* focus_widget = active_window->getFocusWidget();
|
||||
FWidget* focus_widget = active_window->getWindowFocusWidget();
|
||||
|
||||
if ( ! active_window->isActiveWindow() )
|
||||
setActiveWindow(active_window);
|
||||
|
|
|
@ -45,6 +45,7 @@ class FWindow : public FWidget
|
|||
{
|
||||
private:
|
||||
bool window_active;
|
||||
FWidget* win_focus_widget;
|
||||
|
||||
protected:
|
||||
static FWindow* previous_widget;
|
||||
|
@ -79,8 +80,10 @@ class FWindow : public FWidget
|
|||
bool raiseWindow ();
|
||||
static bool lowerWindow (FWidget*);
|
||||
bool lowerWindow ();
|
||||
static void setActiveWindow (FWindow*);
|
||||
static FWindow* getActiveWindow();
|
||||
static void setActiveWindow (FWindow*);
|
||||
FWidget* getWindowFocusWidget() const;
|
||||
void setWindowFocusWidget (FWidget*);
|
||||
static void switchToPrevWindow();
|
||||
static bool activatePrevWindow();
|
||||
bool activateWindow (bool);
|
||||
|
|
Loading…
Reference in New Issue