wxSizerFlags(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxSizerFlags β€” the Erlang module definition, but make it make sense πŸ’–

okay so bestie, quick context: this is wxSizerFlags(3), an Erlang module definition. That's the whole header, consider it folded in. Now let's get into it 🫢


✨ NAME ✨

wxSizerFlags β€” a lil container for sizer item flags that gives them readable names, so you're not out here shouting raw integers at your layout. πŸ’…


🌸 DESCRIPTION 🌸

So like, normally when you add an item to a sizer via wxSizer:add/4, you have to hand over a whole pile of flags and parameters, and it gets unwieldy. Genuinely. It's giving chaos. 😭

This is where wxSizerFlags comes in: it lets you specify all those parameters using named methods instead. For example, instead of

you can now write

(this page's example snippets did not survive the journey, bestie β€” just know they were the before-and-after πŸ’€)

It's way more readable, and it also means you can build wxSizerFlags objects once and reuse them across several sizer items. Iconic behaviour, no cap.

Also, important: by specification, all methods of wxSizerFlags return the wxSizerFlags object itself, so you can chain multiple method calls together like in the examples above. Chain it, slay it, stack it. πŸ”₯

  • See: wxSizer
  • wxWidgets docs: wxSizerFlags

πŸŽ€ DATA TYPES πŸŽ€

  • wxSizerFlags() :: wx:wx_object().

πŸ‘‘ FUNCTIONS πŸ‘‘

  • align(This, Alignment) -> wxSizerFlags() when This :: wxSizerFlags(), Alignment :: integer().

Sets the alignment of this wxSizerFlags to align.

Heads up: this method replaces the previously set alignment with the one you specified. No merging, no stacking, just swap. πŸ’«

See:

  • left/1
  • right/1
  • centre/1
  • border(This, [Option]) -> wxSizerFlags() when This :: wxSizerFlags(), Option :: {direction, integer()}.

Sets the wxSizerFlags to have a border with size as returned by GetDefaultBorder() (not implemented in wx).

  • border(This, Direction, Borderinpixels) -> wxSizerFlags() when This :: wxSizerFlags(), Direction :: integer(), Borderinpixels :: integer().

Sets the wxSizerFlags to have a border of a number of pixels specified by borderinpixels, with the directions specified by direction.

Bestie, listen: prefer to use the overload below, or DoubleBorder() (not implemented in wx) or TripleBorder() (not implemented in wx), instead of hard-coding the border value in pixels β€” that way you dodge the too-small-borders-on-high-DPI-displays tragedy. πŸ”βœ¨
  • center(This) -> wxSizerFlags() when This :: wxSizerFlags().

Sets the object of the wxSizerFlags to center itself in the area it is given. Main character positioning, honestly. 🫢

  • centre(This) -> wxSizerFlags() when This :: wxSizerFlags().

Equivalent to: center/1

  • destroy(This :: wxSizerFlags()) -> ok.

Destroys the object πŸ’€

  • expand(This) -> wxSizerFlags() when This :: wxSizerFlags().

Sets the object of the wxSizerFlags to expand to fill as much area as it can. It's giving take up space, and we love that for it. 🌈

  • left(This) -> wxSizerFlags() when This :: wxSizerFlags().

Aligns the object to the left, similar for Align(wxALIGN_LEFT).

Unlike align/2, this method doesn't change the vertical alignment of the item. Left only, keep it horizontal, iykyk. πŸ‘ˆ

  • new([Option]) -> wxSizerFlags() when Option :: {proportion, integer()}.

Creates the wxSizer with the proportion specified by proportion.

  • proportion(This, Proportion) -> wxSizerFlags() when This :: wxSizerFlags(), Proportion :: integer().

Sets the proportion of this wxSizerFlags to proportion.

  • right(This) -> wxSizerFlags() when This :: wxSizerFlags().

Aligns the object to the right, similar for Align(wxALIGN_RIGHT).

Unlike align/2, this method doesn't change the vertical alignment of the item. Same energy as left/1 but make it right. πŸ‘‰


πŸ’– k that's the whole page, you understood the assignment, go build something cute. πŸ¦‹

Sign-off szn: this lil manual came from Ericsson AB, and it's the wx 2.6 version, dated to match the wxSizerFlags(3) page β€” periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from