Example #1
0
void MenuBar_Adjust(HELE hEle) //调整布局
{
	MENUBAR(hEle)->bAdjust=FALSE;

	menuBar_ *pObject=(menuBar_*)hEle;

	ele_* pEle=(ele_*)hEle;
	int top=(pEle->rect.bottom-pEle->rect.top-MENUBAR(hEle)->buttonHeight)/2;

	int left=5;
	int width=0;
	RECT rect;

	int count=XArray_GetCount(pEle->hArrayEle);
	for(int i=0;i<count;i++)
	{
		HELE  hMenuBarBtn=(HELE)(menuBarButon_*)XArray_GetAt( pEle->hArrayEle,i);
		if(XC_MENUBAR_BUTTON==XC_GetObjectType(hMenuBarBtn))
		{
			XEle_GetRect(hMenuBarBtn,&rect);
			width=rect.right-rect.left;

			rect.left=left;
			rect.right=rect.left+width;
			rect.top=top;
			rect.bottom=rect.top+MENUBAR(hEle)->buttonHeight;
			XEle_SetRect(hMenuBarBtn,&rect);
			left+=width;
		}
	}
}
Example #2
0
/// @brief 删除菜单项.
/// @param hEle 元素句柄.
/// @param index 菜单条上按钮索引.
/// @param id   菜单项ID.
void WINAPI XMenuBar_DeleteMenuItem(HELE hEle,int index,int id)
{
	IsMenuBarDebug(hEle,__FUNCTION__);
	HELE  hMenuBarBtn=(HELE)Array_GetAtEle(((ele_*)hEle)->hArrayEle,index);
	if(XC_MENUBAR_BUTTON==XC_GetObjectType(hMenuBarBtn))
		MenuBarBtn_DeleteMenuItem(hMenuBarBtn,id);
}
Example #3
0
/// @brief 添加菜单项,并指定图标.
/// @param hEle 元素句柄.
/// @param index 菜单条上按钮索引.
/// @param id   菜单项ID.
/// @param pText 文本内容.
/// @param uFlags 标识.
/// @param insertID 插入到该项前面.
void WINAPI XMenuBar_InsertMenuItem(HELE hEle,int index,int id,wchar_t *pText,int uFlags,int insertID) //插入菜单项
{
	IsMenuBarDebug(hEle,__FUNCTION__);
	HELE  hMenuBarBtn=(HELE)Array_GetAtEle(((ele_*)hEle)->hArrayEle,index);
	if(XC_MENUBAR_BUTTON==XC_GetObjectType(hMenuBarBtn))
		MenuBarBtn_InsertMenuItem(hMenuBarBtn,id,pText,uFlags,insertID);
}
Example #4
0
/// @brief 添加菜单项,并指定图标.
/// @param hEle 元素句柄.
/// @param index 菜单条上按钮索引.
/// @param id   菜单项ID.
/// @param pText 文本内容.
/// @param parentId 菜单项的父项ID.
/// @param uFlags 标识.
/// @param hImage  图片句柄.
void WINAPI XMenuBar_AddMenuItemImage(HELE hEle,int index,int id,wchar_t *pText,int parentId,int uFlags,HIMAGE hImage) //增加菜单项
{
	IsMenuBarDebug(hEle,__FUNCTION__);
	HELE  hMenuBarBtn=(HELE)Array_GetAtEle(((ele_*)hEle)->hArrayEle,index);
	if(XC_MENUBAR_BUTTON==XC_GetObjectType(hMenuBarBtn))
		MenuBarBtn_AddMenuItemImage(hMenuBarBtn,id,pText,parentId,uFlags,hImage);
}
Example #5
0
/// @brief 获取菜单句柄.
/// @param hEle 元素句柄.
/// @param index 菜单所在位置索引.
/// @return 菜单句柄.
HMENUX WINAPI XMenuBar_GetMenu(HELE hEle,int index) //获取菜单句柄
{
	IsMenuBarDebug(hEle,__FUNCTION__);
	HELE hButton=XMenuBar_GetButton(hEle,index);  //获取菜单条上按钮
	if(hButton)
	{
		if(XC_MENUBAR_BUTTON==XC_GetObjectType(hButton))
		{
			menuBarButon_ *pMenuBtn=(menuBarButon_*)hButton;
			return pMenuBtn->hMenu;
		}
	}
	return NULL;
}
Example #6
0
	int OnListTemplateCreateEnd(list_item_i* pItem,BOOL *pbHandled)
	{
		
		if (pItem->iSubItem == 0) //按钮在第0列
		{
			HXCGUI hBtn = XList_GetTemplateObject(m_hList,pItem->index,1);
			if (XC_GetObjectType(hBtn) == XC_BUTTON)
			{
				//记住选中状态
				BOOL isCheck = XList_GetItemData(m_hList,pItem->index,pItem->iSubItem);
				XBtn_SetCheck((HELE)hBtn,isCheck);
				XEle_RegEventCPP1((HELE)hBtn,XE_BUTTON_CHECK,&CRightPane::OnButtonCheck);
			}
		}
		
		*pbHandled = TRUE;
		return 0;
	}
