예제 #1
0
void TreeDlg::OnExpandOrCollapse() {
  CTreeCtrl *ctrl = getTreeCtrl();
  HTREEITEM item = ctrl->GetSelectedItem();
  UINT state;
  if((state = ctrl->GetItemState(item, TVIS_EXPANDED)) & TVIS_EXPANDED) {
    OnCollapse();
  } else {
    OnExpand();
  }
}
예제 #2
0
// @pymethod (int,int)|PyCTreeCtrl|GetItemState|Retrieves the state and mask of an item.
// @pyparm HTREEITEM|item||The specified item
// @pyparm int|stateMask||The mask for the result.
PyObject *PyCTreeCtrl_GetItemState( PyObject *self, PyObject *args )
{
	PyObject *obItem; UINT stateMask;
	if (!PyArg_ParseTuple( args, "Ok:GetItemState", &obItem, &stateMask))
		return NULL;
	CTreeCtrl *pList = GetTreeCtrl(self);
	if (!pList) return NULL;
	HTREEITEM item;
	if (!PyWinObject_AsHANDLE(obItem, (HANDLE *)&item))
		return NULL;
	GUI_BGN_SAVE;
	long state = pList->GetItemState(item, stateMask);
	GUI_END_SAVE;
	return PyInt_FromLong(state);
}