// 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
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
#include "wx/wx.h"
#endif
-#if defined(__WIN95__) && !defined(__TWIN32__)
+#if defined(__WIN95__)
#include "wx/spinbutt.h"
#endif
#include "wx/msw/private.h"
// global functions
// ---------------------------------------------------------------------------
-extern wxWindow *wxWndHook;
extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
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;
{
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;
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;
}
{
win = new wxRadioButton;
}
+#if wxUSE_BMPBUTTON
#if defined(__WIN32__) && defined(BS_BITMAP)
else if (style & BS_BITMAP)
{
// 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;
}
else
{
- wxLogError(wxT("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);
}
}
{
win = new wxScrollBar;
}
-#if defined(__WIN95__) && !defined(__TWIN32__) && wxUSE_SPINBTN
+#if defined(__WIN95__) && wxUSE_SPINBTN
else if (str == wxT("MSCTLS_UPDOWN32"))
{
win = new wxSpinButton;
}
#endif
+#if wxUSE_SLIDER
else if (str == wxT("MSCTLS_TRACKBAR32"))
{
// Need to ascertain if it's horiz or vert
win = new wxSlider;
}
+#endif // wxUSE_SLIDER
else if (str == wxT("STATIC"))
{
int style1 = (style & 0xFF);
if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) || (style1 == SS_SIMPLE))
win = new wxStaticText;
+#if wxUSE_STATBMP
#if defined(__WIN32__) && defined(BS_BITMAP)
else if (style1 == SS_BITMAP)
{
wxLogError(wxT("Please make SS_BITMAP statics into owner-draw buttons."));
}
#endif
+#endif /* wxUSE_STATBMP */
}
else
{
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)