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

Method DoEvent

DuiLib/Layout/UIHorizontalLayout.cpp:169–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167 }
168
169 void CHorizontalLayoutUI::DoEvent(TEventUI& event)
170 {
171 if( m_iSepWidth != 0 ) {
172 if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() )
173 {
174 RECT rcSeparator = GetThumbRect(false);
175 if( ::PtInRect(&rcSeparator, event.ptMouse) ) {
176 m_uButtonState |= UISTATE_CAPTURED;
177 ptLastMouse = event.ptMouse;
178 m_rcNewPos = m_rcItem;
179 if( !m_bImmMode && m_pManager ) m_pManager->AddPostPaint(this);
180 return;
181 }
182 }
183 if( event.Type == UIEVENT_BUTTONUP )
184 {
185 if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
186 m_uButtonState &= ~UISTATE_CAPTURED;
187 m_rcItem = m_rcNewPos;
188 if( !m_bImmMode && m_pManager ) m_pManager->RemovePostPaint(this);
189 NeedParentUpdate();
190 return;
191 }
192 }
193 if( event.Type == UIEVENT_MOUSEMOVE )
194 {
195 if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
196 LONG cx = event.ptMouse.x - ptLastMouse.x;
197 ptLastMouse = event.ptMouse;
198 RECT rc = m_rcNewPos;
199 if( m_iSepWidth >= 0 ) {
200 if( cx > 0 && event.ptMouse.x < m_rcNewPos.right - m_iSepWidth ) return;
201 if( cx < 0 && event.ptMouse.x > m_rcNewPos.right ) return;
202 rc.right += cx;
203 if( rc.right - rc.left <= GetMinWidth() ) {
204 if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
205 rc.right = rc.left + GetMinWidth();
206 }
207 if( rc.right - rc.left >= GetMaxWidth() ) {
208 if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
209 rc.right = rc.left + GetMaxWidth();
210 }
211 }
212 else {
213 if( cx > 0 && event.ptMouse.x < m_rcNewPos.left ) return;
214 if( cx < 0 && event.ptMouse.x > m_rcNewPos.left - m_iSepWidth ) return;
215 rc.left += cx;
216 if( rc.right - rc.left <= GetMinWidth() ) {
217 if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
218 rc.left = rc.right - GetMinWidth();
219 }
220 if( rc.right - rc.left >= GetMaxWidth() ) {
221 if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
222 rc.left = rc.right - GetMaxWidth();
223 }
224 }
225
226 CDuiRect rcInvalidate = GetThumbRect(true);

Callers

nothing calls this directly

Calls 4

AddPostPaintMethod · 0.80
RemovePostPaintMethod · 0.80
JoinMethod · 0.80
InvalidateMethod · 0.45

Tested by

no test coverage detected