示例#1
0
// Collapse all the tree sections.  This is recursive
// so that we can collapse submenus.  SetRedraw should
// be FALSE while this is executing.
void CStatisticsTree::CollapseAll(HTREEITEM theItem)
{
	HTREEITEM hCurrent;

	if (theItem == NULL) {
		hCurrent = GetRootItem();
		m_bExpandingAll = true;
	}
	else
		hCurrent = theItem;

	while (hCurrent != NULL)
	{
		if (ItemHasChildren(hCurrent))
			CollapseAll(GetChildItem(hCurrent));
		Expand(hCurrent, TVE_COLLAPSE);
		hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
	}

	if (theItem == NULL) m_bExpandingAll = false;
}
示例#2
0
void CMySuperGrid::SortData()
{
	int nIndex = GetNextItem(-1, LVNI_ALL | LVNI_SELECTED); 
	if(nIndex==-1)
		return;

	CTreeItem *pItem = reinterpret_cast<CTreeItem*>(GetItemData(nIndex));

	if(AfxMessageBox("Sort all children(Yes)\nor just sort rootitems(No)",MB_YESNO)==IDYES)
		Sort(pItem, TRUE);			
	else
		Sort(pItem, FALSE);			
	//do a simple refresh thing
	if(ItemHasChildren(pItem))
	{
		SetRedraw(0);
		Collapse(pItem);
		Expand(pItem, nIndex);
		SetRedraw(1);
	}
}
void CDownloadClientsCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED);
	const CUpDownClient* client = (iSel != -1) ? (CUpDownClient*)GetItemData(iSel) : NULL;

	CTitleMenu ClientMenu;
	ClientMenu.CreatePopupMenu();
	ClientMenu.AddMenuTitle(GetResString(IDS_CLIENTS), true);
	ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS"));
	ClientMenu.SetDefaultItem(MP_DETAIL);

	//Xman Xtreme Downloadmanager
	if (client && client->GetDownloadState() == DS_DOWNLOADING)
		ClientMenu.AppendMenu(MF_STRING,MP_STOP_CLIENT,GetResString(IDS_STOP_CLIENT), _T("EXIT"));
	//Xman end
	//Xman friendhandling
	ClientMenu.AppendMenu(MF_SEPARATOR); 
	//Xman end
	ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND"));
	//Xman friendhandling
	ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_REMOVEFRIEND, GetResString(IDS_REMOVEFRIEND), _T("DELETEFRIEND"));
	ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_FRIENDSLOT, GetResString(IDS_FRIENDSLOT), _T("FRIENDSLOT"));
	ClientMenu.CheckMenuItem(MP_FRIENDSLOT, (client && client->GetFriendSlot()) ? MF_CHECKED : MF_UNCHECKED);
	ClientMenu.AppendMenu(MF_SEPARATOR); 
	//Xman end

	ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE"));
	ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetViewSharedFilesSupport()) ? MF_ENABLED : MF_GRAYED), MP_SHOWLIST, GetResString(IDS_VIEWFILES), _T("VIEWFILES"));
	if (Kademlia::CKademlia::IsRunning() && !Kademlia::CKademlia::IsConnected())
		ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetKadPort()!=0 && client->GetKadVersion() > 1) ? MF_ENABLED : MF_GRAYED), MP_BOOT, GetResString(IDS_BOOTSTRAP));
	ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));

	// - show requested files (sivka/Xman)
	ClientMenu.AppendMenu(MF_SEPARATOR); 
	ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED),MP_LIST_REQUESTED_FILES, GetResString(IDS_LISTREQUESTED), _T("FILEREQUESTED")); 
	//Xman end

	GetPopupMenuPos(*this, point);
	ClientMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
