Example #1
0
void XYGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
    int nIndex = m_cellActive.m_nRow - 1;

    // Change values in Grid
    CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
    double val;
    switch (m_cellActive.m_nCol) {
    case 1: // X
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].x = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(val, 0.0));
        }
        break;
    case 2: // Y
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].y = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(0.0, val));
        }
        break;
    }

    ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

    StopEdit(false);

    // if the right key continue editing on next cell
    switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
    }
}
Example #2
0
// 캔버스 윈도우의 메시지 처리 함수
LRESULT CALLBACK CanvasProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
	switch(iMessage) {
	case WM_CREATE:
		return OnCreate(hWnd,wParam,lParam);
	case WM_DESTROY:
		return OnDestroy(hWnd,wParam,lParam);
	case WM_PAINT:
		return OnPaint(hWnd,wParam,lParam);
	case WM_COMMAND:
		return OnCommand(hWnd,wParam,lParam);
	case WM_LBUTTONDOWN:
		return OnLButtonDown(hWnd,wParam,lParam);
	case WM_MOUSEMOVE:
		return OnMouseMove(hWnd,wParam,lParam);
	case WM_LBUTTONUP:
		return OnLButtonUp(hWnd,wParam,lParam);
	case WM_KEYDOWN:
		return OnKeyDown(hWnd,wParam,lParam);
	case WM_SETCURSOR:
		return OnSetCursor(hWnd,wParam,lParam);
	case WM_SIZE:
		return OnSize(hWnd,wParam,lParam);
	case WM_CONTEXTMENU:
		return OnContextMenu(hWnd,wParam,lParam);
	case WM_LBUTTONDBLCLK:
		return OnLButtonDblclk(hWnd,wParam,lParam);
	}
	return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
Example #3
0
LRESULT CDUIListBox::ProcessEvent(const DUIEvent& info, BOOL& bHandled)
{
	LRESULT lRet(S_OK);
	switch(info.dwEventType)
	{
	case DUI_EVENT_ELE_ITEM_CLICK:
		OnItemClick(info);
		bHandled = TRUE;
		break;
	case DUI_EVENT_ELE_ITEM_DBCLICK:
		OnItemDBClick(info);
		bHandled = TRUE;
		break;

	case DUI_EVENT_ELE_ITEM_MOUSEENTER:
	case DUI_EVENT_ELE_ITEM_MOUSELEAVE:
		OnItemHover(info);
		bHandled = TRUE;
		break;
		
	case DUI_EVENT_KEYDOWN:
		OnKeyDown(info);
		bHandled = TRUE;
		break;

	default:
		break;
	}

	if(bHandled) return lRet;

	return theBase::ProcessEvent(info, bHandled);
}
Example #4
0
void
COpenGLDemo::HandleEvents()
{
  SDL_Event ev;
  while ( SDL_PollEvent( &ev ))
  {
    switch( ev.type )
    {
    case SDL_QUIT:
      OnQuit( ev.quit );
      break;
    case SDL_KEYDOWN:
      OnKeyDown( ev.key );
      break;
    case SDL_KEYUP:
      OnKeyUp( ev.key );
      break;
    case SDL_MOUSEMOTION:
      OnMouseMotion( ev.motion );
      break;
    case SDL_MOUSEBUTTONUP:
      OnMouseRelease( ev.button );
      break;
    case SDL_MOUSEBUTTONDOWN:
      OnMousePress( ev.button );
      break;
    }
  }
}
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;
#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:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
	case WM_SIZE:			lRes = OnSize(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;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

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

	if (paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes;
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
Example #6
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);

}
Example #7
0
LRESULT RootWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) 
    {
        case WM_CREATE:
            return OnCreate();  

        case WM_MOUSEMOVE:
            return OnMouseMove(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
        
        case WM_NCDESTROY:
            KillTimer(m_hwnd, ANIM_TIMER_ID);
            // Death of the root window ends the thread
            PostQuitMessage(0);
            break;

        case WM_SETFOCUS:
            if (NULL != m_hwndChild)
                SetFocus(m_hwndChild);
            return 0;

        case WM_TIMER:
            OnTimer();
            return 0;

        case WM_KEYDOWN:
            OnKeyDown(wParam, lParam);
            return 0;
    }
    
    return super::HandleMessage(uMsg, wParam, lParam);
}
Example #8
0
	virtual bool ProcessEvent(wxEvent &event) {
		bool handled = false;
		if (event.GetEventType() == wxEVT_KEY_DOWN) {
			handled = OnKeyDown((wxKeyEvent&)event);
		}
		return (handled || wxEvtHandler::ProcessEvent(event));
	}
void ProdRestartGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
  int index = m_cellActive.m_nRow - 1;

  UnitReal temp(productionRestartUnits, productionRestartTimes[index]);
  if (temp.IsWithinRange(szText, -1.0E+08, 1.0E+08))
  {
    productionRestartTimes[index] = temp.GetMetricVal();
    if (index > productionRestartTimes.UpperBound())
      productionRestartTimes.SetSize(index + 1);
  }
  StopEdit(false);

  UpdateAllRows();


  // if the right key continue editing on next cell
  switch (nLastChar) {
  case VK_TAB:
  case VK_DOWN:
  case VK_UP:
  case VK_RIGHT:
  case VK_LEFT:
  case VK_NEXT:
  case VK_PRIOR:
  case VK_HOME:
  case VK_END:
    OnKeyDown(nLastChar, 0, 0);
    UpdateWindow();
    if (m_cellActive != m_cellActiveOld)
      StartEdit(nLastChar);
    break;
  }
}
BOOL CPokeMiniEmulatorDlg::PreTranslateMessage(MSG* pMsg)
{
    if (GS_NULL == pMsg)
    {
        return FALSE;
    }

    switch (pMsg->message)
    {
    case WM_KEYDOWN:
        if (OnKeyDown(pMsg))
        {
            return TRUE;
        }
        break;
    case WM_KEYUP:
        if (OnKeyUp(pMsg))
        {
            return TRUE;
        }
        break;
    default:
        break;
    }

    return CDialogEx::PreTranslateMessage(pMsg);
}
Example #11
0
//==========================================================================
//
// 引擎捕捉键盘按下消息后,将调用到本函数
// 参数 iKey:被按下的键,值见 enum KeyCodes 宏定义
// 参数 iAltPress, iShiftPress,iCtrlPress:键盘上的功能键Alt,Ctrl,Shift当前是否也处于按下状态(0未按下,1按下)
//
void dOnKeyDown( const int iKey, const int iAltPress, const int iShiftPress, const int iCtrlPress )
{
	// 可以在此添加游戏需要的响应函数


	OnKeyDown(iKey, iAltPress, iShiftPress, iCtrlPress);
}
Example #12
0
//窗口处理函数
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
						 WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
	case WM_CHAR:
		OnChar(hWnd,wParam);
		break;
	case WM_KEYDOWN:
		OnKeyDown(hWnd,wParam);
		break;
	case WM_KEYUP:
		OnKeyUp(hWnd,wParam);
		break;
	case WM_LBUTTONDOWN:
		InvalidateRect(hWnd,NULL,TRUE);//想让PAINT消息出现就用这个函数
		//但这个函数不会发送paint消息
		break;
	case WM_PAINT:
		OnPaint(hWnd);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	}
	return DefWindowProc(hWnd,msg,wParam,lParam);
}
Example #13
0
 Keyboard(wxWindow *parent)
 :   wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(0, kWhiteKeyHeight))
 {
     img_white_          = LoadImage(L"pianokey_white.png");
     img_white_pushed_   = LoadImage(L"pianokey_white_pushed.png");
     img_white_pushed_contiguous_   = LoadImage(L"pianokey_white_pushed_contiguous.png");
     img_black_          = LoadImage(L"pianokey_black.png");
     img_black_pushed_   = LoadImage(L"pianokey_black_pushed.png");
     
     img_white_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_contiguous_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_black_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     img_black_pushed_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     
     Bind(wxEVT_PAINT, [this](auto &ev) { OnPaint(); });
     
     timer_.Bind(wxEVT_TIMER, [this](auto &ev) { OnTimer(); });
     timer_.Start(50);
     Bind(wxEVT_LEFT_DOWN, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_DCLICK, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_UP, [this](auto &ev) { OnLeftUp(ev); });
     Bind(wxEVT_MOTION, [this](auto &ev) { OnMotion(ev); });
     Bind(wxEVT_KEY_DOWN, [this](auto &ev) { OnKeyDown(ev); });
     Bind(wxEVT_KEY_UP, [this](auto &ev) { OnKeyUp(ev); });
     
     key_code_for_sample_note_.fill(0);
 }
Example #14
0
void KeyboardReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
        // On error - return
        if (buf[2] == 1)
                return;

        //KBDINFO	*pki = (KBDINFO*)buf;

	// provide event for changed control key state
	if (prevState.bInfo[0x00] != buf[0x00]) {
		OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
	}

        for (uint8_t i = 2; i < 8; i++) {
                bool down = false;
                bool up = false;

                for (uint8_t j = 2; j < 8; j++) {
                        if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
                                down = true;
                        if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
                                up = true;
                }
                if (!down) {
                        HandleLockingKeys(hid, buf[i]);
                        OnKeyDown(*buf, buf[i]);
                }
                if (!up)
                        OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
        }
        for (uint8_t i = 0; i < 8; i++)
                prevState.bInfo[i] = buf[i];
};
Example #15
0
void KeyboardController::KeyboardEvent(bool press, int scode) {
	uint8_t mod = 0, oemkey = 0;
	unsigned char asciicode;

	if (key[KEY_LCONTROL]) mod |= 0x01;
    if (key[KEY_LSHIFT])   mod |= 0x02;
    if (key[KEY_ALT])      mod |= 0x04;
    if (key[KEY_LWIN])     mod |= 0x08;
    if (key[KEY_RCONTROL]) mod |= 0x10;
    if (key[KEY_RSHIFT])   mod |= 0x20;
    if (key[KEY_ALTGR])    mod |= 0x40;
    if (key[KEY_RWIN])     mod |= 0x80;

    oemkey = scancodeMap[scode];
    
    if(oemkey != 0x00) // pause is a special key, it occur one interuupt on pressing but not on releasing.
    {
	    if(press)
	    {
	    	handleLockingKeys(scode);
	    	OnKeyDown(mod, oemkey);
	    }
	    else
	    {
	    	OnKeyUp(mod, oemkey);
	    }
	}
}
LRESULT CCharacterProcess::DefMainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch ( uMsg )
	{
		case WM_LBUTTONDOWN:
			OnLButtonDown(wParam, lParam);
			break;
		case WM_LBUTTONUP:
			OnLButtonUp(wParam, lParam);
			break;
		case ID_SOCKCLIENT_EVENT_MSG:
			g_xClientSocket.OnSocketMessage(wParam, lParam);
			break;
		case WM_KEYDOWN:
			OnKeyDown(wParam, lParam);
			break;
		case WM_MOUSEON:
			OnMouseOn(wParam,lParam);
			break;
		case WM_MOVE:
			OnWindowMove(wParam,lParam);
			break;
		case WM_MOUSEMOVE:
			OnMouseMove(wParam,lParam);
			break;
		default:
			break;
	}
	return CWHDefProcess::DefMainWndProc(hWnd, uMsg, wParam, lParam);
}
Example #17
0
LRESULT CALLBACK WndProc(
 HWND   hWnd,
 UINT   message,
 WPARAM wParam,
 LPARAM lParam
){
 RECT   rect;

 switch(message){
  case WM_CLOSE:
   PostQuitMessage(0);
   return 0;

  case WM_SIZE:
  case WM_MOVE:
  case WM_PAINT:
  case WM_MOVING:
  case WM_SIZING:
   if(Initialised){
    GetClientRect(hwnd, &rect);
    Render(rect.right, rect.bottom);
    SwapBuffers(hDC);
   }
   break;

  case WM_KEYDOWN:
   if(wParam == VK_ESCAPE) PostQuitMessage(0);
   else                    OnKeyDown(wParam);
   return 0;

  default:
   break;
 }
 return DefWindowProc(hWnd, message, wParam, lParam);
}
Example #18
0
void CWindow::WinProc (unsigned int msg, WPARAM wParam, LPARAM lParam)
#endif
{
    switch (msg) 
    {
        case WM_CREATE:         OnCreate (m_hWnd, wParam, lParam);  break;
        case WM_INITDIALOG:     OnInitDialog (wParam, lParam);      break;
        case WM_ACTIVATEAPP:    OnActivateApp (wParam, lParam);     break;
        case WM_SIZE:           OnSize (wParam, lParam);            break;
        case WM_MOVE:           OnMove (wParam, lParam);            break;
        case WM_PAINT:          OnPaint (wParam, lParam);           break;
        case WM_KEYDOWN:        OnKeyDown (wParam, lParam);         break;
        case WM_KEYUP:          OnKeyUp (wParam, lParam);           break;
        case WM_COMMAND:        OnCommand (wParam, lParam);         break;
        case WM_SYSCOMMAND:     OnSysCommand (wParam, lParam);      break;
        case WM_CLOSE:          OnClose (wParam, lParam);           break;
        case WM_DESTROY:        OnDestroy (wParam, lParam);         break;
#ifndef WIN32
        case SDL_JOYAXISMOTION: OnJoystickAxis(wParam, lParam);		break;
        case SDL_JOYBUTTONDOWN:
        case SDL_JOYBUTTONUP:	OnJoystickButton(wParam, lParam);	break;
#endif
    }

#ifdef WIN32
        return DefWindowProc (m_hWnd, msg, wParam, lParam);
#else
        return;
#endif
}
Example #19
0
static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode < 0)
		return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
	if (nCode == HC_ACTION) {
		LPKBDLLHOOKSTRUCT pkbs = (LPKBDLLHOOKSTRUCT)lParam;
		switch (pkbs->vkCode) {
		case VK_LSHIFT:
		case VK_RSHIFT:
		case VK_LMENU:
		case VK_RMENU:
		case VK_LCONTROL:
		case VK_RCONTROL:
			return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
		}
		if (pkbs->dwExtraInfo == MY_EXTRA_INFO)
			return CallNextHookEx(Global.hHook, nCode, wParam, lParam);

		switch (wParam) {
		case WM_KEYDOWN:
		case WM_SYSKEYDOWN:
			if (OnKeyDown(pkbs->vkCode))
				return TRUE;
			break;
		case WM_KEYUP:
			if (OnScanUp(pkbs->scanCode))
				return TRUE;
			break;
		}
	}
	return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
}
Example #20
0
	void AEEngine::i_OnKeyDown(int *param)
	{
		this->keys[param[0]]=AE_TRUE;

		if(this->OnKeyDown!=NULL)
			OnKeyDown(param);
	}
