From 35ff90a0b30bf24fcb9478a3c43143c124bbff46 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 26 Sep 2004 14:17:23 +0000 Subject: [PATCH] Added wxTopLevelWindow::HasFocus() as discussed. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/toplevel.h | 2 ++ include/wx/gtk1/toplevel.h | 2 ++ include/wx/toplevel.h | 5 ++++- src/gtk/toplevel.cpp | 9 +++++++++ src/gtk1/toplevel.cpp | 9 +++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index 8ee1660d8b..c55ec91352 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -64,6 +64,8 @@ public: virtual bool Show(bool show = TRUE); + virtual bool HasFocus(); + virtual void SetTitle( const wxString &title ); virtual wxString GetTitle() const { return m_title; } diff --git a/include/wx/gtk1/toplevel.h b/include/wx/gtk1/toplevel.h index 8ee1660d8b..c55ec91352 100644 --- a/include/wx/gtk1/toplevel.h +++ b/include/wx/gtk1/toplevel.h @@ -64,6 +64,8 @@ public: virtual bool Show(bool show = TRUE); + virtual bool HasFocus(); + virtual void SetTitle( const wxString &title ); virtual wxString GetTitle() const { return m_title; } diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index cdabc86695..89fcba6c0d 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -174,7 +174,10 @@ public: // Attracts the users attention to this window if the application is // inactive (should be called when a background event occurs) virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - + + // Is this the active frame (highlighted in the taskbar)? + virtual bool HasFocus() + { return (wxGetTopLevelParent(FindFocus()) == this); } // implementation only from now on // ------------------------------- diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 96e0da6119..d5fff696dd 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -1067,4 +1067,13 @@ bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) return do_shape_combine_region(window, region); } +bool wxTopLevelWindowGTK::HasFocus() +{ +#ifdef __WXGTK20__ + return GTK_WINDOW( m_widget )->has_toplevel_focus; +#else + return ( wxGetTopLevelParent(FindFocus()) = this ); +#endif +} + // vi:sts=4:sw=4:et diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index 96e0da6119..d5fff696dd 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -1067,4 +1067,13 @@ bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) return do_shape_combine_region(window, region); } +bool wxTopLevelWindowGTK::HasFocus() +{ +#ifdef __WXGTK20__ + return GTK_WINDOW( m_widget )->has_toplevel_focus; +#else + return ( wxGetTopLevelParent(FindFocus()) = this ); +#endif +} + // vi:sts=4:sw=4:et