/// @brief ÉèÖÃΪˮƽ»ò´¹Ö±»¬¶¯Ìõ. /// @param hEle ÔªËؾä±ú. /// @param bHorizon Èç¹ûֵΪTRUEˮƽ»¬¶¯Ìõ,·ñÔòÏà·´. void WINAPI XSliderBar_SetHorizon(HELE hEle,BOOL bHorizon) //ˮƽÏÔʾ»ò´¹Ö± { IsSliderDebug(hEle,__FUNCTION__); SLIDER(hEle)->bHorizon=bHorizon; slider_ *pObj=SLIDER(hEle); int cx=((ele_*)hEle)->rect.right-((ele_*)hEle)->rect.left; int cy=((ele_*)hEle)->rect.bottom-((ele_*)hEle)->rect.top; int btnWidth= ((ele_*)(pObj->hButton))->rect.right-((ele_*)(pObj->hButton))->rect.left; int btnHeight= ((ele_*)(pObj->hButton))->rect.bottom-((ele_*)(pObj->hButton))->rect.top; if(pObj->bHorizon) { RECT rc; rc.left=(long)(pObj->pos*pObj->minPos); rc.top=cy/2-btnWidth/2; rc.right=rc.left+btnHeight; rc.bottom=rc.top+btnWidth; XEle_SetRect(pObj->hButton,&rc); }else { RECT rc; rc.left=cx/2-btnHeight/2; rc.top=(long)(pObj->pos*pObj->minPos); rc.right=rc.left+btnHeight; rc.bottom=rc.top+btnWidth; XEle_SetRect(pObj->hButton,&rc); } XEle_RedrawEle(hEle); }
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 Cell_OnSize_FloatWnd_Pane(layoutCell_ *pCell) { RECT rect=pCell->rect; pane_state_ state=((layoutPane_*)pCell->hPane)->state; if(pane_state_float==state) XEle_SetRect(pCell->hPane,&rect); }
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; } } }
void SliderBar_Adjust(HELE hEle) { slider_ *pObj=SLIDER(hEle); if(SLIDER(hEle)->bHorizon) { double cx=(((ele_*)hEle)->rect.right-((ele_*)hEle)->rect.left)-SLIDER(hEle)->btnWidth; if(0!=cx && 0!=SLIDER(hEle)->range) SLIDER(hEle)->minPos=cx/SLIDER(hEle)->range; else SLIDER(hEle)->minPos=0; }else { double cy=(((ele_*)hEle)->rect.bottom-((ele_*)hEle)->rect.top)-SLIDER(hEle)->btnWidth; if(0!=cy && 0!=SLIDER(hEle)->range) SLIDER(hEle)->minPos=cy/SLIDER(hEle)->range; else SLIDER(hEle)->minPos=0; } int cx=((ele_*)hEle)->rect.right-((ele_*)hEle)->rect.left; int cy=((ele_*)hEle)->rect.bottom-((ele_*)hEle)->rect.top; int btnWidth= ((ele_*)(pObj->hButton))->rect.right-((ele_*)(pObj->hButton))->rect.left; int btnHeight= ((ele_*)(pObj->hButton))->rect.bottom-((ele_*)(pObj->hButton))->rect.top; if(pObj->bHorizon) { btnWidth=pObj->btnWidth; RECT rc; rc.left=(long)(pObj->pos*pObj->minPos); rc.top=cy/2-btnHeight/2; rc.right=rc.left+btnWidth; rc.bottom=rc.top+btnHeight; XEle_SetRect(pObj->hButton,&rc); }else { btnHeight=pObj->btnWidth; RECT rc; rc.left=cx/2-btnWidth/2; rc.top=(long)(pObj->pos*pObj->minPos); rc.right=rc.left+btnWidth; rc.bottom=rc.top+btnHeight; XEle_SetRect(pObj->hButton,&rc); } //XEle_RedrawEle(hEle); }
void ResetBtnPos() { int x = 0; int y = 0; RECT rtBtn; int buttonWidth = 0; int buttonHeight = 0; int nSize = 0; // RECT rtClient; // XEle_GetClientRect(m_hEle,&rtClient); for (int i = 0; i < m_LabelM.size(); i++) { XEle_GetClientRect(m_LabelM[i].hBtn,&rtBtn); buttonWidth = rtBtn.right; buttonHeight= rtBtn.bottom; switch (m_Direction) { case tabbar_direction_left: { rtBtn.left = 0; rtBtn.top += nSize; rtBtn.right = rtBtn.left + buttonWidth; rtBtn.bottom = rtBtn.top + buttonHeight; nSize += buttonHeight; } break; case tabbar_direction_top: { rtBtn.left += nSize; rtBtn.top = 0; rtBtn.right = rtBtn.left + buttonWidth; rtBtn.bottom = rtBtn.top + buttonHeight; nSize += buttonWidth; } break; case tabbar_direction_right: { rtBtn.left = 0; rtBtn.top += nSize; rtBtn.right = rtBtn.left + buttonWidth; rtBtn.bottom = rtBtn.top + buttonHeight; nSize += buttonHeight; } break; case tabbar_direction_bottom: { rtBtn.left += nSize; rtBtn.top = 0; rtBtn.right = rtBtn.left + buttonWidth; rtBtn.bottom = rtBtn.top + buttonHeight; nSize += buttonWidth; } break; } XEle_SetRect(m_LabelM[i].hBtn,&rtBtn); } }
void ResetPagePos() { int xPage = 0; int yPage = 0; int cxPage = 0; int cyPage = 0; RECT rtSView; XEle_GetClientRect(m_hSview,&rtSView); RECT rtTabBar; XEle_GetClientRect(m_hEle,&rtTabBar); switch (m_Direction) { case tabbar_direction_left: { xPage = rtSView.right; cxPage = rtTabBar.right - rtSView.right; cyPage = rtTabBar.bottom; } break; case tabbar_direction_top: { yPage = rtSView.bottom; cxPage= rtTabBar.right; cyPage= rtTabBar.bottom - rtSView.bottom; } break; case tabbar_direction_right: { cxPage = rtTabBar.right - rtSView.right; cyPage = rtTabBar.bottom; } break; case tabbar_direction_bottom: { cxPage = rtTabBar.right; cyPage = rtTabBar.bottom - rtSView.bottom; } break; } RECT rtPage; rtPage.left = xPage; rtPage.top = yPage; rtPage.right = rtPage.left+ cxPage; rtPage.bottom= rtPage.top + cyPage; for (int i = 0; i < m_LabelM.size(); i++) { XEle_SetRect(m_LabelM[i].hPage,&rtPage); } }
/// @brief ÉèÖû¬¿éλÖÃ. /// @param hEle ÔªËؾä±ú /// @param pos »¬¿éλÖÃ. void WINAPI XSliderBar_SetPos(HELE hEle,int pos) //ÉèÖû¬¿éλÖà { IsSliderDebug(hEle,__FUNCTION__); slider_ *pObj=SLIDER(hEle); RECT rect; XEle_GetClientRect(hEle,&rect); if(pObj->bHorizon) { int cx=rect.right-rect.left; int x=(int)(pos*pObj->minPos); RECT rc; rc.left=x; rc.top=0; rc.right=rc.left+pObj->btnWidth; rc.bottom=rect.bottom-rect.top; if(rc.right>cx) { rc.right=cx; rc.left=rc.right-pObj->btnWidth; } XEle_SetRect(pObj->hButton,&rc); }else { int cy=rect.bottom-rect.top; int y=(int)(pos*pObj->minPos); RECT rc=rect; rc.bottom=rect.bottom-y; rc.top=rc.bottom-pObj->btnWidth; if(rc.top<0) { rc.bottom=pObj->btnWidth; rc.top=0; } XEle_SetRect(pObj->hButton,&rc); } SLIDER(hEle)->pos=pos; XEle_RedrawEle(hEle); }
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 PGrid_AdjustChildItem(HELE hEle,PGridGroup_ *pGroup,int &posy,int right,int posyPort) { propertyGrid_ *pObj=(propertyGrid_*)hEle; PGridItem_ *pItem=pGroup->pItemList; while(pItem) { pItem->posy=posy; if(pItem->hEle) { RECT rc={pObj->spacePoint,posy,right,posy+pObj->itemHeight-1}; XEle_SetRect(pItem->hEle,&rc); } posy+=pObj->itemHeight; pItem=pItem->pNext; } }
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); }
void Cell_OnSize_left_right(layoutCell_ *pCell,HWINDOW hWindow,BOOL bAdjust,BOOL bFixedSize) { BOOL bShowDragBar=FALSE; //是否显示拖动条 // 1 左右都为窗格 if(cell_type_pane==pCell->pCell1->type && cell_type_pane==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 2 左右都为组 else if(cell_type_group==pCell->pCell1->type && cell_type_group==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 3 左右都为cell_type_left_right或cell_type_top_bottom else if((cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)&& (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 4 左为窗格,右为组 else if(cell_type_pane==pCell->pCell1->type && cell_type_group==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 5 右为窗格,左为组 else if(cell_type_group==pCell->pCell1->type && cell_type_pane==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 6 左为窗格,右为cell_type_left_right或cell_type_top_bottom else if(cell_type_pane==pCell->pCell1->type && (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 7 右为窗格,左为cell_type_left_right或cell_type_top_bottom else if(cell_type_pane==pCell->pCell2->type && (cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 8 左为组, 右为cell_type_left_right或cell_type_top_bottom else if(cell_type_group==pCell->pCell1->type && (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } // 9 右为组, 左为cell_type_left_right或cell_type_top_bottom else if(cell_type_group==pCell->pCell2->type && (cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)) { bShowDragBar=Cell_OnSize_left_right_1(pCell,hWindow,bFixedSize); } if(bShowDragBar) { //检查拖动条 if(pCell->hDragBar) { RECT rcBar=pCell->pCell1->rect; rcBar.left=rcBar.right; rcBar.right=rcBar.right+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(pCell->pCell1->rect.right,pCell->pCell1->rect.top,PANE_DRAGBAR_WIDTH,pCell->pCell1->rect.bottom-pCell->pCell1->rect.top,FALSE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); } }else { if(pCell->hDragBar) { XEle_Destroy(pCell->hDragBar); pCell->hDragBar=NULL; } } }
void Cell_OnSize_top_bottom(layoutCell_ *pCell,HWINDOW hWindow,BOOL bAdjust,BOOL bFixedSize) { //1 左右窗格都显示 //2 左窗格显示,右不显示 //3 右窗格显示,左不显示 //4 都不显示 // 1 左右都为窗格 // 2 左右都为组 // 3 左右都为cell_type_left_right或cell_type_top_bottom // 4 左为窗格,右为组 // 5 右为窗格,左为组 // 6 左为窗格,右为cell_type_left_right或cell_type_top_bottom // 7 右为窗格,左为cell_type_left_right或cell_type_top_bottom // 8 左为组, 右为cell_type_left_right或cell_type_top_bottom // 9 右为组, 左为cell_type_left_right或cell_type_top_bottom if(FALSE==bAdjust) //窗格不显示,不需要调整,但是要隐藏不需要显示的元素 { if(pCell->hDragBar) { XEle_Destroy(pCell->hDragBar); pCell->hDragBar=NULL; } Cell_OnSize2(pCell->pCell1,hWindow,bAdjust,bFixedSize); Cell_OnSize2(pCell->pCell2,hWindow,bAdjust,bFixedSize); return ; } BOOL bShowDragBar=FALSE; //是否显示拖动条 // 1 左右都为窗格 if(cell_type_pane==pCell->pCell1->type && cell_type_pane==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 2 左右都为组 if(cell_type_group==pCell->pCell1->type && cell_type_group==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 3 左右都为cell_type_left_right或cell_type_top_bottom if((cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)&& (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 4 左为窗格,右为组 if(cell_type_pane==pCell->pCell1->type && cell_type_group==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 5 右为窗格,左为组 if(cell_type_group==pCell->pCell1->type && cell_type_pane==pCell->pCell2->type) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 6 左为窗格,右为cell_type_left_right或cell_type_top_bottom if(cell_type_pane==pCell->pCell1->type && (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 7 右为窗格,左为cell_type_left_right或cell_type_top_bottom if(cell_type_pane==pCell->pCell2->type && (cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 8 左为组, 右为cell_type_left_right或cell_type_top_bottom if(cell_type_group==pCell->pCell1->type && (cell_type_left_right==pCell->pCell2->type || cell_type_top_bottom==pCell->pCell2->type)) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); }else // 9 右为组, 左为cell_type_left_right或cell_type_top_bottom if(cell_type_group==pCell->pCell2->type && (cell_type_left_right==pCell->pCell1->type || cell_type_top_bottom==pCell->pCell1->type)) { bShowDragBar=Cell_OnSize_top_bottom_1(pCell,hWindow,bFixedSize); } if(bShowDragBar) { //检查拖动条 if(pCell->hDragBar) { RECT rcBar=pCell->pCell1->rect; rcBar.top=rcBar.bottom; rcBar.bottom=rcBar.bottom+PANE_DRAGBAR_WIDTH; XEle_SetRect(pCell->hDragBar,&rcBar); }else { pCell->hDragBar=DragBar_Create(pCell->pCell1->rect.left,pCell->pCell1->rect.bottom,pCell->pCell1->rect.right-pCell->pCell1->rect.left,PANE_DRAGBAR_WIDTH,TRUE,hWindow); DrawBar_SetCell(pCell->hDragBar,pCell); } }else { if(pCell->hDragBar) { XEle_Destroy(pCell->hDragBar); pCell->hDragBar=NULL; } } }
void SetLabelDirection(tabbar_direction_ nDirection) { m_Direction = nDirection; if (nDirection == tabbar_direction_left || nDirection == tabbar_direction_right) { XSView_ShowSBarV(m_hSview,TRUE); XSView_ShowSBarH(m_hSview,FALSE); XSView_ScrollPosV(m_hSview,0); XSView_ScrollPosH(m_hSview,0); m_bHorizon = FALSE; }else { XSView_ShowSBarV(m_hSview,FALSE); XSView_ShowSBarH(m_hSview,TRUE); XSView_ScrollPosH(m_hSview,0); XSView_ScrollPosV(m_hSview,0); m_bHorizon = TRUE; } int labelSize = GetLableSize(); if (m_bHorizon) { ReSizeView(labelSize); }else { ReSizeView(labelSize); } RECT rtView; RECT rtTabBar; XEle_GetClientRect(m_hEle,&rtTabBar); switch (m_Direction) { case tabbar_direction_left: { rtView.left = 0; rtView.top = 0; rtView.right = m_ViewWidth; rtView.bottom = rtTabBar.bottom; } break; case tabbar_direction_top: { rtView.left = 0; rtView.top = 0; rtView.right = rtTabBar.right; rtView.bottom = m_ViewHeight; } break; case tabbar_direction_right: { rtView.left = rtTabBar.right - m_ViewWidth; rtView.top = 0; rtView.right = rtTabBar.right; rtView.bottom = rtTabBar.bottom; } break; case tabbar_direction_bottom: { rtView.top = rtTabBar.bottom - m_ViewHeight; rtView.left = 0; rtView.right = rtTabBar.right; rtView.bottom = rtTabBar.bottom; } break; } XEle_SetRect(m_hSview,&rtView); ResetBtnPos(); ResetPagePos(); XEle_RedrawEle(m_hEle); }
BOOL CALLBACK SliderBar_OnLButtonDown(HELE hEle,UINT flags,POINT *pPt) { slider_ *pObj=SLIDER(hEle); if(!pObj->bDown) { pObj->bDown=TRUE; RECT rect; XEle_GetClientRect(hEle,&rect); int cx=rect.right-rect.left; int cy=rect.bottom-rect.top; int btnWidth= ((ele_*)(pObj->hButton))->rect.right-((ele_*)(pObj->hButton))->rect.left; int btnHeight= ((ele_*)(pObj->hButton))->rect.bottom-((ele_*)(pObj->hButton))->rect.top; if(pObj->bHorizon) { int x=pPt->x-(btnWidth/2); if(x<0) x=0; else if(x>(cx-btnWidth)) x=cx-btnWidth; int pos=(int)( x/pObj->minPos); if(pos != pObj->pos) { pObj->pos=pos; RECT rc; rc.left=(long)(pos*pObj->minPos); rc.top=cy/2-btnHeight/2; rc.right=rc.left+btnWidth; rc.bottom=rc.top+btnHeight; XEle_SetRect(pObj->hButton,&rc); XEle_SetCapture(hEle); //ÉèÖÃÔªËØÊó±ê²¶»ñ BUTTON(pObj->hButton)->state=STATE_DOWN; Ele_SendEvent(hEle,XE_SLIDER_CHANGE,(WPARAM)pObj->pos,0); XEle_RedrawEle(hEle); } }else { int height=rect.bottom-pPt->y; height=height-(btnHeight/2); if(height<0) height=0; else if(height>(cy-btnHeight)) height=cy-btnHeight; int pos=(int)( height/pObj->minPos); if(pos != pObj->pos) { pObj->pos=pos; RECT rc=rect; rc.left=cx/2-btnWidth/2; rc.right=rc.left+btnWidth; rc.bottom=rc.bottom-height; rc.top=rc.bottom-pObj->btnWidth; XEle_SetRect(pObj->hButton,&rc); XEle_SetCapture(hEle); //ÉèÖÃÔªËØÊó±ê²¶»ñ Ele_SendEvent(hEle,XE_SLIDER_CHANGE,(WPARAM)pObj->pos,0); XEle_RedrawEle(hEle); } } } return FALSE; }
void PGrid_Adjust(HELE hEle) { propertyGrid_ *pObj=(propertyGrid_*)hEle; pObj->bAdjust=FALSE; int left=XSView_GetSpacingLeft(hEle)-XSView_GetHViewPos(hEle); PGridNode_ *pNode=pObj->pItemList; int posy=0; //计算视图需要高度 while(pNode) { if(1==pNode->type) //组 { posy+=pObj->itemHeight; //子项 if(((PGridGroup_*)pNode->pItem)->bExpand) { PGridItem_ *pItem=((PGridGroup_*)pNode->pItem)->pItemList; while(pItem) { posy+=pObj->itemHeight; pItem=pItem->pNext; } } }else //项 { PGridItem_ *pItem=(PGridItem_*)pNode->pItem; posy+=pObj->itemHeight; } pNode=pNode->pNext; } pObj->bottom=posy; XSView_SetSize(hEle,1,posy); int viewWidth=XSView_GetViewWidth(hEle)-XSView_GetHViewPos(hEle); int right=left+viewWidth; pNode=pObj->pItemList; int posyPort=XSView_GetVViewPos(hEle); posy=0; //调整布局 while(pNode) { if(1==pNode->type) //组 { ((PGridGroup_*)pNode->pItem)->posy=posy; posy+=pObj->itemHeight; //子项 if(((PGridGroup_*)pNode->pItem)->bExpand) PGrid_AdjustChildItem(hEle,(PGridGroup_*)pNode->pItem,posy,right,posyPort); }else //项 { PGridItem_ *pItem=(PGridItem_*)pNode->pItem; pItem->posy=posy; if(pItem->hEle) { RECT rc={pObj->spacePoint,posy,right,posy+pObj->itemHeight-1}; XEle_SetRect(pItem->hEle,&rc); } posy+=pObj->itemHeight; } pNode=pNode->pNext; } pObj->bottom=posy; }