Esempio n. 1
0
//窗口处理函数(自定义函数,处理消息)
LRESULT CALLBACK WndProc(HWND hWnd,
						 UINT msgID,
						 WPARAM wParam,
						 LPARAM lParam
						 ){
	switch(msgID)
	{
	case WM_CHAR:
		OnChar(hWnd,wParam);
		break;
	case WM_PAINT:
		OnPaint(hWnd);
		break;
	case WM_KEYDOWN:
		OnKeyDown(hWnd,wParam);
		break;
	case WM_KEYUP:
		OnKeyUp(hWnd,wParam);
		break;
	case WM_LBUTTONUP:
		InvalidateRect(hWnd,NULL,true);
		OnPaint(hWnd);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	}
	return DefWindowProc(hWnd,msgID,wParam,lParam);

}
void CChoiceWindow::OnListviewKeydown(NMHDR* pnmhdr, LRESULT* pResult)
{
	LPNMLVKEYDOWN lpnmkd = LPNMLVKEYDOWN(pnmhdr);

	OnChar(lpnmkd->wVKey, 0, lpnmkd->flags);

	*pResult = 0;
}
Esempio n. 3
0
bool CImeView::IsYouMessage(UINT msg,WPARAM wparam, LPARAM lparam)
{
	if(!m_hWnd)
		return FALSE;
	switch (msg) { 
	  
	  case WM_IME_STARTCOMPOSITION:     // 글자 조합의 시작. WM_IME_COMPOSITION 메시지를           // 받을 준비를 한다. 
			OnIMEStartComposition(wparam,lparam);
         return TRUE;    
	  case WM_IME_ENDCOMPOSITION:          // 글자 조합의 끝. 조합된 문자열 처리를 끝낸다          break; 
			OnIMEEndComposition(wparam,lparam);
			///버튼 클릭시 현재 조합중이던 글자가 날라가 버리는 현상을 막기 위해
			///현재 Focus를 가지진 EditBox에 조합중이던 글자를 보내주고 처리하도록 한다.
			memset(m_TextComp,0,3);
         return TRUE;    
      case WM_IME_COMPOSITION:          // 현재 조합중인 문자열이나 완성된 문자열을 얻어서 화면 출력 
			OnIMEComposition(wparam,lparam);
			InvalidateRect(m_hWnd,NULL,TRUE);
         return TRUE;    
	  case WM_IME_SETCONTEXT:    // 글자 조합 윈도우와 한자 변환 윈도우를 표시하지 않게 바꿈 
			OnIMESetContext(wparam,lparam);
         return TRUE;    
      case WM_IME_NOTIFY:        
		  OnIMENotify(wparam,lparam);
         return TRUE;             
      case WM_INPUTLANGCHANGE:       // 키보드 레이아웃이 바뀌는 경우 IME를 초기화      
		  OnInputLangChange(wparam,lparam);
           return TRUE;    
	  case WM_IME_CONTROL:
		  OnIMEControl(wparam,lparam);
         return TRUE;    
	  case WM_IME_COMPOSITIONFULL:
		  OnIMECompositionFull(wparam,lparam);
         return TRUE;    
	  case WM_CHAR:
		  OnChar((UINT)wparam);
		  InvalidateRect(m_hWnd,NULL,TRUE);
		  break;
	  case WM_KEYDOWN:
		  
		  switch(wparam)
		  {
		  case VK_RETURN:
			  memset(m_TextComp, 0, sizeof(char) * 3);	
			  break;
		  case VK_SPACE:
			  memset(m_TextComp, 0, sizeof(char) * 3);	
			  break;
		  }
		  
		  break;

    }
	
	return FALSE;
}
BOOL CEScreen::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class

	if ( pMsg->message == WM_CHAR )
	{
		OnChar(pMsg->wParam, 1, 0);
	}

	return CWnd::PreTranslateMessage(pMsg);
}
Esempio n. 5
0
void CFunctionView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    if ( nChar == VK_DELETE )
    {
        OnChar(nChar, 0, 0);
    }
    else
    {
        CRichEditView::OnKeyDown(nChar, nRepCnt, nFlags);
    }
}
Esempio n. 6
0
void CUDSMainWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    if ( nChar == VK_DELETE )
    {
        OnChar(nChar, 0, 0);
    }
    else
    {
        CUDSMainWnd::OnKeyDown(nChar, nRepCnt, nFlags);
    }
}
Esempio n. 7
0
int EditBox::HandleEvent(KeyboardEvent* evt){
	if(!Visible()) return 0;
	if(UiState::mFocus != this) return 0;

	if(evt->type == KEY_DOWN)
		OnKeyDown(evt->key);
	else if(evt->type == KEY_CHAR)
		OnChar(evt->key);

	return mID;
}
Esempio n. 8
0
BOOL CScriptDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
	


	NMHDR *phDR;
	phDR = (NMHDR*)lParam;

	// Does notification come from scintilla window?
	if (phDR !=  NULL)
	{
		CScintillaWnd* m_wndScintilla = NULL;
		if(phDR->hwndFrom == m_Script.m_hWnd)
			m_wndScintilla = &m_Script;
		if(phDR->hwndFrom == m_Help.m_hWnd)
			m_wndScintilla = &m_Help;

		SCNotification *pMsg = (SCNotification*)lParam;
		switch(phDR->code)       
		{ 
			case SCN_SAVEPOINTLEFT:
				break;

			case SCN_UPDATEUI:
				m_wndScintilla->UpdateUI();
				OnModify();
				break; 

			case SCN_MARGINCLICK:
				 m_wndScintilla->DoDefaultFolding(pMsg->margin,pMsg->position);
				break;

			case SCN_DOUBLECLICK:
				HelpMe();
				break;

			case SCN_CHARADDED:
			{
				SCNotification *scn = (SCNotification*)phDR;
				OnChar(scn->ch);
				OnModify();
				break;
			}

			case SCN_MODIFIED:
				OnModify();
				break;

		}
		return TRUE; 
   }

   return CWnd::OnNotify(wParam, lParam, pResult);
}
Esempio n. 9
0
// -----------------------------------------------------------------------------------
bool cgUILineEdit::OnMessage( UINT uMsg, unsigned wparam, unsigned lparam )
{
	switch (uMsg)
	{
	case WM_LBUTTONDOWN:
		{
			OnLButtonDown(wparam, lparam);
		}break;
	case WM_MOUSEMOVE:
		{
			OnMouseMove(wparam, lparam);
		}break;
	case WM_CHAR:
		{
			return OnChar(wparam, lparam);
		}break;
	case WM_KEYDOWN:
		{
			if ( OnKeyDown(wparam, lparam))
				return true;
		}break;
	case WM_LBUTTONDBLCLK:
		{
			SetSelBegin(0);
			SetCursorPos(m_strText.length());
		}break;
	case cgUIMsg_Copy:
		{
			return OnCopy();
		}break;
	case cgUIMsg_Cut:
		{
			return OnCut();
		}break;
	case cgUIMsg_Paste:
		{
			return OnPaste();
		}break;
	case cgUIMsg_MouseOut:
		{
			OnMouseMove(wparam, lparam);
		}break;
	case cgUIMsg_MouseIn:
		{

		}
	default:
		break;
	}

	return cgUIWidget::OnMessage(uMsg, wparam, lparam);
}
Esempio n. 10
0
	LRESULT CWin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		switch (uMsg)
		{
		case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
		case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
		//case WM_NCCREATE:		lRes = OnNcCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSEMOVE:    lRes = OnNCMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSELEAVE:   lRes = OnNCMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
		case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
		case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
		case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
		case WM_ERASEBKGND:     lRes = OnEraseBkGnd(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
		case WM_CHAR:		    lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
		case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
		case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
		case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSELEAVE:     lRes = OnMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEHOVER:	    lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
		case WM_HOTKEY:			lRes = OnHotKey(uMsg, wParam, lParam, bHandled); break;
//		case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;//OnTimer响应有小问题
		case WM_MOVING:			lRes = OnMoving(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZING:			lRes = OnSizing(uMsg, wParam, lParam, bHandled); break;
		case WM_SHOWWINDOW:		lRes = OnShowWindow(uMsg, wParam, lParam, bHandled); break;
		case WM_COMMAND:		lRes = OnCommand(uMsg, wParam, lParam, bHandled); break;
//		case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;//OnPaint响应有问题
		case WM_MENUCOMMAND:    lRes = OnMenuCommand(uMsg, wParam, lParam, bHandled); break;
		default:				bHandled = FALSE; break;
		}
		if (bHandled) return lRes;

		lRes = ProcessWindowMessage(uMsg, wParam, lParam, bHandled);
		if (bHandled) return lRes;

		if(_paintManager && _paintManager->MessageHandler(uMsg,wParam,lParam,lRes))
			return lRes;
		return __super::HandleMessage(uMsg,wParam,lParam);
	}
Esempio n. 11
0
void CLocalListView::OnKeyDown(wxKeyEvent& event)
{
	const int code = event.GetKeyCode();
	if (code == 'A' && event.GetModifiers() == wxMOD_CMD)
	{
		for (int i = m_hasParent ? 1 : 0; i < GetItemCount(); i++)
		{
			SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
		}
	}
	else
		OnChar(event);
		//event.Skip();
}
Esempio n. 12
0
LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam)
{
	switch (a_Msg)
	{
		case WM_CHAR:        return OnChar       (wParam, lParam);
		case WM_CLOSE:       return OnClose      ();
		case WM_COMMAND:     return OnCommand    (wParam, lParam);
		case WM_LBUTTONDOWN: return OnLButtonDown(wParam, lParam);
		case WM_LBUTTONUP:   return OnLButtonUp  (wParam, lParam);
		case WM_MOUSEMOVE:   return OnMouseMove  (wParam, lParam);
		case WM_PAINT:       return OnPaint      ();
		case WM_TIMER:       return OnTimer      (wParam);
	}
	return ::DefWindowProc(a_Wnd, a_Msg, wParam, lParam);
}
Esempio n. 13
0
void IHISession::HIChar (char chChar, DWORD dwKeyData)

