/// Left-click void InstanceCtrl::OnLeftClick(wxMouseEvent& event) { SetFocus(); VisualCoord clickedIndex; HitTest(event.GetPosition(), clickedIndex); if(clickedIndex.isItem()) { int flags = 0; if (event.ControlDown()) flags |= wxINST_CTRL_DOWN; if (event.ShiftDown()) flags |= wxINST_SHIFT_DOWN; if (event.AltDown()) flags |= wxINST_ALT_DOWN; EnsureVisible(clickedIndex); DoSelection(clickedIndex); SetIntendedColumn(clickedIndex); } else if(clickedIndex.isHeaderTicker()) { ToggleGroup(clickedIndex.groupIndex); } else ClearSelections(); }
void wxRadioButton::SetValue(bool value) { if (GetValue() == value) return; m_inSetValue = true; XmToggleButtonSetState ((Widget) m_mainWidget, (Boolean) value, False); m_inSetValue = false; ClearSelections(); }
/* -----------------------------------------------------------------------------*/ void SelectPort (short port, Boolean on) { if (on) { portSelected = port; ResetSlotsMap (); ShowSrcDest (port); } else { ClearSelections (); portSelected = -1; } ShowEditMode (myWindow, on); InvalPortArea (); }
void CListBoxCtrl::ResetSelection() { if (multiSelection) { SetRedraw(false); ClearSelections(); int numSel = m_intValArray.Size(); for (int i = 0; i < numSel; i++) SetSel(m_intValArray[i], true); SetRedraw(true); Invalidate(); UpdateWindow(); } else SetCurSel(*m_pintVal); }
void Project::SetOpenGLPanel(OpenGLPanel *newPanel) { if (newPanel) { glPanel = newPanel; connect(this, SIGNAL(subdomainCreated(QString)), glPanel, SLOT(addSubdomainToMenus(QString))); connect(glPanel, SIGNAL(openColorOptions()), this, SLOT(ShowDisplayOptionsDialog())); connect(glPanel, SIGNAL(matchColors(QAction*)), this, SLOT(MatchColors(QAction*))); connect(glPanel, SIGNAL(matchCamera(QAction*)), this, SLOT(MatchCamera(QAction*))); connect(glPanel, SIGNAL(clearSelections()), this, SLOT(ClearSelections())); for (std::vector<SubDomain*>::iterator it = subDomains.begin(); it != subDomains.end(); ++it) { SubDomain* currSubdomain = *it; emit subdomainCreated(currSubdomain->GetDomainName()); } } }
void SelectionList::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SelectionList"); if(searchNode == 0) return; DataNode *node; DataNode **children; if((node = searchNode->GetNode("autoApplyUpdates")) != 0) SetAutoApplyUpdates(node->AsBool()); // Clear all the SelectionPropertiess if we got any. bool clearedSelections = false; // Go through all of the children and construct a new // SelectionProperties for each one of them. children = searchNode->GetChildren(); if(children != 0) { for(int i = 0; i < searchNode->GetNumChildren(); ++i) { if(children[i]->GetKey() == std::string("SelectionProperties")) { if (!clearedSelections) { ClearSelections(); clearedSelections = true; } SelectionProperties temp; temp.SetFromNode(children[i]); AddSelections(temp); } } } // Clear all the SelectionSummary list. ClearSelectionSummarys(); }
/// Right-click void InstanceCtrl::OnRightClick(wxMouseEvent& event) { SetFocus(); VisualCoord clickedIndex; int flags = 0; if (event.ControlDown()) flags |= wxINST_CTRL_DOWN; if (event.ShiftDown()) flags |= wxINST_SHIFT_DOWN; if (event.AltDown()) flags |= wxINST_ALT_DOWN; HitTest(event.GetPosition(), clickedIndex); if (clickedIndex.isItem()) { EnsureVisible(clickedIndex); DoSelection(clickedIndex); SetIntendedColumn(clickedIndex); } else { ClearSelections(); } InstanceCtrlEvent cmdEvent(wxEVT_COMMAND_INST_MENU, GetId()); cmdEvent.SetEventObject(this); cmdEvent.SetItemIndex(clickedIndex); int clickedID = IDFromIndex(clickedIndex); cmdEvent.SetItemID(clickedID); cmdEvent.SetFlags(flags); cmdEvent.SetPosition(event.GetPosition()); if (clickedIndex.isGroup()) { cmdEvent.SetGroup(m_groups[clickedIndex.groupIndex].m_group); } GetEventHandler()->ProcessEvent(cmdEvent); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } if (m_pListPane->m_bIsSingleSelection) { // If no item has been selected yet, select the first item. #ifdef __WXMSW__ if ((m_pListPane->GetSelectedItemCount() == 0) && (m_pListPane->GetItemCount() >= 1)) { long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED; m_pListPane->SetItemState(0, desiredstate, desiredstate); } #else if ((m_pListPane->GetFirstSelected() < 0) && (m_pListPane->GetItemCount() >= 1)) { m_pListPane->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); } #endif } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); #ifdef __WXGTK__ // Work around an apparent bug in wxWidgets 3.0 // which drew blank lines at the top and failed // to draw the bottom items. This could happen // if the list was scrolled near the bottom and // the user selected "Show active tasks." m_pListPane->EnsureVisible(iDocCount - 1); #endif m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
BOOL MoveAroundBrowser(HWND hWnd, WORD wKey, WORD wFlags, OBJECTID idParent) { BRDATA lpBrData = (BRDATA) GLOBALLOCK(hClBrData); CLBRITEM lpLevel, lpNode = NULL; LPBRTABLE lpBrowser; LEVEL_TYPE level; if (!lpBrData->hBrowser) return FALSE; lpBrowser = (LPBRTABLE) GLOBALLOCK(lpBrData->hBrowser); level = (LEVEL_TYPE) ((float) (lpBrData->fLeftColumn * sNodeWidth + BrSelection.rect.left + 2) / sNodeWidth); if (wKey == VK_HOME) { lpNode = FindFocusedNode(lpBrowser, lpBrData); level = lpBrData->fLeftColumn; } else if (BrSelection.idObj) { switch (wKey) { case VK_RIGHT: if (OBJECT_TYPE(BrSelection.idObj) == CLASS && FindLevel_BrTable(lpBrowser, level + 1, (LPLPBRTABLE) &lpLevel, FALSE)) { CLBRITEM lpParent = FindNodeInLevel(BrSelection.idObj, level, lpBrData->sItemSize, lpBrowser); if (lpParent) { BOOL bInstVisible = ARE_INSTANCES_VISIBLE(BRITEM_FLAGS(lpParent)); BOOL bClassVisible = ARE_SUBCLASSES_VISIBLE(BRITEM_FLAGS(lpParent)); level += 1; lpNode = FindTopInLevel(BrSelection.idObj, (LPBRTABLE) lpLevel, lpBrData->sItemSize, bInstVisible, bClassVisible, lpBrData->fTopRow, lpBrData->fBottomRow, lpBrData, level); } } break; case VK_LEFT: if (BrSelection.idObj != lpIDs->idRootClass) { OBJECTID idObj = BrSelection.idObj; WORD wType = OBJECT_TYPE(idObj); if (!idParent) idParent = Kpp_Get_Super(wType, idObj); if (BrSelection.idObj == lpBrData->idFocusedItem) { SetClBrowserFocusCB(CLASS, idParent); SendMessage(hWnd, WM_PAINT, 0, 0L); } if (FindLevel_BrTable(lpBrowser, --level, (LPBRTABLE *) &lpLevel, FALSE)) lpNode = FindParentInLevel(BrSelection.idObj, (LPBRTABLE) lpLevel, lpBrData->sItemSize, lpBrData->fTopRow, lpBrData->fBottomRow, idParent); } break; case VK_UP: case VK_DOWN: if (BrSelection.idObj != lpIDs->idRootClass && FindLevel_BrTable(lpBrowser, level, (LPLPBRTABLE) &lpLevel, FALSE)) { LPBRTABLE lpParentLevel; if (FindLevel_BrTable(lpBrowser, level - 1, (LPLPBRTABLE) &lpParentLevel, FALSE)) lpNode = FindNextInLevel(BrSelection.fRow, (LPBRTABLE) lpLevel, lpBrData->sItemSize, wKey == VK_UP, lpParentLevel, lpBrData->fTopRow, lpBrData->fBottomRow, lpBrData->idFocusedItem, lpBrData, level); } break; case VK_PRIOR: case VK_NEXT: SendMessage(hWnd, WM_VSCROLL, wKey == VK_PRIOR ? SB_PAGEUP : SB_PAGEDOWN, 0L); break; case VK_CANCEL: case VK_CLEAR: ClearSelections(hWnd, lpBrData); break; } } if (lpNode) { HDC hDC = GetDC(hWnd); float fItemRow = GET_Y_REL(lpNode); float fItemColumn = (float) (level - 1); RECT rect, wrect; int sbw = GetSystemMetrics(SM_CXVSCROLL); MapWinToView(hWnd, lpBrData, hDC); GetClientRect(hWnd, &wrect); wrect.right -= sbw; wrect.left = sbw; GetItemRect(lpBrData, (LPBRTABLE) lpNode, level, &rect); DPtoLP(hDC, (LPPOINT) &wrect, 2); SelectNode(lpNode, wFlags & SHIFT_FLAG, hDC, level); ReleaseDC(hWnd, hDC); if (wFlags & ONCE_NO_DELETE) BRITEM_FLAGS(lpNode) |= ONCE_NO_DELETE; if (!(fItemRow - lpBrData->fTopRow > (float) -1.0)) SendMessage(hWnd, WM_VSCROLL, SB_LINEUP, 0L); else if (!(lpBrData->fBottomRow - fItemRow > (float) 0.0)) SendMessage(hWnd, WM_VSCROLL, SB_LINEDOWN, 0L); if (fItemColumn > lpBrData->fRightColumn || rect.left > wrect.right) SendMessage(hWnd, WM_HSCROLL, SB_PAGEDOWN, 0L); else if (fItemColumn < lpBrData->fLeftColumn - 1) SendMessage(hWnd, WM_HSCROLL, SB_PAGEUP, 0L); } GLOBALUNLOCK(lpBrData->hBrowser); GLOBALUNLOCK(hClBrData); return TRUE; }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }