void CuDlgDomPropTblPages::OnPaletteChanged(CWnd* pFocusWnd) { CDialog::OnPaletteChanged(pFocusWnd); if (pFocusWnd != this) OnQueryNewPalette(); }
void palEditDlg::OnPaletteChanged(CWnd* pFocusWnd) { if (pFocusWnd == this || IsChild(pFocusWnd)) return; OnQueryNewPalette(); }
static void OnPaletteChanged(HWND hWnd, HWND hWndPaletteChange) { if (hWnd == hWndPaletteChange) return; OnQueryNewPalette(hWnd); }
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) { CFrameWnd::OnPaletteChanged(pFocusWnd); if(pFocusWnd != this) OnQueryNewPalette(); }
LRESULT KEMFView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch( uMsg ) { case WM_CREATE: m_hWnd = hWnd; m_hViewMenu = LoadMenu(m_hInst, MAKEINTRESOURCE(IDR_VIEWER)); { RECT rect; GetClientRect(m_hWnd, & rect); m_emftree.Create(hWnd, 101, 0, 0, m_nDivision, rect.bottom, m_hInst); m_emfpanel.CreateEx(WS_EX_CLIENTEDGE, "EMFPanel", NULL, WS_VISIBLE | WS_BORDER | WS_CHILD, m_nDivision+3, 0, rect.right - m_nDivision+3, rect.bottom, hWnd, NULL, m_hInst); { KEmfDC emfdc; if ( m_emfpanel.m_hEmf ) emfdc.DeCompile(NULL, m_emfpanel.m_hEmf, & m_emftree); else emfdc.DeCompile(NULL, m_FileName, & m_emftree, m_emfpanel.m_hEmf); } // palette message handling is in KWindow class, which needs m_hPalette to be set { HDC hDC = GetDC(hWnd); m_hPalette = GetEMFPalette(m_emfpanel.m_hEmf, hDC); m_emfpanel.m_hPalette = m_hPalette; ReleaseDC(hWnd, hDC); } } return 0; case WM_SIZE: MoveWindow( m_emftree.m_hWnd, 0, 0, m_nDivision, HIWORD(lParam), TRUE); MoveWindow(m_emfpanel.m_hWnd, m_nDivision+3, 0, LOWORD(lParam)-m_nDivision+3, HIWORD(lParam), TRUE); return 0; case WM_MOUSEMOVE: // handle split window adjustment if ( wParam & MK_LBUTTON ) { if ( GetCapture() != hWnd ) SetCapture(hWnd); RECT rect; GetClientRect(hWnd, & rect); m_nDivision = LOWORD(lParam); SendMessage(hWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom)); } else if ( GetCapture() == hWnd ) ReleaseCapture(); return 0; case WM_COMMAND: switch ( LOWORD(wParam) ) { case IDM_FILE_SAVETEXT: { KFileDialog fd; ofstream out; if ( fd.GetSaveFileName(NULL, "txt", "Text Files") ) { out.open(fd.m_TitleName); SimpleEnumerateEMF(m_emfpanel.m_hEmf, out); out.close(); } return 0; } case IDM_FILE_DECOMPILE: { KFileDialog fd; if ( fd.GetSaveFileName(NULL, "cpp", "C++ Programs") ) { KEmfDC dc; dc.DeCompile(fd.m_TitleName, m_emfpanel.m_hEmf, NULL); } } return 0; case IDM_FILE_FILTER: { KGrayEMF gray; HENHMETAFILE hEmf = FilterEMF(m_emfpanel.m_hEmf, gray); DeleteEnhMetaFile(hEmf); } break; case IDM_VIEW_DELAY: { m_emfpanel.m_mode = 1; m_emfpanel.SetZoom(0, true); } return 0; case IDM_VIEW_GRAY: { m_emfpanel.m_mode = 2; m_emfpanel.SetZoom(0, true); } return 0; case IDM_VIEW_TRACE: { m_emfpanel.m_mode = 3; m_emfpanel.SetZoom(0, true); } return 0; case IDM_VIEW_ZOOM50: m_emfpanel.SetZoom(50); return 0; case IDM_VIEW_ZOOM100: m_emfpanel.SetZoom(100); return 0; case IDM_VIEW_ZOOM200: m_emfpanel.SetZoom(200); return 0; } case WM_PALETTECHANGED: return OnPaletteChanged(hWnd, wParam); case WM_QUERYNEWPALETTE: return OnQueryNewPalette(); default: return CommonMDIChildProc(hWnd, uMsg, wParam, lParam, m_hViewMenu, 4); } }
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { CLIENTCREATESTRUCT ccs; HWND hwndChild = 0; if ( IsWindow(hwndMDIClient) ) hwndChild = ChildGetActive(); switch ( uMsg ) { case WM_CREATE: /* following is regular MDI incantation */ ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), WINDOW_MENU_POS); ccs.idFirstChild = IDM_WINDOW_CHILDREN; hwndMDIClient = CreateWindow( "mdiclient", NULL, WS_CHILD | WS_CLIPCHILDREN, 0, 0, 0, 0, hWnd, 0, hinstThis, &ccs); if ( hwndMDIClient != 0 ) { ShowWindow(hwndMDIClient, SW_SHOW); /* subclass the hwndMDIClient window so we can change the cursor to a wait cursor when desired */ pfnOldMDIClientWndProc = (WNDPROC)SetWindowLong(hwndMDIClient, GWL_WNDPROC, (LONG)MDIClientWndProc); } return ( 0 ); case WM_INITMENUPOPUP: /* some popup menu is about to be displayed */ MenuStatus((int)LOWORD(lParam), (HMENU)wParam); return ( 0 ); case WM_COMMAND: /* if WM_COMMAND is not from a control (then it's from a menu item) */ if ( LOWORD(lParam) == 0 && MenuOnCommand(LOWORD(wParam)) ) return ( 0 ); break; case WM_QUERYENDSESSION: return ( ChildQueryCloseAll() ); case WM_CLOSE: if ( !ChildQueryCloseAll() ) return ( 0 ); break; case WM_DESTROY: WinHelp(hwndFrame, APPLICATION_HELPFILENAME, HELP_QUIT, 0); PostQuitMessage(0); return ( 0 ); case WM_QUERYNEWPALETTE: /* set the system palette to the active child's palette */ return ( OnQueryNewPalette(hwndChild) ); case WM_MDIACTIVATE: /* set the system palette to the newly active child's palette */ OnQueryNewPalette((HWND)wParam); return ( 0 ); case WM_PALETTECHANGED: /* forwarded to children so they can each realize their background palettes */ ForwardToChildren(hWnd, uMsg, wParam, lParam); return ( 0 ); case WM_SYSCOLORCHANGE: Ctl3dColorChange(); break; case WM_SYSCOMMAND: switch ( wParam & 0xfff0 ) { case SC_MAXIMIZE: case SC_RESTORE: /* since we effectively change our image origin when maximized or restored, we have to _force_ the window repaint to include the entire window -- else win '95 (at least) optimizes away some of the regions */ DefFrameProc(hWnd, hwndMDIClient, uMsg, wParam, lParam); if ( IsWindow(hwndChild) ) { InvalidateRect(hwndChild, NULL, FALSE); UpdateWindow(hwndChild); } return ( 0 ); default: break; } break; case WM_MOUSEMOVE: if ( nWaitCursor != 0 ) SetCursor(hWaitCursor); else SetCursor(hArrowCursor); break; default: break; } if ( !IsWindow(hwndMDIClient) ) return ( DefFrameProc(hWnd, 0, uMsg, wParam, lParam) ); return ( DefFrameProc(hWnd, hwndMDIClient, uMsg, wParam, lParam) ); }