Exemplo n.º 1
0
	virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
	{
		if (msg == WM_NOTIFY) {
			LPNMHDR lpnmhdr = (LPNMHDR)lParam;
			if (lpnmhdr->idFrom == IDC_EXTRAORDER && lpnmhdr->code == NM_RCLICK) {
				HTREEITEM hSelected = m_tree.GetDropHilight();
				if (hSelected != NULL && !m_tree.IsSelected(hSelected)) {
					m_tree.UnselectAll();
					m_tree.SelectItem(hSelected);
				}

				int sels = m_tree.GetNumSelected();
				if (sels > 1) {
					if (ShowPopup(0) == ID_GROUP) {
						GroupSelectedItems();
						NotifyChange();
					}
				}
				else if (sels == 1) {
					HTREEITEM hItem = m_tree.GetSelection();
					intlist *ids = Tree_GetIDs(hItem);
					if (ids->count > 1) {
						if (ShowPopup(1) == ID_UNGROUP) {
							UngroupSelectedItems();
							NotifyChange();
						}
					}
				}
			}
		}

		return CDlgBase::DlgProc(msg, wParam, lParam);
	}
Exemplo n.º 2
0
	void RebuildTree()
	{
		TVITEMEX tvi = { 0 };
		tvi.mask = TVIF_HANDLE | TVIF_PARAM;
		tvi.hItem = m_tvFilter.GetSelection();
		m_tvFilter.GetItem(&tvi);
		TCHAR *szActiveTag = mir_tstrdup((TCHAR *)tvi.lParam);

		m_tvFilter.DeleteAllItems();

		TVINSERTSTRUCT tvis = { 0 };
		tvis.hInsertAfter = TVI_LAST;
		tvis.itemex.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
		tvis.itemex.stateMask = tvis.itemex.state = TVIS_BOLD | TVIS_EXPANDED;
		tvis.itemex.pszText = TranslateT("All tags");

		PopulateTags(m_tvFilter.InsertItem(&tvis), szActiveTag);
		mir_free(szActiveTag);
	}