Esempio n. 1
0
        private static IntPtr XmlSubclassCreateCS(IntPtr className)
        {
            string name     = new wxString(className);
            string assembly = null;
            // Allow these two formats for for class names:
            //   class
            //   [assembly]class (specify assembly)
            Match m = Regex.Match(name, "\\[(.+)\\]");

            if (m.Success)
            {
                assembly = m.Result("$1");
                name     = m.Result("$'");
            }
            else
            {
                assembly = _SubclassAssembly;
            }

            // Use caller's assembly?
            if ((assembly == null) || (assembly == ""))
            {
                assembly = _CallerAssembly;
            }

            // Tack on any namespace prefix to the class? Only if the
            // class does not already have a "." in it
            if (name.IndexOf(".") == -1)
            {
                string ns = "";
                // Use caller's namespace?
                if ((_SubclassNamespace == null) || (_SubclassNamespace == ""))
                {
                    ns = _CallerNamespace;
                }
                else
                {
                    ns = _SubclassNamespace;
                }
                name = ns + "." + name;
            }

            try {
                Console.WriteLine("Attempting to create {0} from assembly {1}",
                                  name, assembly);
                ObjectHandle handle = Activator.CreateInstance(assembly, name);

                if (handle == null)
                {
                    return(IntPtr.Zero);
                }

                Object o = (Object)handle.Unwrap();
                return(o.wxObject);
            } catch (Exception e) {
                Console.WriteLine(e);

                return(IntPtr.Zero);
            }
        }
Esempio n. 2
0
        //-----------------------------------------------------------------------------

        /*public DocManager DocumentManager
         * {
         *  get { return (DocManager)FindObject(wxDocument_GetDocumentManager(wxObject), DocManager); }
         * }
         *
         * //-----------------------------------------------------------------------------
         *
         * public DocTemplate DocumentTemplate
         * {
         *  get { return (DocTemplate)FindObject(return wxDocument_GetDocumentTemplate(wxObject), DocTemplate);
         *  set { wxDocument_SetDocumentTemplate(wxObject, Object.SafePtr(value)); }
         * }*/

        //-----------------------------------------------------------------------------

        public bool GetPrintableName(out string buf)
        {
            wxString name = "";
            bool     ret  = wxDocument_GetPrintableName(wxObject, Object.SafePtr(name));

            buf = name;

            return(ret);
        }
Esempio n. 3
0
        public bool Read(string key, ref string str, string defVal)
        {
            bool     ret;
            wxString wstr = new wxString(str);

            ret = wxConfigBase_ReadStrDef(wxObject, key, wxString.SafePtr(wstr), defVal);
            str = wstr;

            return(ret);
        }
Esempio n. 4
0
        public bool GetNextEntry(ref string str, ref int lIndex)
        {
            bool     ret;
            wxString wstr = new wxString(str);

            ret = wxConfigBase_GetNextEntry(wxObject, wxString.SafePtr(wstr), ref lIndex);
            str = wstr;

            return(ret);
        }