📄 window.c
字号:
}void UpdateDesktop( const HWND hWnd){ PWindowsTree pControl; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if(!IsEmptyInvalidRegion(pWin->pInvRgn)) SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pWin->pControlHead; while(pControl){ if(!IsEmptyInvalidRegion(pControl->pInvRgn)) SendMessage(pControl,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pControl->pNext; }}BOOL ShowMain( const HWND hWnd, int nCmdShow){ PWindowsTree pChild,pControl; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if(nCmdShow){ pChild=pWin->pChildHead; if(pChild){ ActiveWindow((HWND)pChild); } else ActiveWindow((HWND)pWin); } else DisactiveWindow((HWND)pWin); if(nCmdShow){ SendMsgByClient(LMSG_IPC_SHOWMAINWIN,NULL,0); LockMutexForSynchro(); //set window visible pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; //get clip area from server //for there are maybe skb or ime window. ReCalClipRegion(pWin); pChild=pWin->pChildHead; while(pChild){ ReCalClipRegion(pChild); pControl=pChild->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } pChild=pChild->pNext; } pControl=pWin->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } } else{ SendMsgByClient(LMSG_IPC_HIDEMAINWIN,NULL,0); pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); pChild=pWin->pChildHead; while(pChild){ EmptyClipRegion(pChild->pClipRgn); pControl=pChild->pControlHead; while(pControl){ EmptyClipRegion(pControl->pClipRgn); pControl=pControl->pNext; } pChild=pChild->pNext; } pControl=pWin->pControlHead; while(pControl){ EmptyClipRegion(pControl->pClipRgn); pControl=pControl->pNext; } } if(nCmdShow){ scrInvalidateRect((HWND)pWin, NULL,true); pChild=pWin->pChildHead; while(pChild){ if(IsVisible((HWND)pChild)){ scrInvalidateRect(pChild, NULL,true); pControl=pChild->pControlHead; while(pControl){ if(IsVisible((HWND)pControl)) scrInvalidateRect(pControl, NULL,true); pControl=pControl->pNext; } } pChild=pChild->pNext; } pControl=pWin->pControlHead; while(pControl){ if(IsVisible((HWND)pControl)) scrInvalidateRect(pControl,NULL,true); pControl=pControl->pNext; } //SendMsgByClient(LMSG_IPC_SHOWMAINWIN,NULL,0); } else{ //SendMsgByClient(LMSG_IPC_HIDEMAINWIN,NULL,0); } return true;}void UpdateMain( const HWND hWnd){ PWindowsTree pChild,pControl; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)){ SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pWin->pControlHead; while(pControl){ SendMessage((HWND)pControl,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pControl->pNext; } pChild=pWin->pChildHead; while(pChild){ SendMessage((HWND)pChild,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pChild->pControlHead; while(pControl){ SendMessage((HWND)pControl,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pControl->pNext; } pChild=pChild->pNext; } }}//show child will not change the visible attribute of its control//but clip region of its control and its parent may be changed.BOOL ShowChild( const HWND hWnd, int nCmdShow){ PWindowsTree pBrother, pControl; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; //Set Active Window if(nCmdShow){ ActiveWindow((HWND)pWin); } else{ if(IsActive((HWND)pWin)){ //Set it's brother active if(pWin->pNext) ActiveWindow((HWND)(pWin->pNext)); else ActiveWindow((HWND)(pWin->pParent)); } } if(nCmdShow){ MoveWindowTopMost(hWnd); pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; ReCalClipRegion(pWin); SubtractClipRegion(pWin->pParent->pClipRgn,&(pWin->rect)); pControl = pWin->pParent->pControlHead; while(pControl){ SubtractClipRegion(pControl->pClipRgn,&(pWin->rect)); pControl = pControl->pNext; } pBrother=pWin->pNext; while(pBrother){ if(IsIntersect(&(pWin->rect),&(pBrother->rect))){ SubtractClipRegion(pBrother->pClipRgn,&(pWin->rect)); pControl = pBrother->pControlHead; while(pControl){ SubtractClipRegion(pControl->pClipRgn,&(pWin->rect)); pControl = pControl->pNext; } } pBrother=pBrother->pNext; } pControl=pWin->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } } else{ pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); pControl=pWin->pControlHead; while(pControl){ EmptyClipRegion(pControl->pClipRgn); pControl=pControl->pNext; } ReCalClipRegion(pWin->pParent); pBrother=pWin->pNext; while(pBrother){ if(IsIntersect(&(pWin->rect),&(pBrother->rect))){ ReCalClipRegion(pBrother); pControl = pBrother->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl = pControl->pNext; } } pBrother=pBrother->pNext; //Set Active Window } } if(nCmdShow){ ActiveWindow((HWND)pWin); } else{ if(IsActive((HWND)pWin)){ //Set it's brother active if(pWin->pNext) ActiveWindow((HWND)(pWin->pNext)); else ActiveWindow((HWND)(pWin->pParent)); } } if(nCmdShow){ scrInvalidateRect((HWND)pWin,NULL,true); pControl=pWin->pControlHead; while(pControl){ if(IsVisible((HWND)pControl)) scrInvalidateRect(pControl,NULL,true); pControl=pControl->pNext; } } else RePaintCoveredWindow(pWin); return true;}void UpdateChild( const HWND hWnd){ PWindowsTree pControl; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)){ SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pWin->pControlHead; while(pControl){ SendMessage((HWND)pControl,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); pControl=pControl->pNext; } }}BOOL ShowControl( const HWND hWnd, int nCmdShow){ PWindowsTree pBrother; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if(nCmdShow){ pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; //MoveWindowTopMost(hWnd); //do not move to top most otherwise it will lead a error of deskicon //when scroll up /down ReCalClipRegion(pWin); SubtractClipRegion(pWin->pParent->pClipRgn,&(pWin->rect)); pBrother=pWin->pNext; while(pBrother){ if(IsIntersect(&(pWin->rect),&(pBrother->rect))) SubtractClipRegion(pBrother->pClipRgn,&(pWin->rect)); pBrother=pBrother->pNext; } } else{ pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); ReCalClipRegion(pWin->pParent); pBrother=pWin->pNext; while(pBrother){ if(IsIntersect(&(pWin->rect),&(pBrother->rect))) ReCalClipRegion(pBrother); pBrother=pBrother->pNext; } } if(nCmdShow){ scrInvalidateRect((HWND)pWin,NULL,true); } else{ RePaintCoveredWindow(pWin); } return true;}void UpdateControl( const HWND hWnd){ PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)) SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL);//显示客户区}BOOL ShowImeWin( const HWND hWnd, int nCmdShow){ PlGUIAppStat pCurStat; PWindowsTree pBrother, pControl; PWindowsTree pWin; RECT rc; pWin=(PWindowsTree)hWnd; CopyRect(&rc,&(pWin->rect)); if(nCmdShow){ pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; SetInitRectClipRegion(pWin->pClipRgn,&rc); SubtractClipRegion(_lGUI_pWindowsTree->pClipRgn,&rc); pControl = _lGUI_pWindowsTree->pControlHead; while(pControl){ SubtractClipRegion(pControl->pClipRgn,&rc); pControl = pControl->pNext; } pCurStat=_lGUI_pAppStat; while(pCurStat){ if(IsIntersect(&(pCurStat->pClipRgn->rcBound),&rc)){ SubtractClipRegion(pCurStat->pClipRgn, &rc); if(pCurStat->bVisible) SendClipRgnChangeMsg(pCurStat); } pCurStat = pCurStat->pNext; } //paint winInvalidateRect(hWnd,NULL,true); } else{ pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); ReCalClipRegion(_lGUI_pWindowsTree); InvalidateRect((HWND)_lGUI_pWindowsTree,NULL,true); pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ scrInvalidateRect((HWND)pControl,NULL,true); pControl=pControl->pNext; } pCurStat = _lGUI_pAppStat; RecalClipRgnUnderThis(pCurStat); while(pCurStat){ SendClipRgnChangeMsg(pCurStat); pCurStat=pCurStat->pNext; } pCurStat = _lGUI_pAppStat; while(pCurStat){ SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,(void*)&rc,sizeof(RECT)); pCurStat=pCurStat->pNext; } } return true;}void UpdateImeWin( const HWND hWnd){ PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)) SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); //else // SyncPaintCoveredWindow(pWin);}BOOL ShowSkbWin( const HWND hWnd, int nCmdShow){ PlGUIAppStat pCurStat; PWindowsTree pBrother, pControl; PWindowsTree pWin; RECT rc; pWin=(PWindowsTree)hWnd; CopyRect(&rc,&(pWin->rect)); if(nCmdShow){ pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; SetInitRectClipRegion(pWin->pClipRgn,&rc); SubtractClipRegion(_lGUI_pWindowsTree->pClipRgn,&rc); pControl = _lGUI_pWindowsTree->pControlHead; while(pControl){ SubtractClipRegion(pControl->pClipRgn,&rc); pControl = pControl->pNext; } pCurStat=_lGUI_pAppStat; while(pCurStat){ if(IsIntersect(&(pCurStat->pClipRgn->rcBound),&rc)){ SubtractClipRegion(pCurStat->pClipRgn, &rc); if(pCurStat->bVisible) SendClipRgnChangeMsg(pCurStat); } pCurStat = pCurStat->pNext; } //paint winInvalidateRect(hWnd,NULL,true); } else{ pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); ReCalClipRegion(_lGUI_pWindowsTree); InvalidateRect((HWND)_lGUI_pWindowsTree,NULL,true); pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ scrInvalidateRect((HWND)pControl,NULL,true); pControl=pControl->pNext; } pCurStat = _lGUI_pAppStat; RecalClipRgnUnderThis(pCurStat); while(pCurStat){ SendClipRgnChangeMsg(pCurStat); pCurStat=pCurStat->pNext; } pCurStat = _lGUI_pAppStat; while(pCurStat){ //SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,NULL,0); SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,(void*)&rc,sizeof(RECT)); pCurStat=pCurStat->pNext; } } return true;}void UpdateSkbWin( const HWND hWnd){ PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)) SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL);}BOOL ShowMenuWin( const HWND hWnd, int nCmdShow){ PlGUIAppStat pCurStat; PWindowsTree pBrother, pControl; PWindowsTree pWin; RECT rc; pWin=(PWindowsTree)hWnd; CopyRect(&rc,&(pWin->rect)); if(nCmdShow){ pWin->dwStyle = pWin->dwStyle | WS_VISIBLE; SetInitRectClipRegion(pWin->pClipRgn,&rc); SubtractClipRegion(_lGUI_pWindowsTree->pClipRgn,&rc); pControl = _lGUI_pWindowsTree->pControlHead; while(pControl){ SubtractClipRegion(pControl->pClipRgn,&rc); pControl = pControl->pNext; } pCurStat=_lGUI_pAppStat; while(pCurStat){ if(IsIntersect(&(pCurStat->pClipRgn->rcBound),&rc)){ SubtractClipRegion(pCurStat->pClipRgn, &rc); if(pCurStat->bVisible) SendClipRgnChangeMsg(pCurStat); } pCurStat = pCurStat->pNext; } winInvalidateRect(hWnd,NULL,true); } else{ pWin->dwStyle = pWin->dwStyle & ~WS_VISIBLE; EmptyClipRegion(pWin->pClipRgn); ReCalClipRegion(_lGUI_pWindowsTree); InvalidateRect((HWND)_lGUI_pWindowsTree,NULL,true); pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ ReCalClipRegion(pControl); pControl=pControl->pNext; } pControl=_lGUI_pWindowsTree->pControlHead; while(pControl){ scrInvalidateRect((HWND)pControl,NULL,true); pControl=pControl->pNext; } pCurStat = _lGUI_pAppStat; RecalClipRgnUnderThis(pCurStat); while(pCurStat){ SendClipRgnChangeMsg(pCurStat); pCurStat=pCurStat->pNext; } pCurStat = _lGUI_pAppStat; while(pCurStat){ //SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,NULL,0); SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,(void*)&rc,sizeof(RECT)); pCurStat=pCurStat->pNext; } } return true;}void UpdateMenuWin( const HWND hWnd){ PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if((pWin->dwStyle & WS_VISIBLE) && !IsEmptyInvalidRegion(pWin->pInvRgn)) SendMessage((HWND)pWin,LMSG_PAINT,(WPARAM)NULL,(LPARAM)NULL); //else // SyncPaintCoveredWindow(pWin);}//Destroywindow function will destroy sub window and control of this windowvoid GUIAPI DestroyWindow(HWND hWnd){ PWindowsTree pWin; pWin=(PWindowsTree)hWnd; if(!pWin){ printerror("null window pointer!"); return; } //free the scroll struct if(pWin->pVScroll)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -