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

📄 framewin_setbordersize.c

📁 ucgui的3.98版本的源代码
💻 C
字号:
/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : FRAMEWIN.c
Purpose     : FRAMEWIN_SetBorderSize
---------------------------END-OF-HEADER------------------------------
*/

#include "FRAMEWIN_Private.h"
#include "WIDGET.h"

#if GUI_WINSUPPORT

/*********************************************************************
*
*       Exported code
*
**********************************************************************
*/

/*********************************************************************
*
*       FRAMEWIN_SetBorderSize
*/
void FRAMEWIN_SetBorderSize(FRAMEWIN_Handle hObj, unsigned Size) {
  GUI_LOCK();
  if (hObj) {
    GUI_RECT r;
    WM_Obj * pChild;
    int Diff, OldSize, OldHeight;
    WM_HWIN hChild;
    FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj);
    OldHeight          = FRAMEWIN__CalcTitleHeight(pObj);
    OldSize            = pObj->Props.BorderSize;
    Diff               = Size - OldSize;
    for (hChild = pObj->Widget.Win.hFirstChild; hChild; hChild = pChild->hNext) {
      pChild = WM_H2P(hChild);
      r = pChild->Rect;
      GUI_MoveRect(&r, -pObj->Widget.Win.Rect.x0, -pObj->Widget.Win.Rect.y0);
      if ((r.y0 == pObj->Props.BorderSize) && ((r.y1 - r.y0 + 1) == OldHeight)) {
        if (pChild->Status & WM_SF_ANCHOR_RIGHT) {
          WM_MoveWindow(hChild, -Diff, Diff);
        } else {
          WM_MoveWindow(hChild, Diff, Diff);
        }
      }
    }
    pObj->Props.BorderSize   = Size;
    FRAMEWIN__UpdatePositions(pObj);
    FRAMEWIN_Invalidate(hObj);
  }
  GUI_UNLOCK();
}

#else
  void FRAMEWIN_SetBorderSize_C(void) {} /* avoid empty object files */
#endif /* GUI_WINSUPPORT */
	 	 			 		    	 				 	  			   	 	 	 	 	 	  	  	      	   		 	 	 		  		  	 		 	  	  			     			       	   	 			  		    	 	     	 				  	 					 	 			   	  	  			 				 		 	 	 			     			 

⌨️ 快捷键说明

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