wxMDIParentFrame(3)

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

πŸ’– wxMDIParentFrame πŸ’–

okay bestie, welcome to the Erlang Module Definition manual, wx edition β€” this is the page for wxMDIParentFrame, and yes it's as extra as it sounds. let's get into it 🫢


✨ NAME ✨

wxMDIParentFrame β€” an MDI (Multiple Document Interface) parent frame. it's a window that can hold MDI child frames up in its client area, and the whole thing is basically cosplaying your entire desktop. iconic behavior tbh πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so MDI is a user-interface model where all the windows live inside one single parent window instead of being separate lil' independent things. and the way it's still popular? unhinged, because Microsoft themselves β€” the very company that popularized this model in the first place β€” is out here giving dire warnings that MDI is obsolete. they said that. about their own thing. πŸ’€ anyway it remains popular regardless.

every MDI parent frame always has a wxMDIClientWindow attached to it, and that is the actual parent for all the MDI child frames. in the simplest case the client window just eats up the entire parent frame area. but β€” plot twist β€” you can also resize it smaller so you can have other windows chillin' in the frame too. the classic example? a sidebar along one of the window edges. cute, functional, slay πŸŽ€

the appearance of MDI apps is different depending on the port, bestie, so pay attention:

  • the classic MDI model β€” child windows you can independently move, resize, etc. β€” is only available under MSW, which provides native support for it.
  • on Mac ports, multiple top level windows get used for the MDI children too, and the MDI parent frame itself is invisible, all so it can accommodate the native look and feel requirements.
  • on all the other ports, a tab-based MDI implementation (sometimes called TDI) is used, so at most one MDI child is visible at any moment. child frames are always maximized in that case.

and even though technically you could have multiple MDI parent frames, a typical MDI application rolls with a single MDI parent frame window, and inside it you create multiple MDI child frames β€” i.e. objects of class wxMDIChildFrame. main character energy 🧚

πŸŽ€ Styles πŸŽ€

this class supports the following styles, and here's the tea:

there are no special styles for this class β€” all wxFrame styles apply to it in the usual way. the only exception is that wxHSCROLL and wxVSCROLL styles apply not to the frame itself but to the client window, so using them enables horizontal and vertical scrollbars for this window and not the frame. iykyk πŸ’…

See:

  • wxMDIChildFrame
  • wxMDIClientWindow
  • wxFrame
  • wxDialog

this class is derived, and can use functions, from:

  • wxFrame
  • wxTopLevelWindow
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxMDIParentFrame 🌈


πŸ“ DATA TYPES πŸ“

wxMDIParentFrame() :: wx:wx_object().

πŸ’… FUNCTIONS πŸ’…

🌸 activateNext(This) -> ok when This :: wxMDIParentFrame().

activates the MDI child that comes right after the currently active one.

the MDI children are kept in an ordered list, and this function switches to the next element in that list β€” and yes, it wraps around to the start if the currently active child is the last one. circular queuing, we love to see it ✨

See: activatePrevious/1


🌸 activatePrevious(This) -> ok when This :: wxMDIParentFrame().

activates the MDI child that comes right before the currently active one. the backwards twin of the one above, no cap 🫢

See: activateNext/1


🌸 arrangeIcons(This) -> ok when This :: wxMDIParentFrame().

arranges any iconized (minimized) MDI child windows. tidying up the little minimized gremlins, basically 🧹

heads up: this method is only implemented in the MSW MDI implementation and does nothing under the other platforms. so if nothing happens on your platform, that's why, not you.

See:

  • cascade/1
  • tile/2

🌸 cascade(This) -> ok when This :: wxMDIParentFrame().

arranges the MDI child windows in a cascade β€” you know, that stair-step offset look πŸ‘‘

same caveat as always: this method is only implemented in the MSW MDI implementation and does nothing under the other platforms.

See:

  • tile/2
  • arrangeIcons/1

🌸 create(This, Parent, Id, Title, [Option]) -> boolean()

create(This, Parent, Id, Title, [Option]) -> boolean()
                when
                    This :: wxMDIParentFrame(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Title :: unicode:chardata(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()}.

used in two-step frame construction. the "make it in two moves" approach ✨

See new/4 for further details.


🌸 destroy(This :: wxMDIParentFrame()) -> ok.

destroys the object. yeet, but make it formal πŸ’€


🌸 getActiveChild(This) -> wxMDIChildFrame:wxMDIChildFrame() when This :: wxMDIParentFrame().

returns a pointer to the active MDI child, if there is one.

and here's the lil' detail: if there are any children at all, this function returns a non-NULL pointer. so like, non-NULL = there's defo a child, got it 🌟


🌸 getClientWindow(This) -> wxMDIClientWindow:wxMDIClientWindow() when This :: wxMDIParentFrame().

returns a pointer to the client window. that's it, that's the whole function, and honestly? respect the simplicity πŸ’œ


🌸 new() -> wxMDIParentFrame().

default constructor.

use create/5 for the objects created using this constructor. two-step construction, remember? πŸŽ€


🌸 new(Parent, Id, Title, [Option]) -> wxMDIParentFrame()

new(Parent, Id, Title, [Option]) -> wxMDIParentFrame()
                when
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Title :: unicode:chardata(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()}.

constructor, creating the window. the main-event way to spawn one 🌈

⚠️ important notice, bestie, don't skip this: if you override the virtual OnCreateClient() method (not implemented in wx) you should not use this constructor. use the default constructor plus create/5 instead β€” otherwise your overridden method is never going to be called, because of the usual C++ virtual call resolution rules. it's giving "why is my override not firing" and the answer is this exact sentence. 😭

also, under wxMSW, the client window will automatically have a sunken border style when the active child is not maximized, and no border style when a child is maximized. automatic glow-up depending on state, we stan ✨

See: create/5


🌸 tile(This, [Option]) -> ok

tile(This, [Option]) -> ok
                when
                    This :: wxMDIParentFrame(),
                    Option :: {orient, wx:wx_enum()}.

tiles the MDI child windows either horizontally or vertically, depending on whether orient is wxHORIZONTAL or wxVERTICAL. pick your fighter πŸ¦‹

and yep, same rule applies: this method is only implemented in the MSW MDI implementation and does nothing under the other platforms.

and that's the whole page, bestie!! πŸŽ‰ go forth and parent some MDI frames responsibly. this lil' manual came to you from Ericsson AB, version wx 2.6 β€” mwah, take care of yourself, drink water, and may all your overrides actually get called πŸ’–πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from