X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8c18da2e41b828804dce26bafa93bd21ca8a04b9..f3ebca94dddd57008b48c466d3e4919ba4e6a6f4:/src/msw/nativdlg.cpp diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index 5d251c9cc8..fd61bcf8e2 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -17,7 +17,7 @@ // headers // --------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation #endif @@ -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" @@ -61,7 +61,7 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) (DLGPROC) wxDlgProc); if ( !m_hWnd ) - return FALSE; + return false; SubclassWin(GetHWND()); @@ -74,18 +74,17 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) HWND hWndNext; hWndNext = ::GetWindow((HWND) m_hWnd, GW_CHILD); - wxWindow* child = NULL; if (hWndNext) - child = CreateWindowFromHWND(this, (WXHWND) hWndNext); + CreateWindowFromHWND(this, (WXHWND) hWndNext); while (hWndNext != (HWND) NULL) { hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); if (hWndNext) - child = CreateWindowFromHWND(this, (WXHWND) hWndNext); + CreateWindowFromHWND(this, (WXHWND) hWndNext); } - return TRUE; + return true; } bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) @@ -99,7 +98,7 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) (DLGPROC)wxDlgProc); if ( !m_hWnd ) - return FALSE; + return false; SubclassWin(GetHWND()); @@ -108,9 +107,21 @@ 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); - return TRUE; + if (hWndNext) + CreateWindowFromHWND(this, (WXHWND) hWndNext); + + while (hWndNext != (HWND) NULL) + { + hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); + if (hWndNext) + CreateWindowFromHWND(this, (WXHWND) hWndNext); + } + + return true; } // --------------------------------------------------------------------------- @@ -122,7 +133,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(); @@ -174,25 +185,32 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) if (str == wxT("BUTTON")) { int style1 = (style & 0xFF); +#if wxUSE_CHECKBOX if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) || (style1 == BS_CHECKBOX)) { win = new wxCheckBox; } - else if ((style1 == BS_AUTORADIOBUTTON) || (style1 == BS_RADIOBUTTON)) + else +#endif +#if wxUSE_RADIOBTN + if ((style1 == BS_AUTORADIOBUTTON) || (style1 == BS_RADIOBUTTON)) { win = new wxRadioButton; } + else +#endif #if wxUSE_BMPBUTTON #if defined(__WIN32__) && defined(BS_BITMAP) - else if (style & BS_BITMAP) + if (style & BS_BITMAP) { // TODO: how to find the bitmap? win = new wxBitmapButton; wxLogError(wxT("Have not yet implemented bitmap button as BS_BITMAP button.")); } + else #endif - else if (style1 == BS_OWNERDRAW) + if (style1 == BS_OWNERDRAW) { // TODO: how to find the bitmap? // TODO: can't distinguish between bitmap button and bitmap static. @@ -202,25 +220,34 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) // with a switch in the drawing code. Call default proc if BS_BITMAP. win = new wxBitmapButton; } + else #endif - else if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON)) +#if wxUSE_BUTTON + if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON)) { win = new wxButton; } - else if (style1 == BS_GROUPBOX) + else +#endif +#if wxUSE_STATBOX + if (style1 == BS_GROUPBOX) { win = new wxStaticBox; } else +#endif { wxLogError(wxT("Don't know what kind of button this is: id = %ld"), id); } } +#if wxUSE_COMBOBOX else if (str == wxT("COMBOBOX")) { win = new wxComboBox; } +#endif +#if wxUSE_TEXTCTRL // TODO: Problem if the user creates a multiline - but not rich text - text control, // since wxWin assumes RichEdit control for this. Should have m_isRichText in // wxTextCtrl. Also, convert as much of the window style as is necessary @@ -231,15 +258,20 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { win = new wxTextCtrl; } +#endif +#if wxUSE_LISTBOX else if (str == wxT("LISTBOX")) { win = new wxListBox; } +#endif +#if wxUSE_SCROLLBAR else if (str == wxT("SCROLLBAR")) { win = new wxScrollBar; } -#if defined(__WIN95__) && !defined(__TWIN32__) && wxUSE_SPINBTN +#endif +#if defined(__WIN95__) && wxUSE_SPINBTN else if (str == wxT("MSCTLS_UPDOWN32")) { win = new wxSpinButton; @@ -252,11 +284,16 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) win = new wxSlider; } #endif // wxUSE_SLIDER +#if wxUSE_STATTEXT 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) @@ -268,8 +305,9 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) wxLogError(wxT("Please make SS_BITMAP statics into owner-draw buttons.")); } #endif -#endif /* wxUSE_STATBMP */ +#endif /* wxUSE_STATBMP */ } +#endif else { wxString msg(wxT("Don't know how to convert from Windows class "));