void Cell_OnSize_group(layoutCell_ *pCell,HWINDOW hWindow,BOOL bAdjust) { if(FALSE==bAdjust) { // layoutCell_ *pChild=(layoutCell_*)XArray_GetAt(pCell->hArrayList); // (pChild->hPane) // // if(XEle_IsShowEle(pCell->hTabBar)) // XEle_ShowEle(pCell->hTabBar,FALSE); return ; } RECT rc=pCell->rect; //如果不显示TAB条 int c=XTabBar_GetLabelCount(pCell->hTabBar); if(c<1) { int count=XArray_GetCount(pCell->hArrayList); for(int i=0;i<count;i++) { layoutCell_ *pChild=(layoutCell_*)XArray_GetAt(pCell->hArrayList,i); if(((layoutPane_*)pChild->hPane)->bInFrame) { XEle_SetRect(pChild->hPane,&pCell->rect); pChild->rect=pCell->rect; } } if(XEle_IsShowEle(pCell->hTabBar)) { XEle_ShowEle(pCell->hTabBar,FALSE); } return ; } //显示TAB条 rc.bottom=pCell->rect.bottom-25; int count=XArray_GetCount(pCell->hArrayList); for(int i=0;i<count;i++) { layoutCell_ *pChild=(layoutCell_*)XArray_GetAt(pCell->hArrayList,i); if(((layoutPane_*)pChild->hPane)->bInFrame) { XEle_SetRect(pChild->hPane,&rc); pChild->rect=rc; } } rc.top=pCell->rect.bottom-23; rc.bottom=pCell->rect.bottom; XEle_SetRect(pCell->hTabBar,&rc); if(FALSE==XEle_IsShowEle(pCell->hTabBar)) //如果TAB没有显示,我们显示它 XEle_ShowEle(pCell->hTabBar,TRUE); }
void ShowPage(HELE hBtn) { for (int i = 0; i < m_LabelM.size(); i++) { if (m_LabelM[i].hBtn == hBtn) { XEle_ShowEle(m_LabelM[i].hPage,TRUE); }else { XEle_ShowEle(m_LabelM[i].hPage,FALSE); } } }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { XInitXCGUI(); //创建窗口 hWindow=XWnd_CreateWindow(0,0,400,300,L"炫彩界面库-窗口"); hImage1=XImage_LoadFile(L"image\\button_leave.png"); hImage2=XImage_LoadFile(L"image\\button_stay.png"); hImage3=XImage_LoadFile(L"image\\button_down.png"); hImage1_check=XImage_LoadFile(L"image\\button_check_leave.png"); hImage2_check=XImage_LoadFile(L"image\\button_check_stay.png"); hImage3_check=XImage_LoadFile(L"image\\button_check_down.png"); HELE hRadio1=CreateRadio(10,10,L"Radio1"); HELE hRadio2=CreateRadio(10,50,L"Radio2"); HELE hRadio3=CreateRadio(10,90,L"Radio3"); HELE hRadio4=CreateRadio(10,130,L"Radio4"); HELE hRadio5=CreateRadio(10,170,L"Radio5"); XBtn_SetCheck(hRadio1,TRUE); /////////////////////////////////////////////////////// HELE hEle1=XEle_Create(130,10,200,35,hWindow); HELE hEle2=XEle_Create(130,50,200,35,hWindow); HELE hEle3=XEle_Create(130,90,200,35,hWindow); HELE hEle4=XEle_Create(130,130,200,35,hWindow); HELE hEle5=XEle_Create(130,170,200,35,hWindow); XRadio_SetBindEle(hRadio1,hEle1); XRadio_SetBindEle(hRadio2,hEle2); XRadio_SetBindEle(hRadio3,hEle3); XRadio_SetBindEle(hRadio4,hEle4); XRadio_SetBindEle(hRadio5,hEle5); XEle_SetBkColor(hEle1,RGB(249,141,235)); XEle_SetBkColor(hEle2,RGB(105,20,193)); XEle_SetBkColor(hEle3,RGB(0,179,138)); XEle_SetBkColor(hEle4,RGB(213,48,68)); XEle_SetBkColor(hEle5,RGB(42,110,187)); XEle_ShowEle(hEle2,FALSE); XEle_ShowEle(hEle3,FALSE); XEle_ShowEle(hEle4,FALSE); XEle_ShowEle(hEle5,FALSE); XWnd_ShowWindow(hWindow,SW_SHOW); XRunXCGUI(); return 0; }
void PGrid_HideEle(HELE hEle) { propertyGrid_ *pObj=(propertyGrid_*)hEle; PGridItem_ *pItem=PGrid_GetItem(hEle,pObj->selId); if(pItem && pItem->hEle) { XEle_ShowEle(pItem->hEle,FALSE); } }
void PGrid_ShowEle(HELE hEle,PGridItem_ *pItem)//显示指定项 { propertyGrid_ *pObj=(propertyGrid_*)hEle; pObj->selId=pItem->id; if(pItem->hEle) { //保存临时备份 switch(pItem->type) { case PGRID_STRING: break; case PGRID_EDIT_FILE: case PGRID_EDIT: { if(pObj->pTemp) { free(pObj->pTemp); pObj->pTemp=NULL; } int len=XEdit_GetTextLength(pItem->hEle); len = (len+1)*sizeof(wchar_t); pObj->pTemp=(wchar_t*)malloc(len); memset(pObj->pTemp,0,len); XEdit_GetText(pItem->hEle,pObj->pTemp,len/sizeof(wchar_t)); }break; case PGRID_COMBOBOX: { if(pObj->pTemp) { free(pObj->pTemp); pObj->pTemp=NULL; } int len=XEdit_GetTextLength(pItem->hEle); len = (len+1)*sizeof(wchar_t); pObj->pTemp=(wchar_t*)malloc(len); memset(pObj->pTemp,0,len); XEdit_GetText(pItem->hEle,pObj->pTemp,len/sizeof(wchar_t)); } break; case PGRID_CHOOSECOLOR: { if(pObj->pTemp) { free(pObj->pTemp); pObj->pTemp=NULL; } int len=XEdit_GetTextLength(pItem->hEle); len = (len+1)*sizeof(wchar_t); pObj->pTemp=(wchar_t*)malloc(len); memset(pObj->pTemp,0,len); XEdit_GetText(pItem->hEle,pObj->pTemp,len/sizeof(wchar_t)); } break; } XEle_ShowEle(pItem->hEle,TRUE); } }
void WINAPI XBtn_SetCheck(HELE hEle,BOOL bCheck) { IsButtonDebug(hEle,__FUNCTION__); if(BUTTON(hEle)->bCheck==bCheck) return ; BUTTON(hEle)->bCheck=bCheck; if(XC_RADIO==((ele_*)hEle)->eleType) { if(RADIO(hEle)->hBindEle) { if (BUTTON(hEle)->bCheck) { XEle_ShowEle(RADIO(hEle)->hBindEle,TRUE); XEle_RedrawEle(RADIO(hEle)->hBindEle); }else { XEle_RedrawEle(RADIO(hEle)->hBindEle); XEle_ShowEle(RADIO(hEle)->hBindEle,FALSE); } } } }
void Cell_OnSize_FloatWnd_Group(layoutCell_ *pCell) { RECT rc=pCell->rect; //如果不显示TAB条 int c=XTabBar_GetLabelCount(pCell->hTabBar); if(c<1) { int count=XArray_GetCount(pCell->hArrayList); for(int i=0;i<count;i++) { layoutCell_ *pChild=(layoutCell_*)XArray_GetAt(pCell->hArrayList,i); XEle_SetRect(pChild->hPane,&pCell->rect); pChild->rect=pCell->rect; } if(XEle_IsShowEle(pCell->hTabBar)) { XEle_ShowEle(pCell->hTabBar,FALSE); } return ; } //显示TAB条 rc.bottom=pCell->rect.bottom-25; int count=XArray_GetCount(pCell->hArrayList); for(int i=0;i<count;i++) { layoutCell_ *pChild=(layoutCell_*)XArray_GetAt(pCell->hArrayList,i); XEle_SetRect(pChild->hPane,&rc); pChild->rect=rc; } rc.top=pCell->rect.bottom-23; rc.bottom=pCell->rect.bottom; XEle_SetRect(pCell->hTabBar,&rc); }
void Cell_OnSize_pane(layoutCell_ *pCell,HWINDOW hWindow,BOOL bAdjust) { RECT rect=pCell->rect; pane_state_ state=((layoutPane_*)pCell->hPane)->state; if(pane_state_dock==state) //停靠在码头 { align_type_ align=pCell->align; if(align_group_member==pCell->align) { align=((layoutPane_*)pCell->hPane)->dockAlign; } switch(align) { case align_left: case align_any: { rect.right=rect.right-PANE_DRAGBAR_WIDTH; //检查拖动条 if(pCell->hDragBar) { RECT rcBar=rect; rcBar.left=rect.right; rcBar.right=rect.right+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(rect.right,rect.top,PANE_DRAGBAR_WIDTH,rect.bottom-rect.top,FALSE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); XEle_ShowEle(pCell->hDragBar,FALSE); } }break; case align_top: { rect.bottom=rect.bottom-PANE_DRAGBAR_WIDTH; //检查拖动条 if(pCell->hDragBar) { RECT rcBar=rect; rcBar.top=rect.bottom; rcBar.bottom=rect.bottom+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(rect.left,rect.bottom,rect.right-rect.left,PANE_DRAGBAR_WIDTH,TRUE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); XEle_ShowEle(pCell->hDragBar,FALSE); } }break; case align_right: { //检查拖动条 if(pCell->hDragBar) { RECT rcBar=rect; rcBar.right=rect.left+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(rect.left,rect.top,PANE_DRAGBAR_WIDTH,rect.bottom-rect.top,FALSE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); XEle_ShowEle(pCell->hDragBar,FALSE); } rect.left=rect.left+PANE_DRAGBAR_WIDTH; }break; case align_bottom: //检查拖动条 if(pCell->hDragBar) { RECT rcBar=rect; rcBar.bottom=rect.top+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(rect.left,rect.top,rect.right-rect.left,PANE_DRAGBAR_WIDTH,TRUE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); XEle_ShowEle(pCell->hDragBar,FALSE); } rect.top=rect.top+PANE_DRAGBAR_WIDTH; break; } }else if(pane_state_lock==state) { } XEle_SetRect(pCell->hPane,&rect); }
/// @brief 属性网格元素,添加项. /// @param hEle 元素句柄. /// @param pName 项名称. /// @param type 项类型. /// @param groupID 所属组ID,如果-1没有分组 /// @return 新添加的项ID标示符,如果失败返回-1. int WINAPI XPGrid_AddItem(HELE hEle,wchar_t *pName,int type,int groupID) //添加项 { IsPGridDebug(hEle,__FUNCTION__); propertyGrid_ *pObj=(propertyGrid_*)hEle; PGridItem_ *pItem=(PGridItem_*)malloc(sizeof(PGridItem_)); pItem->id=PGrid_AddID(hEle); pItem->posy=NULL; pItem->hEle=NULL; pItem->type=type; pItem->pName=NULL; pItem->pValue=NULL; pItem->pNext=NULL; if(pName) { int size=wcslen(pName)+1; pItem->pName=(wchar_t*)malloc(size*sizeof(wchar_t)); wcscpy_s(pItem->pName,size,pName); } switch(type) { case PGRID_EDIT: { HELE hEdit=XEdit_Create(0,0,20,20,hEle); XEle_ShowEle(hEdit,FALSE); pItem->hEle=hEdit; }break; case PGRID_COMBOBOX: { HELE hCom=XComboBox_Create(0,0,20,20,hEle); XEle_ShowEle(hCom,FALSE); pItem->hEle=hCom; }break; case PGRID_CHOOSECOLOR: { HELE hColor= XCHColor_Create(0,0,20,20,hEle); XEle_ShowEle(hColor,FALSE); pItem->hEle=hColor; }break; case PGRID_EDIT_FILE: { HELE hEditFile= XEditFile_Create(0,0,20,20,hEle); XEle_ShowEle(hEditFile,FALSE); pItem->hEle=hEditFile; } #ifdef _DEBUG case PGRID_STRING: break; default: { XMessageBox(hEle,L"XPGrid_AddItem() API,参数type错误",L"炫彩界面库-错误提示",XMB_OK); } #endif } if(-1==groupID) //一级项 { PGridNode_ *pNode=(PGridNode_*)malloc(sizeof(PGridNode_)); pNode->pItem=pItem; pNode->type=2; pNode->pNext=NULL; if(NULL==pObj->pItemList) { pObj->pItemList=pNode; pObj->pItemLast=pNode; }else { pObj->pItemLast->pNext=pNode; pObj->pItemLast=pNode; } }else //二级项 { PGridGroup_ *pGroup=PGrid_GetGroup(hEle,groupID); if(pGroup) { if(NULL==pGroup->pItemList) { pGroup->pItemList=pItem; pGroup->pItemLast=pItem; }else { pGroup->pItemLast->pNext=pItem; pGroup->pItemLast=pItem; } } } pObj->bAdjust=TRUE; return pItem->id; }