/********************************************************************* * * FRAMEWIN_AddMenu */ void FRAMEWIN_AddMenu(FRAMEWIN_Handle hObj, WM_HWIN hMenu) { if (hObj) { FRAMEWIN_Obj* pObj; WM_LOCK(); pObj = FRAMEWIN_H2P(hObj); if (pObj) { int TitleHeight, BorderSize, IBorderSize = 0; int x0, y0, xSize; TitleHeight = FRAMEWIN__CalcTitleHeight(pObj); BorderSize = pObj->Props.BorderSize; if (pObj->Widget.State & FRAMEWIN_SF_TITLEVIS) { IBorderSize = pObj->Props.IBorderSize; } x0 = BorderSize; y0 = BorderSize + TitleHeight + IBorderSize; xSize = WM__GetWindowSizeX(&pObj->Widget.Win); xSize -= BorderSize * 2; pObj->hMenu = hMenu; if (pObj->cb) { MENU_SetOwner(hMenu, pObj->hClient); } MENU_Attach(hMenu, hObj, x0, y0, xSize, 0, 0); WM_SetAnchor(hMenu, WM_CF_ANCHOR_LEFT | WM_CF_ANCHOR_RIGHT); FRAMEWIN__UpdatePositions(pObj); FRAMEWIN_Invalidate(hObj); } WM_UNLOCK(); } }
/********************************************************************* * * FRAMEWIN_SetFont */ void FRAMEWIN_SetFont(FRAMEWIN_Handle hObj, const GUI_FONT GUI_UNI_PTR * pFont) { GUI_LOCK(); if (hObj) { FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj); int OldHeight = FRAMEWIN__CalcTitleHeight(pObj); pObj->Props.pFont = pFont; FRAMEWIN__UpdatePositions(pObj); FRAMEWIN__UpdateButtons(pObj, OldHeight); FRAMEWIN_Invalidate(hObj); } GUI_UNLOCK(); }
/********************************************************************* * * _MinimizeFramewin */ static void _MinimizeFramewin(FRAMEWIN_Handle hObj, FRAMEWIN_Obj* pObj) { _RestoreMaximized(hObj, pObj); /* When window is not minimized, minimize it */ if ((pObj->Flags & FRAMEWIN_SF_MINIMIZED) == 0) { int OldHeight = pObj->Widget.Win.Rect.y1 - pObj->Widget.Win.Rect.y0 + 1; int NewHeight = FRAMEWIN__CalcTitleHeight(pObj) + pObj->Widget.pEffect->EffectSize * 2 + 2; pObj->rRestore = pObj->Widget.Win.Rect; WM_HideWindow(pObj->hClient); WM_HideWindow(pObj->hMenu); WM_ResizeWindow(hObj, 0, NewHeight - OldHeight); FRAMEWIN__UpdatePositions(pObj); pObj->Flags |= FRAMEWIN_SF_MINIMIZED; _InvalidateButton(pObj, GUI_ID_MINIMIZE); } }