wxXmlResource(3erl)

πŸ’– NAME πŸ’–

wxXmlResource β€” the Erlang module definition, and yup bestie, this is the 3erl manual page for all the Functions for the wxXmlResource class. 🫢


✨ DESCRIPTION ✨

This is the main class for interacting with the XML-based resource system. It’s giving very important, very singleton energy. πŸ’…

The class holds XML resources from one or more .xml files, binary files or zip archive files. πŸŽ€

Note that this is a singleton class and you'll never allocate/deallocate it. Just use the static get/0 getter. No cap β€” that’s the whole vibe. 🌸

See: Overview xrc, Overview xrcformat

wxWidgets docs: wxXmlResource


πŸ¦‹ DATA TYPES πŸ¦‹

wxXmlResource() = wx:wx_object()

πŸ”₯ EXPORTS πŸ”₯

  • new() -> wxXmlResource()
  • new(Options :: [Option]) -> wxXmlResource() β€” Constructor. ✨

Types:

  • Option = {flags, integer()} | {domain, unicode:chardata()}
  • new(Filemask, Options :: [Option]) -> wxXmlResource() β€” Constructor. πŸŽ€

Types:

  • Filemask = unicode:chardata()
  • Option = {flags, integer()} | {domain, unicode:chardata()}
  • destroy(This :: wxXmlResource()) -> ok β€” Destructor. πŸ’€

Types:

  • This = wxXmlResource()
  • attachUnknownControl(This, Name, Control) -> boolean()

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()
  • Control = wxWindow:wxWindow()
  • attachUnknownControl(This, Name, Control, Options :: [Option]) -> boolean() β€” Attaches an unknown control to the given panel/window/dialog. 🫢

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()
  • Control = wxWindow:wxWindow()
  • Option = {parent, wxWindow:wxWindow()}

Unknown controls are used in conjunction with <object class="unknown">.

  • clearHandlers(This) -> ok β€” Removes all handlers and deletes them. This means that any handlers added using AddHandler() (not implemented in wx) must be allocated on the heap. 😭

Types:

  • This = wxXmlResource()
  • compareVersion(This, Major, Minor, Release, Revision) -> integer() β€” Compares the XRC version to the argument. πŸ”

Types:

  • This = wxXmlResource()
  • Major = Minor = Release = Revision = integer()

Returns -1 if the XRC version is less than the argument, +1 if greater, and 0 if they are equal. Periodt.

  • get() -> wxXmlResource() β€” Gets the global resources object or creates one if none exists. πŸ‘‘
  • getFlags(This) -> integer() β€” Returns flags, which may be a bitlist of ?wxXmlResourceFlags enumeration values. 🌈

Types:

  • This = wxXmlResource()
  • getVersion(This) -> integer() β€” Returns version information (a.b.c.d = d + 256*c + 2562*b + 2563*a). ⭐

Types:

  • This = wxXmlResource()
  • getXRCID(Str_id) -> integer()

Types:

  • Str_id = unicode:chardata()
  • getXRCID(Str_id, Options :: [Option]) -> integer() β€” Returns a numeric ID that is equivalent to the string ID used in an XML resource. πŸŽ€

Types:

  • Str_id = unicode:chardata()
  • Option = {value_if_not_found, integer()}

If an unknown str_id is requested (i.e. other than wxID_XXX or integer), a new record is created which associates the given string with a number.

If value_if_not_found is wxID_NONE, the number is obtained via wx_misc:newId/0. Otherwise value_if_not_found is used.

Macro XRCID(name) is provided for convenient use in event tables.

Note: IDs returned by XRCID() cannot be used with the EVT_*_RANGE macros, because the order in which they are assigned to symbolic name values is not guaranteed. πŸ™ˆ
  • initAllHandlers(This) -> ok β€” Initializes handlers for all supported controls/windows. ✨

Types:

  • This = wxXmlResource()

This will make the executable quite big because it forces linking against most of the wxWidgets library. Big yikes, but also iconic.

  • load(This, Filemask) -> boolean() β€” Loads resources from XML files that match given filemask. πŸ¦‹

Types:

  • This = wxXmlResource()
  • Filemask = unicode:chardata()

Example: (the original page leaves this blank, bestie β€” mysterious main character energy 😭)

