wxClientDC(3)

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

πŸ’– wxClientDC πŸ’–

okay bestie, so this is the wxClientDC page from the Erlang module docs (yes we're in wx, the Erlang wxWidgets bindings, come with me 🫢).

✨ NAME ✨

wxClientDC β€” bestie, this class is primarily useful for obtaining information about the window from outside the EVT_PAINT() handler. that's its whole moment. that's the gig. πŸ‘‘


🌸 DESCRIPTION 🌸

so the typical use of this class is to grab the extent of some text string so you can allocate enough size for a window, e.g.

⚠️ Note, and this one MATTERS: while wxClientDC may also be used for drawing on the client area of a window from outside an EVT_PAINT() handler in some ports, this does NOT work on all platforms. neither wxOSX nor wxGTK with the GTK 3 Wayland backend support this, so drawing using wxClientDC simply doesn't have any effect there 😭. the only portable way of drawing is via wxPaintDC. to redraw a small part of the window, use wxWindow:refreshRect/3 to invalidate just this part, and check wxWindow:getUpdateRegion/1 in the paint event handler to redraw this part only. iykyk πŸ’…

wxClientDC objects should normally be constructed as temporary stack objects, i.e. don't store a wxClientDC object. periodt. don't do it. it's giving temporary. πŸŽ€

a wxClientDC object is initialized to use the same font and colours as the window it is associated with. no need to fight it, it already matches. ✨

See, like, go look at:

  • wxDC
  • wxMemoryDC
  • wxPaintDC
  • wxWindowDC
  • wxScreenDC

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

  • wxWindowDC
  • wxDC

wxWidgets docs: wxClientDC


πŸ¦‹ DATA TYPES πŸ¦‹

wxClientDC() :: wx:wx_object().

🌈 FUNCTIONS 🌈

  • destroy(This :: wxClientDC()) -> ok β€” destroys the object πŸ’€ that's it, that's the function.
  • new(Window) -> wxClientDC() when Window :: wxWindow:wxWindow() β€” the constructor, bestie 🫢. pass a pointer to the window on which you wish to paint. that's the whole vibe.

and that's the page, no cap πŸ’œ this fine manual came to you from Ericsson AB, and it's the wx 2.6 era of the docs, filed under wxClientDC(3). go forth and get that text extent, queen πŸ‘‘πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from