wxSplitterWindow(3erl)

🌸 NAME 🌸

wxSplitterWindow β€” literally the functions for the wxSplitterWindow class, bestie. It's an Erlang module definition page, this is part 1, and yes we're doing this together 🫢


✨ DESCRIPTION ✨

Okay so picture this: this class manages up to two subwindows πŸ’… That's the whole vibe. Two. Not three. Two.

The current view can be split into two programmatically (maybe from a menu command, cute), and unsplit either programmatically or via the wxSplitterWindow user interface. So you've got options, icon behaviour πŸŽ€

🎨 Styles

This class supports the following styles:

and then the page just... doesn't list any here πŸ™ˆ no cap, that's genuinely all it says in this section β€” the styles list itself shows up elsewhere, so don't come for me, I'm only reporting what's on the page.

See: wxSplitterEvent, Overview splitterwindow β€” go look, iykyk πŸ”₯


This class is derived (and can use functions) from: wxWindow wxEvtHandler

wxWidgets docs: wxSplitterWindow


πŸ’« EVENTS πŸ’«

Event types emitted from this class, and yes I'm listing every single one because we don't skip 🀌

  • command_splitter_sash_pos_changing
  • command_splitter_sash_pos_changed
  • command_splitter_unsplit

That's the trio. Sash moving, sash moved, and the unsplit. Main character energy from all three, honestly πŸ‘‘


πŸ¦‹ DATA TYPES πŸ¦‹

Here's the type, exactly as written, no notes:

wxSplitterWindow() = wx:wx_object()

Lowkey the shortest section on the page and it still ate πŸ’€ wx:wx_object() β€” that's the whole type. Periodt.


okay stay with me, there's more of this page coming πŸ‘€ don't go anywhere πŸ’–

πŸ’… EXPORTS πŸ’…

okay so this is the part where the actual functions live, bestie β€” every constructor, getter, setter, split, unsplit, and that lil updateSize moment. Keep your wxSplitterWindow() close and your sash gravity closer ✨

new() -> wxSplitterWindow()

Default constructor. Like, the bare-minimum glow-up: a splitter window with no parent and no options, living its best life 🫢

new(Parent) -> wxSplitterWindow()

Types:

Parent = wxWindow:wxWindow()

Same constructor energy, but now with a parent πŸ’–

new(Parent, Options :: [Option]) -> wxSplitterWindow()

Types:

Parent = wxWindow:wxWindow()
Option =
    {id, integer()} |
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {style, integer()}

Constructor for creating the window. Frail-proof your setup, bestie πŸŽ€

Remark: After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of initialize/2, splitVertically/4 and splitHorizontally/4 in order to set the pane(s). You can create two windows, with one hidden when not being shown; or you can create and delete the second pane on demand.

See: initialize/2, splitVertically/4, splitHorizontally/4, create/3

destroy(This :: wxSplitterWindow()) -> ok

Destroys the wxSplitterWindow and its children. It's giving cleanup era 🧹✨

create(This, Parent) -> boolean()

Types:

This = wxSplitterWindow()
Parent = wxWindow:wxWindow()

This one is just types, no extra prose β€” the /3 version below has the actual construction lore 🫢

create(This, Parent, Options :: [Option]) -> boolean()

Types:

This = wxSplitterWindow()
Parent = wxWindow:wxWindow()
Option =
    {id, integer()} |
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {style, integer()}

Creation function, for two-step construction. Very "build it, then reveal it" main character energy πŸ’…

See new/2 for details.

getMinimumPaneSize(This) -> integer()

Types:

This = wxSplitterWindow()

Returns the current minimum pane size (defaults to zero). Tiny pane rights, but make it make sense πŸ“

See: setMinimumPaneSize/2

getSashGravity(This) -> number()

Types:

This = wxSplitterWindow()

Returns the current sash gravity. Gotta know how hard your sash is pulling, fr fr 🌈

See: setSashGravity/2

getSashPosition(This) -> integer()

Types:

This = wxSplitterWindow()

Returns the current sash position. Where my sash at? πŸ‘€

See: setSashPosition/3

getSplitMode(This) -> wx:wx_enum()

Types:

This = wxSplitterWindow()

Gets the split mode. Mode check, but make it splitter-coded πŸ¦‹

See: setSplitMode/2, splitVertically/4, splitHorizontally/4

getWindow1(This) -> wxWindow:wxWindow()

Types:

This = wxSplitterWindow()

Returns the left/top or only pane. The first window is serving first-pane realness πŸ‘‘

getWindow2(This) -> wxWindow:wxWindow()

Types:

This = wxSplitterWindow()

Returns the right/bottom pane. Second pane, but never second best πŸ’œ

initialize(This, Window) -> ok

Types:

This = wxSplitterWindow()
Window = wxWindow:wxWindow()

Initializes the splitter window to have one pane. The child window is shown if it is currently hidden. One-pane era, lowkey iconic ✨

Remark: This should be called if you wish to initially view only a single pane in the splitter window.

See: splitVertically/4, splitHorizontally/4

isSplit(This) -> boolean()

Types:

This = wxSplitterWindow()

Returns true if the window is split, false otherwise. Vibes: either split or not split, no in-between 🫢

replaceWindow(This, WinOld, WinNew) -> boolean()

Types:

This = wxSplitterWindow()
WinOld = WinNew = wxWindow:wxWindow()

This function replaces one of the windows managed by the wxSplitterWindow with another one. Glow-up swap, but make it flicker-free πŸ’…

