xj qian
2024-07-01 01ecca79b7c23d690ba21fb182dd1f56f2f182ed
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#pragma once
 
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <wobject/xapp.hpp>
class responsewin : public xframe
{
public:
    responsewin(void* impl, HWND hWnd) :xframe(impl, hWnd) {}
    virtual int SetAgent()
    {
        return 1;
    }
 
    virtual int PreOnSetFocus()
    {
        //·µ»Ø0¡ª¡ª²»ÔÚÖ´ÐÐÒÔÏ´úÂ룻·µ»ØÆäËû¡ª¡ªÖ´ÐÐÒÔÏ´úÂë¡£
        return 1;
    }
 
    //½¹µã¼¤»î´¦Àíº¯Êý
    int OnSetFocus(TEvent* evt, int p)
    {
        //ÖØÖù¤¾ßÌõ
        SetAgent();
        return 1;
    }
 
    virtual int PreOnCmdDispatch(xstring comdid)
    {
        //·µ»Ø0¡ª¡ª²»ÔÚÖ´ÐÐÒÔÏ´úÂ룻·µ»ØÆäËû¡ª¡ªÖ´ÐÐÒÔÏ´úÂë¡£
        return 1;
    }
 
    virtual int PostOnCmdDispatch(xstring comdid, int rtn)
    {
        return 1;
    }
 
    int OnCmdDispatch(xstring comdid)
    {
        int rtn = 0;
        if (PreOnCmdDispatch(comdid) == 0)
            return 1;
 
        if (comdid.find(L"action:", 0) >= 0)
            rtn = ProcessFlowAction(comdid, 1);
 
        if (PostOnCmdDispatch(comdid, rtn) != 1)
        {
            alert(L"error");
            return 1;
        }
 
        return rtn;
    }
 
    //ÃüÁî´¦Àíʼþ
    int OnXCommand(TEvent* evt, int p)
    {
        /*xwin::SendMessage(sPHWND.toInt(),0x401,sAssortmentHwnd,0);
        struct TEvent
        {
            int        hWnd; //this.GetHWND().toString()
            int        message;//WM_XCOMMAND 0x401, evt.message.toString()ÊÇÊ®½øÖÆ1045
            int        wParam;
            int        lParam;δʹÓÃ
            int        time;
            xpoint    pt;
        };
        struct TXCommandEvent : public TEvent
        {
            native string pStrID;
        };*/
        //string str = "ccc"+evt.wParam.toString(); 
        //alert(str);
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
 
    int OnClose(TEvent* evt, int p)
    {
 
        return 1;
    }
 
    virtual int PostOnAttachEvent()
    {
        return 1;
    }
 
    int OnAttachEvent()
    {
        //°ó¶¨¹¤¾ßÌõµã»÷ʼþ
        AttachEvent(L"WM_XCOMMAND", (FEvent)&responsewin::OnXCommand);
        //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
        AttachEvent(L"WM_SETFOCUS", (FEvent)&responsewin::OnSetFocus);
        //AttachEvent("WM_CLOSE",OnClose);
 
        PostOnAttachEvent();
        return 0;
    }
 
    virtual int OnInit()
    {
        return 1;
    }
 
    int onload()
    {
        SetAgent();
        OnAttachEvent();
 
        OnInit();
        return 1;
    }
};