Пример #1
0
void GeometryListView::OnEditGeometry() 
// Called when user clicks "Edit" in the geometry list.
{
	// Figure out which geometry item to edit.
	int	index = GetSelectedItemIndex();
	if (index < 0) {
		// No item selected, so we don't know what to delete...
		return;
	}
	if (index == 0) {
		// Can't edit null geometry.
		return;
	}

	// Get the geometry object to edit.
	Geometry*	g = GetDocument()->GetGeometry(index);
	if (g == NULL) return;

	// Call edit dialog box.
	GeometryPropertiesDialog d;
	d.SetName(g->GetName());
	d.SetFilename(g->GetFilename()); 
	d.SetComment(g->GetComment());

	if (d.DoModal() != IDCANCEL) {
		// Apply the changes.
		g->SetName(d.GetName());
		g->SetFilename(d.GetFilename());
		g->SetComment(d.GetComment());

		GetDocument()->SetModifiedFlag();
		GetDocument()->UpdateAllViews(NULL);
	}
}
Пример #2
0
//______________________________________________________________________________
void ArgusWindow::OnDoubleClick(TGListTreeItem* item, Int_t /* btn */)
{
   Int_t selectedTabIndex = GetSelectedItemIndex(item);
   if (selectedTabIndex < 0 || selectedTabIndex == fCurrentTabIndex) {
      return;
   }

   // do not close if current tab is children of selected one
   Bool_t iflag = kFALSE;
   Int_t  parent = fParentIndex[fCurrentTabIndex];
   while (parent >=0) {
      if (selectedTabIndex == parent) {
         iflag = kTRUE;
         break;
      }
      parent = fParentIndex[parent];
   }
   if (iflag) {
      fListTree->OpenItem(item);
   }

   // selecting a branch-node is not allowed.
   if (fNumberOfChildren[selectedTabIndex] > 0) {
#if ROOT_VERSION_CODE >= ROOT_VERSION(5,0,0)
      // For ROOT 4 and earlier, selecting a branch-node might cause
      // inconsistency; a tab being displayed might be different from
      // the selected one in the ListTree view.
      fListTree->SetSelected(fListTreeItem[fCurrentTabIndex]);
      fListTree->HighlightItem(fListTreeItem[fCurrentTabIndex], kTRUE, kTRUE);
      fListTree->HighlightItem(fListTreeItem[selectedTabIndex], kFALSE, kTRUE);
#endif
      return;
   }
}
Пример #3
0
//______________________________________________________________________________
void ArgusWindow::OnClick(TGListTreeItem* item, Int_t /* btn */)
{
   Int_t selectedTabIndex = GetSelectedItemIndex(item);
   if (selectedTabIndex < 0 || selectedTabIndex == fCurrentTabIndex) {
      return;
   }
   ChangeTab(selectedTabIndex);
}
Пример #4
0
void CTextureDlg::OnDeleteTexture()
{
	int selectedIndex = GetSelectedItemIndex();
	if (selectedIndex == -1) return;

	CString filename = TextureList.GetItemText(selectedIndex, (int)TEXTURE_LIST_FILE);
	CString stage = TextureList.GetItemText(selectedIndex, (int)TEXTURE_LIST_INDEX);
	int stageIndex = _ttoi(stage);

	CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
	ASSERT(pMainFrm);	
	pMainFrm->DeleteTexture(stageIndex, filename);

	TextureList.DeleteItem(selectedIndex);	
}
			description::Value GuiBindableTreeView::GetSelectedItem()
			{
				vint index = GetSelectedItemIndex();
				if (index == -1) return Value();

				Value result;
				if (auto node = nodeItemView->RequestNode(index))
				{
					if (auto itemSourceNode = node.Cast<ItemSourceNode>())
					{
						result = itemSourceNode->GetItemSource();
					}
				}
				return result;
			}
