// Update Content Lines structure void TextFieldWidget::UpdateContentLines() { m_ContentLines.clear(); m_MaxLineLength = 0; std::string::size_type Start = 0, End; do { End = m_Content.find_first_of('\n', Start); auto Length = ((std::string::npos != End) ? End : m_Content.length()) - Start; m_ContentLines.push_back(ContentLine(Start, Length)); auto LengthX = GetCaretPositionX(m_ContentLines.size() - 1, Length) / charWidth; if (m_MaxLineLength < LengthX) m_MaxLineLength = LengthX; Start = End + 1; } while (std::string::npos != End); // TEST: Resize the widget to accomodate text width ModifyDimensions().X() = std::max<sint32>(static_cast<sint32>(m_MaxLineLength * charWidth), 3 * charWidth); ModifyDimensions().Y() = std::max<sint32>(static_cast<sint32>(m_ContentLines.size()) * lineHeight, 1 * lineHeight); if (nullptr != m_OnChange) { m_OnChange(); } }
void TextFileWidget::NotifyChange(bool OverrideLiveToggle) { if (nullptr != m_OnChange) { m_OnChange(); } NotifyExternalChange(OverrideLiveToggle); }
template <typename T> void MenuWidget<T>::SetSelectedEntryId(decltype(m_SelectedEntryId) SelectedEntryId) { if (m_SelectedEntryId != SelectedEntryId) { m_SelectedEntryId = SelectedEntryId; if (nullptr != m_OnChange) { m_OnChange(); } } }
void ParamPageEvents::OnChangeNotify(void) { if (m_OnChange) //call only if handler present! m_OnChange(); }