]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xh_unkwn.cpp
Unicode build fix
[wxWidgets.git] / src / xrc / xh_unkwn.cpp
index 4ff17331255d181695cea5bc0578729e75407e07..0dae73bc63af57a3dc5d5b7289ff2cb4a68bf1bf 100644 (file)
@@ -8,7 +8,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "xh_unkwn.h"
 #endif
 
@@ -19,6 +19,8 @@
     #pragma hdrstop
 #endif
 
+#if wxUSE_XRC
+
 #include "wx/xrc/xh_unkwn.h"
 #include "wx/window.h"
 #include "wx/log.h"
@@ -31,7 +33,7 @@ class wxUnknownControlContainer : public wxPanel
 public:
     wxUnknownControlContainer(wxWindow *parent,
                               const wxString& controlName,
-                              wxWindowID id = -1,
+                              wxWindowID id = wxID_ANY,
                               const wxPoint& pos = wxDefaultPosition,
                               const wxSize& size = wxDefaultSize,
                               long style = 0)
@@ -68,7 +70,6 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child)
     wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
     sizer->Add((wxWindow*)child, 1, wxEXPAND);
     SetSizer(sizer);
-    SetAutoLayout(true);
     Layout();
 }
 
@@ -90,9 +91,12 @@ wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
 
 wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
 {
+    wxASSERT_MSG( m_instance == NULL,
+                  _T("'unknown' controls can't be subclassed, use wxXmlResource::AttachUnknownControl") );
+
     wxPanel *panel =
         new wxUnknownControlContainer(m_parentAsWindow,
-                                      GetName(), -1,
+                                      GetName(), wxID_ANY,
                                       GetPosition(), GetSize(),
                                       GetStyle(wxT("style")));
     SetupWindow(panel);
@@ -104,3 +108,4 @@ bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node)
     return IsOfClass(node, wxT("unknown"));
 }
 
+#endif // wxUSE_XRC