Example #21
0
    void ColorMapGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
    {
        int rowIndex = m_cellActive.m_nRow - 1;
        int colIndex = m_cellActive.m_nCol - 1;

        double val;
        if ((!IsValidReal(szText, val)) || (val < 0.0) || (val > 1.0))
            val = 0.0;

        SC_ColorSpec& currSpec = gColorMap.colorMapColors[rowIndex];

        switch (colIndex )
            {
            case 0 : {currSpec.RH = val; break;}
            case 1 : {currSpec.GS = val; break;}
            case 2 : {currSpec.BV = val; break;}
            case 3 : {break;}
            }

        if (rowIndex >= gColorMap.ncolorMap)
            {
                for (int i = gColorMap.ncolorMap; i < rowIndex; i++)
                    gColorMap.colorMapColors[i] = SC_ColorSpec(0.0, 0.0, 0.0);
                m_nCurrRow = gColorMap.ncolorMap - 1;
                gColorMap.ncolorMap = rowIndex + 1;
                UpdateModifiedRows();
            }
        else
            {
                for (int j = 1; j < GetColCount(); j++)
                    {
                        CGridCell* pCell = GetCell(rowIndex + 1, j);
                        pCell->UpdateText();
                        InvalidateCell(rowIndex + 1, j);
                    }
            }

        ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

        StopEdit(false);

        // if the right key continue editing on next cell
        switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
        }
    }
Example #22
0
    void SDLWrapper::OnInput( )
    {
        SDL_Event event;

        if( SDL_PollEvent( &event ))
        {
            // Clean exit if window is closed
            //
            if( event.type == SDL_QUIT )
            {
                OnExit( );
            }

            switch( event.type )
            {
                case SDL_KEYDOWN:
                    OnKeyDown( event.key );
                    break;

                case SDL_KEYUP:
                    OnKeyUp( event.key );
                    break;

                case SDL_MOUSEMOTION:
                    OnMouseMove( event.motion.x,
                                 event.motion.y,
                                 event.motion.xrel,
                                 event.motion.yrel,
                                 ( event.motion.state & SDL_BUTTON( SDL_BUTTON_LEFT   )) != 0,   // Left button clicked
                                 ( event.motion.state & SDL_BUTTON( SDL_BUTTON_RIGHT  )) != 0,   // Right button clicked
                                 ( event.motion.state & SDL_BUTTON( SDL_BUTTON_MIDDLE )) != 0 ); // Middle button clicked
                    break;

                case SDL_MOUSEBUTTONDOWN:
                    HandleMouseButtonDownEvents( &event );
                    break;

                case SDL_MOUSEBUTTONUP:
                    HandleMouseButtonUpEvents( &event );
                    break;

                #if EMSCRIPTEN
                case SDL_FINGERMOTION:
                    OnFingerMotion( &event );
                    break;

                case SDL_FINGERDOWN:
                    OnFingerDown( &event );
                    break;

                case SDL_FINGERUP:
                    OnFingerUp( &event );
                    break;
                #endif
            }
        }
    }
