]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1308152 ] wxGrid XRC handler patch HEAD
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Nov 2005 17:26:05 +0000 (17:26 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Nov 2005 17:26:05 +0000 (17:26 +0000)
Start of a wxGrid handler by Agron Selimaj
Applied with corrections. Needs further work for retrieving grid properties
and styles.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36242 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/bakefiles/files.bkl
include/wx/xrc/xh_all.h
include/wx/xrc/xh_grid.h [new file with mode: 0644]
src/xrc/xh_grid.cpp [new file with mode: 0644]
src/xrc/xmlrsall.cpp

index 8a74ab16ce8c4414e10201e79ab9887ece9b3f94..28ca3a9abd8f8c384143ac925cf485b820e2fdb5 100644 (file)
@@ -2631,6 +2631,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/xrc/xh_treebk.cpp
     src/xrc/xh_unkwn.cpp
     src/xrc/xh_wizrd.cpp
+    src/xrc/xh_grid.cpp
     src/xrc/xmlres.cpp
     src/xrc/xmlrsall.cpp
 </set>
@@ -2678,6 +2679,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/xrc/xh_treebk.h
     wx/xrc/xh_unkwn.h
     wx/xrc/xh_wizrd.h
+    wx/xrc/xh_grid.h
     wx/xrc/xmlres.h
 </set>
 
index b3f42aa180b737a96b5e421f5885a4f68861000d..14a4b03b5d1db5c30234a61676d9f0e96de6ca7f 100644 (file)
@@ -56,5 +56,6 @@
 #include "wx/xrc/xh_wizrd.h"
 #include "wx/xrc/xh_statbar.h"
 #include "wx/xrc/xh_mdi.h"
+#include "wx/xrc/xh_grid.h"
 
 #endif // _WX_XH_ALL_H_
diff --git a/include/wx/xrc/xh_grid.h b/include/wx/xrc/xh_grid.h
new file mode 100644 (file)
index 0000000..762ae2d
--- /dev/null
@@ -0,0 +1,34 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        xh_grid.h
+// Purpose:     XML resource handler for the grid control
+// Author:      Agron Selimaj
+// Created:     2005/08/11
+// RCS-ID:      $Id$
+// Copyright:   (c) 2005 Agron Selimaj, Freepour Controls Inc.
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_GRD_H_
+#define _WX_XH_GRD_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "xh_grid.cpp"
+#endif
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC
+
+class WXDLLIMPEXP_XRC wxGridXmlHandler : public wxXmlResourceHandler
+{
+DECLARE_DYNAMIC_CLASS(wxGridXmlHandler)
+public:
+       wxGridXmlHandler();
+    virtual wxObject *DoCreateResource();
+    virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC
+
+
+#endif // _WX_XH_GRD_H_
diff --git a/src/xrc/xh_grid.cpp b/src/xrc/xh_grid.cpp
new file mode 100644 (file)
index 0000000..a5cea99
--- /dev/null
@@ -0,0 +1,51 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        xh_grid.h
+// Purpose:     XML resource handler for the grid control
+// Author:      Agron Selimaj
+// Created:     2005/08/11
+// RCS-ID:      $Id$
+// Copyright:   (c) 2005 Agron Selimaj, Freepour Controls Inc.
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_XRC
+
+#include "wx/xrc/xh_grid.h"
+#include "wx/grid.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxGridXmlHandler, wxXmlResourceHandler)
+
+wxGridXmlHandler::wxGridXmlHandler()
+: wxXmlResourceHandler()
+{
+    AddWindowStyles();
+}
+
+wxObject *wxGridXmlHandler::DoCreateResource()
+{
+    XRC_MAKE_INSTANCE(grid, wxGrid)
+
+    grid->Create(m_parentAsWindow,
+                   GetID(),
+                   GetPosition(), GetSize(),
+                   GetStyle(wxT("style")),
+                   GetName());
+
+    SetupWindow( grid);
+
+    return grid;
+}
+
+bool wxGridXmlHandler::CanHandle(wxXmlNode *node)
+{
+    return IsOfClass(node, wxT("wxGrid"));
+}
+
+#endif // wxUSE_XRC
index db1d0e9003d3c7667588be20a5f91120607bc330..df66f1d675672338b30ac183a43a86457e0c0991 100644 (file)
@@ -118,6 +118,9 @@ void wxXmlResource::InitAllHandlers()
 #if wxUSE_MDI
     AddHandler(new wxMdiXmlHandler);
 #endif
+#if wxUSE_GRID
+    AddHandler( new wxGridXmlHandler);
+#endif
 }
 
 #endif // wxUSE_XRC