⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wm.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
                The following windows are affected:
                * windows below the window creating the invalidation.
                * transparent windows located above
                The coordinates given are absolute coordinates (desktop coordinates)
              */
              void WM__InvalidateAreaBelow(const GUI_RECT* pRect, WM_HWIN StopWin) {
                WM_HWIN   iWin, iNext;
                GUI_USE_PARA(StopWin); /* tbd: change calls of this function */
                /* Iterate over windows below StopWin */
                for (iWin = WM__FirstWin; iWin/*!=StopWin*/; iWin = iNext) {
                  GUI_RECT r = *pRect;
                  WM_Obj* pWin = WM_H2P(iWin);
                  iNext = pWin->hNextLin;
                  if (GUI__IntersectRects(&r, &r, &pWin->Rect)) {
                    WM_InvalidateBWin1Abs (iWin, &r);
                  }
C51 COMPILER V8.05a   WM                                                                   04/11/2008 14:19:41 PAGE 10  

                };
              }
              
              /*
                Invalidate any transparent window above the given area
              */
              void WM__InvalidateTransAreaAbove(const GUI_RECT* pRect, WM_HWIN StopWin) {
                GUI_USE_PARA(pRect);
                GUI_USE_PARA(StopWin);
              #if 0
                WM_HWIN   iWin;
                /* Iterate over windows below StopWin */
                for (iWin = StopWin; iWin!=WM_HWIN_NULL; iWin = WM_H2P(iWin)->Next) {
                  WM_Obj *pWin = WM_H2P(iWin);
                  if (pWin->Status & WM_SF_HASTRANS) {
                    GUI_RECT r = *pRect;
                    if (GUI__IntersectRects(&r, &r, &WM_H2P(iWin)->Rect)) {
                      WM_InvalidateBWin1Abs (iWin, &r);
                    }
                  }
                }
              #endif
              }
              
              
              /*
                        *****************************************************************
                        *                                                               *
                        *              Invalidation functions                           *
                        *                                                               *
                        *****************************************************************
              */
              
              /* Invalidate a section of the window. The optional rectangle
                 contains client coordinates, which are independent of the
                 position of the window on the logical desktop area.
              */
              
              
              void WM_InvalidateRect(WM_HWIN hWin, const GUI_RECT*pRect) {
                GUI_RECT r;
                WM_Obj* pWin;
                WM_LOCK();
                pWin = WM_H2P(hWin);
                WM__GetClientRectWin(pWin, &r);
                if (pRect) {
                  GUI__IntersectRect(&r, pRect);
                }
                WM_InvalidateBWin1(hWin, &r);
              /* Convert into absolute coordinates ... */
                GUI_MoveRect (&r, pWin->Rect.x0, pWin->Rect.y0);
              /* Make sure windows below are invalidated if this one is transparent */
                if (pWin->Status & WM_SF_HASTRANS) {
                  ResetNextDrawWin();
                  WM__InvalidateAreaBelow(&r, hWin);
                }
              /* Invalidate the transparent ones above */
                WM__InvalidateTransAreaAbove(&r,hWin);
                WM_UNLOCK();
              }
              
              void WM_InvalidateWindow(WM_HWIN hWin) {
C51 COMPILER V8.05a   WM                                                                   04/11/2008 14:19:41 PAGE 11  

                WM_InvalidateRect(hWin, NULL);
              }
              
              /* Invalidate, using desktop coordinates */
              void WM_InvalidateBWinAbs(WM_HWIN hWin, const GUI_RECT*pRect) {
                GUI_RECT r = *pRect;
                WM_LOCK();
                GUI_MoveRect(&r, -WM_H2P(hWin)->Rect.x0, -WM_H2P(hWin)->Rect.y0);
                WM_InvalidateRect(hWin, &r);
                WM_UNLOCK();
              }
              
              
              /*
                Invalidate a certain section of the display. One main reason for this is
                that the top window has been moved or destroyed.
                The coordinates given are absolute coordinates (desktop coordinates)
              */
              void WM_InvalidateArea(GUI_RECT* pRect) {
                WM_HWIN   iWin;
                WM_LOCK();
                /* Iterate over all windows */
                for (iWin=WM__FirstWin; iWin !=0; ) {
                  WM_Obj* pWin = WM_H2P(iWin);
                  GUI_RECT r = *pRect;
                  GUI__IntersectRect(&r, &pWin->Rect);
                  /* Calculate which area is actually visible by subtracting the
                     windows which are on top of this one */
                  WM_InvalidateBWinAbs (iWin, &r);
                  iWin = pWin->hNextLin;
                }
                WM_UNLOCK();
              }
              
              
              /*
                ********************************************************************
                *                                                                  *
                *              manage windows stack                                *
                *                                                                  *
                ********************************************************************
              */
              
              
              /* Return index (handle) of the window which is bottom of stack.
                 Note that in the current implementation, this is always
                 window 0.
              */
              WM_HWIN WM_GetDesktopWindow(void) {
                return WM__FirstWin;
              }
              
              /*
                ********************************************************************
                *
                *              Create window (as child)
                *
                ********************************************************************
              */
              
              WM_HWIN WM_CreateWindowAsChild(
                                  int x0, int y0, int width, int height
C51 COMPILER V8.05a   WM                                                                   04/11/2008 14:19:41 PAGE 12  

                                 ,WM_HWIN hParent, U16 Style, WM_CALLBACK* cb
                                 ,int NumExtraBytes)
              {
                WM_Obj* pWin;
                WM_HWIN hWin;
                WM_LOCK();
                Style |= WM__CreateFlags;
                /* Get Parent info */
                if (!hParent) {
                  if (WM__NumWindows) {
                    hParent = WM_HBKWIN;
                  }
                }
                if (hParent) {
                  GUI_RECT Rect;
              //    Rect = WM_H2P(hParent)->Rect;
              
                  WM_GetInsideRect(hParent, &Rect);
                  WM__Client2Screen(WM_H2P(hParent), &Rect);
              
                  x0 += Rect.x0;
                  y0 += Rect.y0;
                  if (width==0)
                    width = Rect.x1-Rect.x0+1;
                  if (height==0)
                    height = Rect.y1-Rect.y0+1;
                }
                if ((hWin = (WM_HWIN) WM_ALLOC(NumExtraBytes+sizeof(WM_Obj))) == 0) {
                  GUI_DEBUG_ERROROUT("WM_CreateWindow: No memory to create window");
                } else {
                  WM__NumWindows++;
                  pWin = WM_H2P(hWin);
                  memset (pWin,   0, sizeof(WM_Obj));        /* erase this data structure
                         The explicit zero-init is no longer needed since the entire data structure
                         is already zeroed. The advantage is that it reduces program size.
                         */
                  pWin->Rect.x0 = x0;
                  pWin->Rect.y0 = y0;
                  pWin->Rect.x1 = x0+width-1;
                  pWin->Rect.y1 = y0+height-1;
                  pWin->Status = WM_SF_INUSE;     /* Mark window as in use */
                  pWin->cb = cb;
                  /* Add to linked lists */
                  pWin->hParent = hParent;
                  _AddChild(hParent, hWin, Style & WM_CF_STAYONTOP);
                  _AddToLinList(hWin);
                /* Put Window on top (or bottom) of windows stack */
                  if (Style & WM_CF_ACTIVATE /*| (cb==NULL)*/) {
                    WM_SelectWindow(hWin);  /* This is not needed
                                               if callbacks are being used, but it
                                               does not cost a lot and makes life
                                               easier ... */
                  }
                /* Mark client area as invalid */
                  WM__SendMsgNoData(hWin, WM_CREATE);
                /* Handle the Style flags, one at a time */
                  if (Style & WM_CF_SHOW) {
                    WM_ShowWindow(hWin);
                  }
                /* Hide if parent is not visible */
                  if (hParent) {
                    WM_Obj* pWinParent = WM_H2P(hParent);
C51 COMPILER V8.05a   WM                                                                   04/11/2008 14:19:41 PAGE 13  

                    if (!(pWinParent->Status & WM_SF_ISVIS)) {
                      WM_HideWindow(hWin);
                    }
                  }
                  /* Copy the flags which can simply be accepted */
                  pWin->Status |= (Style & (WM_SF_MEMDEV|WM_SF_STAYONTOP|WM_SF_HASTRANS));
                }
                WM_UNLOCK();
                return hWin;
              }
              
              WM_HWIN WM_CreateWindow(int x0, int y0, int width, int height, U16 Style, WM_CALLBACK* cb, int NumExtraByt
             -es) {
                return WM_CreateWindowAsChild(x0,y0,width,height, 0 /* No parent */,  Style, cb, NumExtraBytes);
              }
              
              
              
              /****************************************************************
              *
              *          Delete window
              *
              *****************************************************************
              
              */
              
              void WM_DeleteWindow (WM_HWIN Win) {
                WM_Obj* pWin;
                if (!Win)
                  return;
                WM_LOCK();
                if (WM__IsWindow(Win)) {
                  pWin = WM_H2P(Win);
                  ResetNextDrawWin();              /* Make sure the window will no longer receive drawing messages */
                /* Make sure that focus is set to an existing window */
                  if (WM__hWinFocus == Win) {
                    WM__hWinFocus = 0;
                  }
                  if (Win == WM__hCapture) {
                    WM__hCapture = 0;
                  }
                /* Delete all children */
                  _DeleteAllChildren(pWin->hFirstChild);
                  _DeleteInSiblingList(Win);
                /* Send WM_DELETE message to window in order to inform window itself */
                  WM__SendMsgNoData(Win, WM_DELETE);     /* tell window about it */
                  /* Inform other modules if necessary */
                  if (WM__pfDeleteWindowHook) {
                    (*WM__pfDeleteWindowHook)(Win);
                  }
                /* Remove window from window stack */
                  if (pWin->Status & WM_SF_INVALID) {
                    WM__NumInvalidWindows--;
                  }
                  WM__RemoveFromLinList(Win);
                /* Clear area used by this window */
                  WM_InvalidateArea(&pWin->Rect);
                /* Free window memory */
                  WM__NumWindows--;
                  WM_FREE(Win);
                /* Select a valid window */
                  WM_SelectWindow(WM__FirstWin);
C51 COMPILER V8.05a   WM                                                                   04/11/2008 14:19:41 PAGE 14  

                } else {
                  GUI_DEBUG_WARN("WM_DeleteWindow: Invalid handle");
                }
                WM_UNLOCK();
              }
              

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -