SplitView
Extends: AbstractView
A native view that arranges two child views separated by a draggable splitter.
The first child is placed on the left for a vertical split, or on the top for a horizontal split. The second child occupies the remaining space.
Example
import { BaseWindow, BrowserView, SplitView } from '@mobrowser/api';
const splitView = new SplitView({
orientation: 'vertical',
firstView: new BrowserView({
url: 'https://example.com/left'
}),
secondView: new BrowserView({
url: 'https://example.com/right'
}),
splitterPosition: 320,
splitterWidth: 10
})
const win = new BaseWindow({
size: { width: 900, height: 600 }
})
win.contentView.addChildView(splitView)
win.show()
Properties
orientation
readonly orientation: SplitViewOrientation;
The split orientation.
firstView
readonly firstView: View | BrowserView | SplitView | null;
The first child view, or null if no first child is set.
secondView
readonly secondView: View | BrowserView | SplitView | null;
The second child view, or null if no second child is set.
splitterPosition
readonly splitterPosition: number;
The splitter position in logical pixels from the left or top edge.
splitterWidth
readonly splitterWidth: number;
The splitter width in logical pixels.
Methods
constructor()
constructor(options?: SplitViewOptions): void;
Creates a new split view with the given options.
| Parameter | Type | Description |
|---|---|---|
options? | SplitViewOptions | The options to use for creating the new split view. If not provided, default options will be used. |
setOrientation()
setOrientation(orientation: SplitViewOrientation): void;
Sets the split orientation.
| Parameter | Type | Description |
|---|---|---|
orientation | SplitViewOrientation | The orientation to use for the split. |
setFirstView()
setFirstView(view: View | BrowserView | SplitView | null): void;
Sets the first child view.
Pass null to clear the current first child view.
| Parameter | Type | Description |
|---|---|---|
view | View | BrowserView |
setSecondView()
setSecondView(view: View | BrowserView | SplitView | null): void;
Sets the second child view.
Pass null to clear the current second child view.
| Parameter | Type | Description |
|---|---|---|
view | View | BrowserView |
setSplitterPosition()
setSplitterPosition(position: number): void;
Sets the splitter position in logical pixels from the left or top edge.
| Parameter | Type | Description |
|---|---|---|
position | number | The splitter position. |
setSplitterWidth()
setSplitterWidth(width: number): void;
Sets the splitter width in logical pixels.
| Parameter | Type | Description |
|---|---|---|
width | number | The splitter width. |