void RendererBase::CreateScreen() { imgBuf1 = new BYTE[GB_SCREEN_W*GB_SCREEN_H*3]; imgBuf2 = new BYTE[GB_SCREEN_W*GB_SCREEN_H*3]; backBuffer = imgBuf1; frontBuffer = imgBuf2; OnClear(); ChangePalette(SettingsGetGreenScale()); }
void CBookmarksView::OnContextMenu(HWND /*phWnd*/, CPoint pPoint) { WTL::CMenu m; m.LoadMenu(IDR_POPUP_BOOKMARKS); bool noCount = m_list.GetItemCount() == 0; bool noSelection = m_list.GetSelectedCount() == 0; m.EnableMenuItem(ID_BOOKMARKS_OPEN, noCount || noSelection ? MF_DISABLED : MF_ENABLED); m.EnableMenuItem(ID_BOOKMARKS_SAVE, noCount ? MF_DISABLED : MF_ENABLED); m.EnableMenuItem(ID_BOOKMARKS_CLEAR, noCount ? MF_DISABLED : MF_ENABLED); m.EnableMenuItem(ID_BOOKMARKS_LOADMERGE, noCount ? MF_DISABLED : MF_ENABLED); m.EnableMenuItem(ID_BOOKMARKS_DELETEFROMLIST, noCount || noSelection ? MF_DISABLED : MF_ENABLED); unsigned int id = m.GetSubMenu(0).TrackPopupMenuEx(TPM_RETURNCMD, pPoint.x, pPoint.y, m_hWnd, NULL); switch (id) { case ID_BOOKMARKS_OPEN: { OnOpen(); } break; case ID_BOOKMARKS_SAVE: { OnSaveFile(); } break; case ID_BOOKMARKS_LOAD: { OnLoadFile(); } break; case ID_BOOKMARKS_LOADMERGE: { OnLoadFile(true); } break; case ID_BOOKMARKS_DELETEFROMLIST: { OnDeleteLines(); } break; case ID_BOOKMARKS_CLEAR: { if (MessageBox(CLEAR_BOOKMARKS_MSG, _T("Warning"), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES) { return; } OnClear(NULL, NULL, NULL); } break; } }
//--------------------------------- // private methods //--------------------------------- void InteractiveMatlabDialog::OnButton(wxCommandEvent& event) { if (event.GetEventObject() == theEvaluateButton) { delete(theCmd); theCmd = new CallFunction(wxT("CallMatlabFunction")); SetupCommand(); SetResults(); } else if (event.GetEventObject() == theClearButton) { OnClear(); } else if (event.GetEventObject() == theCloseButton) { OnClear(); delete(theCmd); Close(); } else { //Error - unknown object } }
//----------------------------------------------------------------------------- // Name: InitVariables() // Desc: Initialize global varibles //----------------------------------------------------------------------------- HRESULT InitVariables() { ICONINFO iconInfo; BITMAP bitmap; HDC hDC; // Get our crosshairs cursor and extract the the width and // hotspot location so we can draw it manually. g_hCursorCross = LoadCursor( NULL, IDC_CROSS ); GetIconInfo( g_hCursorCross, &iconInfo ); GetObject( iconInfo.hbmMask, sizeof(BITMAP), &bitmap ); // Delete un-needed handles if( iconInfo.hbmMask) DeleteObject( iconInfo.hbmMask ); if( iconInfo.hbmColor) DeleteObject( iconInfo.hbmColor ); // Save x-y info g_dxCrossHot = iconInfo.xHotspot; g_dyCrossHot = iconInfo.yHotspot; g_cxCross = bitmap.bmWidth; g_cyCross = bitmap.bmHeight; // create and setup our scrawl bitmap. hDC = GetDC( NULL ); g_hDC = CreateCompatibleDC( hDC ); ReleaseDC( NULL, hDC ); if( NULL == g_hDC ) return E_FAIL; g_hBitmap = CreateBitmap( SCRAWL_CXBITMAP, SCRAWL_CYBITMAP, 1, 1, 0 ); if( NULL == g_hBitmap ) return E_FAIL; g_hbmpDeselect = (HBITMAP)SelectObject( g_hDC, g_hBitmap ); // Clear bitmap OnClear( NULL ); return S_OK; }
void OnCommand( HWND hWnd, WPARAM wParam ) { switch( LOWORD(wParam) ) { case 1001: if( HIWORD(wParam)==CBN_SELCHANGE ) { HWND hSimple = GetDlgItem( hWnd, 1001 ); HWND hDropDown = GetDlgItem( hWnd, 1002 ); HWND hDropList = GetDlgItem( hWnd, 1003 ); LRESULT nSel = SendMessage( hSimple, CB_GETCURSEL, 0, 0 ); SendMessage(hDropDown,CB_SETCURSEL,nSel,0); SendMessage(hDropList,CB_SETCURSEL,nSel,0); }else if( HIWORD(wParam)==CBN_EDITCHANGE ) { MessageBox(hWnd,"键盘输入内容有变化","Infor", MB_OK ); } break; case ID_DATA: OnData( hWnd );//获取选择项的附加数据 break; case ID_TEXT: OnText( hWnd );//获取选择项文本内容 break; case ID_FIND: OnFind( hWnd );//匹配选项 break; case ID_DELETE: OnDelete( hWnd );//删除选择项 break; case ID_CLEAR: OnClear( hWnd );//清空选项 break; case ID_ADD: OnAdd( hWnd );//添加选项 break; } }
/********************************************************************************** * AUTHOR : Balaji MNA * DATE : 13-Dec-2008 * NAME : OnLoadHindi * DESCRIPTION : Loads hindi project * ARGUMENTS : none * RETURNS : * NOTES : * CHANGE HISTROY * ************************************************************************************/ void CIMEAppDlg::OnLoadPreBuildRecognizer() { displayMessage(L"Loading project"); OnClear(); m_IsProjectLoaded = false; CString projectName; string path = m_lipiRoot + PROJECTS_PATH_STRING; TCHAR pathFile[MAX_PATH] = {0}; mbstowcs(pathFile, path.c_str(), MAX_PATH); checkProjectDirectory(pathFile,projectName); char projectnm[MAX_PATH] = {0}; wcstombs(projectnm, projectName.GetBuffer(projectName.GetLength()),MAX_PATH); if(loadProject(string(projectnm)) == FAILURE) return ; if(!m_FontName.IsEmpty()) { m_pFont.DeleteObject(); m_FontName.Trim(); TCHAR szFontNm[MAX_PATH] = {0}; _tcscpy(szFontNm,m_FontName.GetBuffer(m_FontName.GetLength())); m_pFont.CreateFont(35,0, 0, 0, 400, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, szFontNm); } for(int i = 0; i< MAX_CHOICE;i++) m_DisplayChoice[i].SetFont(&m_pFont,TRUE); m_IsProjectLoaded = true; displayMessage(L""); }
int main(int argc, char** argv) { // 초기화(FreeGLUT에서만) glutInit(&argc, argv); // 초기화 glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); // 화면의 (100, 100) 위치에 glutInitWindowPosition(100, 100); // 가로 800, 세로 600으로 glutInitWindowSize(800, 600); // SimpleGLUT 라는 제목을 가진 윈도우를 생성한다. glutCreateWindow("SimpleGLUT"); // 함수 등록 glutDisplayFunc(OnDisplay); glutKeyboardFunc(OnKeyboard); if(OnSetup()) { // 메세지 루프! glutMainLoop(); } else { printf("Setup Failed\n"); return 0; } OnClear(); return 0; }
// CBacnetProgramEdit message handlers LRESULT CBacnetProgramEdit::OnHotKey(WPARAM wParam,LPARAM lParam) { if(Run_once_mutex == true) //If already exist some function run,it can't show another one; return -1; if (wParam==KEY_F2) { Run_once_mutex = true; OnSend(); Run_once_mutex = false; } else if(wParam == KEY_F3) { Run_once_mutex = true; OnClear(); Run_once_mutex = false; } else if(wParam == KEY_F7) { Run_once_mutex = true; OnLoadfile(); Run_once_mutex = false; } else if(wParam == KEY_F6) { Run_once_mutex = true; OnSavefile(); Run_once_mutex = false; } else if(wParam == KEY_F8) { Run_once_mutex = true; OnRefresh(); Run_once_mutex = false; } return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); idBodu = 0; ui->view->setScene(&scene); connect(ui->buttonPridejVrchol,SIGNAL(clicked()), this, SLOT(OnPridejVrchol())); connect(ui->buttonPridejHranu, SIGNAL(clicked()), this, SLOT(OnPridejHranu())); connect(ui->buttonDijkstra,SIGNAL(clicked()), this, SLOT(OnDijkstra())); connect(ui->buttonClear,SIGNAL(clicked()), this, SLOT(OnClear())); connect(ui->buttonUplnyGraf,SIGNAL(clicked()), this, SLOT(OnUplnyGraf())); connect(ui->buttonNajdiKostru,SIGNAL(clicked()), this, SLOT(OnKostraGrafu())); connect(ui->buttonClearHrany,SIGNAL(clicked()), this, SLOT(OnClearHrany())); }
//----------------------------------------------------------------------------- // Name: WndProc() // Desc: Handles window messages //----------------------------------------------------------------------------- LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { LRESULT lr = 0; switch( msg ) { // Pass these messages to user defined functions HANDLE_MSG( hWnd, WM_CREATE, OnCreate ); HANDLE_MSG( hWnd, WM_PAINT, OnPaint ); HANDLE_MSG( hWnd, WM_INITMENUPOPUP, OnInitMenuPopup ); HANDLE_MSG( hWnd, WM_KEYDOWN, OnKeyDown ); case WM_ACTIVATE: // sent when window changes active state if( WA_INACTIVE == wParam ) g_bActive = FALSE; else g_bActive = TRUE; // Set exclusive mode access to the mouse based on active state SetAcquire(); return 0; case WM_NCLBUTTONDOWN: switch (wParam) { case HTMINBUTTON: ShowWindow( hWnd, SW_MINIMIZE); break; case HTCLOSE: PostQuitMessage(0); break; } case WM_ENTERMENULOOP: case WM_ENTERSIZEMOVE: // un-acquire device when entering menu or re-sizing // this will show the mouse cursor again g_bActive = FALSE; SetAcquire(); return 0; case WM_EXITMENULOOP: // If we aren't returning from the popup menu, let the user continue // to be in non-exclusive mode (to move the window for example) if( (BOOL)wParam == FALSE ) return 0; case WM_EXITSIZEMOVE: // re-acquire device when leaving menu or re-sizing // this will show the mouse cursor again // even though the menu is going away, the app // might have lost focus or be an icon if( GetActiveWindow() == hWnd || !IsIconic( hWnd ) ) g_bActive = TRUE; else g_bActive = FALSE; SetAcquire(); return 0; case WM_SYSCOMMAND: lr = 0; switch ( LOWORD(wParam) ) { case IDC_CLEAR: OnClear( hWnd ); break; case IDC_ABOUT: MessageBox( hWnd, _T("Scrawl DirectInput Sample v1.0"), _T("Scrawl"), MB_OK ); break; case SC_SCREENSAVE: // eat the screen-saver notification. break; case IDC_SENSITIVITY_LOW: g_iSensitivity = -1; break; case IDC_SENSITIVITY_NORMAL: g_iSensitivity = 0; break; case IDC_SENSITIVITY_HIGH: g_iSensitivity = 1; break; default: lr = DefWindowProc( hWnd, msg, wParam, lParam ); break; } // The WM_SYSCOMMAND might've been a WM_CLOSE, // in which case our window no longer exists. if( IsWindow(hWnd) ) SetAcquire(); return lr; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc( hWnd, msg, wParam, lParam ); }
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; } }