//	HIChar
//
//	Handle character input
	
	{
	//	See if the animator will handle it

	if (m_Reanimator.HandleChar(chChar, dwKeyData))
		return;

	//	Otherwise, the subclass can handle it.

	OnChar(chChar, dwKeyData); 
	}
Esempio n. 14
0
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;

	case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
	case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
	case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
	case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;

	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
	case WM_CHAR:		    lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
	case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEHOVER:	lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) {
		return lRes;
	}
	lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);
	if (bHandled) {
		return lRes;
	}
	if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes)) {
		return lRes;
	}

	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
    void OnCharHook( wxKeyEvent& aEvent )
    {
        // On certain platforms, EVT_CHAR_HOOK is the only handler that receives
        // certain "special" keys. However, it doesn't always receive "normal"
        // keys correctly. For example, with a US keyboard, it sees ? as shift+/.
        //
        // Untangling these incorrect keys would be too much trouble, so we bind
        // both events, and simply skip the EVT_CHAR_HOOK if it receives a
        // "normal" key.

        const enum wxKeyCode skipped_keys[] =
        {
            WXK_NONE,    WXK_SHIFT,  WXK_ALT, WXK_CONTROL, WXK_CAPITAL,
            WXK_NUMLOCK, WXK_SCROLL, WXK_RAW_CONTROL
        };

        int key = aEvent.GetKeyCode();

        for( size_t i = 0; i < sizeof( skipped_keys ) / sizeof( skipped_keys[0] ); ++i )
        {
            if( key == skipped_keys[i] )
                return;
        }

        if( key <= 255 && isprint( key ) && !isspace( key ) )
        {
            // Let EVT_CHAR handle this one
            aEvent.DoAllowNextEvent();

            // On Windows, wxEvent::Skip must NOT be called.
            // On Linux and OSX, wxEvent::Skip MUST be called.
            // No, I don't know why.
#ifndef __WXMSW__
            aEvent.Skip();
#endif
        }
        else
        {
            OnChar( aEvent );
        }
    }
