virtual void updateIfChanged() { //fgout << fgnl << "SplitScroll::updateIfChanged"; if (g_gg.dg.update(m_api.updateFlagIdx)) { //fgout << " ... updating" << fgpush; // call DestroyWindow in all created sub-windows: for (size_t ii=0; ii<m_panes.size(); ++ii) m_panes[ii]->destroy(); FgGuiPtrs panes = m_api.getPanes(); m_panes.resize(panes.size()); for (size_t ii=0; ii<m_panes.size(); ++ii) { m_panes[ii] = panes[ii]->getInstance(); m_panes[ii]->create(hwndThis,int(ii),m_store+"_"+fgToString(ii),0UL,true); } //fgout << fgpop; } for (size_t ii=0; ii<m_panes.size(); ++ii) m_panes[ii]->updateIfChanged(); }
LRESULT wndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { if (message == WM_CREATE) { //fgout << fgnl << "SplitScroll::WM_CREATE" << fgpush; hwndThis = hwnd; FGASSERT(m_panes.empty()); FgGuiPtrs panes = m_api.getPanes(); m_panes.resize(panes.size()); for (size_t ii=0; ii<m_panes.size(); ++ii) { m_panes[ii] = panes[ii]->getInstance(); m_panes[ii]->create(hwndThis,int(ii),m_store+"_"+fgToString(ii),0UL,true); } g_gg.dg.update(m_api.updateFlagIdx); //fgout << fgpop; return 0; } else if (message == WM_SIZE) { m_client = FgVect2I(LOWORD(lParam),HIWORD(lParam)); if (m_client[0] * m_client[1] > 0) { //fgout << fgnl << "SplitScroll::WM_SIZE: " << m_client << fgpush; resize(); //fgout << fgpop; } return 0; } else if (message == WM_VSCROLL) { //fgout << "SplitScroll::WM_VSCROLL"; int tmp = m_si.nPos; // Get the current state, esp. trackbar drag position: m_si.fMask = SIF_ALL; GetScrollInfo(hwnd,SB_VERT,&m_si); int msg = LOWORD(wParam); if (msg == SB_TOP) m_si.nPos = m_si.nMin; else if (msg == SB_BOTTOM) m_si.nPos = m_si.nMax; else if (msg == SB_LINEUP) m_si.nPos -= 5; else if (msg == SB_LINEDOWN) m_si.nPos += 5; else if (msg == SB_PAGEUP) m_si.nPos -= m_client[1]; else if (msg == SB_PAGEDOWN) m_si.nPos += m_client[1]; else if (msg == SB_THUMBTRACK) m_si.nPos = m_si.nTrackPos; m_si.fMask = SIF_POS; SetScrollInfo(hwnd,SB_VERT,&m_si,TRUE); // Windows may clamp the position: GetScrollInfo(hwnd,SB_VERT,&m_si); if (m_si.nPos != tmp) { resize(); InvalidateRect(hwndThis,NULL,TRUE); } return 0; } else if (message == WM_PAINT) { //fgout << fgnl << "SplitScroll::WM_PAINT"; } return DefWindowProc(hwnd,message,wParam,lParam); }