void CListCtrlEx::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;

	OnKeyDown (pLVKeyDow->wVKey);

	
	*pResult = 0;
}
Example #24
0
void CTEKWindow::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (nChar==VK_F10) {
		OnKeyDown(nChar,nRepCnt,nFlags);
	}
	else {
		CFrameWnd::OnSysKeyDown(nChar,nRepCnt,nFlags);
	}
}
Example #25
0
// Called every time there is a window event
void AppWindow::glutKeyboard ( unsigned char key, int x, int y )
{
    // Check if we should trigger oneshot
    auto tracker = keys.find(key);
    if(tracker == keys.end() || !tracker->second)
    {
        keys[key] = true;
        OnKeyDown(key);
    }
}
Example #26
0
BOOL CBCGPBreadcrumb::OnKeyDownReflect (NMHDR* pNmhdr, LRESULT* pResult)
{
	NMKEY* pKey = (NMKEY*)pNmhdr;
	if (pKey != NULL && OnKeyDown (pKey->nVKey, pKey->uFlags))
	{
		*pResult = TRUE;
		return TRUE;
	}
	return FALSE;
}
Example #27
0
void Engine::_ProcessEvents(void)
{
    SDL_Event evt;
    while(!s_quit && SDL_PollEvent(&evt))
    {
        if(!OnRawEvent(evt))
            continue;

        switch(evt.type)
        {
            case SDL_KEYDOWN:
                OnKeyDown(evt.key.keysym.sym, evt.key.keysym.mod);
                break;

            case SDL_KEYUP:
                OnKeyUp(evt.key.keysym.sym, evt.key.keysym.mod);
                break;

            case SDL_JOYAXISMOTION:
                OnJoystickEvent(evt.jaxis.type, evt.jaxis.which, evt.jaxis.axis, evt.jaxis.value);
                break;

            case SDL_JOYBUTTONDOWN:
            case SDL_JOYBUTTONUP:
                OnJoystickEvent(evt.jbutton.type, evt.jbutton.which, evt.jbutton.button, evt.jbutton.state);
                break;

            case SDL_JOYHATMOTION:
                OnJoystickEvent(evt.jhat.type, evt.jhat.which, evt.jhat.hat, evt.jhat.value);
                break;

            case SDL_ACTIVEEVENT:
                OnWindowEvent(evt.active.gain);
                break;

            case SDL_VIDEORESIZE:
                OnWindowResize(evt.resize.w, evt.resize.h);
                break;

            case SDL_MOUSEMOTION:
                OnMouseEvent(evt.type, 0, evt.motion.state, evt.motion.x, evt.motion.y, evt.motion.xrel, evt.motion.yrel);
                break;

            case SDL_MOUSEBUTTONDOWN:
            case SDL_MOUSEBUTTONUP:
                OnMouseEvent(evt.type, evt.button.button, evt.button.state, evt.button.x, evt.button.y, 0, 0);
                break;

            case SDL_QUIT:
                SetQuit(true);
                break;
        }
    }
}
Example #28
0
/** $(class), OnEvent:
 *  Detailed description.
 *  @param pEvent TODO
 * @return TODO
 */
void Screen::OnEvent(SDL_Event* pEvent) {
    switch(pEvent->type)
    {
    case SDL_KEYDOWN:
        //key press
        OnKeyDown(pEvent->key.keysym.sym, pEvent->key.keysym.mod);
        break;
    default:
        break;
    }
}
Example #29
0
void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return;

  switch (pMessage->GetClassID()) {
    case CFWL_MessageType::Activate: {
      OnActivate(pMessage);
      break;
    }
    case CFWL_MessageType::SetFocus: {
      OnFocusChanged(pMessage, TRUE);
      break;
    }
    case CFWL_MessageType::KillFocus: {
      OnFocusChanged(pMessage, FALSE);
      break;
    }
    case CFWL_MessageType::Mouse: {
      CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
      switch (pMsg->m_dwCmd) {
        case FWL_MouseCommand::LeftButtonDown: {
          OnLButtonDown(pMsg);
          break;
        }
        case FWL_MouseCommand::LeftButtonUp: {
          OnLButtonUp(pMsg);
          break;
        }
        case FWL_MouseCommand::Move: {
          OnMouseMove(pMsg);
          break;
        }
        case FWL_MouseCommand::Leave: {
          OnMouseLeave(pMsg);
          break;
        }
        default:
          break;
      }
      break;
    }
    case CFWL_MessageType::Key: {
      CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
      if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown)
        OnKeyDown(pKey);
      break;
    }
    default: {
      break;
    }
  }

  CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
Example #30
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;
}