diff --git a/src/wxxt/src/Windows/Panel.cc b/src/wxxt/src/Windows/Panel.cc index 9ec7f21cf8..10fcfc01ec 100644 --- a/src/wxxt/src/Windows/Panel.cc +++ b/src/wxxt/src/Windows/Panel.cc @@ -196,6 +196,19 @@ void wxPanel::ChangeToGray(Bool gray) } } +void wxPanel::ReleaseAllFocus() +{ + wxChildNode *cn; + wxChildList *cl; + cl = GetChildren(); + for (cn = cl->First(); cn; cn = cn->Next()) { + wxWindow *w; + w = (wxWindow *)cn->Data(); + w->ReleaseAllFocus(); + } + ReleaseFocus(); +} + //----------------------------------------------------------------------------- // positioning of items //----------------------------------------------------------------------------- diff --git a/src/wxxt/src/Windows/Panel.h b/src/wxxt/src/Windows/Panel.h index 4ecf0f63fd..427fea2c2b 100644 --- a/src/wxxt/src/Windows/Panel.h +++ b/src/wxxt/src/Windows/Panel.h @@ -69,6 +69,7 @@ public: // drawing wxPanelDC* GetPanelDC(void) { return dc; } virtual void ChangeToGray(Bool gray); + virtual void ReleaseAllFocus(); protected: friend class wxButton; // allow access to default_item diff --git a/src/wxxt/src/Windows/Window.cc b/src/wxxt/src/Windows/Window.cc index b14264e15e..029c774798 100644 --- a/src/wxxt/src/Windows/Window.cc +++ b/src/wxxt/src/Windows/Window.cc @@ -753,8 +753,14 @@ void wxWindow::ChangeToGray(Bool gray) if (XtIsSubclass(X->frame, xfwfEnforcerWidgetClass)) XtVaSetValues(X->frame, XtNdrawgray, (Boolean)gray, NULL); + if (gray) + ReleaseFocus(); +} + +void wxWindow::ReleaseFocus() +{ /* If disabling and this window has the focus, get rid of it: */ - if (gray && (misc_flags & FOCUS_FLAG)) { + if (misc_flags & FOCUS_FLAG) { wxWindow *p; p = GetParent(); while (p) { @@ -767,6 +773,11 @@ void wxWindow::ChangeToGray(Bool gray) } } +void wxWindow::ReleaseAllFocus() +{ + ReleaseFocus(); +} + Bool wxWindow::IsGray(void) { return (misc_flags & DISABLED_FLAG) || internal_gray_disabled; @@ -926,6 +937,9 @@ Bool wxWindow::Show(Bool show) if (!X->handle) // forbid, if no widget associated return TRUE; + if (!show) + ReleaseAllFocus(); + /* Get rid of or restore focus traversal */ if (XtIsSubclass(X->frame, xfwfCommonWidgetClass)) XtVaSetValues(X->frame, XtNtraversalOn, (Boolean)show, NULL); diff --git a/src/wxxt/src/Windows/Window.h b/src/wxxt/src/Windows/Window.h index c1dd5456af..c410f2648d 100644 --- a/src/wxxt/src/Windows/Window.h +++ b/src/wxxt/src/Windows/Window.h @@ -159,6 +159,8 @@ public: void MakeModal(int on); void InternalEnable(Bool enable, Bool gray = FALSE); virtual void ChangeToGray(Bool gray); + void ReleaseFocus(); + virtual void ReleaseAllFocus(); Bool IsGray(void); Bool IsShown(void);