X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..921f5019a6e6fd0c5983b7ebe7e02c53a9776998:/src/msw/nativdlg.cpp diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index 0d9fca1ca2..ed6efcdd49 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // =========================================================================== @@ -34,7 +34,7 @@ #include "wx/wx.h" #endif -#if defined(__WIN95__) && !defined(__TWIN32__) +#if defined(__WIN95__) #include "wx/spinbutt.h" #endif #include "wx/msw/private.h" @@ -43,7 +43,6 @@ // global functions // --------------------------------------------------------------------------- -extern wxWindow *wxWndHook; extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -54,12 +53,12 @@ extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message, bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) { m_windowId = id; - wxWndHook = this; + + wxWindowCreationHook hook(this); m_hWnd = (WXHWND)::CreateDialog((HINSTANCE)wxGetInstance(), MAKEINTRESOURCE(id), parent ? (HWND)parent->GetHWND() : 0, (DLGPROC) wxDlgProc); - wxWndHook = NULL; if ( !m_hWnd ) return FALSE; @@ -93,12 +92,11 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) { SetName(name); - wxWndHook = this; + wxWindowCreationHook hook(this); m_hWnd = (WXHWND)::CreateDialog((HINSTANCE) wxGetInstance(), name.c_str(), parent ? (HWND)parent->GetHWND() : 0, (DLGPROC)wxDlgProc); - wxWndHook = NULL; if ( !m_hWnd ) return FALSE; @@ -110,7 +108,20 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) else wxTopLevelWindows.Append(this); - // FIXME why don't we enum all children here? + // Enumerate all children + HWND hWndNext; + hWndNext = ::GetWindow((HWND) m_hWnd, GW_CHILD); + + wxWindow* child = NULL; + if (hWndNext) + child = CreateWindowFromHWND(this, (WXHWND) hWndNext); + + while (hWndNext != (HWND) NULL) + { + hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); + if (hWndNext) + child = CreateWindowFromHWND(this, (WXHWND) hWndNext); + } return TRUE; } @@ -124,7 +135,7 @@ wxWindow* wxWindow::GetWindowChild1(wxWindowID id) if ( m_windowId == id ) return this; - wxWindowList::Node *node = GetChildren().GetFirst(); + wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); while ( node ) { wxWindow* child = node->GetData(); @@ -173,7 +184,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) wxWindow* win = NULL; - if (str == T("BUTTON")) + if (str == wxT("BUTTON")) { int style1 = (style & 0xFF); if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) || @@ -185,12 +196,13 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { win = new wxRadioButton; } +#if wxUSE_BMPBUTTON #if defined(__WIN32__) && defined(BS_BITMAP) else if (style & BS_BITMAP) { // TODO: how to find the bitmap? win = new wxBitmapButton; - wxLogError(T("Have not yet implemented bitmap button as BS_BITMAP button.")); + wxLogError(wxT("Have not yet implemented bitmap button as BS_BITMAP button.")); } #endif else if (style1 == BS_OWNERDRAW) @@ -203,6 +215,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) // with a switch in the drawing code. Call default proc if BS_BITMAP. win = new wxBitmapButton; } +#endif else if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON)) { win = new wxButton; @@ -213,11 +226,11 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) } else { - wxLogError(T("Don't know what kind of button this is: id = %d"), + wxLogError(wxT("Don't know what kind of button this is: id = %ld"), id); } } - else if (str == T("COMBOBOX")) + else if (str == wxT("COMBOBOX")) { win = new wxComboBox; } @@ -227,48 +240,56 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) // for correct functioning. // Could have wxWindow::AdoptAttributesFromHWND(WXHWND) // to be overridden by each control class. - else if (str == T("EDIT(")) + else if (str == wxT("EDIT")) { win = new wxTextCtrl; } - else if (str == T("LISTBOX")) + else if (str == wxT("LISTBOX")) { win = new wxListBox; } - else if (str == T("SCROLLBAR")) + else if (str == wxT("SCROLLBAR")) { win = new wxScrollBar; } -#if defined(__WIN95__) && !defined(__TWIN32__) - else if (str == T("MSCTLS_UPDOWN32")) +#if defined(__WIN95__) && wxUSE_SPINBTN + else if (str == wxT("MSCTLS_UPDOWN32")) { win = new wxSpinButton; } #endif - else if (str == T("MSCTLS_TRACKBAR32")) +#if wxUSE_SLIDER + else if (str == wxT("MSCTLS_TRACKBAR32")) { // Need to ascertain if it's horiz or vert win = new wxSlider; } - else if (str == T("STATIC")) +#endif // wxUSE_SLIDER + else if (str == wxT("STATIC")) { int style1 = (style & 0xFF); - if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) || (style1 == SS_SIMPLE)) + if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) +#ifndef __WXWINCE__ + || (style1 == SS_SIMPLE) +#endif + ) win = new wxStaticText; +#if wxUSE_STATBMP #if defined(__WIN32__) && defined(BS_BITMAP) else if (style1 == SS_BITMAP) { win = new wxStaticBitmap; // Help! this doesn't correspond with the wxWin implementation. - wxLogError(T("Please make SS_BITMAP statics into owner-draw buttons.")); + wxLogError(wxT("Please make SS_BITMAP statics into owner-draw buttons.")); } #endif +#endif /* wxUSE_STATBMP */ } else { - wxString msg(T("Don't know how to convert from Windows class ")); + wxString msg(wxT("Don't know how to convert from Windows class ")); msg += str; wxLogError(msg); } @@ -282,11 +303,9 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) win->SubclassWin(hWnd); win->AdoptAttributesFromHWND(); win->SetupColours(); - - return win; } - else - return NULL; + + return win; } // Make sure the window style (etc.) reflects the HWND style (roughly)