1
0

svc_accroleserver.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include <precomp.h>
  2. #include "svc_accroleserver.h"
  3. #include <api/script/objects/guiobject.h>
  4. #include <api/wnd/api_window.h>
  5. #define CBCLASS svc_accRoleServerI
  6. START_DISPATCH;
  7. CB(RS_HANDLEROLE, handleRole);
  8. CB(RS_CREATEOBJECT, createObject);
  9. VCB(RS_DESTROYOBJECT, destroyObject);
  10. END_DISPATCH;
  11. #undef CBCLASS
  12. #define CBCLASS roleServerObjectI
  13. START_DISPATCH;
  14. CB(RSO_WNDPROC, wndProc);
  15. CB(RSO_GETHWND, gethWnd);
  16. CB(RSO_FLATTENCONTENT, flattenContent);
  17. END_DISPATCH;
  18. #undef CBCLASS
  19. roleServerObjectI::roleServerObjectI(HWND par, api_window *w) {
  20. wnd = w;
  21. hwnd = NULL;
  22. parent = par;
  23. triedyet = 0;
  24. }
  25. roleServerObjectI::~roleServerObjectI() {
  26. if (hwnd != NULL)
  27. DestroyWindow(hwnd);
  28. }
  29. api_window *roleServerObjectI::getWnd() {
  30. return wnd;
  31. }
  32. HWND roleServerObjectI::gethWnd() {
  33. if (!triedyet) {
  34. triedyet = 1;
  35. hwnd = createWindow(parent);
  36. if (hwnd !=NULL)
  37. oldproc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC);
  38. else
  39. oldproc = NULL;
  40. }
  41. return hwnd;
  42. }
  43. ScriptObject *roleServerObjectI::getScriptObject() {
  44. if (wnd == NULL) return NULL;
  45. GuiObject *go = wnd->getGuiObject();
  46. if (go == NULL) return NULL;
  47. return go->guiobject_getScriptObject();
  48. }
  49. WNDPROC roleServerObjectI::getOldProc() {
  50. return oldproc;
  51. }
  52. int roleServerObjectI::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  53. return CallWindowProc(oldproc, hWnd, uMsg, wParam, lParam);
  54. }
  55. int roleServerObjectI::flattenContent(HWND *w) {
  56. return FLATTENFLAG_ASKPARENT;
  57. }