wxNotebook(3)
π wxNotebook π
okay so bestie, this is the Erlang module definition for wxNotebook, and no cap it's genuinely one of the cutest widgets in the whole wx toolkit. buckle up π
β¨ NAME β¨
wxNotebook β this class represents a notebook control, which manages multiple windows with associated tabs.
like, it's the thing with the little tabs on top. you already know. iykyk π
πΈ DESCRIPTION πΈ
To get this party started, you create a wxNotebook object and then call wxBookCtrlBase:addPage/4 or wxBookCtrlBase:insertPage/5, handing it the window you want to use as the page. that window becomes the page. periodt.
β οΈ do NOT explicitly delete the window for a page that is currently managed by wxNotebook. just... don't. the notebook owns it now, she's the main character, let her cook. π
also fyi: wxNotebookPage is a typedef for wxWindow. cute little alias, we love a rebrand. π¦
π¨ Styles
this class supports the following styles, and yes you can stack them, go off:
wxNB_TOPβ place tabs on the top side. (the classic. the default vibe. iconic.)wxNB_LEFTβ place tabs on the left side.wxNB_RIGHTβ place tabs on the right side.wxNB_BOTTOMβ place tabs under instead of above the notebook pages. rebellious. love that for her.wxNB_FIXEDWIDTHβ (Windows only) all tabs will have same width. matchy matchy β¨wxNB_MULTILINEβ (Windows only) there can be several rows of tabs. tabs stacked like a lil croissant π₯wxNB_NOPAGETHEMEβ (Windows only) display a solid colour on notebook pages, and not a gradient, which can reduce performance. so it's the glow-down that's actually a glow-up. and heads up: the styleswxNB_LEFT,wxNB_RIGHTandwxNB_BOTTOMare not supported under Microsoft Windows when using visual themes. π« (yes, that's the fine print. read it.)
π Page backgrounds
On Windows, the default theme paints a background on the notebook's pages. if that's giving you the ick β for aesthetic or performance reasons β there are three ways to suppress this theme:
- use
wxNB_NOPAGETHEMEto disable themed drawing for a particular notebook - call
wxSystemOptions:setOption/2to disable it for the whole application - disable it for individual pages by using
wxWindow:setBackgroundColour/2
To disable themed pages globally:
set the value to 1 to enable it again. and to give a single page a solid background that more or less fits in with the overall theme, use:
_(bestie that's the whole instruction, the snippets live in the original docs, i'm not inventing code that isn't there π )_
On platforms other than Windows, or if the application is not using Windows themes, getThemeBackgroundColour/1 will return an uninitialised colour object, and the above code will therefore work on all platforms. cross-platform slay πβ¨
π See:
?wxBookCtrlwxBookCtrlEventwxImageList- Examples
π³ This class is derived, and can use functions, from:
wxBookCtrlBasewxControlwxWindowwxEvtHandler
wxWidgets docs: wxNotebook
π Events
event types emitted from this class:
command_notebook_page_changedcommand_notebook_page_changing
the page changed. the page is changing. the page is in her era. π¦
π§ DATA TYPES
wxNotebook() :: wx:wx_object().
π FUNCTIONS π
assignImageList(This, ImageList) -> ok
assignImageList(This, ImageList) -> ok
when
This :: wxNotebook(),
ImageList :: wxImageList:wxImageList().
Sets the image list for the page control and takes ownership of the list. so she's yours now, notebook. (unlike setImageList/2, which we'll get to. the drama.)
See:
wxImageListsetImageList/2
create(This, Parent, Id, [Option]) -> boolean()
create(This, Parent, Id, [Option]) -> boolean()
when
This :: wxNotebook(),
Parent :: wxWindow:wxWindow(),
Id :: integer(),
Option ::
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()}.
Creates a notebook control. β¨
See new/3 for a description of the parameters. (spoiler: same params, different entry point. consistency queen.)
destroy(This :: wxNotebook()) -> ok.
Destroys the object.
bye bestie ππ
getImageList(This) -> wxImageList:wxImageList()
getImageList(This) -> wxImageList:wxImageList()
when This :: wxNotebook().
Returns the associated image list, may be NULL. (yes, she can come back empty. don't panic.)
See:
wxImageListsetImageList/2
getPageImage(This, NPage) -> integer()
getPageImage(This, NPage) -> integer()
when This :: wxNotebook(), NPage :: integer().
Returns the image index for the given page. π’
getRowCount(This) -> integer()
getRowCount(This) -> integer() when This :: wxNotebook().
Returns the number of rows in the notebook control.
getThemeBackgroundColour(This) -> wx:wx_colour4()
getThemeBackgroundColour(This) -> wx:wx_colour4()
when This :: wxNotebook().
If running under Windows and themes are enabled for the application, this function returns a suitable colour for painting the background of a notebook page, and can be passed to wxWindow:setBackgroundColour/2. π¨
Otherwise, an uninitialised colour will be returned. (so like, don't vibe with an uninitialised colour on purpose, mmkay)
new() -> wxNotebook().
new() -> wxNotebook().
Constructs a notebook control. the no-args girlypop version. π
new(Parent, Id, [Option]) -> wxNotebook()
new(Parent, Id, [Option]) -> wxNotebook()
when
Parent :: wxWindow:wxWindow(),
Id :: integer(),
Option ::
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()}.
Constructs a notebook control. the full-glam version. π
pro tip from the docs: note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN window style. less flicker = more slay. β¨
setImageList(This, ImageList) -> ok
setImageList(This, ImageList) -> ok
when
This :: wxNotebook(),
ImageList :: wxImageList:wxImageList().
Sets the image list to use. πΌοΈ
β οΈ it does not take ownership of the image list β you must delete it yourself. unlike assignImageList/2. the plot twist nobody saw coming. π
See:
wxImageListassignImageList/2
setPadding(This, Padding) -> ok
setPadding(This, Padding) -> ok
when
This :: wxNotebook(),
Padding :: {W :: integer(), H :: integer()}.
Sets the amount of space around each page's icon and label, in pixels. give her room to breathe. πΈ
note: the vertical padding cannot be changed in wxGTK. it's giving fixed, unfortunately. π
setPageImage(This, Page, Image) -> boolean()
setPageImage(This, Page, Image) -> boolean()
when
This :: wxNotebook(),
Page :: integer(),
Image :: integer().
Sets the image index for the given page.
image is an index into the image list which was set with setImageList/2. π―
setPageSize(This, Size) -> ok
setPageSize(This, Size) -> ok
when
This :: wxNotebook(),
Size :: {W :: integer(), H :: integer()}.
Sets the width and height of the pages. π
note: this method is currently not implemented for wxGTK. so on GTK, this is a vibe only. π
and that's the whole page bestie, every flag, every signature, every little caveat. no cap. go build something iconic with it. πβ¨
this has been wxNotebook(3) from the Erlang Module Definitions, brought to you by Ericsson AB β that's version wx 2.6 β and yeah, the footer page said wxNotebook(3) again because the girlies love a callback. π«Άπ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms