/** * name: OnApply * class: CPsTree * desc: saves settings of all pages * param: none * return: 0 if ready to continue, 1 if need to abort **/ int CPsTree::OnApply() { CPsTreeItem *pti = CurrentItem(); if (pti != NULL) { PSHNOTIFY pshn; int i; pshn.hdr.idFrom = 0; pshn.hdr.code = PSN_KILLACTIVE; pshn.hdr.hwndFrom = pti->Wnd(); if (!SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn)) { // save everything to database pshn.hdr.code = PSN_APPLY; for (i = 0; i < _numItems; i++) { pshn.lParam = (LPARAM)_pItems[i]->hContact(); if (_pItems[i] && _pItems[i]->Wnd() && _pItems[i]->Flags() & PSPF_CHANGED) { pshn.hdr.hwndFrom = _pItems[i]->Wnd(); if (SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) { CPsTreeItem *pti; if (pti = CurrentItem()) ShowWindow(pti->Wnd(), SW_HIDE); _curItem = i; ShowWindow(_pItems[i]->Wnd(), SW_SHOW); return 1; } _pItems[i]->RemoveFlags(PSPF_CHANGED); } } return 0; } } return 1; }
void CWidgetSearchTemplate::on_actionDownload_triggered() { SearchTreeItem* itemSearch = m_pSearchModel->topLevelItemFromIndex(CurrentItem()); if( itemSearch != NULL ) { on_treeViewSearchResults_doubleClicked(CurrentItem()); } }
//------------------------------------------------------------------------------ void MenuEditor::OnSelectionChanged(BMessage* /*msg*/) { if ((fListView->CurrentSelection() < 0) || is_kind_of(CurrentItem(), BSeparatorItem)) { fLabelText->SetText(""); fLabelText->SetEnabled(false); fMsgText->SetText("none"); fMsgText->SetEnabled(false); fShortcutText->SetText(""); fShortcutText->SetEnabled(false); fModifierField->Menu()->ItemAt(0)->SetMarked(false); fModifierField->Menu()->ItemAt(1)->SetMarked(false); fModifierField->Menu()->ItemAt(2)->SetMarked(false); fModifierField->SetEnabled(false); fEnabledBox->SetEnabled(false); fEnabledBox->SetValue(B_CONTROL_OFF); return; } else { fLabelText->SetEnabled(true); fMsgText->SetEnabled(true); fModifierField->Menu()->ItemAt(0)->SetMarked(false); fModifierField->Menu()->ItemAt(1)->SetMarked(false); fModifierField->Menu()->ItemAt(2)->SetMarked(false); fEnabledBox->SetEnabled(true); fEnabledBox->SetValue(CurrentItem()->IsEnabled()); fShortcutText->SetEnabled(CurrentItem()->Submenu() == NULL); } fLabelText->SetText(CurrentItem()->Label()); char temp[5]; BMenuItem *item = CurrentItem(); if (item->Message() != NULL) strncpy(temp, (char *)(new int32(flipcode(item->Message()->what))), 4); else strcpy(temp, "none"); temp[4] = 0; fMsgText->SetText(temp); uint32 mod; temp[1] = 0; temp[0] = item->Shortcut(&mod); fShortcutText->SetText(temp); fModifierField->SetEnabled(*temp); if (*temp) { fModifierField->Menu()->ItemAt(0)->SetMarked(mod & B_OPTION_KEY); fModifierField->Menu()->ItemAt(1)->SetMarked(mod & B_SHIFT_KEY); fModifierField->Menu()->ItemAt(2)->SetMarked(mod & B_CONTROL_KEY); } }
void CUIInventoryWnd::ProcessPropertiesBoxClicked () { if(UIPropertiesBox.GetClickedItem()) { switch(UIPropertiesBox.GetClickedItem()->GetID()) { case INVENTORY_TO_SLOT_ACTION: ToSlot(CurrentItem(), true); break; case INVENTORY_TO_BELT_ACTION: ToBelt(CurrentItem(),false); break; case INVENTORY_TO_BAG_ACTION: ToBag(CurrentItem(),false); break; case INVENTORY_DROP_ACTION: { void* d = UIPropertiesBox.GetClickedItem()->GetData(); bool b_all = (d==(void*)33); DropCurrentItem(b_all); }break; case INVENTORY_EAT_ACTION: EatItem(CurrentIItem()); break; case INVENTORY_ATTACH_ADDON: AttachAddon((PIItem)(UIPropertiesBox.GetClickedItem()->GetData())); break; case INVENTORY_DETACH_SCOPE_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetScopeName()); break; case INVENTORY_DETACH_SILENCER_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetSilencerName()); break; case INVENTORY_DETACH_GRENADE_LAUNCHER_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetGrenadeLauncherName()); break; case INVENTORY_ACTIVATE_ARTEFACT_ACTION: Activate_Artefact(); break; case INVENTORY_RELOAD_MAGAZINE: (smart_cast<CWeapon*>(CurrentIItem()))->Action(kWPN_RELOAD, CMD_START); break; case INVENTORY_UNLOAD_MAGAZINE: { CUICellItem * itm = CurrentItem(); (smart_cast<CWeaponMagazined*>((CWeapon*)itm->m_pData))->UnloadMagazine(); for(u32 i=0; i<itm->ChildsCount(); ++i) { CUICellItem * child_itm = itm->Child(i); (smart_cast<CWeaponMagazined*>((CWeapon*)child_itm->m_pData))->UnloadMagazine(); } }break; } } }
void CWidgetSearchTemplate::on_actionBanNode_triggered() { SearchTreeItem* itemSearch = m_pSearchModel->itemFromIndex(CurrentItem()); if( itemSearch != NULL ) { bool ok; QString reason = QInputDialog::getText(this, tr("Ban Reason"), tr("Please enter a ban reason."), QLineEdit::Normal, "", &ok); if(ok && !reason.isEmpty()) { CEndPoint address = itemSearch->HitData.pQueryHit.data()->m_pHitInfo.data()->m_oNodeAddress; securityManager.ban(address, RuleTime::Special, false, reason, false, true); m_pSearchModel->removeQueryHit(CurrentItem().row(), m_pSearchModel->parent(CurrentItem())); } } }
void CUICarBodyWnd::SendMessage(CUIWindow *pWnd, s16 msg, void *pData) { if (BUTTON_CLICKED == msg && m_pUITakeAll == pWnd) { TakeAll (); } else if(pWnd == m_pUIPropertiesBox && msg == PROPERTY_CLICKED) { if(m_pUIPropertiesBox->GetClickedItem()) { switch(m_pUIPropertiesBox->GetClickedItem()->GetID()) { case INVENTORY_EAT_ACTION: //съесть объект EatItem(); break; case INVENTORY_UNLOAD_MAGAZINE: { CUICellItem * itm = CurrentItem(); (smart_cast<CWeaponMagazined*>((CWeapon*)itm->m_pData))->UnloadMagazine(); for(u32 i=0; i<itm->ChildsCount(); ++i) { CUICellItem * child_itm = itm->Child(i); (smart_cast<CWeaponMagazined*>((CWeapon*)child_itm->m_pData))->UnloadMagazine(); } }break; } } } inherited::SendMessage (pWnd, msg, pData); }
bool CUITradeWnd::ToOthersBag() { move_item (CurrentItem(), &m_uidata->UIOthersTradeList, &m_uidata->UIOthersBagList); UpdatePrices (); return true; }
// Создание нового элемента void sTreeWidget::NewElement(){ sTreeWidgetItem *it; xmlItem item = CurrentItem()->GetXmlItem(); xmlItem r; if (item.nodeName() == md_element){ r = p_xml->insert(item,md_field,"Реквизит",0); p_xml->setAttr(r,mda_type,"S 10 2"); p_xml->setAttr(r,mda_width,"10"); it = new sTreeWidgetItem("Реквизит",r); it->setExpanded(true); } CurrentItem()->addChild(it); frmElement *frmEl = new frmElement(p_xml); frmEl->getData(r); frmEl->show(); }
/** * name: SaveState * class: CPsTree * desc: saves the current tree to database * param: none * return: nothing **/ void CPsTree::SaveState() { CPsTreeItem *pti = CurrentItem(); if (_hWndTree && (_dwFlags & (PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED|PSTVF_STATE_CHANGED))) { SHORT i; int iItem = 0; // save all visible items WORD numErrors = SaveItemsState(TREE_ROOTITEM, TVGN_ROOT, iItem); // save all invisible items of the current subtree for (i = 0; i < _numItems; i++) { if (!_pItems[i]->Hti()) { LPSTR pszGroup; if (!IsIndexValid(_pItems[i]->Parent()) || !(pszGroup = _pItems[_pItems[i]->Parent()]->Name())) pszGroup = TREE_ROOTITEM; numErrors += _pItems[i]->DBSaveItemState(pszGroup, iItem++, DBTVIS_INVISIBLE, _dwFlags); } } // remove changed flags RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED); } // save current selected item if (pti) db_set_utf(NULL, MODNAME, SET_LASTITEM, pti->Name()); else db_unset(NULL, MODNAME, SET_LASTITEM); }
void CWidgetSearchTemplate::on_treeViewSearchResults_doubleClicked(const QModelIndex &index) { Q_UNUSED(index); SearchTreeItem* itemSearch = m_pSearchModel->topLevelItemFromIndex(CurrentItem()); if( itemSearch != NULL ) { CQueryHit* pHits = 0; CQueryHit* pLast = 0; for(int i = 0; i < itemSearch->childCount(); ++i) { if( pLast ) { pLast->m_pNext = new CQueryHit(itemSearch->child(i)->HitData.pQueryHit.data()); pLast = pLast->m_pNext; } else { pHits = new CQueryHit(itemSearch->child(i)->HitData.pQueryHit.data()); pLast = pHits; } } Downloads.m_pSection.lock(); Downloads.add(pHits); Downloads.m_pSection.unlock(); delete pHits; } }
bool CUICarBodyWnd::OnItemDbClick(CUICellItem* itm) { CUIDragDropListEx* old_owner = itm->OwnerList(); CUIDragDropListEx* new_owner = (old_owner==m_pUIOthersBagList)?m_pUIOurBagList:m_pUIOthersBagList; if(m_pOthersObject) { if( TransferItem ( CurrentIItem(), (old_owner==m_pUIOthersBagList)?m_pOthersObject:m_pOurObject, (old_owner==m_pUIOurBagList)?m_pOthersObject:m_pOurObject, (old_owner==m_pUIOurBagList) ) ) { CUICellItem* ci = old_owner->RemoveItem(CurrentItem(), false); new_owner->SetItem (ci); } }else { if(false && old_owner==m_pUIOurBagList) return true; bool bMoveDirection = (old_owner==m_pUIOthersBagList); u16 tmp_id = (smart_cast<CGameObject*>(m_pOurObject))->ID(); move_item ( bMoveDirection?m_pInventoryBox->ID():tmp_id, bMoveDirection?tmp_id:m_pInventoryBox->ID(), CurrentIItem()->object().ID()); //. Actor()->callback (GameObject::eInvBoxItemTake)(m_pInventoryBox->lua_game_object(), CurrentIItem()->object().lua_game_object() ); } SetCurrentItem (NULL); return true; }
bool CUITradeWnd::ToOurTrade() { if (!CanMoveToOther(CurrentIItem())) return false; move_item (CurrentItem(), &m_uidata->UIOurBagList, &m_uidata->UIOurTradeList); UpdatePrices (); return true; }
void CCntDbManager::DeleteNotifyL(TContactItemId aContactId) { if (aContactId == CurrentItem()) { // Tell the server that the current item has just been deleted. RemoveCurrentItemL(0); } }
String FontComboBox::CurrentFontFace() const { int index = CurrentItem(); if ( index < 0 ) return String(); String face = ItemText( index ); face.Trim(); return face; }
void CWidgetSearchTemplate::on_actionViewReviews_triggered() { SearchTreeItem* itemSearch = m_pSearchModel->topLevelItemFromIndex(CurrentItem()); if( itemSearch != NULL ) { QDesktopServices::openUrl( QUrl(QString("http://bitzi.com/lookup/%1?v=detail&ref=quazaa").arg(itemSearch->HitData.lHashes.at(0).toString()), QUrl::TolerantMode) ); } }
void CWidgetSearchTemplate::on_actionVirusTotalCheck_triggered() { SearchTreeItem* itemSearch = m_pSearchModel->topLevelItemFromIndex(CurrentItem()); if( itemSearch != NULL ) { QDesktopServices::openUrl( QUrl(QString("www.virustotal.com/latest-report.html?resource=%1").arg(QString(itemSearch->HitData.lHashes.at(0).rawValue().toHex())), QUrl::TolerantMode) ); } }
/** * name: OnSelChanged * class: CPsTree * desc: it handles the change of displayed page * param: lpnmtv - notification structure * return: nothing **/ void CPsTree::OnSelChanged(LPNMTREEVIEW lpnmtv) { CPsTreeItem *oldPage = CurrentItem(); CPsTreeItem *pti; _curItem = (int)lpnmtv->itemNew.lParam; if (pti = CurrentItem()) { if (pti->Wnd() == NULL) { pti->CreateWnd(_pPs); } } // hide old page even if new item has no valid one if (oldPage && oldPage->Wnd() != NULL) ShowWindow(oldPage->Wnd(), SW_HIDE); if (pti) ShowWindow(pti->Wnd(), SW_SHOW); if (lpnmtv->action != TVC_BYMOUSE) SetFocus(_hWndTree); }
// --------------------------------------------------------------------------- // CAppMngr2ListContainer::HandleGenericCommandL() // --------------------------------------------------------------------------- // void CAppMngr2ListContainer::HandleGenericCommandL( TInt aCommand ) { if( !IsListEmpty() ) { CAppMngr2InfoBase& currentItem = CurrentItem(); if( currentItem.SupportsGenericCommand( aCommand ) ) { Model().HandleCommandL( currentItem, aCommand ); } } }
void CWidgetSearchTemplate::on_treeViewSearchResults_customContextMenuRequested(const QPoint &pos) { QModelIndex currIndex = ui->treeViewSearchResults->indexAt(pos); if( currIndex.isValid() ) { if(m_pSearchModel->parent(CurrentItem()).isValid()) ui->actionBanNode->setVisible(true); else ui->actionBanNode->setVisible(false); searchMenu->exec(QCursor::pos()); } }
/** * name: OnSelChanging * class: CPsTree * desc: the displayed page is up to change * param: none * return: nothing **/ BYTE CPsTree::OnSelChanging() { CPsTreeItem *pti = CurrentItem(); if (pti != NULL) { TreeView_SetItemState(_hWndTree, pti->Hti(), 0, TVIS_SELECTED); if (pti->Wnd() != NULL) { PSHNOTIFY pshn; pshn.hdr.code = PSN_KILLACTIVE; pshn.hdr.hwndFrom = pti->Wnd(); pshn.hdr.idFrom = 0; pshn.lParam = (LPARAM)pti->hContact(); if (SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn)) { SetWindowLongPtr(_pPs->hDlg, DWLP_MSGRESULT, TRUE); return TRUE; } } } return FALSE; }
// Создание новой формы // types: 1-Форма списка, 2-Форма объекта, 3-Форма выбора void sTreeWidget::NewForm(){ sTreeWidgetItem *it; xmlItem item = CurrentItem()->GetXmlItem(); xmlItem frm, temp; if (item.nodeName() == md_forms){ qDebug() << item.nodeName(); frm = p_xml->insert(item,md_form,"Новая Форма",0); p_xml->setAttr(frm,mda_type,"2"); p_xml->setAttr(frm,mda_readonly,false); temp = p_xml->insert(frm,md_description,QString::null,0); temp = p_xml->insert(frm,md_sourcecode,QString::null,0); temp = p_xml->insert(frm,md_defaultmod,QString::null,0); temp = p_xml->insert(frm,md_formdesign,QString::null,0); it = new sTreeWidgetItem("Новая Форма",frm); it->setExpanded(true); } // CurrentItem()->addChild(it); // frmElement *frmEl = new frmElement(p_xml); // frmEl->getData(r); // frmEl->show(); }
// Редактирование элемента void sTreeWidget::EditElement(){ xmlItem item = CurrentItem()->GetXmlItem(); frmElement *frmEl = new frmElement(p_xml); frmEl->getData(item); frmEl->show(); }
// Редактирование документа void sTreeWidget::EditDocument(){ xmlItem item = CurrentItem()->GetXmlItem(); frmDocument *frmDoc = new frmDocument(p_xml,m_frame); frmDoc->show(); frmDoc->getData(item); }
//Удаление void sTreeWidget::DelElement(){ xmlItem item = CurrentItem()->GetXmlItem(); p_xml->remove(item); removeItem(CurrentItem()); }
void CUIInventoryWnd::ActivatePropertiesBox() { // Флаг-признак для невлючения пункта контекстного меню: Dreess Outfit, если костюм уже надет bool bAlreadyDressed = false; UIPropertiesBox.RemoveAll(); CMedkit* pMedkit = smart_cast<CMedkit*> (CurrentIItem()); CAntirad* pAntirad = smart_cast<CAntirad*> (CurrentIItem()); CEatableItem* pEatableItem = smart_cast<CEatableItem*> (CurrentIItem()); CCustomOutfit* pOutfit = smart_cast<CCustomOutfit*> (CurrentIItem()); //. CArtefact* pArtefact = smart_cast<CArtefact*> (CurrentIItem()); CWeapon* pWeapon = smart_cast<CWeapon*> (CurrentIItem()); CScope* pScope = smart_cast<CScope*> (CurrentIItem()); CSilencer* pSilencer = smart_cast<CSilencer*> (CurrentIItem()); CGrenadeLauncher* pGrenadeLauncher = smart_cast<CGrenadeLauncher*> (CurrentIItem()); CBottleItem* pBottleItem = smart_cast<CBottleItem*> (CurrentIItem()); bool b_show = false; if(!pOutfit && CurrentIItem()->GetSlot()!=NO_ACTIVE_SLOT && !m_pInv->m_slots[CurrentIItem()->GetSlot()].m_bPersistent && m_pInv->CanPutInSlot(CurrentIItem())) { UIPropertiesBox.AddItem("st_move_to_slot", NULL, INVENTORY_TO_SLOT_ACTION); b_show = true; } if(CurrentIItem()->Belt() && m_pInv->CanPutInBelt(CurrentIItem())) { UIPropertiesBox.AddItem("st_move_on_belt", NULL, INVENTORY_TO_BELT_ACTION); b_show = true; } if(CurrentIItem()->Ruck() && m_pInv->CanPutInRuck(CurrentIItem()) && (CurrentIItem()->GetSlot()==u32(-1) || !m_pInv->m_slots[CurrentIItem()->GetSlot()].m_bPersistent) ) { if(!pOutfit) UIPropertiesBox.AddItem("st_move_to_bag", NULL, INVENTORY_TO_BAG_ACTION); else UIPropertiesBox.AddItem("st_undress_outfit", NULL, INVENTORY_TO_BAG_ACTION); bAlreadyDressed = true; b_show = true; } if(pOutfit && !bAlreadyDressed ) { UIPropertiesBox.AddItem("st_dress_outfit", NULL, INVENTORY_TO_SLOT_ACTION); b_show = true; } //отсоединение аддонов от вещи if(pWeapon) { if(pWeapon->GrenadeLauncherAttachable() && pWeapon->IsGrenadeLauncherAttached()) { UIPropertiesBox.AddItem("st_detach_gl", NULL, INVENTORY_DETACH_GRENADE_LAUNCHER_ADDON); b_show = true; } if(pWeapon->ScopeAttachable() && pWeapon->IsScopeAttached()) { UIPropertiesBox.AddItem("st_detach_scope", NULL, INVENTORY_DETACH_SCOPE_ADDON); b_show = true; } if(pWeapon->SilencerAttachable() && pWeapon->IsSilencerAttached()) { UIPropertiesBox.AddItem("st_detach_silencer", NULL, INVENTORY_DETACH_SILENCER_ADDON); b_show = true; } if(smart_cast<CWeaponMagazined*>(pWeapon) && IsGameTypeSingle()) { bool b = (0!=pWeapon->GetAmmoElapsed()); if(!b) { CUICellItem * itm = CurrentItem(); for(u32 i=0; i<itm->ChildsCount(); ++i) { pWeapon = smart_cast<CWeaponMagazined*>((CWeapon*)itm->Child(i)->m_pData); if(pWeapon->GetAmmoElapsed()) { b = true; break; } } } if(b){ UIPropertiesBox.AddItem("st_unload_magazine", NULL, INVENTORY_UNLOAD_MAGAZINE); b_show = true; } } } //присоединение аддонов к активному слоту (2 или 3) if(pScope) { if(m_pInv->m_slots[PISTOL_SLOT].m_pIItem != NULL && m_pInv->m_slots[PISTOL_SLOT].m_pIItem->CanAttach(pScope)) { PIItem tgt = m_pInv->m_slots[PISTOL_SLOT].m_pIItem; UIPropertiesBox.AddItem("st_attach_scope_to_pistol", (void*)tgt, INVENTORY_ATTACH_ADDON); b_show = true; } if(m_pInv->m_slots[RIFLE_SLOT].m_pIItem != NULL && m_pInv->m_slots[RIFLE_SLOT].m_pIItem->CanAttach(pScope)) { PIItem tgt = m_pInv->m_slots[RIFLE_SLOT].m_pIItem; UIPropertiesBox.AddItem("st_attach_scope_to_rifle", (void*)tgt, INVENTORY_ATTACH_ADDON); b_show = true; } } else if(pSilencer) { if(m_pInv->m_slots[PISTOL_SLOT].m_pIItem != NULL && m_pInv->m_slots[PISTOL_SLOT].m_pIItem->CanAttach(pSilencer)) { PIItem tgt = m_pInv->m_slots[PISTOL_SLOT].m_pIItem; UIPropertiesBox.AddItem("st_attach_silencer_to_pistol", (void*)tgt, INVENTORY_ATTACH_ADDON); b_show = true; } if(m_pInv->m_slots[RIFLE_SLOT].m_pIItem != NULL && m_pInv->m_slots[RIFLE_SLOT].m_pIItem->CanAttach(pSilencer)) { PIItem tgt = m_pInv->m_slots[RIFLE_SLOT].m_pIItem; UIPropertiesBox.AddItem("st_attach_silencer_to_rifle", (void*)tgt, INVENTORY_ATTACH_ADDON); b_show = true; } } else if(pGrenadeLauncher) { if(m_pInv->m_slots[RIFLE_SLOT].m_pIItem != NULL && m_pInv->m_slots[RIFLE_SLOT].m_pIItem->CanAttach(pGrenadeLauncher)) { PIItem tgt = m_pInv->m_slots[RIFLE_SLOT].m_pIItem; UIPropertiesBox.AddItem("st_attach_gl_to_rifle", (void*)tgt, INVENTORY_ATTACH_ADDON); b_show = true; } } LPCSTR _action = NULL; if(pMedkit || pAntirad) { _action = "st_use"; } else if(pEatableItem) { if(pBottleItem) _action = "st_drink"; else _action = "st_eat"; } if(_action){ UIPropertiesBox.AddItem(_action, NULL, INVENTORY_EAT_ACTION); b_show = true; } //. if(pArtefact&&pArtefact->CanBeActivated()) //. UIPropertiesBox.AddItem("st_activate_artefact", NULL, INVENTORY_ACTIVATE_ARTEFACT_ACTION); if(!CurrentIItem()->IsQuestItem()){ UIPropertiesBox.AddItem("st_drop", NULL, INVENTORY_DROP_ACTION); b_show = true; if(CurrentItem()->ChildsCount()) UIPropertiesBox.AddItem("st_drop_all", (void*)33, INVENTORY_DROP_ACTION); } if(b_show) { UIPropertiesBox.AutoUpdateSize (); UIPropertiesBox.BringAllToTop (); Fvector2 cursor_pos; Frect vis_rect; GetAbsoluteRect (vis_rect); GetUICursor()->GetPos (cursor_pos.x, cursor_pos.y); cursor_pos.sub (vis_rect.lt); UIPropertiesBox.Show (vis_rect, cursor_pos); PlaySnd (eInvProperties); } }
void sTreeWidget::removeItem(sTreeWidgetItem *item){ CurrentItem()->parent()->removeChild(item); }
//------------------------------------------------------------------------------ void MenuEditor::MessageReceived(BMessage* msg) { BMenuItem* item; switch (msg->what) { case MSG_MENU_NEW_ITEM: { if (fMenu) { fMenu->AddItem(new BMenuItem("New Item", new BMessage('none'))); fListView->Refresh(false); } break; } case MSG_MENU_SET_ITEM_LABEL: CurrentItem()->SetLabel(fLabelText->Text()); fListView->Refresh(true); break; case MSG_MENU_SET_ITEM_MSG: { int32 what = flipcode(*((int32 *)(fMsgText->Text()))); CurrentItem()->SetMessage(new BMessage(what)); break; } case MSG_MENU_SET_ITEM_MARKED: msg->FindPointer("source", (void **)(&item)); item->SetMarked(!item->IsMarked()); case MSG_MENU_SET_ITEM_SHORTCUT: { if (fShortcutText->TextView()->TextLength() == 0) { fModifierField->Menu()->ItemAt(0)->SetMarked(false); fModifierField->Menu()->ItemAt(1)->SetMarked(false); fModifierField->Menu()->ItemAt(2)->SetMarked(false); fModifierField->SetEnabled(false); } else if (!fModifierField->IsEnabled()) { fModifierField->SetEnabled(true); } CurrentItem()->SetShortcut(*(fShortcutText->Text()), MakeModMask()); break; } case MSG_MENU_SET_ITEM_ENABLED: { CurrentItem()->SetEnabled(fEnabledBox->Value() == B_CONTROL_ON); break; } case MSG_MENU_ADD_SEPARATOR: { if (fMenu) { item = new BSeparatorItem; fMenu->AddItem(item); fListView->Refresh(false); } break; } case MSG_MENU_SELECTION_CHANGED: { OnSelectionChanged(msg); break; } default: BBox::MessageReceived(msg); break; } }
// mda_key; key=1 Поле ключевое void sTreeWidget::NewObjMd(){ sTreeWidgetItem *it; xmlItem r; if (CurrentItem()->GetXmlItem().nodeName() == md_spravochniki){ xmlItem spr = p_xml->findChild(md,md_spravochniki); // Справочник spr = p_xml->insert(spr,md_spravochnik,"Новый справочник",0); it = new sTreeWidgetItem("Новый справочник",spr); // Реквизиты xmlItem el = p_xml->insert(spr,md_element,QString::null,-1); it->addChild(new sTreeWidgetItem("Реквизиты",el)); // Формы xmlItem frm = p_xml->insert(spr,md_forms,QString::null,-1); it->addChild(new sTreeWidgetItem("Формы",frm)); // Ключевые поля if (el.nodeName() == md_element){ r = p_xml->insert(el,md_field,"Код",0); p_xml->setAttr(r,mda_type,"S 10 0"); p_xml->setAttr(r,mda_width,"10"); p_xml->setAttr(r,mda_key,"2"); p_xml->setAttr(r,mda_visible,"0"); r = p_xml->insert(el,md_field,"Наименование",0); p_xml->setAttr(r,mda_type,"S 50 0"); p_xml->setAttr(r,mda_width,"50"); p_xml->setAttr(r,mda_key,"1"); p_xml->setAttr(r,mda_visible,"0"); } } if (CurrentItem()->GetXmlItem().nodeName() == md_documents){ xmlItem doc = p_xml->findChild(md,md_documents); // Документ doc = p_xml->insert(doc,md_document,"Новый документ",0); it = new sTreeWidgetItem("Новый документ",doc); // Реквизиты xmlItem el = p_xml->insert(doc,md_element,QString::null,-1); it->addChild(new sTreeWidgetItem("Шапка",el)); // Табличные части xmlItem tbel = p_xml->insert(doc,md_tables,QString::null,-1); it->addChild(new sTreeWidgetItem("Таблицы",tbel)); // Формы xmlItem frm = p_xml->insert(doc,md_forms,QString::null,-1); it->addChild(new sTreeWidgetItem("Формы",frm)); // Ключевые поля if (el.nodeName() == md_element){ r = p_xml->insert(el,md_field,"Номер",0); p_xml->setAttr(r,mda_type,"S 10 0"); p_xml->setAttr(r,mda_width,"10"); p_xml->setAttr(r,mda_key,"2"); p_xml->setAttr(r,mda_visible,"0"); r = p_xml->insert(el,md_field,"Дата",0); p_xml->setAttr(r,mda_type,"D"); p_xml->setAttr(r,mda_width,"10"); p_xml->setAttr(r,mda_key,"1"); p_xml->setAttr(r,mda_visible,"0"); } } CurrentItem()->addChild(it); }