Beispiel #1
0
void CSiteGroupsTree::OnRightClick(NMHDR *, LRESULT *result)
{
    CPoint pt;
    GetCursorPos(&pt);
    CPoint ptClient = pt;
    ScreenToClient(&ptClient);
    
    HTREEITEM item = HitTest(ptClient);
    if (item == 0)
        item = GetSelectedItem();

    UpdateMenu(m_menu, item);
    m_menu.TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, this);

    *result = 1;
}
Beispiel #2
0
void ValueListCtrl::OnDelete(wxCommandEvent& event)
{
  wxMessageDialog Dlg(this, "Are you sure you want to delete this value?", "Confirm Value Delete", wxYES_NO | wxICON_EXCLAMATION );
  if(Dlg.ShowModal() != wxID_YES)
  {
    return;
  }
  long Item = GetSelectedItem();
  if(Item == -1)
  {
    return ;
  }
  wxString Text = GetItemText(Item);
  m_pConfig->remove_value(m_Key, Text);
  DeleteItem(Item);
}
void MenuEditor::AddItem(const wxString& label, const wxString& shortcut,
  const wxString& id, const wxString& name, const wxString &help, const wxString &kind)
{
    int sel = GetSelectedItem();
    int identation = 0;
    if (sel >= 0) identation = GetItemIdentation(sel);
    wxString labelAux = label;
    labelAux.Trim(true);
    labelAux.Trim(false);
    if (sel < 0) sel = m_menuList->GetItemCount() - 1;

    labelAux = wxString(wxChar(' '), identation * IDENTATION) + labelAux;

    long index = InsertItem(sel + 1, labelAux, shortcut, id, name, help, kind);
    m_menuList->SetItemState(index, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
Beispiel #4
0
void CPageSound::OnSelectButton() 
{
	int iSel = GetSelectedItem();
	
	if(iSel!=-1)
	{
		CString strFileName = m_SoundPathList.GetItemText(iSel,1);
		CFileDialog OpenDlg(TRUE,NULL,strFileName,OFN_CREATEPROMPT|OFN_EXPLORER,GetString(IDS_SOUND_FORMAT),this);
		if(OpenDlg.DoModal()==IDOK)
		{
			m_SoundPathList.SetItemText(iSel,1,OpenDlg.GetPathName());
			SetModified();
		}
	}
	BlockOrUnBlock();
}
Beispiel #5
0
void CMyTreeListControl::OnContextMenu(CWnd* /*pWnd*/, CPoint pt)
{
	int i= GetSelectedItem();
	if (i == -1)
		return;

	CTreeListItem *item= GetItem(i);

	CRect rc= GetWholeSubitemRect(i, 0);
	CRect rcTitle= item->GetTitleRect() + rc.TopLeft();

	CMenu menu;
	menu.LoadMenu(IDR_POPUPLIST);
	CMenu *sub= menu.GetSubMenu(0);

	PrepareDefaultMenu(sub, (CItem *)item);
	GetMainFrame()->AppendUserDefinedCleanups(sub);

	// Show popup menu and act accordingly.
	//
	// The menu shall not overlap the label but appear
	// horizontally at the cursor position,
	// vertically under (or above) the label.
	// TrackPopupMenuEx() behaves in the desired way, if
	// we exclude the label rectangle extended to full screen width.
	// 
	// Thanks to Sven for this compromise between the old Windirstat
	// behavior (show the menu to the right of the label) and the
	// Explorer behavior (show the menu at the cursor position).

	TPMPARAMS tp;
	tp.cbSize = sizeof(tp);
	tp.rcExclude = rcTitle;
	ClientToScreen(&tp.rcExclude);

	CRect desktop;
	GetDesktopWindow()->GetWindowRect(desktop);

	tp.rcExclude.left = desktop.left;
	tp.rcExclude.right = desktop.right;

	const int overlap = 2;	// a little vertical overlapping
	tp.rcExclude.top += overlap;
	tp.rcExclude.bottom -= overlap;

	sub->TrackPopupMenuEx(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, AfxGetMainWnd(), &tp);
}
Beispiel #6
0
void CTreeFileCtrl::OnRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult) 
{
  //Remember the old selected item
  HTREEITEM hOldSelItem = GetSelectedItem();

  //Work out the position of where the context menu should be
  CPoint p(GetCurrentMessage()->pt);
  CPoint pt(p);
  ScreenToClient(&pt);
  Select(HitTest(pt), TVGN_CARET);
	OnContextMenu(NULL, p);

  //Reselect the old selected item
  Select(hOldSelItem, TVGN_CARET);
	
	*pResult = 0;
}
void CFileListManager::OnUnloadFiles( KeyValues *pParams )
{
	CNotifyScopeGuard notify( "CFileListManager::OnUnloadFiles", NOTIFY_SOURCE_FILE_LIST_MANAGER, NOTIFY_SETDIRTYFLAG );

	int nSelected = GetSelectedItemsCount();
	for ( int i = 0; i < nSelected; ++i )
	{
		int itemId = GetSelectedItem( i );
		DmFileId_t fileid = ( DmFileId_t )GetItemUserData( itemId );
		if ( g_pDataModel->IsFileLoaded( fileid ) )
		{
			SetLoaded( fileid, false );
		}
	}

	Refresh();
}
Beispiel #8
0
//---------------------------- PRIVATE          -----------------------------//
void wxContextListCtrl::LeftDown(wxMouseEvent &)
{
	wxInt32 index = GetSelectedItem();

	if(-1 != index)
	{
		wxInt32 id = GetItemData(index);

		// Since we're a menu, we just want clicks, not selections.
		SetSelectedItem(-1);

		Controller::get().Transmit(shEventContextMenuClick, id);
		
		wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, id);
		ProcessEvent(command);
	}
}
void CTabMemSpellsDlg::OnMaxdec() 
{
	int nIndex = GetSelectedItem();
	if (nIndex == -1)
		return;

	CString strNum;
	int nNum;
	
	strNum = m_lcList.GetItemText(nIndex,2);
	nNum = atoi(strNum);
	if (nNum > 0)
	{
		strNum.Format("%d",nNum-1);
		m_lcList.SetItemText(nIndex,2,strNum);
	}
}
void CDirectoryTreeCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (nChar == VK_SPACE)
	{
		HTREEITEM hItem = GetSelectedItem();
		if (hItem)
		{
			ShareSubDirTree(hItem, GetKeyState(VK_CONTROL) & 0x8000);

			// if Ctrl+Space is passed to the tree control, it just beeps and does not check/uncheck the item!
			SetCheck(hItem, !GetCheck(hItem));
			return;
		}
	}

	CTreeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
