private void DrawRightFrame(Vector2 frameSize)
{
var rightFrameNode = ListView.GetSelectedNode(ListViewID);
if (_currentRightFrameNode != rightFrameNode)
{
_currentRightFrameNode = rightFrameNode;
Task.Run(() =>
{
string newText = rightFrameNode.GetNodeSpecialText();
TextInputBuffer newBuffer = new TextInputBuffer(newText);
InvokeOnMainThread(() =>
{
if (_currentRightFrameNode == rightFrameNode)
{
_rightFrameTextBuffer.Dispose();
_rightFrameTextBuffer = newBuffer;
_rightFrameRawText = newText;
}
else
{
newBuffer.Dispose();
}
});
});
}
if (_selectableText)
{
ImGui.PushStyleColor(ColorTarget.FrameBg, new Vector4(1, 1, 1, 1));
ImGui.PushStyleColor(ColorTarget.Text, new Vector4(0, 0, 0, 1));
ImGui.InputTextMultiline(
"",
_rightFrameTextBuffer.Buffer,
_rightFrameTextBuffer.Length,
frameSize * new Vector2(2.5f, 1f) - Vector2.UnitY * 35f,
InputTextFlags.ReadOnly,
null,
IntPtr.Zero);
ImGui.PopStyleColor(2);
}
else
{
unsafe
{
byte* start = (byte*)_rightFrameTextBuffer.Buffer.ToPointer();
byte* end = start + _rightFrameTextBuffer.Length;
if (_wrapRightFrame)
{
ImGuiNative.igPushTextWrapPos(ImGuiNative.igGetColumnWidth(ImGuiNative.igGetColumnIndex()));
}
ImGuiNative.igTextUnformatted(start, end);
if (_wrapRightFrame)
{
ImGuiNative.igPopTextWrapPos();
}
}
}
}