void CSkinDialog::OnNcLButtonUp(CPoint point) { CRect rtButton; CRect rtWnd; this->GetWindowRect(&rtWnd); rtButton = m_rtBtnExt; rtButton.OffsetRect(rtWnd.left, rtWnd.top); if(rtButton.PtInRect(point)&&(rtButton.PtInRect(m_ptMouseDown))){ SendMessage(WM_CLOSE); } rtButton = m_rtBtnMax; rtButton.OffsetRect(rtWnd.left, rtWnd.top); if(rtButton.PtInRect(point)&&(rtButton.PtInRect(m_ptMouseDown))){ if (IsZoomed()){ SendMessage(WM_SYSCOMMAND, SC_RESTORE, MAKELPARAM(point.x, point.y)); ReLayout(); }else { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, MAKELPARAM(point.x, point.y)); ReLayout(); Invalidate(); } } rtButton = m_rtBtnMin; rtButton.OffsetRect(rtWnd.left, rtWnd.top); if(rtButton.PtInRect(point)&&(rtButton.PtInRect(m_ptMouseDown))){ SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, MAKELPARAM(point.x, point.y)); } return; }
void CSkinDialog::OnNcLButtonDblClk(CPoint point) { if (IsZoomed()){ SendMessage(WM_SYSCOMMAND, SC_RESTORE, MAKELPARAM(point.x, point.y)); ReLayout(); } else { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, MAKELPARAM(point.x, point.y)); ReLayout(); Invalidate(); } }
CDuiPanel* CDuiItemBox::InsertItem(LPCWSTR pszXml,int iItem/*=-1*/,BOOL bEnsureVisible/*=FALSE*/) { CDuiStringA strXml=DUI_CW2A(pszXml,CP_UTF8);; pugi::xml_document xmlDoc; if(!xmlDoc.load_buffer((LPCSTR)strXml,strXml.GetLength(),pugi::parse_default,pugi::encoding_utf8)) return NULL; CDuiWindow *pChild=m_pFirstChild,*pPrevChild=ICWND_FIRST; for(int iChild=0; iChild<iItem || iItem==-1; iChild++) { if(!pChild) break; pPrevChild=pChild; pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING); } CDuiPanel *pPanel=new CDuiPanel; InsertChild(pPanel, pPrevChild); pPanel->LoadChildren(xmlDoc); pPanel->SetVisible(TRUE); pPanel->SetFixSize(m_nItemWid,m_nItemHei); UpdateScroll(); ReLayout(); if(bEnsureVisible) EnsureVisible(pPanel); NotifyInvalidate(); return pPanel; }
BOOL CAddNewItem::OnInitDialog() { CDialog::OnInitDialog(); pAdd=(CButton*)GetDlgItem(IDC_BTN_ORDER_ADD_ROW); pDel=(CButton*)GetDlgItem(IDC_BTN_ORDER_DEL_ROW); pRec=(CButton*)GetDlgItem(IDP_ORDER_INPUT_OK); //init SQL m_pSQLDriver=new CSQLDriver(); if(!OnInitDlgGrid()) { S_LOG_FATAL(L"Init dialog grid fail!"); ::AfxMessageBox(L"窗口初始化失败,请重试!"); CAddNewItem::EndDialog(0); return FALSE; } OnInitProgressBar(); m_RecordEvent=::CreateEvent(NULL,FALSE,FALSE,NULL); if(NULL==m_RecordEvent) { S_LOG_FATAL(L"create record event fail!"); ::AfxMessageBox(L"窗口事件初始化失败,请重试!"); CAddNewItem::EndDialog(0); return FALSE; } ReLayout(); return TRUE; }
void NFrameBase::SetLayout(UINT layout) { if(layout_ == layout) return; layout_ = layout; ReLayout(); }
BOOL CDuiItemBox::OnScroll(BOOL bVertical,UINT uCode,int nPos) { if(!__super::OnScroll(bVertical,uCode,nPos)) return FALSE; ReLayout(); return TRUE; }
BOOL CDuiItemBox::SetNewPosition(CDuiWindow * pChild, DWORD nPos, BOOL bEnsureVisible) { if (pChild == NULL) { return FALSE; } CDuiWindow * pCurChild = m_pFirstChild; DWORD nCurPos = 0; for (; pCurChild != NULL; pCurChild = pCurChild->GetDuiWindow(GDUI_NEXTSIBLING)) { if (pCurChild == pChild) { break; } ++nCurPos; } if (pCurChild == NULL) { return FALSE; } if (nCurPos == nPos) { if (bEnsureVisible) { EnsureVisible(pChild); } NotifyInvalidate(); return TRUE; } if (nPos == 0) { BringWindowAfter(pChild, ICWND_FIRST); } else { CDuiWindow * pNewNext = m_pFirstChild; for (UINT i = 0; i < nPos && pNewNext != NULL; i++) { pNewNext = pNewNext->GetDuiWindow(GDUI_NEXTSIBLING); } BringWindowAfter(pChild, pNewNext); } UpdateScroll(); ReLayout(); if (bEnsureVisible) { EnsureVisible(pChild); } NotifyInvalidate(); return TRUE; }
void CDuiItemBox::OnSize(UINT nType, CSize size) { if(m_rcWindow.IsRectEmpty()) return; m_ptOrigin=CPoint(0,0); m_siVer.nPos=0; UpdateScroll(); ReLayout(); }
void NFrameBase::OnParentChanged() { if(window_) window_ = NULL; if(parentFrame_) OnWindowChanged(parentFrame_->window_); else OnWindowChanged(NULL); ReLayout(); }
BOOL CDuiItemBox::RemoveItem(CDuiWindow * pChild) { if (DestroyChild(pChild)) { UpdateScroll(); ReLayout(); NotifyInvalidate(); return TRUE; } return FALSE; }
void NFrameBase::SetMargin(int left, int top, int right, int bottom) { if(left == margin_.Left && right == margin_.Right && top == margin_.Top && bottom == margin_.Bottom) { return; } margin_.SetRect(left, top, right, bottom); ReLayout(); }
bool NFrameBase::AutoSize() { if(layout_ != LayoutNone) { ReLayout(); return true; } if(!IsAutoSize()) return false; Base::NSize autoSize = GetAutoSize(); return SetSizeImpl(autoSize.Width, autoSize.Height, true); }
BOOL CDuiItemBox::RemoveItem(UINT iItem) { if(iItem>=GetItemCount()) return FALSE; CDuiWindow *pChild=m_pFirstChild; for(UINT iChild=0; iChild<iItem ; iChild++) { pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING); } DestroyChild(pChild); UpdateScroll(); ReLayout(); NotifyInvalidate(); return TRUE; }
///////////////////////////////////////////////////////////////////////////// //【函 数】void OnPictrueSize( long, long lHeight ) //【参 数】lWidth : long, // lHeight : long, //【功 能】改变显示画面窗口的尺寸 //【返回值】void //【说 明】不影响全局变量? ///////////////////////////////////////////////////////////////////////////// void CRunView::PictrueSize(long lWidth, long lHeight) { m_szPicture.cx = lWidth; m_szPicture.cy = lHeight; CRect rcOldPos; m_wndBrowser.GetWindowRect(&rcOldPos); ReLayout(); CRect rcNewPos; m_wndBrowser.GetWindowRect(&rcNewPos); // 新位置小于旧位置时需要刷新 if (rcNewPos.Width() < rcOldPos.Width() || rcNewPos.Height() < rcOldPos.Height()) Invalidate(); }
void CRunView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); ReLayout(); }