int WindowSplitter::SetRatio(double ratio) { if (ratio >= 0.0 && ratio <= 1.0) { m_splitRatio = ratio; m_splitterRect.top = m_windowRect.top + (m_windowRect.bottom*m_splitRatio); m_splitterRect.bottom = m_splitterRect.top + m_splitterSize; PerformLayout(); } return 0; }
bool WindowSplitter::OnMouseMove() { if (!m_dragging) return false; DWORD dPos = GetMessagePos(); //get current mouse pos POINTS pts = MAKEPOINTS(dPos); POINT pos = {pts.x, pts.y}; ScreenToClient(m_windowParent->GetHWND(), &pos); int newSplitterTop = pos.y-m_dragStartOffset; if (newSplitterTop < (m_windowRect.top + m_splitterMargin) || (newSplitterTop + m_splitterSize) > (m_windowRect.bottom + m_windowRect.top - m_splitterMargin)) return true; m_splitRatio = (double)(newSplitterTop - m_windowRect.top)/(double)m_windowRect.bottom; m_splitterRect.top = newSplitterTop; m_splitterRect.bottom = m_splitterRect.top + m_splitterSize; PerformLayout(); return false; }
int WindowSplitter::OnSize(int x, int y, int width, int height) { m_windowRect.left = x; m_windowRect.right = width; m_windowRect.top = y; m_windowRect.bottom = height; m_splitterRect.left = x; m_splitterRect.right = width+x; int splitterTop = y + (height*m_splitRatio); if ((splitterTop - y) > (height-m_splitterMargin)) splitterTop = y + height - m_splitterMargin; if ((splitterTop - y) < m_splitterMargin) splitterTop = y + m_splitterMargin; m_splitterRect.top = splitterTop; m_splitterRect.bottom = m_splitterRect.top + m_splitterSize; //keep the ratio intact //m_splitRatio = (double)(splitterTop-y)/(double)height; return PerformLayout(); }
FX_BOOL CXFA_FFField::LoadWidget() { SetFWLThemeProvider(); m_pDataAcc->LoadCaption(); PerformLayout(); return TRUE; }