bool CListBox::OnMouseButtonUp(CPoint Point, unsigned int Button) { bool bResult = CWindow::OnMouseButtonUp(Point, Button); CPoint WindowPoint(ViewToWindow(Point)); if (!bResult && m_bVisible && (Button == CMouseMessage::LEFT) && (m_ClientRect.HitTest(WindowPoint) == CRect::RELPOS_INSIDE)) { // judb m_iFocusedItem should be <= the number of items in the listbox (0-based, so m_Items.size() - 1) if (m_iFocusedItem == std::min(((WindowPoint.YPos() - m_ClientRect.Top()) / m_iItemHeight + m_pVScrollbar->GetValue()), stdex::safe_static_cast<unsigned int>(m_Items.size()) - 1)) { if (m_bSingleSelection) { SetAllSelections(false); } SetSelection(m_iFocusedItem, !IsSelected(m_iFocusedItem)); CWindow* pDestination = m_pParentWindow; if (m_pDropDown) { pDestination = m_pDropDown; } CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, pDestination, this, m_iFocusedItem)); Draw(); } bResult = true; } return bResult; }
// judb select the item with index iItemIndex in the list, and display the item's name // (in the area to the left of the dropdown arrow) void CDropDown::SelectItem(unsigned int iItemIndex) { if (iItemIndex >= m_pListBox->Size()) { return; } SetAllSelections(false); m_pListBox->SetSelection(iItemIndex, true); SetWindowText(m_pListBox->GetItem(iItemIndex).sItemText); }
void CListBox::SetSelection(unsigned int iItemIndex, bool bSelected, bool bNotify) { if (iItemIndex < m_SelectedItems.size()) { if (m_bSingleSelection) { SetAllSelections(false); } m_SelectedItems.at(iItemIndex) = bSelected; CWindow* pDestination = m_pParentWindow; if (m_pDropDown) { pDestination = m_pDropDown; } if (bNotify) { CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, pDestination, this, m_iFocusedItem)); } Draw(); } }
BOOL WeightTableWindow::WtExecute(int id) { BOOL iret = FALSE; switch (id) { //edit case IDC_COPY : { SetCopyBuffer(); iret = TRUE; UpdatePasteButton(); break; } case IDC_PASTE : { PasteCopyBuffer(); InvalidateViews(); iret = TRUE; break; } case IDC_SELECTALL: { SetAllSelections(); InvalidateViews(); iret = TRUE; break; } case IDC_SELECTNONE: { ClearAllSelections(); InvalidateViews(); iret = TRUE; break; } case IDC_SELECTINVERT: { InvertSelections(); InvalidateViews(); iret = TRUE; break; } //sets case IDC_CREATE : { DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_WEIGHTTABLE_CUSTOMLISTNAME),hWnd, AddCustomListDlgProc, (LPARAM)this); iret = TRUE; break; } case IDC_DELETE : { if (GetActiveSet() >2) DeleteCustomList(GetActiveSet()); iret = TRUE; // PasteCopyBuffer(); // InvalidateViews(); break; } //options case IDC_AFFECTEDBONES_CHECK : { if (GetAffectedBonesOnly()) SetAffectedBonesOnly(FALSE); else SetAffectedBonesOnly(TRUE); iret = TRUE; break; } case IDC_UPDATEONMOUSEUP_CHECK2 : { if (GetUpdateOnMouseUp()) SetUpdateOnMouseUp(FALSE); else SetUpdateOnMouseUp(TRUE); iret = TRUE; break; } case IDC_FLIPFLOPUI_CHECK2 : { if (GetFlipFlopUI()) SetFlipFlopUI(FALSE); else SetFlipFlopUI(TRUE); iret = TRUE; break; } case IDC_ATTRIBUTE_CHECK2 : { if (GetShowAttributes()) SetShowAttributes(FALSE); else SetShowAttributes(TRUE); iret = TRUE; break; } case IDC_GLOBAL_CHECK2 : { if (GetShowGlobals()) SetShowGlobals(FALSE); else SetShowGlobals(TRUE); iret = TRUE; break; } case IDC_REDUCELABELS_CHECK2 : { if (GetReduceLabels()) SetReduceLabels(FALSE); else SetReduceLabels(TRUE); iret = TRUE; break; } case IDC_SHOWEXCLUSION_CHECK : { if (GetShowExclusion()) SetShowExclusion(FALSE); else SetShowExclusion(TRUE); iret = TRUE; break; } case IDC_SHOWLOCK_CHECK : { if (GetShowLock()) SetShowLock(FALSE); else SetShowLock(TRUE); iret = TRUE; break; } case IDC_NAMELISTGLOBAL_DROP : { if (GetAffectSelectedOnly()) SetAffectSelectedOnly(FALSE); else SetAffectSelectedOnly(TRUE); iret = TRUE; break; } case IDC_JBUIMETHOD : { if (GetJBMethod()) SetJBMethod(FALSE); else SetJBMethod(TRUE); iret = TRUE; break; } case IDC_SHOWMENU : { if (GetShowMenu()) SetShowMenu(FALSE); else SetShowMenu(TRUE); iret = TRUE; break; } case IDC_SHOWSETUI : { if (GetShowSetUI()) SetShowSetUI(FALSE); else SetShowSetUI(TRUE); iret = TRUE; break; } case IDC_SHOWOPTIONSUI : { if (GetShowOptionsUI()) SetShowOptionsUI(FALSE); else SetShowOptionsUI(TRUE); iret = TRUE; break; } case IDC_SHOWCOPYPASTEUI : { if (GetShowCopyPasteUI()) SetShowCopyPasteUI(FALSE); else SetShowCopyPasteUI(TRUE); iret = TRUE; break; } case IDC_DRAGMODE : { if (GetDragLeftMode()) SetDragLeftMode(FALSE); else SetDragLeftMode(TRUE); iret = TRUE; break; } case IDC_DEBUGMODE : { if (GetDebugMode()) SetDebugMode(FALSE); else SetDebugMode(TRUE); iret = TRUE; break; } case IDC_SHOWMARKER : { if (GetShowMarker()) SetShowMarker(FALSE); else SetShowMarker(TRUE); iret = TRUE; break; } //5.1.01 case IDC_RIGHTJUSTIFY: { if (GetRightJustify()) SetRightJustify(FALSE); else SetRightJustify(TRUE); break; } } IMenuBarContext* pContext = (IMenuBarContext*) GetCOREInterface()->GetMenuManager()->GetContext(kWeightTableMenuBar); if (pContext) pContext->UpdateWindowsMenu(); return iret; }