LiFan
10 天以前 63eebabbfee1bc84850b36967ecac5116a28b73f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <wobject/xstring.hpp>
#include <wobject/xwin.hpp>
#include <wobject/xaserver.hpp>
#include <wobject/xaserverarg.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xsedit.hpp>
#include <xcontrol/xcombobox.hpp>
#include "XDevEditPage.hpp"
 
using xml = KXMLDOMDocument;
class export dw_xwkdlg : public XDevEditPage
{
    public:
    dw_xwkdlg(void* implPtr, HWND hWnd) :XDevEditPage(implPtr, hWnd) {}
public:
    static dw_xwkdlg* CreateInstance(void* implPtr, void* hWnd)
    {
        dw_xwkdlg* pWin = new dw_xwkdlg(implPtr, (HWND)hWnd);
        return pWin;
    }
private:    //
    xtreeview tv_folder;
 
public:
    //ÃüÁî·¢²¼º¯Êý
    int OnCmdDispatch(xstring comdid)
    {
        if (GetWinParam())
        {
            SetArg();
            xaserverarg arg = GetArg();
            if (comdid == L"xmDevOk")
            {
                HTREEITEM hItem = tv_folder.GetSelectedItem();
                if (!hItem)
                {
                    MessageBox(0,L"ÇëÑ¡Ôñ¹¦ÄÜÄ£¿é!",L"",0);
                    return 1;
                }
                KXMLDOMElement e = tv_folder.GetItemData(hItem);
                //xstring node = e.tagName();
                xstring node = e.getAttribute(L"name");
                if (node== L"file")
                {
                    xstring caption = e.getAttribute(L"caption");
                    xstring guid = e.getAttribute(L"guid");
                    arg.AddArg(L"guid",L"" + guid);
                    arg.AddArg(L"caption",L"" + caption);
                }
                else
                {
                    MessageBox(0,L"ÇëÑ¡Ôñ¹¦ÄÜÄ£¿é!",L"",0);
                    return 1;
                }
            }
            else
            {
                arg.AddArg(L"guid",L"");
                arg.AddArg(L"caption",L"");
            }
        }
        CloseWindow();
        return 0;
    }
 
    //ÃüÁî´¦Àíʼþ
    int OnXCommand(TEvent* evt, LPARAM p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
 
    int OnAttachEvent()
    {
        //°ó¶¨¹¤¾ßÌõµã»÷ʼþ
        AttachEvent(L"WM_XCOMMAND", (FEvent)&dw_xwkdlg::OnXCommand);
        return 1;
    }
 
    int OnInitial()
    {
        OnAttachEvent();
 
        return 1;
    }
 
    int onload()
    {
        SetArg();
        tv_folder = GetControl(L"DevExplorer");
        OnInitial();
        if (GetWinParam()) alert(L"xxx");
        return 1;
    }
};