aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/widgets/groupclickwnd.cpp
blob: 119885bbac81d917761cf28bfb6f8f2cc5e16f94 (plain) (blame)
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
#include <precomp.h>
#include "groupclickwnd.h"
#include <api/script/objects//guiobject.h>
#include <api/wnd/notifmsg.h>

GroupClickWnd::GroupClickWnd() {
  trap = NULL;
  inarea = 0;
}

GroupClickWnd::~GroupClickWnd() {
  delete trap;
}

void GroupClickWnd::abstract_onNewContent() {
  delete trap;
  trap = NULL;

  if (!abstract_getContent()) return;

  GuiObject *mousetrap = abstract_getContent()->guiobject_findObject(L"mousetrap");

  if (mousetrap != NULL)
    trap = new MouseTrap(this, mousetrap->guiobject_getScriptObject());
}

void GroupClickWnd::groupclick_onLeftPush() {
  notifyParent(ChildNotify::BUTTON_LEFTPUSH);
}

void GroupClickWnd::groupclick_onRightPush() {
  notifyParent(ChildNotify::BUTTON_RIGHTPUSH);
}

void GroupClickWnd::content_onLeftButtonDown() {
  notifyParent(ChildNotify::CLICKWND_LEFTDOWN);
}

void GroupClickWnd::content_onLeftButtonUp() {
  notifyParent(ChildNotify::CLICKWND_LEFTUP);
  if (inarea) groupclick_onLeftPush();
}

void GroupClickWnd::content_onRightButtonDown() {
  notifyParent(ChildNotify::CLICKWND_RIGHTDOWN);
}

void GroupClickWnd::content_onRightButtonUp() {
  notifyParent(ChildNotify::CLICKWND_RIGHTUP);
  if (inarea) groupclick_onRightPush();
}

void GroupClickWnd::content_onEnterArea() {
  inarea = 1;
}

void GroupClickWnd::content_onLeaveArea() {
  inarea = 0;
}


void MouseTrap::hook_onLeftButtonDown(int x, int y) { 
  window->content_onLeftButtonDown(); 
}

void MouseTrap::hook_onLeftButtonUp(int x, int y) { 
  window->content_onLeftButtonUp(); 
}

void MouseTrap::hook_onRightButtonDown(int x, int y) { 
  window->content_onRightButtonDown(); 
}

void MouseTrap::hook_onRightButtonUp(int x, int y) { 
  window->content_onRightButtonUp(); 
}

void MouseTrap::hook_onEnterArea() { 
  window->content_onEnterArea(); 
}

void MouseTrap::hook_onLeaveArea() { 
  window->content_onLeaveArea(); 
}