]> git.saurik.com Git - wxWidgets.git/commitdiff
changes to make wxWindow::FindFocus work as expected with composite controls
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 29 Sep 2004 14:34:28 +0000 (14:34 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 29 Sep 2004 14:34:28 +0000 (14:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
include/wx/window.h
src/cocoa/window.mm
src/common/wincmn.cpp
src/generic/listctrl.cpp
src/gtk/window.cpp
src/gtk1/window.cpp
src/mac/carbon/window.cpp
src/mac/classic/window.cpp
src/mgl/window.cpp
src/motif/window.cpp
src/msw/window.cpp
src/os2/window.cpp
src/os2/wx25.def
src/x11/window.cpp

index e43fff75ef51131d698413a2513c0d30830224a6..3c9e9a89063988615299ec4c378b9941de5d2ee6 100644 (file)
@@ -493,7 +493,9 @@ public:
     virtual void SetFocusFromKbd() { SetFocus(); }
 
         // return the window which currently has the focus or NULL
-    static wxWindow *FindFocus() /* = 0: implement in derived classes */;
+    static wxWindow *FindFocus();
+    
+    static wxWindow *DoFindFocus() /* = 0: implement in derived classes */;
 
         // can this window have focus?
     virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); }
@@ -1072,6 +1074,12 @@ protected:
     // Send the wxWindowDestroyEvent
     void SendDestroyEvent();
 
+    // returns the main window of composite control; this is the window
+    // that FindFocus returns if the focus is in one of composite control's
+    // windows
+    virtual wxWindow *GetMainWindowOfCompositeControl() 
+        { return (wxWindow*)this; }
+
     // the window id - a number which uniquely identifies a window among
     // its siblings unless it is wxID_ANY
     wxWindowID           m_windowId;
index b5838d97525ffdd27e4e83f4fcb95be34e1b44ff..a1e06db23ec42bbc25e7fda9514fbfe15cde62e4 100644 (file)
@@ -855,7 +855,7 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 }
 
 // Get the window with the focus
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     // TODO
     return NULL;
index 74b2b50b6ccbaf0ab03fe1102abf03c5cd35d4da..44fdda39918ffc7baca970864cae586e8411b7c3 100644 (file)
@@ -2467,6 +2467,16 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
     }
 }
 
+// ----------------------------------------------------------------------------
+// focus handling
+// ----------------------------------------------------------------------------
+
+/*static*/ wxWindow* wxWindowBase::FindFocus()
+{
+    wxWindow *win = DoFindFocus();
+    return win ? win->GetMainWindowOfCompositeControl() : NULL;
+}
+
 // ----------------------------------------------------------------------------
 // global functions
 // ----------------------------------------------------------------------------
index 573f8c91f61e85611f78b507eedf0bb24807b73a..00e2e002c369a996dd0aae10b8564c6ef542998c 100644 (file)
@@ -517,6 +517,8 @@ public:
                       const wxString &name = _T("listctrlmainwindow") );
 
     virtual ~wxListMainWindow();
+    
+    wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); }
 
     bool HasFlag(int flag) const { return m_parent->HasFlag(flag); }
 
index 5b78c8b40e63438ad5409bf0da98dbb6f4e9aab4..a8d1520741a762b24f4a21acaf458d5e048a696e 100644 (file)
@@ -2359,7 +2359,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
 // because it is static and so couldn't be made virtual
 // ----------------------------------------------------------------------------
 
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     // the cast is necessary when we compile in wxUniversal mode
     return (wxWindow *)g_focusWindow;
index 5b78c8b40e63438ad5409bf0da98dbb6f4e9aab4..a8d1520741a762b24f4a21acaf458d5e048a696e 100644 (file)
@@ -2359,7 +2359,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
 // because it is static and so couldn't be made virtual
 // ----------------------------------------------------------------------------
 
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     // the cast is necessary when we compile in wxUniversal mode
     return (wxWindow *)g_focusWindow;
