示例#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);
	}
示例#2
0
	void InsertTag(HTREEITEM htiRoot, const TCHAR *tag, bool bSelect)
	{
		TVINSERTSTRUCT tvi = {0};
		tvi.hParent = htiRoot;
		tvi.hInsertAfter = TVI_LAST;
		tvi.itemex.mask = TVIF_TEXT|TVIF_PARAM;
		tvi.itemex.pszText = (TCHAR *)tag;
		tvi.itemex.lParam = (LPARAM)mir_tstrdup(tag);
		HTREEITEM hti = m_tvFilter.InsertItem(&tvi);
		if (bSelect) m_tvFilter.SelectItem(hti);
	}
示例#3
0
	void PopulateTags(HTREEITEM htiRoot, TCHAR *szActiveTag)
	{
		LIST<TCHAR> tagSet(5, _tcscmp);
		for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
			TCHAR *tags = m_proto->m_notes[i].GetTags();
			for (TCHAR *tag = tags; tag && *tag; tag = tag + lstrlen(tag) + 1)
			if (!tagSet.find(tag))
				tagSet.insert(tag);
		}

		bool selected = false;
		for (int j = 0; j < tagSet.getCount(); ++j) {
			bool select = !lstrcmp(szActiveTag, tagSet[j]);
			selected |= select;
			InsertTag(htiRoot, tagSet[j], select);
		}

		if (!selected)
			m_tvFilter.SelectItem(htiRoot);
	}