X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fabb57533169f2f75367e0d120c762518548890..2d9cdc4b6947fa5fb05aca64673ca170c66141cf:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 32eb0c46bf..78eb269cf5 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -17,53 +17,61 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP -#include -#include "wx/setup.h" -#include "wx/menu.h" -#include "wx/dc.h" -#include "wx/dcclient.h" -#include "wx/utils.h" -#include "wx/app.h" -#include "wx/panel.h" -#include "wx/layout.h" -#include "wx/dialog.h" -#include "wx/listbox.h" -#include "wx/button.h" -#include "wx/settings.h" -#include "wx/msgdlg.h" + #include + #include "wx/setup.h" + #include "wx/menu.h" + #include "wx/dc.h" + #include "wx/dcclient.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/panel.h" + #include "wx/layout.h" + #include "wx/dialog.h" + #include "wx/frame.h" + #include "wx/listbox.h" + #include "wx/button.h" + #include "wx/settings.h" + #include "wx/msgdlg.h" #endif #if wxUSE_OWNER_DRAWN -#include "wx/ownerdrw.h" + #include "wx/ownerdrw.h" #endif #if wxUSE_DRAG_AND_DROP -#include "wx/msw/ole/droptgt.h" + #include "wx/msw/ole/droptgt.h" #endif #include "wx/menuitem.h" #include "wx/log.h" +#include "wx/tooltip.h" + #include "wx/msw/private.h" #include #ifndef __GNUWIN32__ -#include -#include + #include + #include #endif #ifdef __WIN32__ -#include + #include #endif -#ifdef __GNUWIN32__ -#include +#include + +#ifndef __TWIN32__ + #ifdef __GNUWIN32__ + #include + #endif #endif +// all these are defined in #ifdef GetCharWidth #undef GetCharWidth #endif @@ -81,37 +89,36 @@ #endif #ifdef __WXDEBUG__ -const char *wxGetMessageName(int message); + const char *wxGetMessageName(int message); #endif //__WXDEBUG__ #define WINDOW_MARGIN 3 // This defines sensitivity of Leave events wxMenu *wxCurrentPopupMenu = NULL; -extern wxList wxPendingDelete; +extern wxList WXDLLEXPORT wxPendingDelete; void wxRemoveHandleAssociation(wxWindow *win); void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); wxWindow *wxFindWinFromHandle(WXHWND hWnd); #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) + IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) +#endif BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) -EVT_CHAR(wxWindow::OnChar) -EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) -EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) -EVT_INIT_DIALOG(wxWindow::OnInitDialog) -EVT_IDLE(wxWindow::OnIdle) + EVT_CHAR(wxWindow::OnChar) + EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) + EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) + EVT_INIT_DIALOG(wxWindow::OnInitDialog) + EVT_IDLE(wxWindow::OnIdle) END_EVENT_TABLE() -#endif - // Find an item given the MS Windows id wxWindow *wxWindow::FindItem(int id) const { - if (!GetChildren()) - return NULL; - wxNode *current = GetChildren()->First(); +// if (!GetChildren()) +// return NULL; + wxNode *current = GetChildren().First(); while (current) { wxWindow *childWin = (wxWindow *)current->Data(); @@ -123,7 +130,7 @@ wxWindow *wxWindow::FindItem(int id) const if (childWin->IsKindOf(CLASSINFO(wxControl))) { wxControl *item = (wxControl *)childWin; - if (item->m_windowId == id) + if (item->GetId() == id) return item; else { @@ -140,9 +147,9 @@ wxWindow *wxWindow::FindItem(int id) const // Find an item given the MS Windows handle wxWindow *wxWindow::FindItemByHWND(WXHWND hWnd, bool controlOnly) const { - if (!GetChildren()) - return NULL; - wxNode *current = GetChildren()->First(); +// if (!GetChildren()) +// return NULL; + wxNode *current = GetChildren().First(); while (current) { wxObject *obj = (wxObject *)current->Data() ; @@ -175,9 +182,19 @@ bool wxWindow::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) } bool wxWindow::MSWNotify(WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam), + WXLPARAM lParam, WXLPARAM* WXUNUSED(result)) { + NMHDR* hdr = (NMHDR *)lParam; + if ( hdr->code == TTN_NEEDTEXT && m_tooltip ) + { + TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; + ttt->lpszText = (char *)m_tooltip->GetTip().c_str(); + + // processed + return TRUE; + } + return FALSE; } @@ -264,6 +281,8 @@ void wxWindow::Init() #if wxUSE_DRAG_AND_DROP m_pDropTarget = NULL; #endif + + m_tooltip = NULL; } wxWindow::wxWindow() @@ -276,6 +295,10 @@ wxWindow::~wxWindow() { m_isBeingDeleted = TRUE; + // first of all, delete the things on which nothing else depends + + wxDELETE(m_tooltip); + // JACS - if behaviour is odd, restore this // to the start of ~wxWindow. Vadim has changed // it to nearer the end. Unsure of side-effects @@ -288,6 +311,7 @@ wxWindow::~wxWindow() // delete themselves. #if wxUSE_CONSTRAINTS DeleteRelatedConstraints(); + if (m_constraints) { // This removes any dangling pointers to this window @@ -296,11 +320,9 @@ wxWindow::~wxWindow() delete m_constraints; m_constraints = NULL; } - if (m_windowSizer) - { - delete m_windowSizer; - m_windowSizer = NULL; - } + + wxDELETE(m_windowSizer); + // If this is a child of a sizer, remove self from parent if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this); @@ -364,8 +386,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - Init(); - wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" ); parent->AddChild(this); @@ -499,7 +519,8 @@ void wxWindow::SetDropTarget(wxDropTarget *pDropTarget) m_pDropTarget->Register(m_hWnd); } -#endif +#endif // wxUSE_DRAG_AND_DROP + //old style file-manager drag&drop support // I think we should retain the old-style @@ -512,6 +533,24 @@ void wxWindow::DragAcceptFiles(bool accept) ::DragAcceptFiles(hWnd, (BOOL)accept); } +// ---------------------------------------------------------------------------- +// tooltips +// ---------------------------------------------------------------------------- + +void wxWindow::SetToolTip(const wxString &tip) +{ + SetToolTip(new wxToolTip(tip)); +} + +void wxWindow::SetToolTip(wxToolTip *tooltip) +{ + if ( m_tooltip ) + delete m_tooltip; + + m_tooltip = tooltip; + m_tooltip->SetWindow(this); +} + // Get total size void wxWindow::GetSize(int *x, int *y) const { @@ -619,6 +658,12 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); + int currentW,currentH; + GetSize(¤tW, ¤tH); + + if (x == currentX && y == currentY && width == currentW && height == currentH) + return; + int actualWidth = width; int actualHeight = height; int actualX = x; @@ -630,8 +675,6 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) AdjustForParentClientOrigin(actualX, actualY, sizeFlags); - int currentW,currentH; - GetSize(¤tW, ¤tH); if (width == -1) actualWidth = currentW ; if (height == -1) @@ -781,7 +824,7 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y, // fontToUse->ReleaseResource(); } -void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect) +void wxWindow::Refresh(bool eraseBack, const wxRect *rect) { HWND hWnd = (HWND) GetHWND(); if (hWnd) @@ -839,7 +882,6 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA wxWndHook = NULL; wnd->m_hWnd = (WXHWND) hWnd; } - // wxDebugMsg("hWnd = %d, m_hWnd = %d, msg = %d\n", hWnd, m_hWnd, message); // Stop right here if we don't have a valid handle // in our wxWnd object. @@ -864,21 +906,20 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA // Should probably have a test for 'genuine' NT #if defined(__WIN32__) -#define DIMENSION_TYPE short + #define DIMENSION_TYPE short #else -#define DIMENSION_TYPE int + #define DIMENSION_TYPE int #endif // Main Windows 3 window proc long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { wxASSERT( m_lastMsg == message && - m_lastWParam == wParam && - m_lastLParam == lParam ); + m_lastWParam == wParam && m_lastLParam == lParam ); #ifdef __WXDEBUG__ wxLogTrace(wxTraceMessages, "Processing %s(%lx, %lx)", - wxGetMessageName(message), wParam, lParam); + wxGetMessageName(message), wParam, lParam); #endif // __WXDEBUG__ HWND hWnd = (HWND)m_hWnd; @@ -1160,7 +1201,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) break; } +#if 0 case WM_KEYDOWN: + { + MSWOnKeyDown((WORD) wParam, lParam); // we consider these message "not interesting" if ( wParam == VK_SHIFT || wParam == VK_CONTROL ) return Default(); @@ -1179,7 +1223,14 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) else return Default(); break; + } +#endif + case WM_KEYUP: + { + MSWOnKeyUp((WORD) wParam, lParam); + break; + } case WM_CHAR: // Always an ASCII character { MSWOnChar((WORD)wParam, lParam, TRUE); @@ -1408,7 +1459,7 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) { // adding NULL hWnd is (first) surely a result of an error and // (secondly) breaks menu command processing - wxCHECK_RET( hWnd != NULL, "attempt to add a NULL hWnd to window list" ); + wxCHECK_RET( hWnd != (HWND) NULL, "attempt to add a NULL hWnd to window list" ); if ( !wxWinHandleList->Find((long)hWnd) ) wxWinHandleList->Append((long)hWnd, win); @@ -1467,10 +1518,18 @@ void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent, (DLGPROC)wxDlgProc); #else + // N.B.: if we _don't_ use this form, + // then with VC++ 1.5, it crashes horribly. +#if 1 + m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent, + (DLGPROC)wxDlgProc); +#else + // Crashes when we use this. DLGPROC dlgproc = (DLGPROC)MakeProcInstance((DLGPROC)wxWndProc, wxGetInstance()); m_hWnd = (WXHWND) ::CreateDialog(wxGetInstance(), dialog_template, hParent, (DLGPROC)dlgproc); +#endif #endif if (m_hWnd == 0) @@ -1590,25 +1649,29 @@ long wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam) if ( win ) { - win->MSWNotify(wParam, lParam, &result); + if ( win->MSWNotify(wParam, lParam, &result) ) + return result; } else { // Rely on MSWNotify to check whether the message // belongs to the window or not - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *child = (wxWindow *)node->Data(); if ( child->MSWNotify(wParam, lParam, &result) ) - break; + return result; node = node->Next(); } - } - return result; + // finally try this window too (catches toolbar case) + if ( MSWNotify(wParam, lParam, &result) ) + return result; + } #endif // Win95 + // not processed return FALSE; } @@ -1817,7 +1880,7 @@ long wxWindow::MSWOnQueryNewPalette() // Responds to colour changes: passes event on to children. void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event) { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { // Only propagate to non-top-level windows @@ -1876,14 +1939,19 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0); } - bool bForward = TRUE; + bool bForward = TRUE, + bWindowChange = FALSE; if ( bProcess ) { switch ( msg->wParam ) { case VK_TAB: - if ( lDlgCode & DLGC_WANTTAB ) // FALSE for Ctrl-Tab + if ( lDlgCode & DLGC_WANTTAB ) { bProcess = FALSE; - else + } + else { + // Ctrl-Tab cycles thru notebook pages + bWindowChange = bCtrlDown; bForward = !(::GetKeyState(VK_SHIFT) & 0x100); + } break; case VK_UP: @@ -1900,6 +1968,18 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) bProcess = FALSE; break; + case VK_RETURN: + // if there is a default button, Enter should press it + if ( !GetDefaultItem() ) { + // but if there is not it makes sense to make it work + // like a TAB + + // nothing to do - all variables are already set + + break; + } + //else: fall through and don't process the message + default: bProcess = FALSE; } @@ -1908,7 +1988,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) if ( bProcess ) { wxNavigationKeyEvent event; event.SetDirection(bForward); - event.SetWindowChange(bCtrlDown); + event.SetWindowChange(bWindowChange); event.SetEventObject(this); if ( GetEventHandler()->ProcessEvent(event) ) @@ -1917,6 +1997,14 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) return ::IsDialogMessage((HWND)GetHWND(), msg) != 0; } +#if wxUSE_TOOLTIPS + else if ( m_tooltip ) { + // relay mouse move events to the tooltip control + MSG *msg = (MSG *)pMsg; + if ( msg->message == WM_MOUSEMOVE ) + m_tooltip->RelayEvent(pMsg); + } +#endif // wxUSE_TOOLTIPS return FALSE; } @@ -2068,7 +2156,7 @@ void wxWindow::MSWOnLButtonDown(int x, int y, WXUINT flags) event.SetTimestamp(wxApp::sm_lastMessageTime); event.m_eventObject = this; - m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_LEFT_DOWN; + m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_DOWN; if (!GetEventHandler()->ProcessEvent(event)) Default(); @@ -2380,6 +2468,74 @@ void wxWindow::MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII) } } +void wxWindow::MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam, bool isASCII) +{ + int id; + + if ((id = wxCharCodeMSWToWX(wParam)) == 0) { + id = wParam; + } + + if (id != -1) + { + wxKeyEvent event(wxEVT_KEY_DOWN); + event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); + event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); + if ((HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN) + event.m_altDown = TRUE; + + event.m_eventObject = this; + event.m_keyCode = id; + event.SetTimestamp(wxApp::sm_lastMessageTime); + + POINT pt ; + GetCursorPos(&pt) ; + RECT rect ; + GetWindowRect((HWND) GetHWND(),&rect) ; + pt.x -= rect.left ; + pt.y -= rect.top ; + + event.m_x = pt.x; event.m_y = pt.y; + + if (!GetEventHandler()->ProcessEvent(event)) + Default(); + } +} + +void wxWindow::MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam, bool isASCII) +{ + int id; + + if ((id = wxCharCodeMSWToWX(wParam)) == 0) { + id = wParam; + } + + if (id != -1) + { + wxKeyEvent event(wxEVT_KEY_UP); + event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); + event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); + if ((HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN) + event.m_altDown = TRUE; + + event.m_eventObject = this; + event.m_keyCode = id; + event.SetTimestamp(wxApp::sm_lastMessageTime); + + POINT pt ; + GetCursorPos(&pt) ; + RECT rect ; + GetWindowRect((HWND) GetHWND(),&rect) ; + pt.x -= rect.left ; + pt.y -= rect.top ; + + event.m_x = pt.x; event.m_y = pt.y; + + if (!GetEventHandler()->ProcessEvent(event)) + Default(); + } +} + void wxWindow::MSWOnJoyDown(int joystick, int x, int y, WXUINT flags) { int buttons = 0; @@ -2871,7 +3027,7 @@ void wxSetKeyboardHook(bool doIt) { wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance()); wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(), -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) GetCurrentThreadId()); // (DWORD)GetCurrentProcess()); // This is another possibility. Which is right? #else @@ -2955,13 +3111,6 @@ void wxWindow::Centre(int direction) } -/* TODO (maybe) -void wxWindow::OnPaint() -{ -PaintSelectionHandles(); -} -*/ - void wxWindow::WarpPointer (int x_pos, int y_pos) { // Move the pointer to (x_pos,y_pos) coordinates. They are expressed in @@ -3010,10 +3159,14 @@ bool wxWindow::MSWOnEraseBkgnd (WXHDC pDC) void wxWindow::OnEraseBackground(wxEraseEvent& event) { + if (!GetHWND()) + return; + RECT rect; ::GetClientRect((HWND) GetHWND(), &rect); - HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); + COLORREF ref = PALETTERGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue()) ; + HBRUSH hBrush = ::CreateSolidBrush(ref); int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT); // ::GetClipBox((HDC) event.GetDC()->GetHDC(), &rect); @@ -3188,7 +3341,7 @@ int wxWindow::GetScrollRange(int orient) const #if defined(__WIN95__) // Try to adjust the range to cope with page size > 1 // - a Windows API quirk - int pageSize = GetScrollPage(orient); + int pageSize = GetScrollThumb(orient); if ( pageSize > 1 ) { maxPos -= (pageSize - 1); @@ -3310,7 +3463,7 @@ SetScrollPage(orient, thumbVisible, FALSE); } } -void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect) +void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) { RECT rect2; if ( rect ) @@ -3452,14 +3605,17 @@ WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) void wxWindow::OnChar(wxKeyEvent& event) { +#if 0 if ( event.KeyCode() == WXK_TAB ) { // propagate the TABs to the parent - it's up to it to decide what // to do with it - if ( GetParent() ) { - if ( GetParent()->GetEventHandler()->ProcessEvent(event) ) + wxWindow *parent = GetParent(); + if ( parent ) { + if ( parent->GetEventHandler()->ProcessEvent(event) ) return; } } +#endif // 0 bool isVirtual; int id = wxCharCodeWXToMSW((int)event.KeyCode(), &isVirtual); @@ -3471,11 +3627,6 @@ void wxWindow::OnChar(wxKeyEvent& event) (void) MSWDefWindowProc(m_lastMsg, (WPARAM) id, m_lastLParam); } -void wxWindow::OnPaint(wxPaintEvent& event) -{ - Default(); -} - bool wxWindow::IsEnabled(void) const { return (::IsWindowEnabled((HWND) GetHWND()) != 0); @@ -3492,7 +3643,7 @@ bool wxWindow::IsEnabled(void) const // it's an application error (pops up a dialog) bool wxWindow::TransferDataToWindow() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -3512,7 +3663,7 @@ bool wxWindow::TransferDataToWindow() // validation failed: don't quit bool wxWindow::TransferDataFromWindow() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -3528,7 +3679,7 @@ bool wxWindow::TransferDataFromWindow() bool wxWindow::Validate() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -3555,30 +3706,28 @@ wxWindow *wxWindow::FindFocus() void wxWindow::AddChild(wxWindow *child) { - GetChildren()->Append(child); + GetChildren().Append(child); child->m_windowParent = this; } void wxWindow::RemoveChild(wxWindow *child) { - if (GetChildren()) - GetChildren()->DeleteObject(child); +// if (GetChildren()) + GetChildren().DeleteObject(child); child->m_windowParent = NULL; } void wxWindow::DestroyChildren() { - if (GetChildren()) { wxNode *node; - while ((node = GetChildren()->First()) != (wxNode *)NULL) { + while ((node = GetChildren().First()) != (wxNode *)NULL) { wxWindow *child; if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) { delete child; - if ( GetChildren()->Member(child) ) + if ( GetChildren().Member(child) ) delete node; } } /* while */ - } } void wxWindow::MakeModal(bool modal) @@ -3793,7 +3942,7 @@ bool wxWindow::DoPhase(int phase) { noChanges = 0; noFailures = 0; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *child = (wxWindow *)node->Data(); @@ -3838,7 +3987,7 @@ void wxWindow::ResetConstraints() constr->centreX.SetDone(FALSE); constr->centreY.SetDone(FALSE); } - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *win = (wxWindow *)node->Data(); @@ -3897,7 +4046,7 @@ void wxWindow::SetConstraintSizes(bool recurse) if (recurse) { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *win = (wxWindow *)node->Data(); @@ -4035,9 +4184,9 @@ bool wxWindow::Close(bool force) wxObject* wxWindow::GetChild(int number) const { // Return a pointer to the Nth object in the Panel - if (!GetChildren()) - return(NULL) ; - wxNode *node = GetChildren()->First(); +// if (!GetChildren()) +// return(NULL) ; + wxNode *node = GetChildren().First(); int n = number; while (node && n--) node = node->Next() ; @@ -4099,7 +4248,7 @@ void wxWindow::Fit() { int maxX = 0; int maxY = 0; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *win = (wxWindow *)node->Data(); @@ -4132,7 +4281,7 @@ wxWindow *wxWindow::FindWindow(long id) if ( GetId() == id) return this; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -4149,7 +4298,7 @@ wxWindow *wxWindow::FindWindow(const wxString& name) if ( GetName() == name) return this; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -4318,6 +4467,7 @@ long wxWindow::MSWGetDlgCode() bool wxWindow::AcceptsFocus() const { + // invisible and disabled controls don't need focus return IsShown() && IsEnabled(); }