index c84a5c163214916baa64dfbca82af820629dd5b4..06d75e461139b50163649fe4a33a65a48ea9ef0f 100644 (file)
@@ -2486,7 +2486,7 @@ void wxWindowMac::MacOnScroll(wxScrollEvent &event )
 }
 
 // Get the window with the focus
-wxWindowMac *wxWindowBase::FindFocus()
+wxWindowMac *wxWindowBase::DoFindFocus()
 {
     ControlRef control ;
     GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
index db17efd0b379170e5dbc87dab4d7eddf735ce941..57b25ec1dc52ea4295598e2def29c3364f23c650 100644 (file)
@@ -1332,7 +1332,7 @@ void wxWindowMac::MacOnScroll(wxScrollEvent &event )
 }
 
 // Get the window with the focus
-wxWindowMac *wxWindowBase::FindFocus()
+wxWindowMac *wxWindowBase::DoFindFocus()
 {
     return gFocusWindow ;
 }
index ae6e6e017708c3f04cf741083015c63c3133d147..560a55b51471f1e1f4b190a3c7c8ec49107821ff 100644 (file)
@@ -742,7 +742,7 @@ void wxWindowMGL::KillFocus()
 // this wxWindowBase function is implemented here (in platform-specific file)
 // because it is static and so couldn't be made virtual
 // ----------------------------------------------------------------------------
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     return (wxWindow*)gs_focusedWindow;
 }
index 207afc3ed056f31ce74a1d30f2b327fb8730f23e..c4babdf5dbf5deb0aed2e2e79a2b37b7dd65c939 100644 (file)
@@ -564,7 +564,7 @@ void wxWindow::SetFocus()
 }
 
 // Get the window with the focus
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     // TODO Problems:
     // (1) Can there be multiple focussed widgets in an application?
index 2d23c631f1ae455ee816550aa274a082896bb8c7..1daf19b5e9355e4a3a1bcaaed6a57da938daaeee 100644 (file)
@@ -581,7 +581,7 @@ void wxWindowMSW::SetFocusFromKbd()
 }
 
 // Get the window with the focus
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     HWND hWnd = ::GetFocus();
     if ( hWnd )
index 022caeb47088b7a88448a3dac70d8f291227435a..6c57b9aa91ddcf612968e21c2285c628f2ba7b89 100644 (file)
@@ -475,7 +475,7 @@ void wxWindowOS2::SetFocusFromKbd()
     wxWindowBase::SetFocusFromKbd();
 } // end of wxWindowOS2::SetFocus
 
-wxWindow* wxWindowBase::FindFocus()
+wxWindow* wxWindowBase::DoFindFocus()
 {
     HWND                            hWnd = ::WinQueryFocus(HWND_DESKTOP);
 
@@ -484,7 +484,7 @@ wxWindow* wxWindowBase::FindFocus()
         return wxFindWinFromHandle((WXHWND)hWnd);
     }
     return NULL;
-} // wxWindowBase::FindFocus
+} // wxWindowBase::DoFindFocus
 
 bool wxWindowOS2::Enable(
   bool                              bEnable
index ea187e4c2a79b0a0fca479ab5a7bd351d25d75ce..c2615d9b06b8006913a9b586e88c61579ef3b5b4 100644 (file)
@@ -14262,7 +14262,7 @@ EXPORTS
       DoMoveWindow__8wxWindowFiN31
       ;wxWindow::DoClientToScreen(int*,int*) const
       DoClientToScreen__8wxWindowCFPiT1
-      ;wxWindowBase::FindFocus()
+      ;wxWindowBase::DoFindFocus()
       FindFocus__12wxWindowBaseFv
       ;wxWindow::OS2OnDrawItem(int,void**)
       OS2OnDrawItem__8wxWindowFiPPv
index 666f2d0157cd150c48a779fe220d9ce694fe8817..deccc1ef5b51af41619d2ea1262a6f3722189141 100644 (file)
@@ -394,7 +394,7 @@ void wxWindowX11::SetFocus()
 }
 
 // Get the window with the focus
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::DoFindFocus()
 {
     Window xfocus = (Window) 0;
     int revert = 0;