LRESULT CExtProgressWnd::WindowProc( UINT message, WPARAM wParam, LPARAM lParam ) { if( message == WM_PRINT || message == WM_PRINTCLIENT ) { CRect rcClient; GetClientRect( &rcClient ); CDC * pDC = CDC::FromHandle( (HDC)wParam ); OnPaintProgress( *pDC, rcClient ); return (!0); } // if( message == WM_PRINT || message == WM_PRINTCLIENT ) HWND hWndOwn = m_hWnd; LPVOID pThis = this; LRESULT lResult = CProgressCtrl::WindowProc( message, wParam, lParam ); if( ::IsWindow( hWndOwn ) && LPVOID(CWnd::FromHandlePermanent(hWndOwn)) == pThis && m_bImmediateUpdating && ( message == PBM_SETRANGE || message == PBM_SETPOS || message == PBM_DELTAPOS || message == PBM_STEPIT || message == PBM_SETRANGE32 ) && IsWindowVisible() ) { Invalidate(); UpdateWindow(); } return lResult; }
void CExtProgressWnd::OnPaint() { ASSERT_VALID( this ); CRect rcClient; GetClientRect( &rcClient ); CPaintDC dcPaint(this); CExtMemoryDC dc( &dcPaint ); OnPaintProgress( dc, rcClient ); }
void cWindow::Clicked( cPlayer & a_Player, int a_WindowID, short a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem ) { cPluginManager * PlgMgr = cRoot::Get()->GetPluginManager(); if (a_WindowID != m_WindowID) { LOGWARNING("%s: Wrong window ID (exp %d, got %d) received from \"%s\"; ignoring click.", __FUNCTION__, m_WindowID, a_WindowID, a_Player.GetName().c_str()); return; } switch (a_ClickAction) { case caLeftClickOutside: case caRightClickOutside: { if (PlgMgr->CallHookPlayerTossingItem(a_Player)) { // A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch) return; } if (a_Player.IsGameModeCreative()) { a_Player.TossPickup(a_ClickedItem); } if (a_ClickAction == caLeftClickOutside) { // Toss all dragged items: a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount); } else { // Toss one of the dragged items: a_Player.TossHeldItem(); } return; } case caLeftClickOutsideHoldNothing: case caRightClickOutsideHoldNothing: { // Nothing needed return; } case caLeftPaintBegin: OnPaintBegin (a_Player); return; case caRightPaintBegin: OnPaintBegin (a_Player); return; case caLeftPaintProgress: OnPaintProgress(a_Player, a_SlotNum); return; case caRightPaintProgress: OnPaintProgress(a_Player, a_SlotNum); return; case caLeftPaintEnd: OnLeftPaintEnd (a_Player); return; case caRightPaintEnd: OnRightPaintEnd(a_Player); return; default: { break; } } if (a_SlotNum < 0) { // TODO: Other click actions with irrelevant slot number (FS #371) return; } int LocalSlotNum = a_SlotNum; int idx = 0; for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr) { if (LocalSlotNum < (*itr)->GetNumSlots()) { (*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem); return; } LocalSlotNum -= (*itr)->GetNumSlots(); idx++; } LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.", a_SlotNum, GetNumSlots(), a_Player.GetName().c_str() ); }
void cWindow::Clicked( cPlayer & a_Player, int a_WindowID, short a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem ) { if (a_WindowID != m_WindowID) { LOGWARNING("%s: Wrong window ID (exp %d, got %d) received from \"%s\"; ignoring click.", __FUNCTION__, m_WindowID, a_WindowID, a_Player.GetName().c_str()); return; } switch (a_ClickAction) { case caRightClickOutside: { // Toss one of the dragged items: a_Player.TossItem(true); return; } case caLeftClickOutside: { // Toss all dragged items: a_Player.TossItem(true, a_Player.GetDraggingItem().m_ItemCount); return; } case caLeftClickOutsideHoldNothing: case caRightClickOutsideHoldNothing: { // Nothing needed return; } case caLeftPaintBegin: OnPaintBegin (a_Player); return; case caRightPaintBegin: OnPaintBegin (a_Player); return; case caLeftPaintProgress: OnPaintProgress(a_Player, a_SlotNum); return; case caRightPaintProgress: OnPaintProgress(a_Player, a_SlotNum); return; case caLeftPaintEnd: OnLeftPaintEnd (a_Player); return; case caRightPaintEnd: OnRightPaintEnd(a_Player); return; } if (a_SlotNum < 0) { // TODO: Other click actions with irrelevant slot number (FS #371) return; } int LocalSlotNum = a_SlotNum; int idx = 0; for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr) { if (LocalSlotNum < (*itr)->GetNumSlots()) { (*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem); return; } LocalSlotNum -= (*itr)->GetNumSlots(); idx++; } LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.", a_SlotNum, GetNumSlots(), a_Player.GetName().c_str() ); }