LRESULT FSplitterWindow::OnButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (GetSplitterPos() <= MinOpenSplitterWidth) OnOff(); else { CSplitterWindowImpl<FSplitterWindow>::OnLButtonDown(uMsg, wParam, lParam, bHandled); } return 0; }
void OnSizeSplitter(HWND hWnd) { static int firstTime = TRUE; int changed = FALSE; RECT rWindowRect; POINT p = {0,0}; int i; int nSplitterCount; BOOL bMustChange; nSplitterCount = GetSplitterCount(); if (firstTime) { for (i = 0; i < nSplitterCount; i++) nSplitterOffset[i] = GetSplitterPos(i); changed = TRUE; firstTime = FALSE; } GetWindowRect(hWnd, &rWindowRect); for (i = 0; i < nSplitterCount; i++) { p.x = 0; p.y = 0; ClientToScreen(splitter[i].m_hWnd, &p); /* We must change if our window is not in the window rect */ bMustChange = !PtInRect(&rWindowRect, p); /* We should also change if we are ahead the next splitter */ if ((i < nSplitterCount-1) && (nSplitterOffset[i] >= nSplitterOffset[i+1])) bMustChange = TRUE; /* ...or if we are behind the previous splitter */ if ((i > 0) && (nSplitterOffset[i] <= nSplitterOffset[i-1])) bMustChange = TRUE; if (bMustChange) { nSplitterOffset[i] = (rWindowRect.right - rWindowRect.left) * g_splitterInfo[i].dPosition; changed = TRUE; } } if (changed) { ResizePickerControls(hWnd); RecalcSplitters(); //UpdateScreenShot(); } }
void FSplitterWindow::OnOff() { int nSplitterPos = GetSplitterPos(); if (nSplitterPos == m_cxyMin) { nSplitterPos = m_LastPos; if (nSplitterPos < MinOpenSplitterWidth) nSplitterPos = OpenSplitterWidth; } else { m_LastPos = nSplitterPos; nSplitterPos = 0; } SetSplitterPos( nSplitterPos); }
bool FSplitterWindow::IsOn() { return !(GetSplitterPos() <= m_cxyMin); }