xj qian
2024-07-01 01ecca79b7c23d690ba21fb182dd1f56f2f182ed
jrj/xframe/vbusiness/vframe/responsewin.vframe.vbusiness.hpp
@@ -3,12 +3,114 @@
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <wobject/xapp.hpp>
class responsewin : public xwin
class responsewin : public xframe
{
public:
   responsewin(void* impl, HWND hWnd) :xwin(impl, hWnd) {}
   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;
   }
};