|  |  | 
 |  |  | #include "win32/win.hpp" | 
 |  |  | #include "wobject/xnode.hpp" | 
 |  |  | #include "wobject/xurl.hpp" | 
 |  |  | #include "wobject/xpage.hpp" | 
 |  |  | #include "wobject/xnode.hpp" | 
 |  |  |  | 
 |  |  | using kwin=Hxsoft::XFrame::IXFWin; | 
 |  |  | using kcontrol = Hxsoft::XFrame::IXFControl; | 
 |  |  | using knode = Hxsoft::XFrame::IXNode; | 
 |  |  |  | 
 |  |  | #define export __declspec(dllexport)  | 
 |  |  | #define DeclWinObject_(ty,pty) class __declspec(dllexport) ty :  public pty | 
 |  |  | #define CreateWinObject_(ty,pty) \ | 
 |  |  | public:\ | 
 |  |  | 
 |  |  |    } | 
 |  |  | public: | 
 |  |  |    xwin(void * impl, HWND hWnd):xview(impl,hWnd){} | 
 |  |  |    xwin(kwin* kw) :xview(kw ? kw : nullptr, kw ? kw->GetHWND() : 0) {} | 
 |  |  |    const xwin& operator =(kwin* kw) { this->SetNativePtr(kw ? kw : nullptr); this->SetHandle(kw ? kw->GetHWND() : 0); return *this; } | 
 |  |  | public: | 
 |  |  |    kwin* getKWin() | 
 |  |  |    { | 
 |  |  | 
 |  |  |       return getKWin()->AttachEvent((LPTSTR)msg,*(Hxsoft::XFrame::FEvent*)&fnEvt,this); | 
 |  |  |    } | 
 |  |  |     | 
 |  |  |    kcontrol* xcontrol(const wchar_t* ctrlname) | 
 |  |  |    kcontrol* GetControl(const wchar_t* ctrlname) | 
 |  |  |    { | 
 |  |  |       return getKWin()->GetControl(ctrlname); | 
 |  |  |    } | 
 |  |  | 
 |  |  |    xnode SetAgentNode(xnode node,xnode val) | 
 |  |  |    { | 
 |  |  |       return xnode(getKWin()->SetAgentNodeContent((knode*)node.getNativePointer(), (knode*)val.getNativePointer())); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    xnode GetXNode() | 
 |  |  |    { | 
 |  |  |       return xnode(getKWin()->GetXNode()); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    Hxsoft::XFrame::IXPage* GetXPage() | 
 |  |  |    { | 
 |  |  |       return getKWin()->GetXPage(); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    LPARAM GetWinParam() | 
 |  |  | 
 |  |  |       return -1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int openUrl(xstring aurl, LPARAM para) | 
 |  |  |    { | 
 |  |  |       KXMLDOMDocument x; | 
 |  |  |  | 
 |  |  |       xurl::get(GetServerUrl(), aurl, L"", x); | 
 |  |  |       KXMLDOMNode n = x.selectSingleNode(L"//resource/@src"); | 
 |  |  |       if (n) | 
 |  |  |       { | 
 |  |  |          string xq = n.text(); | 
 |  |  |          OpenWindow(xq, (LPARAM)para); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          n = x.selectSingleNode(L"//resource[@vface!='' and @view!='']"); | 
 |  |  |          if (n) | 
 |  |  |          { | 
 |  |  |             xstring vface = n.selectSingleNode(L"@vface").text(); | 
 |  |  |             xstring view = n.selectSingleNode(L"@view").text(); | 
 |  |  |             xstring config = n.selectSingleNode(L"@config").text(); | 
 |  |  |  | 
 |  |  |             if (vface == L"." || vface == L"") | 
 |  |  |             { | 
 |  |  |                string v = n.selectSingleNode(L"@url").text(); | 
 |  |  |                xstring burl = xstring(aurl).mid(0, xstring(aurl).find(v, 0)); | 
 |  |  |                return openUrl(burl + view, para); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |                return openUrl(vface + L"/" + view, para); | 
 |  |  |          } | 
 |  |  |       } | 
 |  |  |       return -1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    int CloseWindow() | 
 |  |  |    { | 
 |  |  |       return getKWin()->CloseWindow(); | 
 |  |  | 
 |  |  |    { | 
 |  |  |       return getKWin()->SwitchLayer((LPTSTR)pStrLayerSheet, (LPTSTR)pStrLayerFrame); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    xpage GetChildXPage(string name) | 
 |  |  |    { | 
 |  |  |       xnode tnode = GetXNode().GetNodeByName(name); | 
 |  |  |       if (!tnode) return 0; | 
 |  |  |       return tnode.GetXPage(); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    kwin* GetChildWin(string name) | 
 |  |  |    { | 
 |  |  |       xpage tpage = GetChildXPage(name); | 
 |  |  |       if (!tpage) return nullptr; | 
 |  |  |       return tpage.GetWin(); | 
 |  |  |    } | 
 |  |  | }; |