MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OnMouse

Method OnMouse

ogsr_engine/xrGame/ui/UIButton.cpp:56–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56bool CUIButton::OnMouse(float x, float y, EUIMessages mouse_action)
57{
58 m_bButtonClicked = false;
59
60 if (inherited::OnMouse(x, y, mouse_action))
61 return true;
62
63 if ((WINDOW_LBUTTON_DOWN == mouse_action || WINDOW_LBUTTON_UP == mouse_action || WINDOW_RBUTTON_DOWN == mouse_action || WINDOW_RBUTTON_UP == mouse_action) &&
64 HasChildMouseHandler())
65 return false;
66
67 switch (m_ePressMode)
68 {
69 case NORMAL_PRESS:
70 if (m_eButtonState == BUTTON_NORMAL)
71 {
72 if (mouse_action == WINDOW_LBUTTON_DOWN || mouse_action == WINDOW_LBUTTON_DB_CLICK)
73 {
74 m_eButtonState = BUTTON_PUSHED;
75 GetMessageTarget()->SendMessage(this, BUTTON_DOWN, NULL);
76 }
77 }
78 else if (m_eButtonState == BUTTON_PUSHED)
79 {
80 if (mouse_action == WINDOW_LBUTTON_UP)
81 {
82 if (m_bCursorOverWindow)
83 OnClick();
84
85 if (!m_bIsSwitch)
86 m_eButtonState = BUTTON_NORMAL;
87 return true; // fixed OnMouseAction (by kolmogor)
88 }
89 else if (mouse_action == WINDOW_MOUSE_MOVE)
90 {
91 if (!m_bCursorOverWindow && !m_bIsSwitch)
92 m_eButtonState = BUTTON_UP;
93 }
94 }
95 else if (m_eButtonState == BUTTON_UP)
96 {
97 if (mouse_action == WINDOW_MOUSE_MOVE)
98 {
99 if (m_bCursorOverWindow)
100 m_eButtonState = BUTTON_PUSHED;
101 }
102 else if (mouse_action == WINDOW_LBUTTON_UP)
103 {
104 m_eButtonState = BUTTON_NORMAL;
105 }
106 }
107 break;
108
109 case DOWN_PRESS:
110 if (mouse_action == WINDOW_MOUSE_MOVE)
111 {
112 if (m_bCursorOverWindow)
113 {

Callers

nothing calls this directly

Calls 1

SendMessageMethod · 0.45

Tested by

no test coverage detected