MCPcopy Create free account
hub / github.com/cinience/RedisStudio / DoEvent

Method DoEvent

DuiLib/Control/UISlider.cpp:99–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98
99 void CSliderUI::DoEvent(TEventUI& event)
100 {
101 if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
102 if( m_pParent != NULL ) m_pParent->DoEvent(event);
103 else CProgressUI::DoEvent(event);
104 return;
105 }
106
107 if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
108 {
109 if( IsEnabled() ) {
110 RECT rcThumb = GetThumbRect();
111 if( ::PtInRect(&rcThumb, event.ptMouse) ) {
112 m_uButtonState |= UISTATE_CAPTURED;
113 }
114 }
115 return;
116 }
117 if( event.Type == UIEVENT_BUTTONUP )
118 {
119 int nValue;
120 if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
121 m_uButtonState &= ~UISTATE_CAPTURED;
122 }
123 if( m_bHorizontal ) {
124 if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) nValue = m_nMax;
125 else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) nValue = m_nMin;
126 else nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
127 }
128 else {
129 if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) nValue = m_nMin;
130 else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) nValue = m_nMax;
131 else nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
132 }
133 if(m_nValue !=nValue && nValue>=m_nMin && nValue<=m_nMax)
134 {
135 m_nValue =nValue;
136 m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
137 Invalidate();
138 }
139 return;
140 }
141 if( event.Type == UIEVENT_CONTEXTMENU )
142 {
143 return;
144 }
145 if( event.Type == UIEVENT_SCROLLWHEEL )
146 {
147 switch( LOWORD(event.wParam) ) {
148 case SB_LINEUP:
149 SetValue(GetValue() + GetChangeStep());
150 m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
151 return;
152 case SB_LINEDOWN:
153 SetValue(GetValue() - GetChangeStep());
154 m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
155 return;
156 }

Callers

nothing calls this directly

Calls 1

SendNotifyMethod · 0.80

Tested by

no test coverage detected