CRect CButtonExd::Show(bool NeedRevise,int leftpad,int toppad,bool bdelay ,CArray<CButton*>* pButtons ) { if(m_bShow ||(m_parent!=NULL&&m_parent->m_bShow == false)) return m_rc; m_bShow = true; CRect beforeCuurentRC = m_rc; CButtonExd* pCompareButton = NULL; if(m_index >0 && m_parent!=NULL) pCompareButton =m_parent->m_Childs[m_index-1]; else pCompareButton = m_parent; if(pCompareButton != NULL) { if(!pCompareButton->IsRoot()&&!m_bUseAbsolutePos) { CRect rc_c; pCompareButton->m_pBtn->GetWindowRect(&rc_c); m_pWnd->ScreenToClient(&rc_c); m_pBtn->GetWindowRect(&m_rc); int width = m_rc.Width(); int height = m_rc.Height(); m_rc.left = rc_c.left+m_leftpad+leftpad; m_rc.right = rc_c.left+m_leftpad+leftpad+width; m_rc.top = rc_c.bottom+m_toppad+toppad; m_rc.bottom = rc_c.bottom+m_toppad+toppad+height; m_pBtn->MoveWindow(m_rc.left,m_rc.top,m_rc.Width(),m_rc.Height()); } else { m_pBtn->GetWindowRect(m_rc); m_pWnd->ScreenToClient(&m_rc); } if(bdelay && pButtons!=NULL) pButtons->Add(m_pBtn); else m_pBtn->ShowWindow(SW_SHOW); } if(m_bExpand) { CRect RetRect,UnionRC; int childtoppad = 0; for (int i=0;i<m_Childs.size();++i) { CRect beforeRC = m_Childs[i]->m_rc; RetRect = m_Childs[i]->Show(); childtoppad =toppad + RetRect.bottom-beforeRC.bottom; UnionRC.UnionRect(m_rc,RetRect); m_rc = UnionRC; } } if(NeedRevise) Revise(0,m_rc.bottom-beforeCuurentRC.bottom); return m_rc; }
CRect CButtonExd::Folded() { if(!m_bExpand) return m_rc; m_bExpand = false; for (int i=0;i<m_Childs.size();++i) m_Childs[i]->Hide(); CRect rc; m_pBtn->GetWindowRect(&m_rc); m_pWnd->ScreenToClient(&m_rc); m_pBtn->GetWindowRect(&rc); if(m_index<m_parent->m_Childs.size()-1) Revise(0,-(m_parent->m_Childs[m_index+1]->m_rc.top-m_rc.bottom-m_parent->m_Childs[m_index+1]->m_toppad)); return m_rc; }
CRect CButtonExd::Hide(bool NeedRevise) { if(!m_bShow ||(m_parent!=NULL&&m_parent->m_bShow == false)) return m_rc; m_bShow = false; m_pBtn->ShowWindow(SW_HIDE); if(m_bExpand) { CRect RetRect; for (int i=0;i<m_Childs.size();++i) RetRect = m_Childs[i]->Hide(); } if(NeedRevise) Revise(0,m_rc.top-m_rc.bottom); CRect retRect = m_rc; m_rc.SetRectEmpty(); return retRect; }
CRect CButtonExd::Expand() { if(m_bExpand) return m_rc; m_bExpand = true; CRect RetRect,UnionRC; int childtoppad = 0; CRect beforeCuurentRC = m_rc; CArray<CButton*>* pButtons = new CArray<CButton*>(); for (int i=0;i<m_Childs.size();++i) { CRect beforeRC = m_Childs[i]->m_rc; RetRect = m_Childs[i]->Show(false,0,0,true,pButtons); childtoppad =RetRect.bottom-beforeRC.bottom; UnionRC.UnionRect(m_rc,RetRect); m_rc = UnionRC; } Revise(0,m_rc.bottom-beforeCuurentRC.bottom); for (int i=0;i<pButtons->GetCount();++i) { pButtons->GetAt(i)->ShowWindow(SW_SHOW); } return m_rc; }
void TEXT_DRAW::Revise(const FONT & font, const std::string & newtext) { Revise(font, newtext, oldx, oldy, oldscalex, oldscaley); text = newtext; }
void TextDraw::Revise(const Font & font, const std::string & newtext) { Revise(font, newtext, oldx, oldy, oldscalex, oldscaley); text = newtext; }