// Idle Processing BOOL CMyglApp::OnIdle(LONG lcount) { CWnd* pMainWnd = m_pMainWnd; if (pMainWnd != NULL && pMainWnd->m_hWnd != NULL && pMainWnd->IsWindowVisible() && !pMainWnd->IsIconic()) { if (lcount==0) { CWinApp::OnIdle(lcount); // this does an WM_UPDATEIDLE ... } if (m_ActiveView) return(m_ActiveView->OnIdle(lcount)); } return FALSE; #if 0 if (!CWinApp::OnIdle(lcount)) { // if lcount == 0, there was a message before // pass up message to view if (m_ActiveView) return(m_ActiveView->OnIdle(lcount)); } return TRUE; // send more messages #endif }
CWnd* CInformErrorDialog::GetSafeParent() { CWnd *Parent = NULL; #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) // if the splash box is up, use that as the parent Parent = CSplashDialog::GetpWnd(); if (Parent) return Parent; #endif // WEBSTER-ranbirr-12/11/96 #ifndef WEBSTER #ifndef STANDALONE // If there is a print-related dlg up, use it as the parent Parent = CCPrintDialog::GetPrintCWnd(); if (Parent) return Parent; #endif #endif //webster // see if mainframe is up - use it if visible Parent = GetMainFrame(); if (Parent && Parent->IsWindowVisible()) return Parent; return NULL; }
LRESULT CResizableSheetEx::OnResizeSupport(WPARAM wParam, LPARAM lParam) { switch (wParam) { case RSZSUP_SHEETPAGEEXHACK: { // a window object must be still associated to the page handle // but MFC subclassing has been turned off to allow the system // to subclass it first, so we can catch all the messages CWnd* pWnd = CWnd::FromHandlePermanent((HWND)lParam); if (pWnd == NULL) return 0; // suclass the window again and refresh page and sheet pWnd->SubclassWindow(pWnd->Detach()); RefreshLayout(); pWnd->SendMessage(WM_SIZE); Invalidate(); UnlockWindowUpdate(); if (pWnd->IsWindowVisible()) { // send lost PSN_SETACTIVE notification message CPropertyPage* pPage = DYNAMIC_DOWNCAST(CPropertyPage, pWnd); if (pPage != NULL) SetActivePage(pPage); } } break; default: return FALSE; } return TRUE; }
BOOL CBCGPPopupDlg::HasFocus () const { if (GetSafeHwnd () == NULL) { return FALSE; } if (m_bMenuIsActive) { return TRUE; } CWnd* pWndMain = AfxGetMainWnd (); if (pWndMain->GetSafeHwnd () == NULL) { return FALSE; } if (pWndMain->IsIconic () || !pWndMain->IsWindowVisible() || pWndMain != GetForegroundWindow ()) { return FALSE; } CWnd* pFocus = GetFocus(); BOOL bActive = (pFocus->GetSafeHwnd () != NULL && (IsChild (pFocus) || pFocus->GetSafeHwnd () == GetSafeHwnd ())); return bActive; }
BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC) { for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) { if (!pChild->IsWindowVisible()) { continue; } CRect r; pChild->GetClientRect(&r); pChild->MapWindowPoints(this, &r); pDC->ExcludeClipRect(&r); } CRect r; GetClientRect(&r); CMainFrame* pFrame = ((CMainFrame*)GetParentFrame()); if (pFrame->m_pLastBar != this || pFrame->m_fFullScreen) { r.InflateRect(0, 0, 0, 1); } if (pFrame->m_fFullScreen) { r.InflateRect(1, 0, 1, 0); } pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); r.DeflateRect(1, 1); pDC->FillSolidRect(&r, 0); return TRUE; }
void MFCChannelView::ArrangeChildren() { cout << "cv: arrange children()\n"; long atY = 12; for (short i=0; i<NInR(); i++) { MFCInputView *iv = (MFCInputView *)InR(i); iv->SetWindowPos(&wndTop, 1, atY, 0, 0, SWP_NOSIZE); atY += iv->bounds.bottom+1; } atY += 3; for (short i=0; i<NOutR(); i++) { MFCOutputView *ov = (MFCOutputView *)OutR(i); ov->SetWindowPos(&wndTop, 1, atY, 0, 0, SWP_NOSIZE); atY += ov->bounds.bottom+1; } bool adjustMounty = false; if (atY != bounds.bottom) { adjustMounty = true; } SetWindowPos(&wndTop, 0, 0, bounds.right, atY, SWP_NOMOVE); if (adjustMounty) { CWnd *w = GetParent(), *ww=NULL; if (w && w->IsWindowVisible() && (ww=w->GetParent())) { long ret = ww->PostMessage(QM_ARRANGE_VIEW, 0, 0); CFrameWnd *pfw = GetParentFrame(); if (pfw) { QuaChildFrame *qcfw = (QuaChildFrame *)pfw; qcfw->arranger->Invalidate(); } } } }
bool cdxCDynamicControlsManager::StoreWindowPosition(CWnd & rWnd, LPCTSTR lpszProfile) { ASSERT(::IsWindow(rWnd.m_hWnd) && lpszProfile && *lpszProfile); // can't use an empty profile section string; see CWinApp::GetProfileInt() for further information WINDOWPLACEMENT wpl; VERIFY( rWnd.GetWindowPlacement(&wpl) ); BOOL bVisible = rWnd.IsWindowVisible(); int iState = REGVAL_NOSTATE; if(rWnd.IsIconic()) iState = REGVAL_ICONIC; else if(rWnd.IsZoomed()) iState = REGVAL_MAXIMIZED; return AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_INVALID) && // invalidate first AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Left, wpl.rcNormalPosition.left) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Right, wpl.rcNormalPosition.right) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Top, wpl.rcNormalPosition.top) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Bottom, wpl.rcNormalPosition.bottom) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Visible, bVisible ? REGVAL_VISIBLE : REGVAL_HIDDEN) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_State, iState) && AfxGetApp()->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_VALID); // validate position }
void CGuiControlBar::OnWindowPosChanged(WINDOWPOS* lpwndpos) { CRect rc; GetClientRect(rc); nDockBarAling = GetParent()->GetDlgCtrlID(); //envie un recalculo del area cliente solo si el tamaño ha sido //cambiado, de lo contrario permanezca igual lpwndpos->flags |= SWP_FRAMECHANGED; CControlBar::OnWindowPosChanged(lpwndpos); CWnd* pWnd = GetWindow(GW_CHILD); if (!m_bSupportMultiView) { if (pWnd != NULL) { pWnd->MoveWindow(rc); ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL); } } else { while (pWnd != NULL) { if (pWnd->IsWindowVisible()) { pWnd->MoveWindow(rc); break; } pWnd=pWnd->GetWindow(GW_HWNDNEXT); } } }
void CGuiControlBar::OnSize(UINT nType, int cx, int cy) { // CControlBar::OnSize(nType, cx, cy); CWnd* pWnd = GetWindow(GW_CHILD); if (!m_bSupportMultiView) { if (pWnd != NULL) { pWnd->MoveWindow(0, 0, cx, cy); ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL); } } else { while (pWnd != NULL) { if (pWnd->IsWindowVisible()) { pWnd->MoveWindow(0, 0, cx, cy); break; } pWnd=pWnd->GetWindow(GW_HWNDNEXT); } } //m_pDockSite->RecalcLayout(); // TODO: Add your message handler code here }
BOOL CDocManager::OnDDECommand( LPTSTR lpszCommand ) /**************************************************/ { if( _tcsncmp( lpszCommand, _DDECmdStart, sizeof( _DDECmdStart ) / sizeof( TCHAR ) - 1 ) != 0 ) { return( FALSE ); } lpszCommand += sizeof( _DDECmdStart ) / sizeof( TCHAR ) - 1; LPTSTR lpszEnd = _tcsstr( lpszCommand, _DDECmdEnd ); if( lpszEnd == NULL ) { return( FALSE ); } *lpszEnd = _T('\0'); CWinApp *pApp = AfxGetApp(); ASSERT( pApp != NULL ); CWnd *pMainWnd = pApp->m_pMainWnd; ASSERT( pMainWnd != NULL ); if( !pMainWnd->IsWindowVisible() ) { pMainWnd->ShowWindow( SW_SHOW ); } OpenDocumentFile( lpszCommand ); return( TRUE ); }
void CNavPaneWnd::OnShowWindow(BOOL bShow, UINT nStatus) { CWnd::OnShowWindow(bShow, nStatus); CWnd* pParent = GetParent(); if (pParent == NULL || pParent != NULL && pParent->IsWindowVisible()) SendMessageToVisibleDescendants(m_hWnd, WM_SHOWPARENT, bShow, nStatus); }
void CMainFrame::OnUpdateBarMenu(CCmdUI* pCmdUI) { CWnd* pBar; if ((pBar = GetDlgItem(pCmdUI->m_nID)) == NULL) { pCmdUI->ContinueRouting(); return; // not for us } pCmdUI->SetCheck((pBar->IsWindowVisible()) != 0); }
BOOL CMainFrame::OnViewBar(UINT nID) { CWnd* pBar; if ((pBar = GetDlgItem(nID)) == NULL) return FALSE; // not for us // toggle visible state pBar->ShowWindow((pBar->IsWindowVisible()) == 0); RecalcLayout(); return TRUE; }
void TrayToolTipDlg::OnLButtonDown(UINT nFlags, CPoint point) { //TRACEST(_T("TrayToolTipDlg::OnLButtonDown")); //SetRealTransparency(0); //Hide(); CWnd* wnd = AfxGetMainWnd(); if (wnd->IsWindowVisible() == FALSE) wnd->SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); CWnd::OnLButtonDown(nFlags, point); }
void CDlgSuspension::OnNcLButtonDblClk(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CWnd *pParent = GetParent(); ASSERT(pParent); if(!pParent->IsWindowVisible()) pParent->ShowWindow(SW_SHOW); pParent->SetForegroundWindow(); CDialog::OnNcLButtonDblClk(nFlags, point); }
void CResizableSheetEx::GetHeaderRect(LPRECT lpRect) { CWnd* pWizLineHdr = GetDlgItem(ID_WIZLINEHDR); if (pWizLineHdr != NULL && pWizLineHdr->IsWindowVisible()) { pWizLineHdr->GetWindowRect(lpRect); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)lpRect, 2); LONG bottom = lpRect->top; GetClientRect(lpRect); lpRect->bottom = bottom; } else ::SetRectEmpty(lpRect); }
void CMFECToolTip::ShowToolTip( CPoint& point ) { #if 1 CWnd* pWnd = m_pParentWnd->ChildWindowFromPoint(point); if( pWnd ) { UINT nControlID = (UINT)pWnd->GetDlgCtrlID(); if( m_currentControlID != nControlID && pWnd->IsWindowVisible()) { ErasePreviousToolTipDisplay(m_currentControlID); ShowToolTip( nControlID ); } } #endif }
void CGuiBarOffice::UpdateChilds() { CRect rc; GetClientRect(rc); CWnd* pWnd = GetWindow(GW_CHILD); while (pWnd != NULL) { if (pWnd->IsWindowVisible()) { pWnd->MoveWindow(rc); break; } pWnd=pWnd->GetWindow(GW_HWNDNEXT); } }
void CPlayerStatusBar::OnPaint() { CPaintDC dc(this); // device context for painting for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) { if (!pChild->IsWindowVisible()) { continue; } CRect r; pChild->GetClientRect(&r); pChild->MapWindowPoints(this, &r); dc.ExcludeClipRect(&r); } CRect r; GetClientRect(&r); if (m_pMainFrame->m_pLastBar != this || m_pMainFrame->m_fFullScreen) { r.InflateRect(0, 0, 0, 1); } if (m_pMainFrame->m_fFullScreen) { r.InflateRect(1, 0, 1, 0); } dc.Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); r.DeflateRect(1, 1); dc.FillSolidRect(&r, 0); if (m_bm.m_hObject) { BITMAP bm; m_bm.GetBitmap(&bm); CDC memdc; memdc.CreateCompatibleDC(&dc); memdc.SelectObject(&m_bm); CRect clientRect; GetClientRect(&clientRect); CRect statusRect; m_status.GetWindowRect(statusRect); ScreenToClient(statusRect); dc.BitBlt(clientRect.right - bm.bmWidth - 1, statusRect.CenterPoint().y - bm.bmHeight / 2, bm.bmWidth, bm.bmHeight, &memdc, 0, 0, SRCCOPY); } }
//------------------------------------------------------------------------// void CBCGPGlobalUtils::ForceAdjustLayout (CBCGPDockManager* pDockManager, BOOL bForce, BOOL bForceInvisible, BOOL bForceNcArea) { if (pDockManager != NULL && (CBCGPControlBar::m_bHandleMinSize || bForce)) { CWnd* pDockSite = pDockManager->GetDockSite (); if (pDockSite == NULL) { return; } if (!pDockSite->IsWindowVisible () && !bForceInvisible) { return; } if (pDockSite->IsKindOf(RUNTIME_CLASS(CBCGPFrameWnd)) || pDockSite->IsKindOf(RUNTIME_CLASS(CBCGPMDIFrameWnd))) { m_bIsAdjustLayout = (pDockSite->GetStyle() & WS_MAXIMIZE) == WS_MAXIMIZE; } CRect rectWnd; pDockSite->SetRedraw (FALSE); pDockSite->GetWindowRect (rectWnd); pDockSite->SetWindowPos (NULL, -1, -1, rectWnd.Width () + 1, rectWnd.Height () + 1, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); pDockSite->SetWindowPos (NULL, -1, -1, rectWnd.Width (), rectWnd.Height (), SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); pDockSite->SetRedraw (TRUE); if (bForceNcArea) { pDockSite->SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } m_bIsAdjustLayout = FALSE; pDockSite->RedrawWindow (NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN); } }
int fsContextHelpMgr::FindControl(CPoint pt) { for (int i = 0; i < m_cLastCtrls; i++) { CWnd* pCtrl = m_pLastDlg->GetDlgItem (m_pLastCtrls [i].nIDCtrl); if (pCtrl->IsWindowVisible () == FALSE) continue; CRect rcCtrl; pCtrl->GetWindowRect (&rcCtrl); if (PtInRect (&rcCtrl, pt)) return i; } return -1; }
bool cdxCDynamicWndEx::StoreWindowPosition(LPCTSTR lpszProfile) { if(!IsWindow() || !lpszProfile || !*lpszProfile) { ASSERT(false); return false; } CWnd *pWnd = Window(); WINDOWPLACEMENT wpl; VERIFY( pWnd->GetWindowPlacement(&wpl) ); CRect windowRect; pWnd->GetWindowRect(&windowRect); BOOL bVisible = pWnd->IsWindowVisible(); int iState = REGVAL_NOSTATE; if(pWnd->IsIconic()) iState = REGVAL_ICONIC; else if(pWnd->IsZoomed()) iState = REGVAL_MAXIMIZED; CWinApp *app = AfxGetApp(); if(!app->m_pszRegistryKey || !*app->m_pszRegistryKey) { TRACE(_T("*** NOTE[cdxCDynamicWndEx::StoreWindowPosition()]: To properly store and restore a window's position, please call CWinApp::SetRegistryKey() in you app's InitInstance() !\n")); return false; } return app->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_INVALID) && // invalidate first app->WriteProfileInt(lpszProfile, lpszRegVal_Left, windowRect.left) && app->WriteProfileInt(lpszProfile, lpszRegVal_Right, windowRect.right) && app->WriteProfileInt(lpszProfile, lpszRegVal_Top, windowRect.top) && app->WriteProfileInt(lpszProfile, lpszRegVal_Bottom, windowRect.bottom) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Left, wpl.rcNormalPosition.left) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Right, wpl.rcNormalPosition.right) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Top, wpl.rcNormalPosition.top) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Bottom, wpl.rcNormalPosition.bottom) && app->WriteProfileInt(lpszProfile, lpszRegVal_Visible, bVisible ? REGVAL_VISIBLE : REGVAL_HIDDEN) && app->WriteProfileInt(lpszProfile, lpszRegVal_State, iState) && app->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_VALID); // validate position }
BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC) { for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) { if(!pChild->IsWindowVisible()) continue; CRect r; pChild->GetClientRect(&r); pChild->MapWindowPoints(this, &r); pDC->ExcludeClipRect(&r); } CRect r; GetClientRect(&r); pDC->FillSolidRect(&r, 0); return TRUE; }
bool CEtsEodManagerApp::_IsFirstInstance() { CWnd* pWndPrev = CWnd::FindWindow(g_cszMainFrameClassName, NULL); if(pWndPrev) { CWnd* pWndChild = pWndPrev->GetLastActivePopup(); if(pWndPrev->IsIconic()) pWndPrev->ShowWindow(SW_RESTORE); else if(!pWndPrev->IsWindowVisible()) pWndPrev->ShowWindow(SW_SHOW); pWndChild->SetForegroundWindow(); return false; } return true; }
void CvQueryExecutionPlanView::DrawQepBoxes (CaSqlQueryExecutionPlanBinaryTree* pQepBinaryTree, CDC* pDC, BOOL bPreview) { if (pQepBinaryTree) { BOOL bCreateOK = FALSE; CaQepNodeInformation* pNodeInfo = pQepBinaryTree->m_pQepNodeInfo; pNodeInfo->SetDisplayMode (bPreview); CWnd* pQepBox = pNodeInfo->GetQepBox(bPreview); BOOL b2Flash = FALSE; if (!pQepBox) { pNodeInfo->AllocateQepBox(bPreview); bCreateOK = pNodeInfo->CreateQepBox(this, bPreview); if (!bCreateOK) { CString strMsg = _T("Cannot create the QEP boxes."); throw CeSqlQueryException (strMsg); } // Emb for custom bitmap draw: replace Load/SetIcon stuff, and modify window text pQepBox = pNodeInfo->GetQepBox(bPreview); SetIconAndText(pQepBox, pNodeInfo->m_nIcon, pNodeInfo->m_strNodeType); b2Flash = TRUE; } if (pQepBox && !pQepBox->IsWindowVisible()) { pQepBox->SendMessage (WM_SQL_QUERY_UPADATE_DATA, (WPARAM)0, (LPARAM)pNodeInfo); CRect rcQep = pNodeInfo->GetQepBoxRect (bPreview); pQepBox->SetWindowPos (NULL, rcQep.left, rcQep.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOZORDER); if (b2Flash) pQepBox->FlashWindow (TRUE); // Emb: Added frame change to force redraw of caption so that image will gracefully appear pQepBox->SetWindowPos (NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); } DrawChildStart (pQepBinaryTree, pDC, bPreview); DrawQepBoxes (pQepBinaryTree->m_pQepNodeLeft, pDC, bPreview); DrawQepBoxes (pQepBinaryTree->m_pQepNodeRight, pDC, bPreview); } }
BOOL CItemBrowserView::OnEraseBkgnd(CDC* pDC) { // This is not a perfect solution, but it prevents much of the flickering as the // controls are being moved around. The controls themselves will still flicker // as they redraw themselves. This pervents the controls being covered by the // erasing of the background which is really noticable and ugly. CRect rExclude; CWnd *pWnd = GetWindow(GW_CHILD); while(pWnd) { if (pWnd->IsWindowVisible()) { pWnd->GetWindowRect(&rExclude); ScreenToClient(&rExclude); pDC->ExcludeClipRect(&rExclude); } pWnd = pWnd->GetWindow(GW_HWNDNEXT); } return CFormView::OnEraseBkgnd(pDC); }
void CLayoutManager::OnEraseBkgnd(BOOL bPeek, HDC hDC) { CDC * pDC = CDC::FromHandle(hDC); if (bPeek) { CWnd * pWnd; CRect r; CRgn rNew, rTmp; /* save */ ::GetClipRgn(pDC->m_hDC, (HRGN)m_rClip.m_hObject); /* refine */ rNew.CreateRectRgn(0,0,0,0); for (pWnd = m_pWnd->GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) { if (! pWnd->IsWindowVisible()) continue; pWnd->GetWindowRect(&r); m_pWnd->ScreenToClient(&r); rTmp.CreateRectRgnIndirect(&r); rNew.CombineRgn(&rNew, &rTmp, RGN_OR); rTmp.DeleteObject(); } pDC->SelectClipRgn(&rNew, RGN_DIFF); } else { /* restore */ pDC->SelectClipRgn(&m_rClip, RGN_COPY); } }
BOOL Cwinlirc::InitInstance() { AfxInitRichEdit(); #ifdef _DEBUG RedirectIOToConsole(); #endif // set current directory for plugins from exe path { //===================== CString fullPath; int indexOfLastSep; //===================== GetModuleFileName(nullptr, fullPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH); indexOfLastSep = fullPath.ReverseFind(_T('\\')); if(!SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\plugins\\"))) { SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\")); } } config.readINIFile(); // // command line stuff // if(_tcsstr(m_lpCmdLine,_T("/e")) || _tcsstr(m_lpCmdLine,_T("/E"))) { config.exitOnError = TRUE; } if(_tcsstr(m_lpCmdLine,_T("/t")) || _tcsstr(m_lpCmdLine,_T("/T"))) { config.showTrayIcon = FALSE; } CString mutexName; mutexName.Format(_T("WinLIRC Multiple Instance Lockout_%i"),config.serverPort); if(!CreateMutex(0,FALSE,mutexName) || GetLastError()==ERROR_ALREADY_EXISTS) { //======= HWND tmp; //======= tmp=FindWindow(nullptr,_T("WinLIRC")); if(!tmp) { MessageBox(nullptr,_T("WinLIRC is already running"),_T("WinLIRC"),MB_OK); } else { // bring it to the top //=========== CWnd winlirc; CWnd *last; //=========== winlirc.Attach(tmp); last = winlirc.GetLastActivePopup(); if(!winlirc.IsWindowVisible()) { winlirc.ShowWindow(SW_SHOW); } winlirc.SetForegroundWindow(); last->SetForegroundWindow(); winlirc.Detach(); } return FALSE; } // //Process initialization and sanity checks // if(SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS)==0 || SetThreadPriority(THREAD_PRIORITY_IDLE)==0) { MessageBox(nullptr,_T("Could not set thread priority."),_T("WinLIRC"),MB_OK|MB_ICONERROR); return FALSE; } if(server.startServer()==false) { MessageBox(nullptr,_T("Server could not be started. Try checking the port."),_T("WinLIRC"),MB_OK|MB_ICONERROR); } WL_DEBUG("Creating main dialog...\n"); dlg = new Cdrvdlg(); if(!dlg->Create(IDD_DIALOG,nullptr)) { delete dlg; dlg = nullptr; MessageBox(nullptr,_T("Program exiting."),_T("WinLIRC"),MB_OK|MB_ICONERROR); return FALSE; } dlg->ShowWindow(SW_HIDE); dlg->UpdateWindow(); m_pMainWnd = dlg; return TRUE; }
void CCoolBarCtrl::DoPaint(CDC* pDC, CRect& rcClient, BOOL bTransparent) { CRect rcItem( rcClient.left + MARGIN_WIDTH, rcClient.top + 1, rcClient.right - MARGIN_WIDTH, rcClient.bottom - 1 ); CRect rcCopy; if ( m_bGripper ) { if ( bTransparent ) { for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 ) { pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 1, CoolInterface.m_crDisabled, CoolInterface.m_crDisabled ); } } else { for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 ) { pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 2, CoolInterface.m_crDisabled, CoolInterface.m_crMidtone ); } pDC->ExcludeClipRect( rcClient.left + 3, rcClient.top + 4, rcClient.left + GRIPPER_WIDTH + 2, rcClient.bottom - 4 ); } rcItem.left += GRIPPER_WIDTH; } if ( m_pItems.GetCount() == 0 ) return; CFont* pOldFont = (CFont*)pDC->SelectObject( m_bBold ? &CoolInterface.m_fntBold : &CoolInterface.m_fntNormal ); BOOL bRight = FALSE; for ( POSITION pos = m_pItems.GetHeadPosition() ; pos ; ) { CCoolBarItem* pItem = (CCoolBarItem*)m_pItems.GetNext( pos ); if ( pItem->m_nID == ID_RIGHTALIGN && ! bRight ) { int nRight = 0; bRight = TRUE; for ( POSITION pos2 = pos ; pos2 ; ) { CCoolBarItem* pRight = (CCoolBarItem*)m_pItems.GetNext( pos2 ); if ( pRight->m_bVisible ) nRight += pRight->m_nWidth; } if ( rcClient.right - rcItem.left >= nRight + MARGIN_WIDTH ) { rcItem.left = rcClient.right - nRight - MARGIN_WIDTH; } } else if ( pItem->m_bVisible ) { rcItem.right = rcItem.left + pItem->m_nWidth; rcCopy.CopyRect( &rcItem ); CWnd* pCtrl = ( pItem->m_nCtrlID ) ? GetDlgItem( pItem->m_nCtrlID ) : NULL; pItem->Paint( pDC, rcCopy, m_pDown == pItem, m_pHot == pItem || ( pCtrl && pCtrl == GetFocus() ), m_bMenuGray, bTransparent ); if ( ! bTransparent ) pDC->ExcludeClipRect( &rcItem ); if ( pCtrl ) SmartMove( pCtrl, &rcCopy ); rcItem.OffsetRect( rcItem.Width(), 0 ); } else if ( pItem->m_nCtrlID ) { CWnd* pCtrl = GetDlgItem( pItem->m_nCtrlID ); if ( pCtrl && pCtrl->IsWindowVisible() ) pCtrl->ShowWindow( SW_HIDE ); } } pDC->SelectObject( pOldFont ); }
////////////////// // Get size information for a single entry (WINRECT). Returns size info in // the SIZEINFO argument. For a group, calculate size info as aggregate of // subentries. // void CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, CWnd* pWnd) { szi.szMin = SIZEZERO; // default min size = zero szi.szMax = SIZEMAX; // default max size = infinite szi.szDesired = wrc->GetRect().Size(); // default desired size = current if (wrc->IsGroup()) { // For groups, calculate min, max, desired size as aggregate of children szi.szDesired = SIZEZERO; BOOL bRow = wrc->IsRowGroup(); CWinGroupIterator it; for (it=wrc; it; it.Next()) { WINRECT* wrc2 = it; SIZEINFO szi2; OnGetSizeInfo(szi2, wrc2, pWnd); if (bRow) { szi.szMin.cx = max(szi.szMin.cx, szi2.szMin.cx); szi.szMin.cy += szi2.szMin.cy; szi.szMax.cx = min(szi.szMax.cx, szi2.szMax.cx); szi.szMax.cy = min(szi.szMax.cy + szi2.szMax.cy, _INFINITY); szi.szDesired.cx = max(szi.szDesired.cx, szi2.szDesired.cx); szi.szDesired.cy += szi2.szDesired.cy; } else { szi.szMin.cx += szi2.szMin.cx; szi.szMin.cy = max(szi.szMin.cy, szi2.szMin.cy); szi.szMax.cx = min(szi.szMax.cx + szi2.szMax.cx, _INFINITY); szi.szMax.cy = min(szi.szMax.cy, szi2.szMax.cy); szi.szDesired.cx += szi2.szDesired.cx; szi.szDesired.cy = max(szi.szDesired.cy, szi2.szDesired.cy); } } // Add margins. int w2,h2; wrc->GetMargins(w2,h2); // get margins w2<<=1; h2<<=1; // double szi.szMin.cx += max(0,w2); // negative margins ==> don't include in min szi.szMin.cy += max(0,h2); // ditto szi.szDesired.cx += abs(w2); // for desired size, use abs vallue szi.szDesired.cy += abs(h2); // ditto } else { // not a group WINRECT* parent = wrc->Parent(); ASSERT(parent); CRect& rcParent = parent->GetRect(); BOOL bRow = parent->IsRowGroup(); int hw, hwMin, hwTotal, pct; switch (wrc->Type()) { case WRCT_FIXED: hw = hwMin = wrc->GetParam(); // ht/wid is parameter if (hw<0) { // if fixed val is negative: hw = -hw; // use absolute val for desired.. hwMin = 0; // ..and zero for minimum } if (bRow) { szi.szMax.cy = szi.szDesired.cy = hw; szi.szMin.cy = hwMin; } else { szi.szMax.cx = szi.szDesired.cx = hw; szi.szMin.cx = hwMin; } break; case WRCT_PCT: pct = wrc->GetParam(); ASSERT(0<pct && pct<100); hwTotal = bRow ? rcParent.Height() : rcParent.Width(); hw = (hwTotal * pct) / 100; szi.szDesired = bRow ? CSize(rcParent.Width(), hw) : CSize(hw, rcParent.Height()); break; case WRCT_TOFIT: if (wrc->HasToFitSize()) { szi.szDesired = wrc->GetToFitSize(); } break; case WRCT_REST: break; default: ASSERT(FALSE); } // If the entry is a window, send message to get min/max/tofit size. // Only set tofit size if type is TOFIT. // if (wrc->IsWindow() && pWnd) { CWnd* pChild = pWnd->GetDlgItem(wrc->GetID()); if (pChild) { if (!pChild->IsWindowVisible() && pWnd->IsWindowVisible()) { // parent visible but child not ==> tofit size is zero // important so hidden windows use no space szi.szDesired = SIZEZERO; } else { szi.szAvail = rcParent.Size(); SendGetSizeInfo(szi, pWnd, wrc->GetID()); } } } szi.szDesired = maxsize(minsize(szi.szDesired,szi.szMax), szi.szMin); } }