void CBaseView::OutputMsgLine( const char * line ) { BeginNewLine( ); OutputMsgHeader( ); m_astrMsg.Add( line ); GetEditCtrl().ReplaceSel( line ); }
void SWrapBox::FChildArranger::Arrange() { int32 ChildIndex; for (ChildIndex = 0; ChildIndex < WrapBox.Slots.Num(); ++ChildIndex) { const FSlot& Slot = WrapBox.Slots[ChildIndex]; const TSharedRef<SWidget>& Widget = Slot.GetWidget(); /* * Simple utility lambda for determining if the current child index is the first child of the current line. */ const auto& IsFirstChildInCurrentLine = [&]() -> bool { return ChildIndex == IndexOfFirstChildInCurrentLine; }; // Skip collapsed widgets. if (Widget->GetVisibility() == EVisibility::Collapsed) { continue; } FArrangementData& ArrangementData = OngoingArrangementDataMap.Add(ChildIndex, FArrangementData()); // If there is no first child in the current line, we must be the first child. if (IndexOfFirstChildInCurrentLine == INDEX_NONE) { IndexOfFirstChildInCurrentLine = ChildIndex; } /* * Simple utility lambda for beginning a new line with the current child, updating it's offset for the new line. */ const auto& BeginNewLine = [&]() { FinalizeLine(ChildIndex - 1); // Starting a new line. IndexOfFirstChildInCurrentLine = ChildIndex; // Update child's offset to new X and Y values for new line. ArrangementData.SlotOffset.X = Offset.X; ArrangementData.SlotOffset.Y = Offset.Y; }; // Rule: If this child is not the first child in the line, "inner slot padding" needs to be injected left of it. if (!IsFirstChildInCurrentLine()) { Offset.X += WrapBox.InnerSlotPadding.X; } const FVector2D DesiredSizeOfSlot = Slot.SlotPadding.Get().GetDesiredSize() + Widget->GetDesiredSize(); // Populate arrangement data with default size and offset at right end of current line. ArrangementData.SlotOffset.X = Offset.X; ArrangementData.SlotOffset.Y = Offset.Y; ArrangementData.SlotSize.X = DesiredSizeOfSlot.X; ArrangementData.SlotSize.Y = DesiredSizeOfSlot.Y; const float RightBoundOfChild = ArrangementData.SlotOffset.X + ArrangementData.SlotSize.X; // Rule: If required due to a wrapping width under specified threshold, start a new line and allocate all of it to this child. if (Slot.SlotFillLineWhenWidthLessThan.IsSet() && WrapBox.PreferredWidth.Get() < Slot.SlotFillLineWhenWidthLessThan.GetValue()) { // Begin a new line if the current one isn't empty, because we demand a whole line to ourselves. if (!IsFirstChildInCurrentLine()) { BeginNewLine(); } // Fill width of rest of wrap box. ArrangementData.SlotSize.X = WrapBox.PreferredWidth.Get() - Offset.X; } // Rule: If the end of a child would go beyond the width to wrap at, it should move to a new line. else if (RightBoundOfChild > WrapBox.PreferredWidth.Get()) { // Begin a new line if the current one isn't empty, because we demand a new line. if (!IsFirstChildInCurrentLine()) { BeginNewLine(); } } // Update current line maximum height. MaximumHeightInCurrentLine = FMath::Max(MaximumHeightInCurrentLine, ArrangementData.SlotSize.Y); // Update offset to right bound of child. Offset.X = ArrangementData.SlotOffset.X + ArrangementData.SlotSize.X; } // Attempt to finalize the final line if there are any children in it. if (IndexOfFirstChildInCurrentLine != INDEX_NONE) { FinalizeLine(ChildIndex - 1); } }