using System.ComponentModel;
namespace TinyChat;
///
/// A specialized split container control designed for chat applications with a horizontal layout.
/// The top panel is typically used for chat history and the bottom panel for input controls.
///
public class ChatSplitContainerControl : SplitContainer, ISplitContainerControl
{
///
/// Initializes a new instance of the class.
/// Sets up horizontal orientation with the bottom panel (Panel2) as the fixed panel.
///
public ChatSplitContainerControl()
{
Orientation = Orientation.Horizontal;
FixedPanel = FixedPanel.Panel2;
}
///
/// Gets the top panel of the split container, typically used for displaying chat history.
///
public Control? HistoryPanel => Panel1;
///
/// Gets the bottom panel of the split container, typically used for chat input controls.
///
public Control? ChatInputPanel => Panel2;
///
/// Gets or sets the splitter position measured from the bottom of the container.
/// This property provides an alternative to
/// by measuring from the bottom instead of the top, making it easier to work with
/// fixed bottom panels.
///
/// The distance in pixels from the bottom of the container to the splitter.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int SplitterPosition
{
get => Height - SplitterDistance;
set => SplitterDistance = Height - value;
}
}