Beispiel #11
0
/**
 * Call when adapter selection changed. This will reset device
 * combobox, list devices for new adapter, and call ChangedDevice().
 */
void ZFXD3DEnum::ChangedAdapter(void) {
   ZFXADAPTERINFO *pA=NULL;

   // delete content of device combobox
   SendMessage(m_hDEVICE, CB_RESETCONTENT, 0, 0);

   pA = (ZFXADAPTERINFO *)GetSelectedItem(m_hADAPTER);

   for (UINT d=0; d<pA->nNumDevs; d++) {
      AddItem(m_hDEVICE, D3DDevTypeToString(pA->d3dDevs[d].
              d3dDevType), &pA->d3dDevs[d]);
     }
   SendMessage(m_hDEVICE, CB_SETCURSEL, (WPARAM)0, 0);
   
   // treat as if device slectio changed
   ChangedDevice();
   } // ChangedAdapter
Beispiel #12
0
void CPageSound::BlockOrUnBlock()
{
	int iSel = GetSelectedItem();

	BOOL	bBlock1	=	FALSE;
	BOOL	bBlock2	=	FALSE;

	if(iSel != -1)
	{
		bBlock1 = TRUE;
		bBlock2 = !m_SoundPathList.GetItemText(iSel,1).IsEmpty();
	}

	GetDlgItem(IDC_SELECT_BUTTON)->EnableWindow(bBlock1);
	GetDlgItem(IDC_CLEAR_BUTTON)->EnableWindow(bBlock1&&bBlock2);
	GetDlgItem(IDC_TEST_BUTTON)->EnableWindow(bBlock2);
}
Beispiel #13
0
void CPROC UpdateUserButton(uintptr_t psv, PCONTROL pcButton)
{
    PCLIENT pc;
    ConnectToRelay( &pc );
    if( pc )
    {
        char msg[256];
        int len;
        len = sprintf( msg, "UPDATE  %s",
                       GetItemData(
                           GetSelectedItem(
                               GetControl( frame, LST_USERS ) ) ) );
        SendTCP( pc, msg, len );
        while( pc )
            Idle();
    }
}
Beispiel #14
0
void CTreeCtrlEx::OnTimer(UINT nIDEvent)
{
	if (nIDEvent == TCEX_EDITLABEL)
	{
		// Stop the timer.
		KillTimer(m_idTimer);

		// Invoke label editing.
		if (m_bEditLabelPending)
			EditLabel(GetSelectedItem());

		m_bEditLabelPending = FALSE;
		return;
	}

	CTreeCtrl::OnTimer(nIDEvent);
}
void CDirectoryTreeCtrl::OnTvnKeydown(NMHDR *pNMHDR, LRESULT *pResult)
{ 
	LPNMTVKEYDOWN pTVKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(pNMHDR);

	switch(pTVKeyDown->wVKey)
	{
		case VK_SPACE:
		case VK_RETURN:
		{
			HTREEITEM hItem = GetSelectedItem();

			if(hItem)
			{		
				HTREEITEM tItem = GetFirstVisibleItem();

				CheckChanged(hItem, !GetCheck(hItem));
								
				if(m_bCtrlPressed)
				{
					Expand(hItem, TVE_TOGGLE);
					HTREEITEM hChild;
					hChild = GetChildItem(hItem);

					while(hChild != NULL)
					{ 
						MarkChilds(hChild,!GetCheck(hItem));
						hChild = GetNextSiblingItem( hChild );
					}

					SetCheck(hItem, !GetCheck(hItem));
					Expand(hItem, TVE_TOGGLE);
				}
		 
				SelectSetFirstVisible(tItem);
			}

			break;
		}

		default:
			break;
	}

	*pResult = 0;
}
Beispiel #16
0
/**
 *\fn           HRESULT GetCurProject(Project **ppProject)
 *\brief        得到当前项目
 *\param[in]    Project * * ppProject 项目指针
 *\return       HRESULT 0成功,其它失败
 */