It is in general better to use it instead of calling unsplit/2 and then resplitting the window back because it will provoke much less flicker (if any). It is valid to call this function whether the splitter has two windows or only one.

Both parameters should be non-NULL and winOld must specify one of the windows managed by the splitter. If the parameters are incorrect or the window couldn't be replaced, false is returned. Otherwise the function will return true, but please notice that it will not delete the replaced window and you may wish to do it yourself. No cap β€” it's not doing your cleanup for you 😭

See: getMinimumPaneSize/1

setSashGravity(This, Gravity) -> ok

Types:

This = wxSplitterWindow()
Gravity = number()

Sets the sash gravity. Big resize energy πŸŒ€

Remark: Gravity is real factor which controls position of sash while resizing wxSplitterWindow. Gravity tells wxSplitterWindow how much will left/top window grow while resizing. Example values:

(the original page just says that and then moves on, bestie β€” no actual list, iconic πŸ’€)

Notice that when sash gravity for a newly created splitter window, it is often necessary to explicitly set the splitter size using wxWindow:setSize/6 to ensure that is big enough for its initial sash position. Otherwise, i.e. if the window is created with the default tiny size and only resized to its correct size later, the initial sash position will be affected by the gravity and typically result in sash being at the rightmost position for the gravity of 1. See the example code creating wxSplitterWindow in the splitter sample for more details.

See: getSashGravity/1

setSashPosition(This, Position) -> ok

Types:

This = wxSplitterWindow()
Position = integer()

Sets the sash position. No options, just position realness 🎯

setSashPosition(This, Position, Options :: [Option]) -> ok

Types:

This = wxSplitterWindow()
Position = integer()
Option = {redraw, boolean()}

Sets the sash position, now with the redraw option in the mix ✨

Remark: Does not currently check for an out-of-range value. So yes, it will simply not catch that for you β€” proceed with caution, bestie 🚨

See: getSashPosition/1

setMinimumPaneSize(This, PaneSize) -> ok

Types:

This = wxSplitterWindow()
PaneSize = integer()

Sets the minimum pane size. Protect your panes from disappearing into the void 🫢

Remark: The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging), set a minimum size, for example 20 pixels. If the wxSP_PERMIT_UNSPLIT style is used when a splitter window is created, the window may be unsplit even if minimum size is non-zero.

See: getMinimumPaneSize/1

setSplitMode(This, Mode) -> ok

Types:

This = wxSplitterWindow()
Mode = integer()

Sets the split mode. Internally, at least β€” it's not updating the display for you πŸ‘€

Remark: Only sets the internal variable; does not update the display.

See: getSplitMode/1, splitVertically/4, splitHorizontally/4

splitHorizontally(This, Window1, Window2) -> boolean()

Types:

This = wxSplitterWindow()
Window1 = Window2 = wxWindow:wxWindow()

Initializes the top and bottom panes of the splitter window. Stacked-pane slay πŸ₯ž

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using isSplit/1.

splitHorizontally(This, Window1, Window2, Options :: [Option]) -> boolean()

Types:

This = wxSplitterWindow()
Window1 = Window2 = wxWindow:wxWindow()
Option = {sashPosition, integer()}

Initializes the top and bottom panes of the splitter window, with a sashPosition option so you can set the vibe exactly where you want it πŸ’…

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using isSplit/1.

See: splitVertically/4, isSplit/1, unsplit/2

splitVertically(This, Window1, Window2) -> boolean()

Types:

This = wxSplitterWindow()
Window1 = Window2 = wxWindow:wxWindow()

Initializes the left and right panes of the splitter window. Side-by-side bestie layout 🌸

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using isSplit/1.

splitVertically(This, Window1, Window2, Options :: [Option]) -> boolean()

Types:

This = wxSplitterWindow()
Window1 = Window2 = wxWindow:wxWindow()
Option = {sashPosition, integer()}

Initializes the left and right panes of the splitter window, with a sashPosition option for that precise sash placement ✨

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using isSplit/1.

See: splitHorizontally/4, isSplit/1, unsplit/2

unsplit(This) -> boolean()

Types:

This = wxSplitterWindow()

Unsplits the window. Un-slay, but only if it was split 🫠

Return: true if successful, false otherwise (the window was not split).

unsplit(This, Options :: [Option]) -> boolean()

Types:

This = wxSplitterWindow()
Option = {toRemove, wxWindow:wxWindow()}

Unsplits the window, and you can pass toRemove to pick which pane gets the goodbye πŸ‘‹

Return: true if successful, false otherwise (the window was not split).

Remark: This call will not actually delete the pane being removed; it calls OnUnsplit() (not implemented in wx) which can be overridden for the desired behaviour. By default, the pane being removed is hidden.

See: splitHorizontally/4, splitVertically/4, isSplit/1, OnUnsplit() (not implemented in wx)

updateSize(This) -> ok

Types:

This = wxSplitterWindow()

Causes any pending sizing of the sash and child panes to take place immediately. No more waiting for idle time, bestie β€” we're doing it live 🎬

Such resizing normally takes place in idle time, in order to wait for layout to be completed. However, this can cause unacceptable flicker as the panes are resized after the window has been shown. To work around this, you can perform window layout (for example by sending a size event to the parent window), and then call this function, before showing the top-level window. Flicker prevention era πŸ”₯


That's the whole exports list, bestie β€” every function accounted for, no cap. Huge sparkly shoutout to the wxWidgets team, version wx 2.2.2.1, and the date stamped on this page's footer. Page vibe: wxSplitterWindow(3erl). Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from