Example #7
0
BOOL CALLBACK MenuBar_OnMouseMove(HELE hEle,UINT flags,POINT *pPt)
{
	menuBar_ *pMenuBar=MENUBAR(hEle);
	if(pMenuBar->bDown)
	{
		POINT pt={pPt->x,pPt->y};
		int count=Array_GetCount(((ele_*)hEle)->hArrayEle);
		for(int i=0; i<count; i++)
		{
			ele_ *pChild=Array_GetAtEle(((ele_*)hEle)->hArrayEle,i);

			if(XC_MENUBAR_BUTTON==XC_GetObjectType(pChild))
			{
				if( PtInRect(&pChild->rect,pt) )
				{
					int menuItemCount=XMenu_GetItemCount(((menuBarButon_*)pChild)->hMenu);
					if(menuItemCount>0)
					{
						if(pMenuBar->pBtnTop!=((menuBarButon_*)pChild))
						{
							if(pMenuBar->pBtnTop) //关闭先前的菜单
							{
								MenuBarBtn_CloseMenu((HELE)pMenuBar->pBtnTop);
								((button_*)pMenuBar->pBtnTop)->state=STATE_LEAVE; //修改按钮状态
								XEle_RedrawEle((HELE)pMenuBar->pBtnTop);
							}
							pMenuBar->pBtnTop=(menuBarButon_*)pChild;
							((button_*)pChild)->state=STATE_DOWN;
							XEle_RedrawEle((HELE)pChild);
							MenuBarBtn_PopupMenu((HELE)pChild);
						}
					}
					break;
				}
			}
		}
	}
	return FALSE;
}
Example #8
0
void Cell_OnSize(layoutCell_ *pCell,HWINDOW hWindow,BOOL bFixedSize) //调整坐标
{
	if(NULL==pCell)
		return ;

	int type=XC_GetObjectType(hWindow);
	if(XC_FRAMEWND==type)
	{
		if(NULL==pCell->pParentCell)
		{
			if(FALSE==Cell_IsChildInLayout(pCell))
				return ;

			XWnd_GetClientRect(hWindow,&pCell->rect);

			frameWnd_ *pFrame=(frameWnd_*)hWindow;
			if(pFrame->hPierLeft)
				pCell->rect.left=((ele_*)pFrame->hPierLeft)->rect.right;

			if(pFrame->hPierTop)
				pCell->rect.top=((ele_*)pFrame->hPierTop)->rect.bottom;

			if(pFrame->hPierRight)
				pCell->rect.right=((ele_*)pFrame->hPierRight)->rect.left;

			if(pFrame->hPierBottom)
				pCell->rect.bottom=((ele_*)pFrame->hPierBottom)->rect.top;

			Cell_OnSize2(pCell, hWindow,TRUE,bFixedSize);
		}
	}else if(XC_FLOATWND==type)
	{
		//	XWnd_GetClientRect(hWindow,&pCell->rect);
		//	Cell_OnSize2(pCell, hWindow,TRUE);
	}
}