HRESULT CAddinProcess::GetCurProject(Project **ppProject)
{
    CComPtr<SelectedItem> selectItem;
    HRESULT hr = GetSelectedItem(1, &selectItem);

    if (SUCCEEDED(hr) && selectItem != NULL)
    {
        CComPtr<ProjectItem> item;
        hr = selectItem->get_ProjectItem(&item);

        if (SUCCEEDED(hr) && item != NULL)
        {
            hr = item->get_ContainingProject(ppProject);
        }
    }

    return hr;
}
Beispiel #17
0
BOOL CShellTreeCtrl::GetCurFilePath(CString & str)
{
	LPTVITEMDATA	lptvid;
	char		szBuff[MAX_PATH];
	HTREEITEM		hItem=NULL;

	hItem = GetSelectedItem();

	lptvid=(LPTVITEMDATA)GetItemData(hItem);

	if(SHGetPathFromIDList(lptvid->lpifq,szBuff))
	{
		str = szBuff;
		return TRUE;
	}
	else
		return FALSE;
}
Beispiel #18
0
//�������������������������������������������������������������������������Ŀ
// ToolTree - GetSelected                                                   �
//���������������������������������������������������������������������������
dword ToolTree::GetSelected(void)
{
    HTREEITEM       h;
    TV_ITEM         i;

    h = GetSelectedItem();

    if (!h)
        return 0;

    i.mask = TVIF_HANDLE;
    i.hItem = h;

    if (!GetItem(&i))
        return 0;

    return (dword)i.lParam;
}
Beispiel #19
0
int objectList::handle(LPARAM lParam)
{
  NMHDR* nmhdr = (NMHDR*)lParam;
  if (nmhdr->idFrom == ID)
  {
    if (nmhdr->code == TVN_SELCHANGED)
    {
      NMTREEVIEW* tree =    (NMTREEVIEW*)lParam;
      selectedObject   = (object*)GetSelectedItem(tree);
      
      return OBJECTLIST_SELCHANGED;
    }
    else if (nmhdr->code == NM_RCLICK)
    {
      return OBJECTLIST_RCLICK;
    }
  }
}
void CXTPRibbonControlTab::ShowPopupBar(BOOL bKeyboard)
{
	if (!GetSelectedItem())
		return;

	CXTPRibbonBar* pRibbonBar = GetRibbonBar();
	if (!pRibbonBar->IsRibbonMinimized())
		return;

	if (pRibbonBar->m_nPopuped == m_nIndex)
	{
		pRibbonBar->m_nPopuped = -1;
		if (m_pCommandBar) m_pCommandBar->SetTrackingMode(FALSE);
	}

	pRibbonBar->SetTrackingMode(TRUE, FALSE);
	pRibbonBar->SetPopuped(m_nIndex, bKeyboard);
}
Beispiel #21
0
void CTreeFileCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
{
  HTREEITEM hItem = GetSelectedItem();
  CPoint pt = GetCurrentMessage()->pt;
  ScreenToClient(&pt);

	if (hItem && (hItem == HitTest(pt)))
	{
		TV_ITEM tvi;
		ZeroMemory(&tvi, sizeof(TVITEM));
		tvi.mask = TVIF_CHILDREN;
		tvi.hItem = hItem;
		if (GetItem(&tvi) && tvi.cChildren == 0)
			OnFileOpen();
	}
	
	*pResult = 0;
}
Beispiel #22
0
LRESULT MFTreeView::OnKeydown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) {
	int x = 9;
	TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pnmh;

	if (pTVKeyDown->wVKey == VK_F2) {

		WTL::CTreeItem item = GetDropHilightItem();
		if (item.IsNull()) {
			item = GetSelectedItem();
		}
		MFTreeViewItem* pItem = (MFTreeViewItem*)item.GetData();
		if (pItem == NULL) 
			return 0;

		pItem->HandleMenuCmd(4 /*CMD_RENAME*/, item);		
	}
	return 0;
}
Beispiel #23
0
fsDldFilter* CDownloads_Groups::GetCurrentFilter()
{
	HTREEITEM hItem = GetSelectedItem ();

	if (hItem == m_hTasks)
		return &m_filterTasks;

	if (hItem == m_hAllGroups || hItem == m_hFilters)
		return &m_filterAll;

	if (hItem == m_hHistory || hItem == m_hDeleted)
		return NULL;

	if (GetParentItem (hItem) == m_hFilters || IsGroupItem (hItem))
		return (fsDldFilter*) GetItemData (hItem);

	return NULL;
}
Beispiel #24
0
LRESULT CInspectorTreeCtrl::WindowProc(UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch(Msg)
    {
    case MSG_EIP_RESIZE:
        HTREEITEM hitItem = GetSelectedItem();
        CRect rect;
        GetItemRect(hitItem, &rect, FALSE);
        rect.left = getColumnWidth(0);
        rect.right = rect.left + getColumnWidth(1);
        if(rect.Width() > 0)
            editCtrl.Resize(rect);
        else
            DeactivateEIP();
        return 0;
    }
    return CTreeCtrl::WindowProc(Msg, wParam, lParam);
}
Beispiel #25
0
void CTerminalTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default

	CRect rect_Item;

	HTREEITEM hSelItem_cur = HitTest(point);
	if(hSelItem_cur != NULL)
	{
		GetItemRect(hSelItem_cur, &rect_Item, TRUE);
		if(PtInRect(rect_Item, point))
			Select(hSelItem_cur, TVGN_CARET);
		else return;
	}

	HTREEITEM hSelItem = GetSelectedItem();
	if(hSelItem != NULL)
	{
		GetItemRect(hSelItem, &rect_Item, TRUE);

		if(PtInRect(rect_Item, point))
		{
			POINT m_posScreen;
			RECT rect;
			GetWindowRect(&rect);

			m_posScreen.x = rect.left;
			m_posScreen.y = rect.top;
		
			m_posScreen.x += point.x;
			m_posScreen.y += point.y;
            
			ItemData *data = (ItemData *)GetItemData(hSelItem);
			if (data->m_type == ITEM_TYPE_TERMINAL)
			{				
				CMenu menu;
				menu.LoadMenuA(IDR_MAINFRAME);
				menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,m_posScreen.x,m_posScreen.y,this);				
			}			
		}
	}
	
	CTreeCtrl::OnRButtonDown(nFlags, point);
}
Beispiel #26
0
IvObjectDragger::IvObjectDragger(QtCoinViewerPtr viewer, ItemPtr pItem, float draggerScale, bool bAllowRotation)
    : IvDragger(viewer, pItem, draggerScale)
{
    // create a root node for the dragger nodes
    _draggerRoot = new SoSeparator;
    ItemPtr selectedItem = GetSelectedItem();
    selectedItem->GetIvRoot()->insertChild(_draggerRoot, 0);

    // create and size a transform box dragger and then add it to the scene graph
    _transformBox = new SoTransformBoxDragger;

    _transformBox->scaleFactor.setValue(_ab.extents.x * _scale, _ab.extents.y * _scale, _ab.extents.z * _scale);
    _transformBox->translation.setValue(_ab.pos.x, _ab.pos.y, _ab.pos.z);
    _toffset = selectedItem->GetTransform();

    _draggerRoot->addChild(_transformBox);

    // disable the scaling part of the transform box
    _transformBox->setPart("scaler", NULL);

    // disable the rotation around the X and Z axes
    if (!bAllowRotation) {
        const char *rotators[2] = { "rotator1", "rotator3" };
        for (int i = 0; i < 2; i++)
            _transformBox->setPart(rotators[i], NULL);
    }

    // get the material node that governs the color of the dragger and
    // note the dragger's normal color
    if (bAllowRotation) {
        SoRotateCylindricalDragger *rp = (SoRotateCylindricalDragger *)_transformBox->getPart("rotator1", false);
        SoSeparator *s = (SoSeparator *) rp->getPart("rotator", false);
        _draggerMaterial = (SoMaterial *) s->getChild(0);
    }
    else
        _draggerMaterial = new SoMaterial();

    _normalColor = _draggerMaterial->diffuseColor[0];

    // add a motion callback handler for the dragger
    _transformBox->addMotionCallback(_MotionHandler, this);

    UpdateDragger();
}
void EXTreeCtrl::Moveup()
{
    // Get Item
    HTREEITEM hItem = GetDropHilightItem();
    if(hItem)
        SelectItem(hItem);
    else
        hItem = GetSelectedItem();

    // Get previous item
    HTREEITEM hSibling = GetNextItem(hItem,TVGN_PREVIOUS);

    if(hSibling != NULL)
    {

        // Get previous to previous item
        HTREEITEM hNewItem=NULL;
        HTREEITEM hItemBefore = GetNextItem(hSibling,TVGN_PREVIOUS);

        if(hItemBefore != NULL)
        {
            // Insert before item
            hNewItem = CopyItem(hItem,GetParentItem(hItem),hItemBefore);

            // Don't delete item data
            SetItemData(hItem, NULL);
            DeleteItem(hItem);
            SelectItem(hNewItem);
        }
        else
        {
            // Insert at start
            hNewItem = CopyItem(hItem,GetParentItem(hItem),TVI_FIRST);

            // Don't delete item data
            SetItemData(hItem, NULL);
            DeleteItem(hItem);
            SelectItem(hNewItem);
        }

        if(hNewItem)
            RefreshSubItems(hNewItem);
    }
}
	void BookmarksManagerDialog::on_RemoveButton__released ()
	{
		QStandardItem *item = GetSelectedItem ();
		if (!item)
			return;

		const auto& data = item->data ().toMap ();

		if (QMessageBox::question (this,
				"LeechCraft",
				tr ("Are you sure you want to delete the bookmark %1?")
					.arg (data.value ("HumanReadableName").toString ()),
				QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
			return;

		BMModel_->removeRow (item->row ());

		Save ();
	}
Beispiel #29
0
void CDownloads_Groups::OnClick(NMHDR* , LRESULT* pResult) 
{
	*pResult = 0;

	CPoint pt;
	if (FALSE == GetCursorPos (&pt))
		return;

	ScreenToClient (&pt);

	if (HitTest (pt) == m_hHistCustom)
	{
		if (GetSelectedItem () == m_hHistCustom)
		{
			CustomizeHistoryFilter ();
			_pwndDownloads->m_wndHistory.ApplyFilter (&m_filterCustomHist);
		}
	}
}
Beispiel #30
0
void C4Menu::DrawElement(C4TargetFacet &cgo)
{
	// inherited (background)
	typedef C4GUI::Dialog ParentClass;
	ParentClass::DrawElement(cgo);

	// Get selected item id
	C4ID idSelected; C4MenuItem *pItem;
	if ((pItem = GetSelectedItem())) idSelected = pItem->id; else idSelected = C4ID::None;
	C4Def *pDef = C4Id2Def(idSelected);
	// Get item value
	int32_t iValue = 0;
	if (pDef)
	{
		if (pItem && pItem->fOwnValue)
			iValue = pItem->iValue;
		else
			iValue = pDef->GetValue(NULL, NO_OWNER);
	}

	// Store and clear global clipper
//  int32_t iX1,iY1,iX2,iY2;
//  pDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2);
//  pDraw->SubPrimaryClipper(rcBounds.x, rcBounds.y, rcBounds.x+rcBounds.Wdt-1, rcBounds.y+rcBounds.Hgt-1);

	C4Facet cgoExtra(cgo.Surface, cgo.TargetX+rcBounds.x+1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-C4MN_SymbolSize-1, rcBounds.Wdt-2, C4MN_SymbolSize);

	// Draw bar divider
	if (Extra)
	{
		DrawFrame(cgoExtra.Surface, cgoExtra.X-1, cgoExtra.Y-1, cgoExtra.Wdt+1, cgoExtra.Hgt+1);
	}

	// Draw specified extra
	switch (Extra)
	{
	case C4MN_Extra_Value:
	{
		if (pDef) ::GraphicsResource.fctWealth.DrawValue(cgoExtra,iValue,0,0,C4FCT_Right);
	}
	break;
	}
}