Class: Wx::ClientDC

Inherits:
WindowDC show all
Defined in:
lib/wx/doc/gen/client_dc.rb,
lib/wx/doc/client_dc.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

Deprecated class for drawing on the client area of a window.

ClientDC should not be used any longer, please use InfoDC instead for obtaining information about the device context associated with a window.

Note:

While 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 most of the platforms: neither WXOSX nor WXGTK with GTK 3 Wayland backend support this at all, so drawing using ClientDC simply doesn't have any effect there. ClientDC.can_be_used_for_drawing can be used to determine whether ClientDC can be used for drawing in the current environment, but it is recommended to only draw on the window using PaintDC, as this is guaranteed to work everywhere. To redraw a small part of the window, use Window#refresh_rect to invalidate just this part and check Window#get_update_region in the paint event handler to redraw this part only.

ClientDC objects should normally be constructed as temporary stack objects, i.e. don’t store a ClientDC object. A ClientDC object is initialized to use the same font and colours as the window it is associated with.

Category: Device Contexts

Direct Known Subclasses

PaintDC

Class Method Summary collapse

Methods inherited from WindowDC

#initialize

Methods inherited from DC

#blit, #calc_bounding_box, #clear, #copy_attributes, #cross_hair, #destroy_clipping_region, #draw_arc, #draw_bitmap, #draw_check_mark, #draw_circle, #draw_ellipse, #draw_elliptic_arc, #draw_icon, #draw_label, #draw_line, #draw_lines, #draw_point, #draw_poly_polygon, #draw_polygon, #draw_rectangle, #draw_rotated_text, #draw_rounded_rectangle, #draw_spline, #draw_text, #end_doc, #end_page, #flood_fill, #get_as_bitmap, #get_background, #get_background_mode, #get_brush, #get_clipping_box, #get_graphics_context, #get_logical_function, #get_pen, #get_pixel, #get_text_background, #get_text_foreground, #gradient_fill_concentric, #gradient_fill_linear, #max_x, #max_y, #min_x, #min_y, #reset_bounding_box, #set_background, #set_background_mode, #set_brush, #set_clipping_region, #set_device_clipping_region, #set_graphics_context, #set_logical_function, #set_palette, #set_pen, #set_text_background, #set_text_foreground, #start_doc, #start_page, #stretch_blit, #with_background_mode, #with_brush, #with_font, #with_pen, #with_text_background, #with_text_foreground

Methods inherited from ReadOnlyDC

#can_draw_bitmap, #can_get_text_extent, #can_use_transform_matrix, #device_to_logical, #device_to_logical_rel, #device_to_logical_x, #device_to_logical_x_rel, #device_to_logical_y, #device_to_logical_y_rel, #from_dip, #get_char_height, #get_char_width, #get_content_scale_factor, #get_depth, #get_device_origin, #get_dimensions, #get_dimensions_mm, #get_font, #get_font_metrics, #get_layout_direction, #get_logical_origin, #get_logical_scale, #get_map_mode, #get_multi_line_text_extent, #get_multi_line_text_size, #get_ppi, #get_size, #get_size_mm, #get_text_extent, #get_text_size, #get_transform_matrix, #get_user_scale, #is_ok, #logical_to_device, #logical_to_device_rel, #logical_to_device_x, #logical_to_device_x_rel, #logical_to_device_y, #logical_to_device_y_rel, #reset_transform_matrix, #set_axis_orientation, #set_device_origin, #set_font, #set_layout_direction, #set_logical_origin, #set_logical_scale, #set_map_mode, #set_transform_matrix, #set_user_scale, #to_dip

Methods inherited from Object

#clone, #dup, #initialize, #is_same_as, #un_share

Constructor Details

This class inherits a constructor from Wx::WindowDC

Class Method Details

.can_be_used_for_drawing(window) ⇒ Boolean

Return true if drawing on Wx::ClientDC actually works.

In many environments (currently this includes WXGTK when using Wayland backend, WXMSW when using double buffering and WXOSX in all cases), Wx::ClientDC can be only used for obtaining information about the device context, but not for actually drawing on it. Portable code should avoid using Wx::ClientDC completely, as explained in the class documentation, but it is also possible to optionally use it only when it does work, i.e. when this function returns true.

Parameters:

Returns:

  • (Boolean)


38
# File 'lib/wx/doc/gen/client_dc.rb', line 38

def self.can_be_used_for_drawing(window) end

.draw_on(win) {|dc| ... } ⇒ ::Object

Executes the given block providing a temporary (client) dc as it’s single argument.

Parameters:

Yield Parameters:

Returns:

  • (::Object)

    result of the block



17
# File 'lib/wx/doc/client_dc.rb', line 17

def self.draw_on(win) end