# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # {Wx::ClientDC} is primarily useful for obtaining information about the window from outside EVT_PAINT() handler. # Typical use of this class is to obtain the extent of some text string in order to allocate enough size for a window, e.g. # # // Create the initially empty label with the size big enough to show # // the given string. # wxClientDC dc(this); # wxStaticText* text = new wxStaticText # ( # this, wxID_ANY, "", # wxPoint(), # dc.GetTextExtent("String of max length"), # wxST_NO_AUTORESIZE # ); # } # # While {Wx::ClientDC} 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 {Wx::OSX} nor {Wx::GTK} with GTK 3 Wayland backend support this, so drawing using {Wx::ClientDC} simply doesn't have any effect there) and the only portable way of drawing is via {Wx::PaintDC}. To redraw a small part of the window, use {Wx::Window#refresh_rect} to invalidate just this part and check {Wx::Window#get_update_region} in the paint event handler to redraw this part only. # # {Wx::ClientDC} objects should normally be constructed as temporary stack objects, i.e. don't store a {Wx::ClientDC} object. # A {Wx::ClientDC} object is initialized to use the same font and colours as the window it is associated with. # === # # Category: Device Contexts # @see Wx::DC # @see Wx::MemoryDC # @see Wx::PaintDC # @see Wx::WindowDC # @see Wx::ScreenDC # # class ClientDC < WindowDC # Constructor. # Pass a pointer to the window on which you wish to paint. # @param window [Wx::Window] # @return [ClientDC] def initialize(window) end end # ClientDC end