Note: If wxUSE_FILESYS is enabled, this method understands wxFileSystem (not implemented in wx) URLs (see wxFileSystem::FindFirst() (not implemented in wx)).
Note: If you are sure that the argument is name of single XRC file (rather than an URL or a wildcard), use LoadFile() (not implemented in wx) instead.

See: LoadFile() (not implemented in wx), LoadAllFiles() (not implemented in wx)

  • loadBitmap(This, Name) -> wxBitmap:wxBitmap() β€” Loads a bitmap resource from a file. πŸ–ΌοΈ

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()
  • loadDialog(This, Parent, Name) -> wxDialog:wxDialog() β€” Loads a dialog. πŸ’…

Types:

  • This = wxXmlResource()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

parent points to parent window (if any).

  • loadDialog(This, Dlg, Parent, Name) -> boolean() β€” Loads a dialog. πŸŽ€

Types:

  • This = wxXmlResource()
  • Dlg = wxDialog:wxDialog()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

parent points to parent window (if any).

This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table). Example: (blank in the original β€” the suspense is real 😭)

  • loadFrame(This, Parent, Name) -> wxFrame:wxFrame() β€” Loads a frame from the resource. 🌸

Types:

  • This = wxXmlResource()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

parent points to parent window (if any).

  • loadFrame(This, Frame, Parent, Name) -> boolean() β€” Loads the contents of a frame onto an existing wxFrame. 🫢

Types:

  • This = wxXmlResource()
  • Frame = wxFrame:wxFrame()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table).

  • loadIcon(This, Name) -> wxIcon:wxIcon() β€” Loads an icon resource from a file. ⭐

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()
  • loadMenu(This, Name) -> wxMenu:wxMenu() β€” Loads menu from resource. πŸ“

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()

Returns NULL on failure.

  • loadMenuBar(This, Name) -> wxMenuBar:wxMenuBar()

Types:

  • This = wxXmlResource()
  • Name = unicode:chardata()
  • loadMenuBar(This, Parent, Name) -> wxMenuBar:wxMenuBar() β€” Loads a menubar from resource. πŸ‘‘

Types:

  • This = wxXmlResource()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

Returns NULL on failure.

  • loadPanel(This, Parent, Name) -> wxPanel:wxPanel() β€” Loads a panel. ✨

Types:

  • This = wxXmlResource()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

parent points to the parent window.

  • loadPanel(This, Panel, Parent, Name) -> boolean() β€” Loads a panel. πŸ’œ

Types:

  • This = wxXmlResource()
  • Panel = wxPanel:wxPanel()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()

parent points to the parent window. This form is used to finish creation of an already existing instance.

  • loadToolBar(This, Parent, Name) -> wxToolBar:wxToolBar() β€” Loads a toolbar. πŸ› οΈ

Types:

  • This = wxXmlResource()
  • Parent = wxWindow:wxWindow()
  • Name = unicode:chardata()
  • set(Res) -> wxXmlResource() β€” Sets the global resources object and returns a pointer to the previous one (may be NULL). 🌈

Types:

  • Res = wxXmlResource()
  • setFlags(This, Flags) -> ok β€” Sets flags (bitlist of ?wxXmlResourceFlags enumeration values). πŸŽ€

Types:

  • This = wxXmlResource()
  • Flags = integer()
  • unload(This, Filename) -> boolean() β€” This function unloads a resource previously loaded by load/2. πŸ’…

Types:

  • This = wxXmlResource()
  • Filename = unicode:chardata()

Returns true if the resource was successfully unloaded and false if it hasn't been found in the list of loaded resources.

  • xrcctrl(Window, Name, Type) -> wx:wx_object() β€” Looks up a control. πŸ”

Types:

  • Window = wxWindow:wxWindow()
  • Name = string()
  • Type = atom()

Get a control with Name in a window created with XML resources. You can use it to set/get values from controls. The object is type casted to Type. Example: (the manpage leaves this blank too β€” no snippet, just vibes 😭)


Mwah πŸ’‹ β€” the footer bits are wxWidgets team, wx 2.2.2.1, and wxXmlResource(3erl). That’s the sign-off, bestie β€” now go load some resources. πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from