wxPaintEvent(3)

๐Ÿ“ฆ
version 29.0.6 ยท 3 versions
, in ubuntu stonking

โœจ wxPaintEvent โœจ

okay bestie, welcome to the wxPaintEvent era of the Erlang wx docs (manual name: wxPaintEvent, section 3, Erlang Module Definition, in case you were wondering which man page you wandered into) ๐Ÿ’–

๐ŸŒธ NAME ๐ŸŒธ

wxPaintEvent โ€” a paint event gets sent when a window's contents needs to be repainted. that's it, that's the vibe. the window said "bestie I need a glow-up" and this is the notification ๐Ÿ’…


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

so like, the handler of this event must create a wxPaintDC object and use it for painting the window contents. no shortcuts, no other canvas, it's giving very "this one, specifically." โœจ

For example:

yes the example slot is just kinda sitting there empty, do not perceive it ๐Ÿ™ˆ the docs said "For example:" and then walked away. we move.

Notice that you must not create other kinds of wxDC (e.g. wxClientDC or wxWindowDC) in EVT_PAINT handlers โ€” and also don't create wxPaintDC outside of this event handlers. fr fr, do not do it. that's the rule, that's the boundary, respect it ๐Ÿ˜ค๐Ÿ’€

You can optimize painting by retrieving the rectangles that have been damaged and only repainting these. the rectangles are in terms of the client area, and are unscrolled โ€” so you will need to do some calculations using the current view position to obtain logical, scrolled units. math era, lowkey. ๐Ÿงฎ

Here is an example of using the wxRegionIterator (not implemented in wx) class:

again bestie, the code block is not here. the original page just. gestures vaguely. ๐Ÿซถ

Remark: Please notice that in general it is impossible to change the drawing of a standard control (such as wxButton) and so you shouldn't attempt to handle paint events for them โ€” as even if it might work on some platforms, this is inherently not portable and won't work everywhere. so likeโ€ฆ don't. ๐Ÿ™…โ€โ™€๏ธ it's giving false hope on one platform and chaos on the rest.

See: Overview events ๐Ÿ‘‘

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

  • wxEvent

wxWidgets docs: wxPaintEvent


๐Ÿฆ‹ Events ๐Ÿฆ‹

Use wxEvtHandler:connect/3 with wxPaintEventType to subscribe to events of this type. yes bestie, that's the plug. ๐Ÿ”Œ


๐Ÿ’œ DATA TYPES ๐Ÿ’œ

  • wxPaint() :: #wxPaint{}.
  • wxPaintEvent() :: wx:wx_object().
  • wxPaintEventType() :: paint.

๐Ÿ‘‘ FUNCTIONS ๐Ÿ‘‘

this section is here, bestie. it exists. it is simplyโ€ฆ empty. no functions listed, no cap. we stan a minimalist section. โœจ (the heading stays because the originals keep it, iykyk)


and that's the whole page, no notes, periodt ๐Ÿ’…

sign-off: this icon was brought to you by Ericsson AB, wx 2.6, in the classic wxPaintEvent(3) format โ€” take care of your wxPaintDC bestie and she'll take care of you ๐ŸŽ€๐Ÿฆ‹๐Ÿ’–

๐Ÿ“ฆ where this page comes from