// Добавляет кнопку справа от элемента RelativeTo. T *AddButtonAfter(T *RelativeTo, int LabelId) { T *Item = AddDialogItem(DI_BUTTON, GetLangString(LabelId)); Item->Y1 = Item->Y2 = RelativeTo->Y1; Item->X1 = RelativeTo->X1 + ItemWidth(*RelativeTo) - 1 + 2; DialogItemBinding<T> *Binding = FindBinding(RelativeTo); if (Binding) Binding->AfterLabelID = GetItemID(Item); return Item; }
// Добавляет указанную текстовую строку справа от элемента RelativeTo. T *AddTextAfter(T *RelativeTo, const wchar_t* Label) { T *Item = AddDialogItem(DI_TEXT, Label); Item->Y1 = Item->Y2 = RelativeTo->Y1; Item->X1 = RelativeTo->X1 + ItemWidth(*RelativeTo) - 1 + 2; DialogItemBinding<T> *Binding = FindBinding(RelativeTo); if (Binding) Binding->AfterLabelID = GetItemID(Item); return Item; }
bool objFood::Eat(entBase *entity, hnPlayer *player) { assert(entity); // _somebody_ must be eating me! const objPrototype &proto = objManager::GetInstance()->GetPrototype( GetItemID() ); // we should now add prototype.nutrition to the entity's eat. entity->DoEat( proto.nutrition ); return true; }
void CStatusBarEx::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CRect r; for(int i = 0;; i++) { GetItemRect(i, &r); if(r.IsRectEmpty()) break; if(r.PtInRect(point)) { UINT nID = GetItemID(i); PostMessage2MainFrame(WM_COMMAND, nID); break; } } // CStatusBar::OnLButtonDown(nFlags, point); }
OXINTRET COXStatusBar::OnToolHitTest(CPoint point, TOOLINFO* pTI) const { int key=GetAsyncKeyState(VK_LBUTTON); if(key&0x8001) { return -1; } ASSERT_VALID(this); ASSERT(::IsWindow(m_hWnd)); CRect PaneRect; // check child windows first by calling CControlBar int nHit= PtrToInt(CControlBar::OnToolHitTest(point, pTI)); if (nHit != -1) { if (pTI != NULL) { pTI->uFlags &= ~TTF_NOTBUTTON; pTI->uFlags &= ~TTF_CENTERTIP; pTI->lpszText=_tcsdup(m_TipArray.GetAt(nHit)); } return nHit + m_nCount; // register a different toolinfo struct than the percent text } // now hit test against Panes of Statusbar for (int i=0; i < m_nCount; i++) { GetItemRect(i, PaneRect); if (PaneRect.PtInRect(point)) { if (pTI != NULL) { pTI->hwnd=m_hWnd; pTI->rect=PaneRect; pTI->lpszText=_tcsdup(m_TipArray.GetAt(i)); } // found matching rect, return the ID of the Pane return GetItemID(i); } } return -1; }
// Добавляет указанную текстовую строку слева от элемента RelativeTo. T *AddTextBefore(T *RelativeTo, int LabelId) { T *Item = AddDialogItem(DI_TEXT, GetLangString(LabelId)); Item->Y1 = Item->Y2 = RelativeTo->Y1; Item->X1 = 5 + m_Indent; Item->X2 = Item->X1 + ItemWidth(*Item) - 1; intptr_t RelativeToWidth = RelativeTo->X2 - RelativeTo->X1; RelativeTo->X1 = Item->X2 + 2; RelativeTo->X2 = RelativeTo->X1 + RelativeToWidth; DialogItemBinding<T> *Binding = FindBinding(RelativeTo); if (Binding) Binding->BeforeLabelID = GetItemID(Item); return Item; }
void COXStatusBar::OnLButtonDblClk(UINT nFlags, CPoint point) { UNREFERENCED_PARAMETER(nFlags); CRect PaneRect; // first walk through to calculate extra space for (int i=0; i < m_nCount; i++) { GetItemRect(i, PaneRect); if (PaneRect.PtInRect(point) != 0) { GetParent()->SendMessage(WM_STAT_DBLCLICK, (WPARAM)GetItemID(i)); break; } } }
void Bag::BuildPacketData(WorldPacket& Packet) { uint64 ItemID = GetItemID(); // Bag item ID Packet << ItemID << (uint8)m_Capacity; for (uint8 iSlot = 0 ; iSlot < m_Capacity ; ++iSlot) { if (m_Items[iSlot]) { Packet << (uint8)Item::ITEM_USED; m_Items[iSlot]->BuildPacketData(Packet); } else Packet << (uint8)Item::ITEM_UNUSED; } }
CString CSortListCtrl::GetToolTipText(int nRow, int nCol) { if (!m_showInfoTip) return CString(""); if (nRow!=-1 && nCol==1) { int i = GetItemID(nRow); map<int, std::string>::iterator pos = CConstraintMainDialog::constraintExprMap.find(i); if(pos!=CConstraintMainDialog::constraintExprMap.end()) return (LPSTR)(CConstraintMainDialog::constraintExprMap[i].c_str()); else return CString(""); } else return CString(""); }
int MFCQuaTransportBar::OnCreate(LPCREATESTRUCT lpcs) { TBBUTTONINFO tbinfo; tbinfo.cbSize = sizeof(TBBUTTONINFO); tbinfo.dwMask = TBIF_SIZE; LoadToolBar(IDR_QUAMFCTYPE); int gotit = CToolBar::OnCreate(lpcs); for (int index=0; index<GetCount(); index++) { int id = GetItemID(index); CRect rect; CRect tr; GetItemRect(index, &rect); COLORREF bgc = GetSysColor(COLOR_MENUBAR); if (id == ID_TRANSPORT_PLAYTIME) { SetButtonInfo(index, ID_TRANSPORT_PLAYTIME, TBBS_SEPARATOR, TIME_DISPLAY_WIDTH+20); rect.top = 1; rect.left +=5; rect.right = rect.left+TIME_DISPLAY_WIDTH; rect.bottom = 22; tr = CRect(3, 5, 3+TIME_DISPLAY_WIDTH, 5+TIME_DISPLAY_HEIGHT); pleitym.CreateTimeCtrl(rect, this, ID_TRANSPORT_PLAYTIME, &displayFont, &tr, &bgc, &rgb_black, &rgb_red); pleitym.SetVCMsgParams(QM_CTL_CHANGED, QCID_TB_TIME, (WPARAM)&pleitym); } else if (id == ID_TRANSPORT_TEMPO) { rect.top = 1; SetButtonInfo(index, ID_TRANSPORT_TEMPO, TBBS_SEPARATOR, TEMPO_DISPLAY_WIDTH+10); rect.right = rect.left+TEMPO_DISPLAY_WIDTH+2; rect.bottom = 22; tr = CRect(3+26, 5, 3+TEMPO_DISPLAY_WIDTH, 5+TEMPO_DISPLAY_HEIGHT); tempeh.CreateFloatCtrl(rect, this, ID_TRANSPORT_PLAYTIME, &displayFont, &tr, &bgc, &rgb_black, &rgb_red); tempeh.SetVCMsgParams(QM_CTL_CHANGED, QCID_TB_TEMPO, (WPARAM)&tempeh); // tempeh.SetLabel("BPM", &labelFont); tempeh.SetRange(1, 120, 2001); tempeh.SetSteps(1,0.1f,0.01f); tempeh.SetValue(1029.2345f); } } return gotit; }
BOOL CReturnScrollMsgBox::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { switch( nID ) { case IDOK: { SAFE_DELETE( g_WndMng.m_pWndSelectVillage ); g_WndMng.m_pWndSelectVillage = new CWndSelectVillage; g_WndMng.m_pWndSelectVillage->m_dwItemId = GetItemID(); g_WndMng.m_pWndSelectVillage->Initialize( &g_WndMng, 0 ); Destroy(); } break; case IDCANCEL: Destroy(); break; } return CWndNeuz::OnChildNotify( message, nID, pLResult ); //?? }
// see what pane we're on, and send a WM_COMMAND message to the // parent window, with the pane id as the low word of wParam, // and the message causing the command as the lParam void CStatusBarACT::SendPaneCommand(CPoint point, UINT message) { CWnd* pParent = GetParent(); if (pParent != NULL) { int nIndex = HitTest(point); if (nIndex != -1) { UINT nID = GetItemID(nIndex); BOOL bDblClk = message == WM_LBUTTONDBLCLK || message == WM_RBUTTONDBLCLK || message == WM_MBUTTONDBLCLK; BOOL bLeft = message == WM_LBUTTONDOWN || message == WM_LBUTTONDBLCLK; BOOL bRight = message == WM_RBUTTONDOWN || message == WM_RBUTTONDBLCLK; BOOL bMiddle = message == WM_MBUTTONDOWN || message == WM_MBUTTONDBLCLK; DWORD dwFlags = 0; if (m_adwFlags.GetSize() > nIndex && m_adwFlags[nIndex] & SBACTF_COMMAND) { dwFlags = m_adwFlags[nIndex]; if (((bDblClk && (dwFlags & SBACTF_DOUBLECLICK)) || (! bDblClk && (dwFlags & SBACTF_SINGLECLICK)))) { BOOL bDoCommand = FALSE; if (((bLeft && dwFlags & SBACTF_LEFTBUTTON) || (bRight && dwFlags & SBACTF_RIGHTBUTTON) || (bMiddle && dwFlags & SBACTF_MIDDLEBUTTON))) { bDoCommand = TRUE; } if ((bLeft && !(dwFlags & SBACTF_LEFTBUTTON)) || (bRight && !(dwFlags & SBACTF_RIGHTBUTTON)) || (bMiddle && !(dwFlags & SBACTF_MIDDLEBUTTON))) { bDoCommand = FALSE; } if (bDoCommand) { pParent->SendMessage(WM_COMMAND, MAKEWPARAM(nID, message), 0L/*(LPARAM)GetSafeHwnd()*/); } } } } } }
BOOL CPWStatusBar::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT *pResult) { switch(message) { case WM_NOTIFY: { NMHDR *pNMHDR = (NMHDR *)lParam; if (NM_DBLCLK == pNMHDR->code) { NMMOUSE* pNMMouse = (NMMOUSE *)lParam; if (pNMMouse->dwItemSpec >= 0 && pNMMouse->dwItemSpec < (unsigned int)m_nCount) { UINT uCommandId = GetItemID(int(pNMMouse->dwItemSpec)); // Only Interested in double-click on R-O or R/W indicator or filter bitmap if (uCommandId == IDS_READ_ONLY || uCommandId == IDB_FILTER_ACTIVE) GetParent()->SendMessage(WM_COMMAND, uCommandId, 0); } } break; } default: break; } return CStatusBar::OnChildNotify(message, wParam, lParam, pResult); }
BOOL CPlayerToolBar::Create(CWnd* pParentWnd) { VERIFY(__super::CreateEx(pParentWnd, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_AUTOSIZE | TBSTYLE_CUSTOMERASE, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_TOOLTIPS, CRect(2, 2, 0, 1))); VERIFY(LoadToolBar(IDB_PLAYERTOOLBAR)); // Should never be RTLed ModifyStyleEx(WS_EX_LAYOUTRTL, WS_EX_NOINHERITLAYOUT); CToolBarCtrl& tb = GetToolBarCtrl(); tb.DeleteButton(tb.GetButtonCount() - 1); tb.DeleteButton(tb.GetButtonCount() - 1); SetMute(AfxGetAppSettings().fMute); UINT styles[] = { TBBS_CHECKGROUP, TBBS_CHECKGROUP, TBBS_CHECKGROUP, TBBS_SEPARATOR, TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON, TBBS_SEPARATOR, TBBS_BUTTON, TBBS_SEPARATOR, TBBS_SEPARATOR, TBBS_CHECKBOX, }; for (int i = 0; i < _countof(styles); ++i) { // This fixes missing separator in Win 7 if (styles[i] & TBBS_SEPARATOR) { SetButtonInfo(i, GetItemID(i), styles[i], -1); } else { SetButtonStyle(i, styles[i] | TBBS_DISABLED); } } m_volctrl.Create(this); m_volctrl.SetRange(0, 100); m_nButtonHeight = 16; // reset m_nButtonHeight CImage image; if (LoadExternalToolBar(&image)) { CBitmap* bmp = CBitmap::FromHandle(image); int width = image.GetWidth(); int height = image.GetHeight(); int bpp = image.GetBPP(); if (width == height * 15) { // the manual specifies that sizeButton should be sizeImage inflated by (7, 6) SetSizes(CSize(height + 7, height + 6), CSize(height, height)); m_pButtonsImages = DEBUG_NEW CImageList(); if (bpp == 32) { m_pButtonsImages->Create(height, height, ILC_COLOR32 | ILC_MASK, 1, 0); m_pButtonsImages->Add(bmp, nullptr); // alpha is the mask } else { m_pButtonsImages->Create(height, height, ILC_COLOR24 | ILC_MASK, 1, 0); m_pButtonsImages->Add(bmp, RGB(255, 0, 255)); } m_nButtonHeight = height; GetToolBarCtrl().SetImageList(m_pButtonsImages); } image.Destroy(); } return TRUE; }
//********************************************************************************** UINT CToolPalette::GetCheckedButtonID () const { return GetItemID (m_nCheckedIndex); }
void Item::SaveToDB() { if (m_uState == ITEM_CREATED) { sDatabase.PExecute("INSERT INTO `items` VALUES(%llu, %llu, %llu, %llu)", m_GUID, m_OwnerGUID, m_Container ? m_Container->GetGUID() : 0, m_Slot, GetItemID()); } else if (m_uState == ITEM_CHANGED) { // TODO: Make update flag and others thing. // sDatabase.PExecute("UPDATE %s WHERE `guid` = %llu", ModificationQuery); } else if (m_uState == ITEM_DELETED) { sDatabase.PExecute("DELETE FROM `items` WHERE `guid` = %llu", m_GUID); } m_uState = ITEM_UNCHANGED; }
void Item::BuildPacketData(WorldPacket& Packet) { uint64 ItemID = GetItemID(); Packet << ItemID; }