void CSearchBar::OnMenuDropDown(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTOOLBAR nmtb = (LPNMTOOLBAR)pNMHDR; RECT rc; SendMessage(TB_GETRECT, nmtb->iItem, (LPARAM)&rc); ::MapWindowPoints(m_hWnd, NULL, LPPOINT(&rc), 2); if (nmtb->iItem == ID_WEB_SEARCH) { HMENU pop = SearchPluginCollection.CreateSearchMenu(); if (AppConfig.search_engine >= 0) { SetMenuDefaultItem(pop, AppConfig.search_engine, MF_BYPOSITION); CheckMenuItem(pop, AppConfig.search_engine, MF_BYPOSITION | MF_CHECKED); } UINT cmd = TrackPopupMenu(pop, TPM_RETURNCMD | TPM_RIGHTALIGN | TPM_TOPALIGN, rc.right, rc.bottom, 0, m_hWnd, NULL); DestroyMenu(pop); if (cmd > 0) { int idx = (int)cmd - CSearchPluginCollection::ID_SEARCHPLUGIN00; if (AppConfig.search_engine != idx) { AppConfig.search_engine = idx; UpdateBtn(); } } } }
void ofxBKDoubleSlider::mousePressed(ofMouseEventArgs &e) { currentDraggingValue = getNearestValueIndex(getValueForPosition(getMousePosition().x)); mouseDragOffset = getValueForPosition(getMousePosition().x) - (currentDraggingValue == 1?value:value2); ofHideCursor(); #ifdef _WIN32 LPPOINT pt = LPPOINT(); int x = ofGetWindowPositionX()+getGlobalBounds().x + (currentDraggingValue == 1?value:value2)*width; int y = ofGetWindowPositionY()+getGlobalBounds().y+getMousePosition().y; SetCursorPos(x,y); mouseDragOffset = 0; #endif isDragging = true; }
// // Intercept WM_PAINT to redirect from TWindow to the underlying control iff // this Owl object is just a wrapper for a predefined class. // void TFlatListBox::EvPaint() { TListBox::EvPaint(); if (IsFlat()){ TWindowDC dc(GetHandle()); TRect rect = GetClientRect(); TRect wrect = GetWindowRect(); ::MapWindowPoints(HWND_DESKTOP, *this, LPPOINT(&wrect), 2); rect.bottom += 6; rect.right += 6; wrect.Offset(3,3); bool haveScroll = wrect != rect; if(haveScroll){ wrect.bottom -= 1; wrect.right -= 1; } TFlatPainter::Paint(dc, wrect); if((!IsSet(fpMouseIn) || !IsWindowEnabled()) && haveScroll){ // We draw the "untracked" situation wrect.left = wrect.right - TUIMetric::CxHThumb; #ifdef TEST dc.FrameRect(wrect, TBrush(TColor::LtGreen)); #else dc.FrameRect(wrect, TBrush(TColor::SysWindow)); #endif } } }