Document wxGCDC::SetGraphicsContext() difference from ctor

Document the discrepancy between constructing wxGCDC from
wxGraphicsContext directly or default-constructing it and calling
SetGraphicsContext() later.

Current behaviour is somewhat inconsistent, but useful, because it
allows to draw on wxGraphicsContext using wxDC API using any kind of pen
and brush, even those not supported by this API, while remaining
backwards-compatible (i.e. we can't change SetGraphicsContext() to not
re-apply font, pen and brush, as this would break any existing code
relying on this happening), so it seems like the best alternative.
This commit is contained in:
Vadim Zeitlin 2019-07-07 03:18:18 +02:00
parent 8926928a8f
commit cc41ddf62a

View File

@ -100,6 +100,11 @@ public:
Note that this object takes ownership of @a context and will delete it when
it is destroyed or when SetGraphicsContext() is called again.
Also, unlike the constructor taking wxGraphicsContext, this method will
reapply the current font, pen and brush, so that this object continues
to use them, if they had been changed before (which is never the case
when constructing wxGCDC directly from wxGraphicsContext).
*/
void SetGraphicsContext(wxGraphicsContext* context);