| 172 | } |
| 173 | |
| 174 | void CVerticalLayoutUI::DoEvent(TEventUI& event) |
| 175 | { |
| 176 | if( m_iSepHeight != 0 ) { |
| 177 | if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() ) |
| 178 | { |
| 179 | RECT rcSeparator = GetThumbRect(false); |
| 180 | if( ::PtInRect(&rcSeparator, event.ptMouse) ) { |
| 181 | m_uButtonState |= UISTATE_CAPTURED; |
| 182 | ptLastMouse = event.ptMouse; |
| 183 | m_rcNewPos = m_rcItem; |
| 184 | if( !m_bImmMode && m_pManager ) m_pManager->AddPostPaint(this); |
| 185 | return; |
| 186 | } |
| 187 | } |
| 188 | if( event.Type == UIEVENT_BUTTONUP ) |
| 189 | { |
| 190 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) { |
| 191 | m_uButtonState &= ~UISTATE_CAPTURED; |
| 192 | m_rcItem = m_rcNewPos; |
| 193 | if( !m_bImmMode && m_pManager ) m_pManager->RemovePostPaint(this); |
| 194 | NeedParentUpdate(); |
| 195 | return; |
| 196 | } |
| 197 | } |
| 198 | if( event.Type == UIEVENT_MOUSEMOVE ) |
| 199 | { |
| 200 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) { |
| 201 | LONG cy = event.ptMouse.y - ptLastMouse.y; |
| 202 | ptLastMouse = event.ptMouse; |
| 203 | RECT rc = m_rcNewPos; |
| 204 | if( m_iSepHeight >= 0 ) { |
| 205 | if( cy > 0 && event.ptMouse.y < m_rcNewPos.bottom + m_iSepHeight ) return; |
| 206 | if( cy < 0 && event.ptMouse.y > m_rcNewPos.bottom ) return; |
| 207 | rc.bottom += cy; |
| 208 | if( rc.bottom - rc.top <= GetMinHeight() ) { |
| 209 | if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() ) return; |
| 210 | rc.bottom = rc.top + GetMinHeight(); |
| 211 | } |
| 212 | if( rc.bottom - rc.top >= GetMaxHeight() ) { |
| 213 | if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() ) return; |
| 214 | rc.bottom = rc.top + GetMaxHeight(); |
| 215 | } |
| 216 | } |
| 217 | else { |
| 218 | if( cy > 0 && event.ptMouse.y < m_rcNewPos.top ) return; |
| 219 | if( cy < 0 && event.ptMouse.y > m_rcNewPos.top + m_iSepHeight ) return; |
| 220 | rc.top += cy; |
| 221 | if( rc.bottom - rc.top <= GetMinHeight() ) { |
| 222 | if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() ) return; |
| 223 | rc.top = rc.bottom - GetMinHeight(); |
| 224 | } |
| 225 | if( rc.bottom - rc.top >= GetMaxHeight() ) { |
| 226 | if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() ) return; |
| 227 | rc.top = rc.bottom - GetMaxHeight(); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | CDuiRect rcInvalidate = GetThumbRect(true); |
nothing calls this directly
no test coverage detected