Fix initial focus problem with outline and view-source panes.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25213 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-06-09 14:52:38 +00:00
parent 7f4247e718
commit 42cb86adb9
4 changed files with 11 additions and 1 deletions

View File

@ -187,7 +187,10 @@ void Dialog::showView()
} else } else
w->show(); w->show();
w->setFocus(); if (wantInitialFocus())
w->setFocus();
else
lyxview_->setFocus();
} }

View File

@ -124,6 +124,11 @@ public:
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
void showView(); void showView();
/// Decide wether the dialog should grab thekeyboard focus when shown.
/// This method defaults to true, override if a different behaviour
/// is wanted.
virtual bool wantInitialFocus() const { return true; }
/// Update the display of the dialog whilst it is still visible. /// Update the display of the dialog whilst it is still visible.
virtual void updateView() = 0; virtual void updateView() = 0;

View File

@ -48,6 +48,7 @@ public:
bool initialiseParams(std::string const & data); bool initialiseParams(std::string const & data);
void updateView(); void updateView();
void enableView(bool enable); void enableView(bool enable);
bool wantInitialFocus() const { return false; }
public: public:
/// clean-up on hide. /// clean-up on hide.

View File

@ -77,6 +77,7 @@ public:
void enableView(bool enable); void enableView(bool enable);
void saveSession() const; void saveSession() const;
void restoreSession(); void restoreSession();
bool wantInitialFocus() const { return false; }
///@} ///@}
/// The title displayed by the dialog reflects source type. /// The title displayed by the dialog reflects source type.