1
0

groupclickwnd.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include <precomp.h>
  2. #include "groupclickwnd.h"
  3. #include <api/script/objects//guiobject.h>
  4. #include <api/wnd/notifmsg.h>
  5. GroupClickWnd::GroupClickWnd() {
  6. trap = NULL;
  7. inarea = 0;
  8. }
  9. GroupClickWnd::~GroupClickWnd() {
  10. delete trap;
  11. }
  12. void GroupClickWnd::abstract_onNewContent() {
  13. delete trap;
  14. trap = NULL;
  15. if (!abstract_getContent()) return;
  16. GuiObject *mousetrap = abstract_getContent()->guiobject_findObject(L"mousetrap");
  17. if (mousetrap != NULL)
  18. trap = new MouseTrap(this, mousetrap->guiobject_getScriptObject());
  19. }
  20. void GroupClickWnd::groupclick_onLeftPush() {
  21. notifyParent(ChildNotify::BUTTON_LEFTPUSH);
  22. }
  23. void GroupClickWnd::groupclick_onRightPush() {
  24. notifyParent(ChildNotify::BUTTON_RIGHTPUSH);
  25. }
  26. void GroupClickWnd::content_onLeftButtonDown() {
  27. notifyParent(ChildNotify::CLICKWND_LEFTDOWN);
  28. }
  29. void GroupClickWnd::content_onLeftButtonUp() {
  30. notifyParent(ChildNotify::CLICKWND_LEFTUP);
  31. if (inarea) groupclick_onLeftPush();
  32. }
  33. void GroupClickWnd::content_onRightButtonDown() {
  34. notifyParent(ChildNotify::CLICKWND_RIGHTDOWN);
  35. }
  36. void GroupClickWnd::content_onRightButtonUp() {
  37. notifyParent(ChildNotify::CLICKWND_RIGHTUP);
  38. if (inarea) groupclick_onRightPush();
  39. }
  40. void GroupClickWnd::content_onEnterArea() {
  41. inarea = 1;
  42. }
  43. void GroupClickWnd::content_onLeaveArea() {
  44. inarea = 0;
  45. }
  46. void MouseTrap::hook_onLeftButtonDown(int x, int y) {
  47. window->content_onLeftButtonDown();
  48. }
  49. void MouseTrap::hook_onLeftButtonUp(int x, int y) {
  50. window->content_onLeftButtonUp();
  51. }
  52. void MouseTrap::hook_onRightButtonDown(int x, int y) {
  53. window->content_onRightButtonDown();
  54. }
  55. void MouseTrap::hook_onRightButtonUp(int x, int y) {
  56. window->content_onRightButtonUp();
  57. }
  58. void MouseTrap::hook_onEnterArea() {
  59. window->content_onEnterArea();
  60. }
  61. void MouseTrap::hook_onLeaveArea() {
  62. window->content_onLeaveArea();
  63. }