| 2127 | } |
| 2128 | |
| 2129 | LRESULT CRichEditUI::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled) |
| 2130 | { |
| 2131 | if( !IsVisible() || !IsEnabled() ) return 0; |
| 2132 | if( !IsMouseEnabled() && uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST ) return 0; |
| 2133 | if( uMsg == WM_MOUSEWHEEL && (LOWORD(wParam) & MK_CONTROL) == 0 ) return 0; |
| 2134 | |
| 2135 | if (uMsg == WM_IME_COMPOSITION) |
| 2136 | { |
| 2137 | // ��������뷨λ���쳣������ |
| 2138 | HIMC hIMC = ImmGetContext(GetManager()->GetPaintWindow()); |
| 2139 | if (hIMC) |
| 2140 | { |
| 2141 | // Set composition window position near caret position |
| 2142 | POINT point; |
| 2143 | GetCaretPos(&point); |
| 2144 | |
| 2145 | COMPOSITIONFORM Composition; |
| 2146 | Composition.dwStyle = CFS_POINT; |
| 2147 | Composition.ptCurrentPos.x = point.x; |
| 2148 | Composition.ptCurrentPos.y = point.y; |
| 2149 | ImmSetCompositionWindow(hIMC, &Composition); |
| 2150 | |
| 2151 | ImmReleaseContext(GetManager()->GetPaintWindow(),hIMC); |
| 2152 | } |
| 2153 | return 0; |
| 2154 | } |
| 2155 | |
| 2156 | bool bWasHandled = true; |
| 2157 | if( (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || uMsg == WM_SETCURSOR ) { |
| 2158 | if( !m_pTwh->IsCaptured() ) { |
| 2159 | switch (uMsg) { |
| 2160 | case WM_LBUTTONDOWN: |
| 2161 | case WM_LBUTTONUP: |
| 2162 | case WM_LBUTTONDBLCLK: |
| 2163 | case WM_RBUTTONDOWN: |
| 2164 | case WM_RBUTTONUP: |
| 2165 | { |
| 2166 | POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; |
| 2167 | CControlUI* pHover = GetManager()->FindControl(pt); |
| 2168 | if(pHover != this) { |
| 2169 | bWasHandled = false; |
| 2170 | return 0; |
| 2171 | } |
| 2172 | } |
| 2173 | break; |
| 2174 | } |
| 2175 | } |
| 2176 | // Mouse message only go when captured or inside rect |
| 2177 | DWORD dwHitResult = m_pTwh->IsCaptured() ? HITRESULT_HIT : HITRESULT_OUTSIDE; |
| 2178 | if( dwHitResult == HITRESULT_OUTSIDE ) { |
| 2179 | RECT rc; |
| 2180 | m_pTwh->GetControlRect(&rc); |
| 2181 | POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; |
| 2182 | if( uMsg == WM_MOUSEWHEEL ) ::ScreenToClient(GetManager()->GetPaintWindow(), &pt); |
| 2183 | if( ::PtInRect(&rc, pt) && !GetManager()->IsCaptured() ) dwHitResult = HITRESULT_HIT; |
| 2184 | } |
| 2185 | if( dwHitResult != HITRESULT_HIT ) return 0; |
| 2186 | if( uMsg == WM_SETCURSOR ) bWasHandled = false; |
nothing calls this directly
no test coverage detected