Esempio n. 16
0
LRESULT CWkeWebkitWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if ( uMsg != WM_CREATE && m_pWebView == NULL) return -1;
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
	case WM_CHAR:			lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYUP:			lRes = OnKeyUp(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;
	case WM_IME_STARTCOMPOSITION: lRes = OnImeStartComposition(uMsg, wParam, lParam, bHandled); break;	
	case WM_CONTEXTMENU:	lRes= OnContextMenu(uMsg, wParam, lParam, bHandled); break;	
	case WM_LBUTTONDOWN:	
	case WM_MBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_RBUTTONUP:
	case WM_LBUTTONDBLCLK:
	case WM_MBUTTONDBLCLK:
	case WM_RBUTTONDBLCLK:
	case WM_MOUSEMOVE:
	case WM_MOUSELEAVE:
		lRes = OnMouseEvent(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
Esempio n. 17
0
HRESULT GLWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (bDummy)
		return DefWindowProc(m_hwnd, uMsg, wParam, lParam);
	
	int ll = (int)(short)LOWORD(lParam);
	int hl = (int)(short)HIWORD(lParam);

	OnMessage(uMsg, wParam, lParam);
	switch(uMsg)
	{
	case WM_CREATE:
		initRC();
		OnCreate();
		return 0;
	case WM_PAINT:
		this->Redraw();
		ValidateRect(m_hwnd, NULL);
		return 0;
	case WM_SIZE:
		OnSize(ll, hl);
		return 0;
	case WM_LBUTTONDOWN:
		OnMouseDown(MouseButton::LBUTTON, ll, hl);
		SetCapture(m_hwnd);
		return 0;
	case WM_MBUTTONDOWN:
		OnMouseDown(MouseButton::MBUTTON, ll, hl);
		SetCapture(m_hwnd);
		return 0;
	case WM_RBUTTONDOWN:
		OnMouseDown(MouseButton::RBUTTON, ll, hl);
		SetCapture(m_hwnd);
		return 0;
	case WM_LBUTTONUP:
		OnMouseUp(MouseButton::LBUTTON, ll, hl);
		ReleaseCapture();
		return 0;
	case WM_MBUTTONUP:
		OnMouseUp(MouseButton::MBUTTON, ll, hl);
		ReleaseCapture();
		return 0;
	case WM_RBUTTONUP:
		OnMouseUp(MouseButton::RBUTTON, ll, hl);
		ReleaseCapture();
		return 0;
	case WM_LBUTTONDBLCLK:
		OnMouseDblClick(MouseButton::LBUTTON, ll, hl);
		return 0;
	case WM_MBUTTONDBLCLK:
		OnMouseDblClick(MouseButton::MBUTTON, ll, hl);
		return 0;
	case WM_RBUTTONDBLCLK:
		OnMouseDblClick(MouseButton::RBUTTON, ll, hl);
		return 0;
	case WM_MOUSEMOVE:
		OnMouseMove(wParam, ll, hl);
		return 0;
	case WM_MOUSEWHEEL:
		OnMouseWheel(HIWORD(wParam), LOWORD(wParam), ll, hl);
		return 0;
	case WM_KEYDOWN:
		OnKeyDown(wParam);
		return 0;
	case WM_KEYUP:
		OnKeyUp(wParam);
		return 0;
	case WM_CHAR:
		OnChar(wParam);
		return 0;
	case WM_TIMER:
		OnTimer();
		return 0;
	case WM_ACTIVATE:
	{
		WORD active = LOWORD(wParam);
		if (active == WA_INACTIVE) {
			if (bFullScreen) {
				ShowWindow(m_hwnd, SW_SHOWMINIMIZED);
				ChangeDisplaySettings(NULL, 0);
			}
		} else {
			SetFocus(m_hwnd);
			if (bFullScreen) changeDisplaySettings();
		}
		return 0;
	}
	case WM_DESTROY:
		OnDestroy();
		delete m_rc;
		ReleaseDC(m_hwnd, m_hdc);
		return 0;
	}

	return DefWindowProc(m_hwnd, uMsg, wParam, lParam);
}
Esempio n. 18
0
void CMuleListCtrl::OnChar(wxKeyEvent& evt)
{
	int key = evt.GetKeyCode();
	if (key == 0) {
		// We prefer GetKeyCode() to GetUnicodeKey(), in order to work
		// around a bug in the GetUnicodeKey(), that causes values to
		// be returned untranslated. This means for instance, that if
		// shift and '1' is pressed, the result is '1' rather than '!'
		// (as it should be on my keyboard). This has been reported:
		// http://sourceforge.net/tracker/index.php?func=detail&aid=1864810&group_id=9863&atid=109863
		key = evt.GetUnicodeKey();
	} else if (key >= WXK_START) {
		// wxKeycodes are ignored, as they signify events such as the 'home'
		// button. Unicoded chars are not checked as there is an overlap valid
		// chars and the wx keycodes.
		evt.Skip();
		return;
	}
	
	// We wish to avoid handling shortcuts, with the exception of 'select-all'.
	if (evt.AltDown() || evt.ControlDown() || evt.MetaDown()) {
		if (evt.CmdDown() && (evt.GetKeyCode() == 0x01)) {
			// Ctrl+a (Command+a on Mac) was pressed, select all items
			for (int i = 0; i < GetItemCount(); ++i) {
				SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
			}
		}
		
		evt.Skip();
		return;
	} else if (m_tts_time + 1500u < GetTickCount()) {
		m_tts_text.Clear();
	}
	
	m_tts_time = GetTickCount();
	m_tts_text.Append(wxTolower(key));

	// May happen if the subclass does not forward deletion events.
	// Or rather when single-char-repeated (see below) wraps around, so don't assert.
	if (m_tts_item >= GetItemCount()) {
		m_tts_item = -1;
	}
	
	unsigned next = (m_tts_item == -1) ? 0 : m_tts_item;
	for (unsigned i = 0, count = GetItemCount(); i < count; ++i) {
		wxString text = GetTTSText((next + i) % count).MakeLower();

		if (text.StartsWith(m_tts_text)) {
			ClearSelection();
			
			m_tts_item = (next + i) % count;
			SetItemState(m_tts_item, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, 
					wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
			EnsureVisible(m_tts_item);

			return;
		}
	}
	
	if (m_tts_item != -1) {
		// Crop the string so that it matches the old item (avoid typos).
		wxString text = GetTTSText(m_tts_item).MakeLower();
		
		// If the last key didn't result in a hit, then we skip the event.
		if (!text.StartsWith(m_tts_text)) {
			if ((m_tts_text.Length() == 2) && (m_tts_text[0] == m_tts_text[1])) {
				// Special case, single-char, repeated. This allows toggeling
				// between items starting with a specific letter.
				m_tts_text.Clear();
				// Increment, so the next will be selected (or wrap around).
				m_tts_item++;
				OnChar(evt);
			} else {
				m_tts_text.RemoveLast();
				evt.Skip(true);
			}
		}
	} else {
		evt.Skip(true);
	}
}
Esempio n. 19
0
BOOL CLogWin::PreTranslateMessage(MSG* pMsg) 

{

#if 1
	//////////////////////////////////////////////////////////////////////
	// Dispatch messages ourselvs
	if(pMsg->message == WM_CHAR)
		{	
		// Pass chars onto parent
		if(pMsg->wParam == 27 || pMsg->wParam == 9)
			{
			//P2N("CLogWin::PreTranslateMessage  WM_CHAR ESC\r\n");
			return false;
			}
		else
			{
			OnChar(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
			return true;
			}
		}

	if(pMsg->message == WM_KEYDOWN )
		{
		// Pass chars onto parent
		if(pMsg->wParam  == 27 || pMsg->wParam == 9)
			{
			//P2N("CLogWin::PreTranslateMessage  WM_KEYDOWN ESC\r\n");
			return false;
			}
		else
			{
			OnKeyDown(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
			return true;
			}
		}
	if(pMsg->message == WM_KEYUP)
		{
		OnKeyUp(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
		return true;
		}

	if(pMsg->message == WM_SYSCHAR)
		{
		//OnSysChar(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
		return 0;
		}
	if(pMsg->message == WM_SYSKEYDOWN)
		{
		//OnSysKeyDown(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
		return 0;
		}
	if(pMsg->message == WM_SYSKEYUP)
		{
		//OnSysKeyUp(pMsg->wParam, LOWORD(pMsg->lParam), pMsg->lParam); 
		return 0;
		}
#endif

	//P2N("CLogWin::Pretranslage %d %s\r\n", pMsg->message, mxpad.num2msg(pMsg->message));
	return CWnd::PreTranslateMessage(pMsg);
}
Esempio n. 20
0
	LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		CPoint pt;
		switch (uMsg)
		{
		case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
		case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
		case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
		case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
		case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
		case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEWHEEL:	
			{
				pt.x = GET_X_LPARAM( lParam );
				pt.y = GET_Y_LPARAM( lParam );
				lRes = OnMouseWheel(uMsg,GET_KEYSTATE_WPARAM(wParam),GET_WHEEL_DELTA_WPARAM(wParam),pt,bHandled);
				break;
			}
#endif
		case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
		case WM_CHAR:		    lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
		case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
		case WM_KEYDOWN:
			{
				lRes = OnKeyDown( uMsg,wParam, lParam&0xff, lParam>>16 ,bHandled);
				break;
			}
		case WM_KEYUP:
			{
				lRes = OnKeyUp(uMsg, wParam, lParam&0xff, lParam>>16,bHandled );
				break;	
			}
		case WM_SYSKEYDOWN:
			{
				lRes=OnSysKeyDown(uMsg,wParam,lParam&0xff,lParam>>16,bHandled);
				break;
			}
		case WM_SYSKEYUP:
			{
				lRes=OnSysKeyUp(uMsg,wParam,lParam&0xff,lParam>>16,bHandled);
				break;
			}
		case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
		case WM_RBUTTONDOWN:
			{
				lRes = OnRButtonDown(uMsg,wParam,lParam,bHandled);
				break;
			}
		case WM_RBUTTONUP:
			{
				lRes = OnRButtonUp(uMsg,wParam,lParam,bHandled);
				break;
			}
		case WM_MOUSEMOVE:	
			{
				pt.x = GET_X_LPARAM( lParam );
				pt.y = GET_Y_LPARAM( lParam );
				lRes = OnMouseMove(uMsg, wParam, pt, bHandled);
				break;
			}
		case WM_MOUSEHOVER:
			{
				lRes = OnMouseHover(uMsg, wParam, lParam, bHandled);
				break;
			}
#if(WINVER >= 0x0601)
		case WM_TOUCH:
			{
				UINT cInputs = LOWORD(wParam);
				HTOUCHINPUT hTouchInput=(HTOUCHINPUT)lParam;
				lRes = OnTouch(uMsg, cInputs, hTouchInput, bHandled);
				//If the application does not process the message, it must call DefWindowProc
				if (lRes==FALSE)
				{
					::DefWindowProc(*this,uMsg,wParam,lParam);
				}
				break;
			}
#endif
#if(WINVER >= 0x0602)
        case WM_POINTERUP:
            {
                lRes = OnPointerUp(uMsg,wParam,lParam,bHandled);
                break;

            }
		case WM_POINTERDOWN:
			{
                lRes = OnPointerDown(uMsg,wParam,lParam,bHandled);
                break;
			}
#endif
		default:
			{
				bHandled = FALSE; break;
			}
		}
		if (bHandled)
		{
			return lRes;
		}
		lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);

		if(bHandled)
		{
			return lRes;
		}
		if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes))
		{
			return lRes;
		}

		return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	}
Esempio n. 21
0
bool TextViewBase::HandleWndProc(UINT msg, WPARAM wParam, LPARAM lParam, LONG *pResult)
{
	HIMC hIMC = NULL;
	switch (msg)
	{
		// Draw contents of TextView whenever window needs updating
	case WM_ERASEBKGND:
		*pResult = 1;
		return true;
		// Need to custom-draw the border for XP/Vista themes
	case WM_NCPAINT:
		*pResult = OnNcPaint((HRGN)wParam);
		return true;

	case WM_PAINT:
		*pResult = OnPaint();
		return true;
		// Set a new font 
	case WM_SETFONT:
		*pResult = OnSetFont((HFONT)wParam);
		return true;

	case WM_SIZE:
		*pResult = OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
		return true;

	case WM_VSCROLL:
		*pResult = OnVScroll(LOWORD(wParam), HIWORD(wParam));
		return true;

	case WM_HSCROLL:
		*pResult = OnHScroll(LOWORD(wParam), HIWORD(wParam));
		return true;

	case WM_MOUSEACTIVATE:
		*pResult = OnMouseActivate((HWND)wParam, LOWORD(lParam), HIWORD(lParam));
		return true;

		//case WM_CONTEXTMENU:
		//	return OnContextMenu((HWND)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));

	case WM_MOUSEWHEEL:
		if (IsKeyPressed(VK_CONTROL))
			return false;
		else
			*pResult = OnMouseWheel((short)HIWORD(wParam));
		return true;

	case WM_SETFOCUS:
		*pResult = OnSetFocus((HWND)wParam);
		return true;

	case WM_KILLFOCUS:
		*pResult = OnKillFocus((HWND)wParam);
		return true;

		// make sure we get arrow-keys, enter, tab, etc when hosted inside a dialog
	case WM_GETDLGCODE:
		*pResult = DLGC_WANTALLKEYS;//DLGC_WANTMESSAGE;//DLGC_WANTARROWS;
		return true;

	case WM_LBUTTONDOWN:
		*pResult = OnLButtonDown(wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
		return true;

	case WM_LBUTTONUP:
		*pResult = OnLButtonUp(wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
		return true;

	case WM_LBUTTONDBLCLK:
		*pResult = OnLButtonDblClick(wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
		return true;

	case WM_RBUTTONDOWN:
		*pResult = OnRButtonDown(wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
		return true;
	case WM_MOUSEMOVE:
		*pResult = OnMouseMove(wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
		return true;

	case WM_KEYDOWN:
		*pResult = OnKeyDown(wParam, lParam);
		return true;

	case WM_UNDO: case TXM_UNDO: case EM_UNDO:
		*pResult = Undo();
		return true;

	case TXM_REDO : case EM_REDO:
		*pResult = Redo();
		return true;

	case TXM_CANUNDO: case EM_CANUNDO:
		*pResult = CanUndo();
		return true;

	case TXM_CANREDO: case EM_CANREDO:
		*pResult = CanRedo();
		return true;

	case WM_CHAR:
		OutputDebugString(L"WM_CHAR\n");
		*pResult = OnChar(wParam, lParam);
		return true;

	case WM_SETCURSOR:

		if (LOWORD(lParam) == HTCLIENT)
		{
			*pResult = TRUE;
			return true;
		}
		else
			return false;
	case WM_COPY:
		*pResult = OnCopy();
		return true;

	case WM_CUT:
		*pResult = OnCut();
		return true;

	case WM_PASTE:
		*pResult = OnPaste();
		return true;

	case WM_CLEAR:
		*pResult = OnClear();
		return true;
	
	case WM_GETTEXT:
		*pResult = GetText((WCHAR*)lParam, 0, (ULONG)wParam);
		return true;

	case WM_SETTEXT:
		*pResult = OnSetText((WCHAR*)lParam, lstrlen((WCHAR*)lParam));
		return true;
		//case TXM_SETTEXT:
		//	{
		//		ClearFile();
		//		EnterText((WCHAR*)lParam, (LONG)wParam);
		//		return 0;
		//	}
	case WM_TIMER:
		*pResult = OnTimer(wParam);
		return true;

	case WM_IME_STARTCOMPOSITION:
		OutputDebugString(L"WM_IME_STARTCOMPOSITION\n");
		*pResult = OnStartComposition(wParam, lParam);
		return true;
		//return DefWindowProc(m_hWnd, WM_IME_STARTCOMPOSITION, wParam, lParam);

	case WM_IME_COMPOSITION:
		OutputDebugString(L"WM_IME_COMPOSITION\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_COMPOSITION, wParam, lParam);
		return true;
		//return OnComposition(wParam, lParam);

	case WM_IME_ENDCOMPOSITION:
		OutputDebugString(L"WM_IME_ENDCOMPOSITION\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_ENDCOMPOSITION, wParam, lParam);
		return true;
		//return OnEndComposition(wParam, lParam);

	case WM_IME_CHAR:
		OutputDebugString(L"WM_IME_CHAR\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_CHAR, wParam, lParam);
		return true;

	case WM_IME_CONTROL:
		OutputDebugString(L"WM_IME_CONTROL\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_CONTROL, wParam, lParam);
		return true;


	case WM_IME_NOTIFY:
		OutputDebugString(L"WM_IME_NOTIFY\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_NOTIFY, wParam, lParam);
		return true;
		//return HandleImeNotify(wParam, lParam);

	case WM_IME_REQUEST:
		OutputDebugString(L"WM_IME_REQUEST\n");
		*pResult = DefWindowProc(m_hWnd, WM_IME_REQUEST, wParam, lParam);
		return true;
	case WM_INPUTLANGCHANGE:
		*pResult = OnInputLanChange(wParam, lParam);
		return true;

	case TXM_PRINT:
		*pResult = OnPrint((HDC)wParam, (int)lParam);
		return true;

		//
	case TXM_OPENFILE:
		*pResult = OpenFile((TCHAR *)lParam);
		return true;


	case TXM_SAVEFILE:
		*pResult = SaveFile((TCHAR *)lParam);
		return true;

	case TXM_IMPORTFILE:
		*pResult = ImportFile((TCHAR *)lParam, (int)wParam);
		return true;

	case TXM_EXPORTFILE:
	{
		int convertype = LOWORD(wParam);
		int utf_type = HIWORD(wParam);
		*pResult = ExportFile((TCHAR *)lParam, convertype, utf_type);
		return true;
	}

	case TXM_CLEAR:
		*pResult = ClearFile();
		return true;

	case TXM_GETFORMAT:
		*pResult = m_pTextDoc->getformat();
		return true;

	case TXM_SETFORMAT:
		*pResult = m_pTextDoc->setformat((int)wParam);
		return true;

	case TXM_GETSELSIZE:
		*pResult = SelectionSize();
		return true;

	case TXM_SETSELALL:
		*pResult = SelectAll();
		return true;

	case TXM_GETCURPOS:
		*pResult = m_CurrentCharPos.get();
		return true;

	case TXM_GETCURLINE_D:
		*pResult = m_nCurrentLine_D;
		return true;

	case TXM_GETCURLINE_V:
		*pResult = OnGetCurLineV();
		return true;

	case TXM_GETCURCOL:
		*pResult = OnGetCurCol();
		return true;

	case TXM_GETEDITMODE:
		*pResult = m_nEditMode;
		return true;

	case TXM_SETEDITMODE:
		lParam = m_nEditMode;
		m_nEditMode = wParam;
		*pResult = lParam;
		return true;
	case TXM_FIND_INIT:
		FindInitial((WCHAR*)lParam);
		*pResult = 0;
		return true;
	case TXM_FIND:
	{
		BOOL m = (BOOL)LOWORD(wParam);
		BOOL b = (BOOL)HIWORD(wParam);
		//FindText()
		if (b)
			*pResult = FindBackward(m, NULL);
		else
			*pResult = FindForward(m, NULL);
		return true;
	}
	case TXM_FIND_TEXT:
	{
		FIND_OPTION* fp = (FIND_OPTION*)(lParam);
		*pResult = Find_Text(fp->text, lstrlen(fp->text), fp->fBackward, fp->fMachCase, fp->fWarp);
		return true;
	}
	case TXM_REPLACE_TEXT:
	{
		*pResult = Replace_Text((REPLACE_OPTION*)(lParam));
		return true;
	}
	case TXM_SETRESMODULE:
	{
		*pResult = OnSetResModule((HMODULE)lParam);
		return true;
	}
	case WM_GETTEXTLENGTH:
	case TXM_GETTEXTLEN:
	{
		*pResult = OnGetTextLen();
		return true;
	}
	case TXM_REPLACE:
	{
		BOOL ra = (BOOL)LOWORD(wParam);
		WORD mb = (WORD)HIWORD(wParam);
		BOOL m = (BOOL)LOBYTE(mb);
		BOOL b = (BOOL)HIBYTE(mb);
		if (b)
			*pResult = FindBackward(m, (WCHAR*)lParam, ra);
		else
			*pResult = FindForward(m, (WCHAR*)lParam, ra);
		return true;
	}
	case TXM_FIND_GETTEXTLENGTH:
		*pResult = m_pFndIterator->find_text_length();
		return true;
	case TXM_GETSELSTART:
		*pResult = m_nSelectionStart;
		return true;
	case TXM_GETSELEND:
		*pResult = m_nSelectionEnd;
		return true;
	case TXM_GETSELTEXT:
		*pResult = OnGetSelText((WCHAR*)wParam, ULONG(lParam));
		return true;
	case TXM_SETTESTERMODE:
		OnTesterMode((bool)wParam);
		*pResult = 0;
		return true;
	case TXM_SETCONTEXTMENU:
		m_hUserMenu = (HMENU)wParam;
		*pResult = 0;
		return true;
	case TXM_STATISTIC:
		*pResult = OnDoStatistic((STATISTIC*)(lParam));
		return true;
	case TXM_GETCONVERTTYPES:
		*pResult = OnGetConvertTypes((convert_type*)(lParam));
		return true;
	case EM_GETSEL:
		*pResult = OnMsg_EM_GETSEL((ULONG*)wParam, (ULONG*)lParam);
		return true;
	case EM_SETSEL:
		*pResult = OnMsg_EM_SETSEL((LONG)wParam, (LONG)lParam);
		return true;
	default:
		return false;
	}
}
Esempio n. 22
0
DWORD Window::WndProc(
    UINT message,
    WPARAM wParam,
    LPARAM lParam
) {
    switch (message) {
        case WM_CLOSE:
            OnClose();
            return 0;

        case WM_DESTROY:
            OnDestroy();
            return 0;

        case WM_PAINT:
            PAINTSTRUCT paint;
            BeginPaint(GetHWND(), &paint);
            OnPaint(paint.hdc, paint.rcPaint);
            EndPaint(GetHWND(), &paint);
            return 0;

        case WM_MOVE:
        case WM_SIZE:
            UpdateRect();
            RectChanged();
            break;

        case WM_TIMER:
            if (OnTimer())
                return 0;
            break;

        case WM_HSCROLL:
            if (OnHScroll((int)LOWORD(wParam), (short int) HIWORD(wParam), (HWND)lParam))
                return 0;
            break;

        case WM_VSCROLL:
            if (OnVScroll((int)LOWORD(wParam), (short int) HIWORD(wParam), (HWND)lParam))
                return 0;
            break;

        case WM_COMMAND:
            if (OnCommand(wParam, lParam))
                return 0;
            break;

        case WM_SYSCOMMAND:
            if (OnSysCommand(wParam & 0xFFF0, MakePoint(lParam)))
                return 0;
            break;

        case WM_ACTIVATE:
            if (OnActivate(LOWORD(wParam), HIWORD(wParam) != 0))
                return 0;
            break;

        case WM_ACTIVATEAPP:
            if (OnActivateApp(wParam != 0))
                return 0;
            break;

        case WM_CHAR:
            {
                KeyState ks;
                ks.vk = wParam;
                ks.bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
                ks.bControl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
                ks.countRepeat = LOWORD(lParam);

                return !OnChar(ks);
            }
            break;

        case WM_KEYDOWN:
        case WM_SYSKEYDOWN:
        case WM_KEYUP:
        case WM_SYSKEYUP:
            {
                KeyState ks;
                ks.vk = wParam;
                ks.bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
                ks.bControl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
                ks.bAlt = (message == WM_SYSKEYUP || message == WM_SYSKEYDOWN) 
                    && (lParam & (1 << 29)); // See help for WM_SYSKEYDOWN
                ks.bDown = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN);
                ks.countRepeat = LOWORD(lParam);

                return !OnKey(ks);
            }
            break;
		
		case WM_MOUSEWHEEL: //imago 8/13/09
		case WM_XBUTTONDOWN:
		case WM_XBUTTONUP: 
        case WM_MOUSEHOVER: // imago --^
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
        case WM_MBUTTONDOWN:
        case WM_LBUTTONUP:
        case WM_RBUTTONUP:
        case WM_MBUTTONUP:
        case WM_MOUSEMOVE:
        case WM_MOUSELEAVE:
		case WM_NCMOUSEHOVER: //Imago 7/10
		case WM_NCMOUSELEAVE: //<--^
            {
                WinPoint pointMouse;
                if (message != WM_MOUSEWHEEL) {
                    WinPoint point(MakePoint(lParam));
                    pointMouse = WinPoint(point.X(),m_rectClient.YSize() - 1 - point.Y());
                    m_lastPointMouse = pointMouse;
                } else {
                    pointMouse = m_lastPointMouse;
                }

                //
                // Handle mouse leave
                //

                if (message == WM_MOUSELEAVE || message == WM_NCMOUSELEAVE) {
                    if (m_bMouseInside) {
                        m_bMouseInside = false;
                        OnMouseMessage(WM_MOUSELEAVE, 0, pointMouse);
                    }
                } else {
                    //
                    // Handle mouse enter
                    //

                    if (!m_bMouseInside && (message != WM_NCMOUSEHOVER && message != WM_MOUSEHOVER && message != 0)) {
                        m_bMouseInside = true;
                        OnMouseMessage(0, 0, pointMouse);

                        if (s_pfnTrackMouseEvent) {
                            TRACKMOUSEEVENT tme;

                            tme.cbSize      = sizeof(TRACKMOUSEEVENT);
                            tme.dwFlags     = TME_LEAVE;
                            tme.hwndTrack   = m_hwnd;
                            tme.dwHoverTime = HOVER_DEFAULT;

                            ZVerify(s_pfnTrackMouseEvent(&tme));
                        }
                    }

                    //
                    // Handle the mouse message
                    //

                    DWORD ret = 
                          OnMouseMessage(message, wParam, pointMouse)
                        ? 0
                        : 1;
                }

                return true;
            }
            break;

        case WM_SETCURSOR:
            //
            // use the custom cursor for the client area
            //

            if (LOWORD(lParam) == HTCLIENT) {
                ::SetCursor(NULL);
            } else {
                ::SetCursor(GetCursor());
            }

            break;

        case WM_WINDOWPOSCHANGING:
            if (OnWindowPosChanging((LPWINDOWPOS)lParam)) 
                return 0;
            break;
    }

    return m_pfnWndProc(m_hwnd, message, wParam, lParam);
}
Esempio n. 23
0
BOOL CWndRegVend::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
	CString str;

	SetFocus();
	
	CWndStatic* pWndStatic;
	pWndStatic = (m_dwFocus == 0) ? (CWndStatic*)GetDlgItem( WIDC_SELLNUM ): (CWndStatic*)GetDlgItem( WIDC_SELLPRI );

	str = pWndStatic->GetTitle();

	switch( nID )
	{
	case WIDC_VENEQUA:
		{
			if( m_bIsFirst )
			{
				char buffer[20] = { 0 };
				int i = ProcessCalc( m_Calc, atoi(str) );

				if(i < 0)
					_itoa( 2100000000, buffer, 10 );
				else
					_itoa( i, buffer, 10 );

				str = buffer;
				pWndStatic->SetTitle(str);
				m_bIsFirst = FALSE;
				m_Calc.m_nValue = 0;
			}
		}
		break;
	case WIDC_VENPLUS:
		OnChar('+');
		break;
	case WIDC_VENMINUS:
		OnChar('-');
		break;
	case WIDC_VENMULTI:
		OnChar('*');
		break;
	case WIDC_VENDIVID:
		OnChar('/');
		break;
	case WIDC_NUM0:
		OnChar('0');
		break;
	case WIDC_NUM1:
		OnChar('1');
		break;
	case WIDC_NUM2:
		OnChar('2');
		break;
	case WIDC_NUM3:
		OnChar('3');
		break;
	case WIDC_NUM4:
		OnChar('4');
		break;
	case WIDC_NUM5:
		OnChar('5');
		break;
	case WIDC_NUM6:
		OnChar('6');
		break;
	case WIDC_NUM7:
		OnChar('7');
		break;
	case WIDC_NUM8:
		OnChar('8');
		break;
	case WIDC_NUM9:
		OnChar('9');
		break;
	case WIDC_NUM00:
		{
			if(str == "0")
				break;

			CString strSum;
			strSum = str + "00";
			if(strlen(strSum) <= 9)
			{
				str+="00";
				pWndStatic->SetTitle(str);
			}
			break;
		}
	case WIDC_NUM000:
		{
			if(str == "0")
				break;

			CString strSum;
			strSum = str + "000";
			if(strlen(strSum) <= 9)
			{
				str+="000";
				pWndStatic->SetTitle(str);
			}
			break;
		}
	case WIDC_VENMIN:
		{
			pWndStatic->SetTitle( "1" );
			break;
		}
	case WIDC_VENMAX:
		{
			if(m_pItemBase)
			{
				ItemProp *pItemProp = m_pItemBase->GetProp();

				int nValue = 0;
#if __VER >= 8 // __S8_VENDOR_REVISION
				nValue = ( m_dwFocus == 0 ) ? ( (CItemElem*)m_pItemBase )->m_nItemNum: 2100000000;
#else // __VER >= 8 // __S8_VENDOR_REVISION
				nValue = ( m_dwFocus == 0 ) ? ( (CItemElem*)m_pItemBase )->m_nItemNum: pItemProp->dwCost;
#endif // __VER >= 8 // __S8_VENDOR_REVISION
				
				CString str;
				str.Format( "%d", nValue );
				
				pWndStatic->SetTitle(str);
				
			}
			break;
		}
	}
	
	if( nID == WIDC_OK || message ==  EN_RETURN )
	{
		pWndStatic	= (CWndStatic*)GetDlgItem( WIDC_SELLNUM );
		LPCTSTR str	= pWndStatic->GetTitle();
		int nNum	= 1;
		nNum	= atoi( str );
		CItemElem* pItemElem	= (CItemElem*)m_pItemBase;
		if( nNum < 1 )	return TRUE;	// 개수가 너무 작습니다.
		if( nNum > pItemElem->m_nItemNum )	nNum	= pItemElem->m_nItemNum;

		int nCost	= 0;
		pWndStatic	= (CWndStatic*)GetDlgItem( WIDC_SELLPRI );
		str		= pWndStatic->GetTitle();
#if __VER < 8 // __S8_VENDOR_REVISION
		if( strlen( str ) > 9 )	return TRUE;	// 숫자가 너무 큽니다.
#endif // __VER < 8 // __S8_VENDOR_REVISION
		//nCost	= atoi( str );

		__int64  n64Cost = 0;
		n64Cost = _atoi64(str);
		if( n64Cost > INT_MAX )
			n64Cost = INT_MAX;
		nCost = static_cast<int>( n64Cost );

		if( nCost < 1 )	return TRUE;	// 비정상적인 수치가 입력되었습니다.
		
		ItemProp* pItemProp	= m_pItemBase->GetProp();

		
#if __VER >= 8 // __S8_VENDOR_REVISION
//		if( 999999999 < ((EXPINTEGER)nCost*nNum) )
//		{
//			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ONE_GOLD)), MB_OK, this );
//			return TRUE;
//		}
		
		int nGold = g_pPlayer->GetGold();
		for( int iv = 0 ; iv < MAX_VENDITEM ; ++iv )
		{
			CItemBase *pItemBase = g_pPlayer->m_vtInfo.GetItem( iv );
			if( pItemBase == NULL )
				continue;

			nGold += ((CItemElem*)pItemBase)->m_nCost * pItemBase->GetExtra();
		}					
		int nOldGold = nGold;
		//nGold += (nCost * nNum);

		INT64 n64Sum(0);
		INT64 n64Gold(nGold);
		INT64 n64itemCost(nCost);
		INT64 n64Num(nNum);
		n64Sum = n64Gold + (n64itemCost * n64Num);

		if( n64Sum <= 0 || 2100000000 <= n64Sum || nOldGold >= n64Sum )
		{
			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
			return TRUE;
		}

//		if( nGold <= 0 || nOldGold >= nGold || 2100000000 <= nGold )
//		{
//			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
//			return TRUE;
//		}
#endif // __VER >= 8 // __S8_VENDOR_REVISION
		
#if __VER < 8     //8차게임내아이템판매가격제한풀기
		if( nCost > pItemProp->dwCost * 1000 )
		{
			g_WndMng.OpenMessageBox( _T( prj.GetText(TID_GAME_LIMITSELL)), MB_OK, this );
			return TRUE;
		}
#endif	//	   __VER < 8  

		g_DPlay.SendRegisterPVendorItem( m_iIndex, 0, (BYTE)( m_pItemBase->m_dwObjId ), nNum, nCost );
		Destroy( FALSE );
	}
	else if( nID == WIDC_CANCEL )	// WIDC_CANCEL
	{
		Destroy( FALSE );
	}
	

	return CWndNeuz::OnChildNotify( message, nID, pLResult );
}