void Pane::RemoveChild(Pane* ppane) { TRef<Pane> ppaneNext = ppane->m_pnext; ppane->m_pparent = NULL; ppane->m_pnext = NULL; TRef<Pane>* pppane = m_pchild.Pointer(); while ((*pppane) != ppane) { pppane = (*pppane)->m_pnext.Pointer(); } *pppane = ppaneNext; NeedLayout(); NeedPaint(); m_bPaintAll = true; }
void RemoveItemByIdx(int iItem) { int numRemoved = 0; if (iItem != -1) { // find the first matching item while (iItem > 1 && m_vItems[iItem-1] == m_vItems[iItem]) { iItem--; } // now remove all the matching items TRef<ListItem> pListItem = m_vItems[iItem]; while (iItem < m_vItems.GetCount() && m_vItems[iItem] == pListItem) { m_vItems.Remove(iItem); numRemoved++; } if (iItem <= m_iSelItem) { SetSelItemByIdx(m_iSelItem - numRemoved); } else { SetSelItemByIdx(m_iSelItem); } if (m_pScrollPane) { // save the old top item, because shrinking the scroll pane could change it int iOldTopItem = m_iTopItem; m_pScrollPane->SetSize(m_vItems.GetCount()); if (iItem < iOldTopItem) { SetScrollPosition(max(iOldTopItem - numRemoved, 0)); } else { SetScrollPosition(min(iOldTopItem, max(m_vItems.GetCount() - m_cVisibleItems, 0))); } } NeedPaint(); } }
GaugeValuePane(Surface* psurface, Number* pnumber, Number* ptime, const Color& colorFlash, const Color& colorEmpty) : ValuePane(pnumber, ptime), m_psurface(psurface), m_colorFlash(colorFlash), m_colorEmpty(colorEmpty), m_minValue(0.0f), m_maxValue(1.0f), m_value(0), m_valueOld(0), m_valueFlash(0), m_timeLastChange(ptime->GetValue()) { pnumber->Update(); SetValue(pnumber->GetValue(), true); assert(m_psurface); assert(m_minValue < m_maxValue); InternalSetSize(m_psurface->GetSize()); NeedPaint(); }
void ListChanged() { int index; if (m_pitemSelection != NULL) index = m_plist->GetIndex(m_pitemSelection); else index = -1; if (index == -1) { m_pitemSelection = NULL; m_iOldSelection = -1; } m_indexSelection = index; UpdateScrollBar(); UpdateScrollPos(); NeedLayout(); NeedPaint(); SelectionChanged(); }
void Pane::Insert(int index, Pane* ppane) { ZAssert(index >= 0); // make sure ppane doesn't get deleted while switching pointers around TRef<Pane> ppaneSave = ppane; ppane->RemoveSelf(); TRef<Pane>* pppane = m_pchild.Pointer(); for(; index > 0; index--) { pppane = (*pppane)->m_pnext.Pointer(); } ppane->m_pnext = (*pppane); ppane->m_pparent = this; *pppane = ppane; NeedLayout(); NeedPaint(); m_bPaintAll = true; }
void ForceRefresh() { NeedPaint(); }
void ScrollBarChanged() { m_posScroll = m_pscroll->GetPos()/* * GetSignificantSize(*m_ppainter)*/; NeedPaint(); }