//设置类型 void CDlgInsureGame::SetBankerActionType(bool bStorage) { //设置变量 m_bBankStorage = bStorage; m_lInCount = 0; GetDlgItem(IDC_IN_COUNT)->SetWindowText(TEXT("")); ((CButton*)GetDlgItem(IDC_CHECK_ALL))->SetCheck(0); //设置标题 if (m_bBankStorage) { m_blUsingPassWord = false; } else { m_blUsingPassWord = true; } //显示密码框 if(m_blUsingPassWord) { GetDlgItem(IDC_USER_PASSWORD)->EnableWindow(m_blCanStore); } //显示控件 ShowItem(); }
//设置类型 void CDlgBank::SetBankerActionType(bool bStorage) { //设置变量 m_bBankStorage=bStorage; //设置标题 if (m_bBankStorage) { // m_bDrawAllGold=((CButton*)(GetDlgItem(IDC_CHECK_ALL)))->GetCheck()==1?true:false; // ((CButton*)(GetDlgItem(IDC_CHECK_ALL)))->SetCheck(m_bStorageAllGold?1:0); SetDlgItemText(IDC_IN_COUNT,""); SetDlgItemText(IDC_USER_PASSWORD,""); GetDlgItem(IDOK)->SetWindowText(TEXT("存款")); GetDlgItem(IDC_CHECK_ALL)->SetWindowText("存入所有金币"); m_blUsingPassWord = false; } else { // m_bStorageAllGold=((CButton*)(GetDlgItem(IDC_CHECK_ALL)))->GetCheck()==1?true:false; // ((CButton*)(GetDlgItem(IDC_CHECK_ALL)))->SetCheck(m_bDrawAllGold?1:0); SetDlgItemText(IDC_IN_COUNT,""); SetDlgItemText(IDC_USER_PASSWORD,""); GetDlgItem(IDOK)->SetWindowText(TEXT("取款")); GetDlgItem(IDC_CHECK_ALL)->SetWindowText("取出所有金币"); m_blUsingPassWord = true; } ShowItem(); }
/** * name: InitTreeItems() * desc: initialize the tree control's datastructure * param: needWidth - width to expand the tree by * return: TRUE if initialization is ok, FALSE otherwise **/ BOOLEAN CPsTree::InitTreeItems(LPWORD needWidth) { INT i; DBVARIANT dbv; if (!_hWndTree || !_pItems) { return FALSE; } if (!DB::Setting::GetUString(NULL, MODNAME, SET_LASTITEM, &dbv)) { _curItem = FindItemIndexByName(dbv.pszVal); DB::Variant::Free(&dbv); } // init the groups if ((_dwFlags & PSTVF_GROUPS) || (!_pPs->hContact && myGlobals.CanChangeDetails)) { LPSTR pszGroup; // set treeview styles TreeView_SetIndent(_hWndTree, 3); SetWindowLongPtr(_hWndTree, GWL_STYLE, GetWindowLongPtr(_hWndTree, GWL_STYLE)|TVS_HASBUTTONS); // init the iParent member for all the items for (i = 0; i < _numItems; i++) { if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != NULL) { INT iParent = FindItemIndexByName(pszGroup); // need to add an empty parent item if (iParent == -1) { iParent = AddDummyItem(pszGroup); } _pItems[i]->Parent(iParent); mir_free(pszGroup); } } } if (needWidth) { *needWidth = 0; } ShowWindow(_hWndTree, SW_HIDE); for (i = 0; i < _numItems; i++) { if (_pItems[i]->State() != DBTVIS_INVISIBLE) { ShowItem(i, needWidth); } } ShowWindow(_hWndTree, SW_SHOW); return TRUE; }
void DocumentListCtrl::ShowSelectedItem () { long item_number = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item_number != -1) { ShowItem (item_number); } }
/** * name: ShowItem * class: CPsTree * desc: displays on of the items in the treeview * param: iPageIndex - the index of the treeitem in the array. * needWidth - gives and takes the width, the treeview must have to show all items properly * return: TRUE if item was added successfully, FALSE otherwise **/ HTREEITEM CPsTree::ShowItem(const int iPageIndex, LPWORD needWidth) { TVINSERTSTRUCT tvii; CPsTreeItem *pti; // check parameters if (!_hWndTree || !IsIndexValid(iPageIndex) || !(pti = _pItems[iPageIndex]) || !pti->Name() || !pti->Label()) { MsgErr(GetParent(_hWndTree), LPGENT("Due to a parameter error, one of the treeitems can't be added!")); return NULL; } // item is visible at the moment if ((tvii.itemex.hItem = pti->Hti()) == NULL) { RECT rc; const int iParent = pti->Parent(); // init the rest of the treeitem tvii.hParent = IsIndexValid(iParent) ? ShowItem(iParent, needWidth) : NULL; tvii.hInsertAfter = (_dwFlags & PSTVF_SORTTREE) ? TVI_SORT : TVI_LAST; tvii.itemex.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; tvii.itemex.pszText = pti->Label(); tvii.itemex.state = pti->State() == DBTVIS_EXPANDED ? TVIS_EXPANDED : 0; tvii.itemex.stateMask = TVIS_EXPANDED; tvii.itemex.lParam = iPageIndex; // set images if ((tvii.itemex.iImage = tvii.itemex.iSelectedImage = pti->Image()) != -1) { tvii.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; } // insert item into tree if set visible if ((tvii.itemex.hItem = TreeView_InsertItem(_hWndTree, &tvii)) == NULL) { MsgErr(GetParent(_hWndTree), LPGENT("A fatal error occurred on adding a property sheet page!\nDialog creation aborted!")); return NULL; } pti->Hti(tvii.itemex.hItem); // calculate width of treeview if (needWidth && TreeView_GetItemRect(_hWndTree, pti->Hti(), &rc, TRUE) && rc.right > *needWidth) { *needWidth = (WORD)rc.right; } } return tvii.itemex.hItem; }
void DocumentListCtrl::OnListItemActivated (wxListEvent & event) { ShowItem (event.GetIndex ()); }
void CPsTree::PopupMenu() { HMENU hPopup; MENUITEMINFO mii; TVHITTESTINFO hti; TVITEM tvi; POINT pt; int iItem, i; // init popup menu if (!(hPopup = CreatePopupMenu())) return; ZeroMemory(&mii, sizeof(MENUITEMINFO)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_STRING|MIIM_ID; // get cursor postion GetCursorPos(&pt); hti.pt = pt; ScreenToClient(_hWndTree, &hti.pt); tvi.mask = TVIF_PARAM|TVIF_CHILDREN; // find treeitem under cursor TreeView_HitTest(_hWndTree, &hti); if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { tvi.hItem = hti.hItem; TreeView_GetItem(_hWndTree, &tvi); if (!db_get_b(NULL, MODNAME, SET_PROPSHEET_READONLYLABEL, FALSE)) { mii.dwTypeData = TranslateT("Rename Item"); mii.wID = 32001; InsertMenuItem(hPopup, 0, FALSE, &mii); } // do not allow hiding groups if (tvi.cChildren) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; } mii.dwTypeData = TranslateT("Hide Item"); mii.wID = 32000; InsertMenuItem(hPopup, 0, FALSE, &mii); } else { // add hidden items to menu mii.wID = 0; for (i = 0; i < _numItems; i++) { if (!_pItems[i]->Hti()) { mii.dwTypeData = _pItems[i]->Label(); mii.wID = 100 + i; InsertMenuItem(hPopup, 0, FALSE, &mii); } } // add headline if (mii.wID > 0) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; mii.dwTypeData = TranslateT("Show Items:"); mii.wID = 0; InsertMenuItem(hPopup, 0, TRUE, &mii); mii.fMask |= MIIM_FTYPE; mii.fType = MFT_SEPARATOR; InsertMenuItem(hPopup, 1, TRUE, &mii); InsertMenuItem(hPopup, ++i, TRUE, &mii); } mii.fMask &= ~(MIIM_FTYPE|MIIM_STATE); mii.dwTypeData = TranslateT("Reset to defaults"); mii.wID = 32004; InsertMenuItem(hPopup, ++i, TRUE, &mii); } // show the popup menu iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, NULL); DestroyMenu(hPopup); switch (iItem) { // hide the item case 32000: HideItem(tvi.lParam); break; // rename the item case 32001: BeginLabelEdit(tvi.hItem); break; // reset current tree case 32004: DBResetState(); break; // show a hidden item default: if ((iItem -= 100) >= 0 && ShowItem(iItem, NULL)) AddFlags(PSTVF_STATE_CHANGED|PSTVF_POS_CHANGED); break; } }
void CDlgBank::AllowDraw(bool bAllow) { m_bCanDraw=bAllow; ShowItem(); }
void CDlgBank::AllowStorage(bool bAllow) { m_blCanStore=bAllow; ShowItem(); }
/** * @brief ShowTool highlight tool. * @param id object id in container. * @param color highlight color. * @param enable enable or disable highlight. */ void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); }
void CDlgBank::AllowStorage(bool bAllow) { m_blCanStore=bAllow; MyDebug(_T("Bank Set :%d"), m_blCanStore); ShowItem(); }