示例#4
0
void DIALOG_CHOOSE_COMPONENT::OnInterceptSearchBoxKey( wxKeyEvent& aKeyStroke )
{
    // Cursor up/down and partiallyi cursor are use to do tree navigation operations.
    // This is done by intercepting some navigational keystrokes that normally would go to
    // the text search box (which has the focus by default). That way, we are mostly keyboard
    // operable.
    // (If the tree has the focus, it can handle that by itself).
    const wxTreeItemId sel = m_libraryComponentTree->GetSelection();

    switch( aKeyStroke.GetKeyCode() )
    {
    case WXK_UP:
        selectIfValid( GetPrevItem( *m_libraryComponentTree, sel ) );
        break;

    case WXK_DOWN:
        selectIfValid( GetNextItem( *m_libraryComponentTree, sel ) );
        break;

        // The following keys we can only hijack if they are not needed by the textbox itself.

    case WXK_LEFT:
        if( m_searchBox->GetInsertionPoint() == 0 )
            m_libraryComponentTree->Collapse( sel );
        else
            aKeyStroke.Skip();   // Use for original purpose: move cursor.
        break;

    case WXK_RIGHT:
        if( m_searchBox->GetInsertionPoint() >= (long) m_searchBox->GetLineText( 0 ).length() )
            m_libraryComponentTree->Expand( sel );
        else
            aKeyStroke.Skip();   // Use for original purpose: move cursor.
        break;

    default:
        aKeyStroke.Skip();  // Any other key: pass on to search box directly.
        break;
    }
}
示例#5
0
void CInspectorTreeCtrl::dynExpand(HTREEITEM in)
{
    CTreeListItem *parent = GetTreeListItem(in);
    assertex(parent);
    IPropertyTree &pTree = *parent->queryPropertyTree();
    if (!parent->isExpanded())
    {
        HTREEITEM i = GetChildItem(in);
        while(i)
        {
            DeleteItem(i);
            i = GetNextItem(i, TVGN_NEXT);              
        }
        CString txt;
        TV_INSERTSTRUCT is;
        is.hInsertAfter = TVI_LAST;
        is.item.mask = TVIF_TEXT | TVIF_PARAM;
        is.item.pszText = LPSTR_TEXTCALLBACK;   
        
        Owned<IAttributeIterator> attrIterator = pTree.getAttributes();
        ForEach(*attrIterator)
        {
            is.hParent = in;
            is.item.lParam = reinterpret_cast <DWORD> (createTreeListAttribute(attrIterator->queryName(), pTree));
            HTREEITEM r = InsertItem(&is);
            ASSERT(r != NULL);
        }

        Owned<IPropertyTreeIterator> iterator = pTree.getElements("*", iptiter_sort);
        ForEach(*iterator)
        {
            IPropertyTree & thisTree = iterator->query();

            is.hParent = in;
            is.item.lParam = reinterpret_cast <DWORD> (createTreeListProperty(thisTree.queryName(), thisTree));
            HTREEITEM thisTreeItem = InsertItem(&is);
            ASSERT(thisTreeItem != NULL);
        }
        parent->setExpanded();
    }
示例#6
0
bool CLogView::Find(const std::string& text, int direction)
{
	int begin = std::max(GetNextItem(-1, LVNI_FOCUSED), 0);
	int line = begin + direction;
	while (line != begin)
	{
		if (line < 0)
			line += m_logLines.size();
		if (line == m_logLines.size())
			line = 0;

		if (m_logLines[line].message.find(text) != std::string::npos)
		{
			EnsureVisible(line, true);
			SetItemState(line, LVIS_FOCUSED, LVIS_FOCUSED);
			SelectItem(line);
			return true;
		}
		line += direction;
	}
	return false;
}
示例#7
0
void CContactListCtrl::OnCtxMakeQuickCall(wxCommandEvent& e)
{
  int idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
  if ((idx >= 0) && (idx < m_liEntries.size()))
  {
    CContact& rContact = m_liEntries[idx];
    const TPhoneList& rPhones = rContact.getConstPhones();
    int phoneIdx = e.GetId() - ID_CTX_MAKE_CALL;
    if ((phoneIdx >= 0) && (phoneIdx < rPhones.size())) {
      wxString strNumber;
      rPhones[phoneIdx].getCallableNumber(strNumber);
      CCallMonitorApi *pCM = wxGetApp().getDefaultCallProvider();
      if (pCM) {
        wxLogMessage(wxT("Dialing %s using %s ..."), strNumber,
            wxGetApp().getPrefs().getDefaultCallProvider());
        pCM->makeCall(strNumber.ToUTF8().data());
      } else {
        wxLogMessage(wxT("Can't dial -> no valid default call provider"));
      }
    }
  }
}
void CFriendListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	CTitleMenu ClientMenu;
	ClientMenu.CreatePopupMenu();
	ClientMenu.AddMenuTitle(GetResString(IDS_FRIENDLIST), true);

	const CFriend* cur_friend = NULL;
	int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED);
	if (iSel != -1) {
		cur_friend = (CFriend*)GetItemData(iSel);
		ClientMenu.AppendMenu(MF_STRING,MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS"));
		ClientMenu.SetDefaultItem(MP_DETAIL);
	}

	ClientMenu.AppendMenu(MF_STRING, MP_ADDFRIEND, GetResString(IDS_ADDAFRIEND), _T("ADDFRIEND"));
	ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_REMOVEFRIEND, GetResString(IDS_REMOVEFRIEND), _T("DELETEFRIEND"));
	ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE"));
	ClientMenu.AppendMenu(MF_STRING | ((cur_friend==NULL || (cur_friend && cur_friend->GetLinkedClient(true) && !cur_friend->GetLinkedClient(true)->GetViewSharedFilesSupport())) ? MF_GRAYED : MF_ENABLED), MP_SHOWLIST, GetResString(IDS_VIEWFILES) , _T("VIEWFILES"));
	ClientMenu.AppendMenu(MF_STRING, MP_FRIENDSLOT, GetResString(IDS_FRIENDSLOT), _T("FRIENDSLOT"));
	ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));

    ClientMenu.EnableMenuItem(MP_FRIENDSLOT, (cur_friend)?MF_ENABLED : MF_GRAYED);
	ClientMenu.CheckMenuItem(MP_FRIENDSLOT, (cur_friend && cur_friend->GetFriendSlot()) ? MF_CHECKED : MF_UNCHECKED);
	// MORPH START - Modified by Commander, Friendlinks [emulEspaa] - added by zz_fly
	ClientMenu.AppendMenu(MF_SEPARATOR);
    ClientMenu.AppendMenu(MF_STRING | (theApp.IsEd2kFriendLinkInClipboard() ? MF_ENABLED : MF_GRAYED), MP_PASTE, GetResString(IDS_PASTE), _T("PASTELINK"));
	ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_GETFRIENDED2KLINK, GetResString(IDS_GETFRIENDED2KLINK), _T("ED2KLINK"));
	ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_GETHTMLFRIENDED2KLINK, GetResString(IDS_GETHTMLFRIENDED2KLINK), _T("ED2KLINK"));
	// MORPH END - Modified by Commander, Friendlinks [emulEspaa]

	// - show requested files (sivka/Xman)
	ClientMenu.AppendMenu(MF_SEPARATOR); 
	ClientMenu.AppendMenu(MF_STRING | (cur_friend && cur_friend->GetLinkedClient() ? MF_ENABLED : MF_GRAYED),MP_LIST_REQUESTED_FILES, GetResString(IDS_LISTREQUESTED), _T("FILEREQUESTED")); 
	//Xman end

	GetPopupMenuPos(*this, point);
	ClientMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
	VERIFY( ClientMenu.DestroyMenu() ); // XP Style Menu [Xanatos] - Stulle
}
示例#9
0
//寻找项
HTREEITEM CCompanionTreeCtrl::SearchCompanionItem(HTREEITEM hRootTreeItem, DWORD_PTR dwParam)
{
	//获取父项
	if (hRootTreeItem==NULL) hRootTreeItem=GetRootItem();
	if (hRootTreeItem==NULL) return NULL;

	//循环查找
	HTREEITEM hTreeItemTemp=NULL;
	do
	{
		if (GetItemData(hRootTreeItem)==dwParam) return hRootTreeItem;
		hTreeItemTemp=GetChildItem(hRootTreeItem);
		if (hTreeItemTemp!=NULL)
		{
			hTreeItemTemp=SearchCompanionItem(hTreeItemTemp,dwParam);
			if (hTreeItemTemp!=NULL) return hTreeItemTemp;
		}
		hRootTreeItem=GetNextItem(hRootTreeItem,TVGN_NEXT);
	} while (hRootTreeItem!=NULL);

	return NULL;
}
// Get an array of row numbers currently selected in the listctrl
void main_listctrl::get_selected_row_numbers( wxArrayInt *row_numbers )
{   
    long  selected_row_number = -1;  // '-1' needed to include the first selected row.
    
    wxLogDebug( "Entering selected row numbers function" );                                   
        
    for ( ;; ) {
        // for( ;; ) with this next line is the recommended way for iterating selected rows.
        // selected_row_number was initialized at -1 to allow inclusion of first selected
        // row.
        selected_row_number = GetNextItem( selected_row_number, wxLIST_NEXT_ALL,
                                           wxLIST_STATE_SELECTED );
        
        if ( selected_row_number == -1 ) {
            break;           
        } else {
            row_numbers->Add( selected_row_number );        
            wxLogDebug( "Appended row %ld to selected rows", selected_row_number );
        }            
        
    }
}
示例#11
0
void DocumentListCtrl::SortOnResemblance (bool force_sort)
{
	if (_lastsort == sortResemblance && !force_sort) return;
	_lastsort = sortResemblance;
	// get current selected item
	long item_number = GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
	int selected_item = (item_number == -1 ? -1 : _sortedIndices[(int)item_number]);

	std::vector<int> newIndices;

	// initialise the set of new indices
	for (int i=0; i < _sortedIndices.size(); ++i)
	{
		newIndices.push_back (_sortedIndices[i]);
	}
	
	std::sort (newIndices.begin(), newIndices.end(), 
			_ferretparent->GetDocumentList().GetSimilarityComparer (&_document1, &_document2, _remove_common_trigrams, _ignore_template_material));

	_sortedIndices = newIndices;
	RefreshItems (0, _sortedIndices.size()-1);
	// select original item
	if (selected_item != -1)
	{
		// find item in sorted indices, and select that position
		for (long i = 0, n = _sortedIndices.size(); i < n; ++i)
		{
			SetItemState (i, !wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
			if (_sortedIndices[i] == selected_item)
			{
				SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
				EnsureVisible (i);
			}
		}
	}

	Refresh ();
	_ferretparent->SetStatusText ("Rearranged table by similarity", 0);
}
示例#12
0
void DataListCtrl::OnBake(wxCommandEvent& event)
{
   long item = GetNextItem(-1,
         wxLIST_NEXT_ALL,
         wxLIST_STATE_SELECTED);
   if (item != -1 && GetItemText(item) == "Volume")
   {
      wxString name = GetText(item, 1);

      wxFileDialog *fopendlg = new wxFileDialog(
            m_frame, "Bake Volume Data", "", "",
            "Muti-page Tiff file (*.tif, *.tiff)|*.tif;*.tiff|"\
            "Single-page Tiff sequence (*.tif)|*.tif;*.tiff|"\
            "Nrrd file (*.nrrd)|*.nrrd",
            wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
      fopendlg->SetExtraControlCreator(CreateExtraControl);

      int rval = fopendlg->ShowModal();

      if (rval == wxID_OK)
      {
         wxString filename = fopendlg->GetPath();

         VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
         if (vr_frame)
         {
            VolumeData* vd = vr_frame->GetDataManager()->GetVolumeData(name);
            if (vd)
            {
               vd->Save(filename, fopendlg->GetFilterIndex(), true, VRenderFrame::GetCompression());
               wxString str = vd->GetPath();
               SetText(item, 2, str);
            }
         }
      }

      delete fopendlg;
   }
}
示例#13
0
BOOL CLibraryFolderCtrl::ClearSelection(HTREEITEM hExcept, HTREEITEM hItem, BOOL bSelect)
{
	BOOL bChanged = FALSE;

	if ( hItem == NULL ) hItem = GetRootItem();

	for ( ; hItem != NULL ; hItem = GetNextItem( hItem, TVGN_NEXT ) )
	{
		BOOL bIsSelected = ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED ) ? TRUE : FALSE;

		if ( hItem != hExcept && ( bIsSelected != bSelect ) )
		{
			SetItemState( hItem, bSelect ? TVIS_SELECTED : 0, TVIS_SELECTED );
			bChanged = TRUE;
		}

		HTREEITEM hChild = GetChildItem( hItem );
		if ( hChild != NULL ) bChanged |= ClearSelection( hExcept, hChild, bSelect );
	}

	return bChanged;
}
示例#14
0
   /// <summary>Gets the text of the selected suggestion.</summary>
   /// <returns></returns>
   /// <exception cref="Logic::InvalidOperationException">No item selected</exception>
   /// <exception cref="Logic::NotImplementedException">Command selected</exception>
   wstring SuggestionList::GetSelected() const
   {
      // Ensure exists
      if (GetNextItem(-1, LVNI_SELECTED) == -1)
         throw InvalidOperationException(HERE, L"No item selected");

      // Get selection and format
      switch (SuggestionType)
      {
      case Suggestion::GameObject:   return VString(L"{%s}", Content[GetNextItem(-1, LVNI_SELECTED)].Text.c_str());
      case Suggestion::ScriptObject: return VString(L"[%s]", Content[GetNextItem(-1, LVNI_SELECTED)].Text.c_str());
      case Suggestion::Variable:     return VString(L"$%s", Content[GetNextItem(-1, LVNI_SELECTED)].Text.c_str());
      case Suggestion::Label:        return VString(L"%s:", Content[GetNextItem(-1, LVNI_SELECTED)].Text.c_str());
      case Suggestion::Command:      return Content[GetNextItem(-1, LVNI_SELECTED)].Text;
      default:  return L"Error";
      }
   }
示例#15
0
void wxGxContentView::OnSelected(wxListEvent& event)
{
	//event.Skip();
    m_pSelection->Clear(NOTFIRESELID);
    long nItem = wxNOT_FOUND;
	size_t nCount(0);
    for ( ;; )
    {
        nItem = GetNextItem(nItem, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if ( nItem == wxNOT_FOUND )
            break;
        LPITEMDATA pItemData = (LPITEMDATA)GetItemData(nItem);
	    if(pItemData == NULL)
            continue;
		nCount++;
        m_pSelection->Select(pItemData->nObjectID, true, NOTFIRESELID);
    }

    if (m_pGxApp != NULL)
    {
        if(nCount <= 0)
	    	m_pSelection->SetInitiator(TREECTRLID);
        m_pGxApp->UpdateNewMenu(m_pSelection);
	}

    wxGISStatusBar* pStatusBar = m_pApp->GetStatusBar();
    if(pStatusBar)
    {
        if(nCount > 1)
        {
            pStatusBar->SetMessage(wxString::Format(_("%ld objects selected"), nCount));
        }
        else
        {
            pStatusBar->SetMessage(wxEmptyString);
        }
    }
}
示例#16
0
// This is the primary function for generating HTML output of the statistics tree.
// It is recursive.
CString CStatisticsTree::GetHTML(bool onlyVisible, HTREEITEM theItem, int theItemLevel, bool firstItem)
{
	HTREEITEM hCurrent;
	if (theItem == NULL)
	{
		if (!onlyVisible)
			theApp.emuledlg->statisticswnd->ShowStatistics(true);
		hCurrent = GetRootItem(); // Copy All Vis or Copy All
	}
	else
		hCurrent = theItem;

	CString	strBuffer;
	if (firstItem)
		strBuffer.Format(_T("<font face=\"Tahoma,Verdana,Courier New,Helvetica\" size=\"2\">\r\n<b>eMule v%s %s [%s]</b>\r\n<br /><br />\r\n"), theApp.m_strCurVersionLong, GetResString(IDS_SF_STATISTICS), thePrefs.GetUserNick());

	while (hCurrent != NULL)
	{
		CString	strItem;
		if (IsBold(hCurrent))
			strItem = _T("<b>") + GetItemText(hCurrent) + _T("</b>");
		else
			strItem = GetItemText(hCurrent);
		for (int i = 0; i < theItemLevel; i++)
			strBuffer += _T("&nbsp;&nbsp;&nbsp;");
		if (theItemLevel == 0)
			strBuffer.Append(_T("\n"));
		strBuffer += strItem + _T("<br />");
		if (ItemHasChildren(hCurrent) && (!onlyVisible || IsExpanded(hCurrent)))
			strBuffer += GetHTML(onlyVisible, GetChildItem(hCurrent), theItemLevel+1, false);
		hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
		if (firstItem && theItem != NULL)
			break; // Copy Selected Branch was used, so we don't want to copy all branches at this level.  Only the one that was selected.
	}
	if (firstItem)
		strBuffer += _T("</font>");
	return strBuffer;
}
示例#17
0
void WFileList::OnMenuFileDelete(wxCommandEvent& WXUNUSED(event))
{
    std::vector<int> subfilelist;

    long sfid = -1;
    while (1)
    {
        sfid = GetNextItem(sfid, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if (sfid == -1) break;

        subfilelist.push_back(sfid);
    }

    wxString surestr;

    if (subfilelist.empty()) return;
    else if (subfilelist.size() == 1)
    {
        wxString filelist = strSTL2WX(wmain->container.GetSubFileProperty(subfilelist[0], "Name"));
        surestr = wxString::Format(_("Going to permanently delete \"%s\". This cannot be undone, are you sure?"), filelist.c_str());
    }
    else {
        surestr = wxString::Format(_("Going to permanently delete %u files. This cannot be undone, are you sure?"), subfilelist.size());
    }

    wxMessageDialog suredlg(this, surestr, _("Delete files?"),
                            wxYES_NO | wxNO_DEFAULT);

    if (suredlg.ShowModal() != wxID_YES) return;

    for (std::vector<int>::reverse_iterator sfi = subfilelist.rbegin();
         sfi != subfilelist.rend(); ++sfi)
    {
        wmain->DeleteSubFile(*sfi, false);
    }

    ResetItems();
}
示例#18
0
void DataListCtrl::SetSelection(int type, wxString &name)
{
   wxString str_type;
   switch (type)
   {
   case DATA_VOLUME:
      str_type = "Volume";
      break;
   case DATA_MESH:
      str_type = "Mesh";
      break;
   case DATA_ANNOTATIONS:
      str_type = "Annotations";
      break;
   }

   long item = -1;
   for (;;)
   {
      item = GetNextItem(item,
            wxLIST_NEXT_ALL,
            wxLIST_STATE_DONTCARE);
      if (item != -1)
      {
         wxString item_type = GetText(item, 0);
         wxString item_name = GetText(item, 1);

         if (item_type == str_type &&
               item_name == name)
         {
            SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
            break;
         }
      }
      else
         break;
   }
}
示例#19
0
void CMultiTreeCtrl::GetCheckItems(std::vector<HTREEITEM>& vecTreeItems, HTREEITEM hTreeItem)
{
	if (hTreeItem == NULL)
	{
		hTreeItem = GetRootItem();
	}

	HTREEITEM hNextItem = GetChildItem(hTreeItem);
	while(hNextItem!=NULL)
	{
		GetCheckItems(vecTreeItems, hNextItem);
		hNextItem = GetNextItem(hNextItem,TVGN_NEXT);
	}

	if (hTreeItem!=NULL)
	{
		//如果该节点复选框被选中
		if (GetCheck(hTreeItem))
		{
			vecTreeItems.push_back(hTreeItem);
		}
	}
}
void CMusikListCtrl::SelectClickedItem(wxMouseEvent &event)
{
	int HitFlags = 0;
	long item = HitTest(event.GetPosition(),HitFlags);
	if(item != -1)
	{
        if((wxLIST_STATE_SELECTED & GetItemState(item,wxLIST_STATE_SELECTED)) != wxLIST_STATE_SELECTED) // bug in MSW GetItemState (mask param is ignored)
        {    
            if(!event.CmdDown())
            {
                int i = -1;
                while ( -1 != (i = GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)))
                {
                    if(i != item)
                        SetItemState( i, 0, wxLIST_STATE_SELECTED );
                }

            }
            SetItemState(item,wxLIST_STATE_SELECTED,wxLIST_STATE_SELECTED);
            wxTheApp->Yield(true);   // call yield to let the SetItemState changes go through the system.
        }
    }
}
示例#21
0
    BOOL SMCTreeCtrl::DeleteColumn(int iCol)
    {
        if(iCol<0 || iCol>=m_arrColWidth.GetCount()) 
            return FALSE;
        HSTREEITEM hItem = GetRootItem();
        while(hItem)
        {
            MCITEM *pMcItem = (MCITEM*)STreeCtrl::GetItemData(hItem);
            pMcItem->arrText.RemoveAt(iCol);
            hItem = GetNextItem(hItem);
        }
        int nColWid = m_arrColWidth[iCol];
        m_arrColWidth.RemoveAt(iCol);
        
        m_nItemWid = -1;
        CalcItemWidth(0);

        CSize szView = GetViewSize();
        szView.cx = m_nItemWid;
        SetViewSize(szView);
        Invalidate();
        return TRUE;
    }
示例#22
0
void wxGISToolExecuteView::OnBeginDrag(wxListEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(m_nParentGxObjectId);
    if(!pGxObject)
        return;
    wxGISTaskDataObject DragData(wxThread::GetMainId(), wxDataFormat(wxGIS_DND_ID));


    long nItem = wxNOT_FOUND;
    int nCount(0);
    for ( ;; )
    {
        nItem = GetNextItem(nItem, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        if ( nItem == wxNOT_FOUND )
            break;

        DragData.AddDecimal(GetItemData(nItem));
    }

    wxDropSource dragSource( this );
    dragSource.SetData( DragData );
    wxDragResult result = dragSource.DoDragDrop( wxDrag_DefaultMove );
}
示例#23
0
void CCaseTreeCtrl::RunTestCase(HTREEITEM hItem, OperateFun pFn)
{
	SEARCH_FALG searchFlag = FLAG_CONTINUE;

	if (hItem != NULL)
	{
		searchFlag = pFn(this, hItem, 0, (DWORD)this);
		if(searchFlag == FLAG_CONTINUE)
		{
			hItem = GetNextItem(hItem, TVGN_CHILD);
			if (hItem != NULL)
			{
				searchFlag = SeatchItem(hItem,(OperateFun)pFn, (DWORD)this);
			}
		}
	}

	if(searchFlag == FLAG_CONTINUE)
	{
		m_hSelectedItem = NULL;
		m_hCurrentItem = NULL;
	}
}
示例#24
0
// Expand all the tree sections.  Recursive.
// Can also expand only bold items (Main Sections)
void CStatisticsTree::ExpandAll(bool onlyBold, HTREEITEM theItem)
{
	HTREEITEM hCurrent;

	if (theItem == NULL) {
		if (onlyBold) CollapseAll();
		hCurrent = GetRootItem();
		m_bExpandingAll = true;
	}
	else
		hCurrent = theItem;

	while (hCurrent != NULL)
	{
		if (ItemHasChildren(hCurrent) && (!onlyBold || IsBold(hCurrent))) {
			Expand(hCurrent, TVE_EXPAND);
			ExpandAll(onlyBold, GetChildItem(hCurrent));
		}
		hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
	}

	if (theItem == NULL) m_bExpandingAll = false;
}
示例#25
0
bool wxRadioBox::OnKeyDown(wxKeyEvent& event)
{
    wxDirection dir;
    switch ( event.GetKeyCode() )
    {
        case WXK_UP:
            dir = wxUP;
            break;

        case WXK_LEFT:
            dir = wxLEFT;
            break;

        case WXK_DOWN:
            dir = wxDOWN;
            break;

        case WXK_RIGHT:
            dir = wxRIGHT;
            break;

        default:
            return false;
    }

    int selOld = GetSelection();
    int selNew = GetNextItem(selOld, dir, GetWindowStyle());
    if ( selNew != selOld )
    {
        SetSelection(selNew);

        // emulate the button click
        SendRadioEvent();
    }

    return true;
}
void main_listctrl::refresh_rows_due_column( wxArrayString& channel_sections )
{  
    size_t      number_of_sections           = channel_sections.GetCount();
    wxDateTime  due_datetime;
    wxString    due_string;
    wxString    channel_section;  
    long        row_number = -1;  // '-1' needed to include the first selected row.                                 

    if ( number_of_sections == 0 ) {
        return;
    }     
        
    for ( ;; ) {
        row_number = GetNextItem( row_number, wxLIST_NEXT_ALL );
        
        if ( row_number == -1 ) {
            break; 
        }
        
        channel_section = get_row_channel_section( row_number );
        
        // Only proceed if the current channel section was in our array
        if ( channel_sections.Index( channel_section ) != wxNOT_FOUND ) {
        
            due_datetime   = the_plucker_controller->get_channel_due_datetime( channel_section );    
            due_string     = due_datetime.Format( wxT( plkrPRETTY_COMPACT_DATE_TIME_FORMAT ) ).c_str();        

            if ( ! the_plucker_controller->is_channel_update_enabled( channel_section ) ) {
                due_string = _( "Never" );
            }       
    
            if ( due_string != get_cell_contents_string ( row_number, DUE_COLUMN ) ) {       
                SetItem( row_number, DUE_COLUMN, due_string );
            }        
        }    
    }
}
示例#27
0
void CUnitPane::OnPopupMenuGiveEverything (wxCommandEvent& event)
{
    long         idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    CUnit      * pUnit = GetUnit(idx);
    CEditPane  * pOrders;
    wxString     N;

    if (pUnit)
    {
        pOrders = (CEditPane*)gpApp->m_Panes[AH_PANE_UNIT_COMMANDS];
        if (pOrders)
            pOrders->SaveModifications();

        if (m_pCurLand)
            m_pCurLand->guiUnit = pUnit->Id;

        N = wxGetTextFromUser(wxT("Give everything to unit"), wxT("Confirm"));

        gpApp->SetOrdersChanged(gpApp->m_pAtlantis->GenGiveEverything(pUnit, N.mb_str())
                               || gpApp->GetOrdersChanged());
        Update(m_pCurLand);
    }

}
示例#28
0
void CUnitPane::OnPopupMenuSplit(wxCommandEvent& event)
{
    long         idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    CUnit      * pUnit = GetUnit(idx);
    CEditPane  * pOrders;

    if (pUnit)
    {
        pOrders = (CEditPane*)gpApp->m_Panes[AH_PANE_UNIT_COMMANDS];
        if (pOrders)
            pOrders->SaveModifications();

        if (m_pCurLand)
            m_pCurLand->guiUnit = pUnit->Id;

        // do it here

        CUnitSplitDlg dlg(this, pUnit);
        if (wxID_OK == dlg.ShowModal()) // it will modify unit's orders
            gpApp->SetOrdersChanged(TRUE);

        Update(m_pCurLand);
    }
}
// Note: also used on the list control double-click event
void main_listctrl::gui_configure_channel()
{    
    wxString section_string;
    long selected_row_number = -1;       
    
    // Get first selected item
    selected_row_number = GetNextItem( selected_row_number, wxLIST_NEXT_ALL, 
                                       wxLIST_STATE_SELECTED );
        
    // No rows that fit the flag of being in a selected state, so abort
    if ( selected_row_number == -1 )
        return;         
            
    // Get the section of the row
    section_string = get_row_channel_section( selected_row_number );

    // Create a channel dialog
    channel_dialog a_channel_dialog( m_parent, section_string );            
    
    // Show modal, and if clicked OK, then refresh the row, which will repaint as required.
    if ( a_channel_dialog.ShowModal() == wxID_OK ) {    
        refresh_row( selected_row_number );
    }            
}
示例#30
0
const GameListItem * CGameListCtrl::GetSelectedISO()
{
	if (m_ISOFiles.size() == 0)
		return NULL;
	else if (GetSelectedItemCount() == 0)
		return NULL;
	else
	{
		long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		if (item == wxNOT_FOUND)
			return NULL;
		else
		{
			// Here is a little workaround for multiselections:
			// when > 1 item is selected, return info on the first one
			// and deselect it so the next time GetSelectedISO() is called,
			// the next item's info is returned
			if (GetSelectedItemCount() > 1)
				SetItemState(item, 0, wxLIST_STATE_SELECTED);

			return m_ISOFiles[GetItemData(item)];
		}
	}
}