Пример #6
0
void CTextureDlg::OnChangeOperation()
{
	int selectedIndex = GetSelectedItemIndex();
	if (selectedIndex == -1) return;
	CString stage = TextureList.GetItemText(selectedIndex, (int)TEXTURE_LIST_INDEX);
	int stageIndex = _ttoi(stage);

	int operation = OperationComboBox.GetCurSel();
	eTextureOperation  texOperation = eTextureOperation(operation);

	TextureList.SetItemText(selectedIndex, (int)TEXTURE_LIST_OPERATION, TextureOperation[operation]);
	CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
	ASSERT(pMainFrm);
	pMainFrm->ChangeTextureOpeation(stageIndex, texOperation);
	
}
void CManilla2DConfigTabsDlg::OnBnClickedMoveDownButton()
{
    int selectedItemIndex = GetSelectedItemIndex();

    if((selectedItemIndex >= 0) && (selectedItemIndex < (m_mainListControl.GetItemCount()-1)))
    {
        NameAndEnabledStateItem temp = m_newWidgetVector[selectedItemIndex+1];
        m_newWidgetVector[selectedItemIndex+1] = m_newWidgetVector[selectedItemIndex];
        m_newWidgetVector[selectedItemIndex] = temp;

        m_bPopulatingListControl = true;
        m_mainListControl.SetItemState(selectedItemIndex+1, LVIS_SELECTED, LVIS_SELECTED);
        m_bPopulatingListControl = false;

        UpdateListControlFromNewWidgetVector();
    }
}
void CManilla2DConfigTabsDlg::UpdateListControlFromNewWidgetVector()
{
    m_bPopulatingListControl = true;
    int selectedIndex = GetSelectedItemIndex();

    m_mainListControl.DeleteAllItems();

    CHeaderCtrl* pListHeaderCtrl = m_mainListControl.GetHeaderCtrl();

    if(pListHeaderCtrl != NULL)
    {
        int headerItemCount = pListHeaderCtrl->GetItemCount();

        if(headerItemCount != 1)
        {
            // remove all items
            for(int i=headerItemCount; i > 0; i--)
            {
                pListHeaderCtrl->DeleteItem(i);
            }

            CRect lcRect;
            m_mainListControl.GetClientRect(&lcRect);
            m_mainListControl.InsertColumn(0, _T("Item Name"), LVCFMT_LEFT, lcRect.Width());
        }
    }

    for(size_t i=0; i<m_newWidgetVector.size(); i++)
    {
        LPCTSTR p(m_newWidgetVector[i].name);

        m_mainListControl.InsertItem(i, p);
        
        m_mainListControl.SetCheck(i, m_newWidgetVector[i].enabled);
    }

    if((selectedIndex >= 0) && (selectedIndex < m_mainListControl.GetItemCount()))
    {
        m_mainListControl.SetItemState(selectedIndex, LVIS_SELECTED, LVIS_SELECTED);
    }

    OnNMClickMainListControl(NULL, NULL);
    m_mainListControl.SetFocus();
    m_bPopulatingListControl = false;
}
Пример #9
0
void GeometryListView::OnDeleteGeometry() 
// Called when the user clicks "Delete" button in the geometry list dialog.
{
	// Figure out which geometry item to edit.
	int	index = GetSelectedItemIndex();
	if (index < 0) {
		// No item selected, so we don't know what to delete...
		return;
	}
	if (index == 0) {
		// Can't delete geometry 0 (the null geometry).
		return;
	}

	CTerrainDoc*	doc = GetDocument();

	// Check to see if any objects are using this geometry...
	// bool InUse = doc->GeometryInUse(index);
	// if (InUse) {
	//	put up a dialog, noting that the object is in use, asking if the user's sure;
	//	if (DoModal() == IDCANCEL) {
	//		return;
	//	}
	// }
	// else
	{
		// Make the user confirm.
		ConfirmDeleteDialog	d(doc->GetGeometry(index)->GetName());
		if (d.DoModal() == IDCANCEL) {
			return;
		}
	}

	// Delete the item and update views.
	doc->DeleteGeometry(index);
	doc->SetModifiedFlag();
	doc->UpdateAllViews(NULL);
}
void CManilla2DConfigTabsDlg::OnNMClickMainListControl(NMHDR *pNMHDR, LRESULT *pResult)
{
    pNMHDR;
    pResult;

    int selectedItemIndex = GetSelectedItemIndex();

    BOOL upButtonState = TRUE;
    BOOL downButtonState = TRUE;

    if(selectedItemIndex == (m_mainListControl.GetItemCount()-1))
    {
        downButtonState = FALSE;
    }

    if(selectedItemIndex == 0)
    {
        upButtonState = FALSE;
    }

    m_moveDownButton.EnableWindow(downButtonState);
    m_moveUpButton.EnableWindow(upButtonState);
}
			description::Value GuiBindableListView::GetSelectedItem()
			{
				vint index = GetSelectedItemIndex();
				if (index == -1) return Value();
				return itemSource->Get(index);
			}