Class: Wx::Window

Inherits:
EvtHandler show all
Defined in:
lib/wx/doc/gen/window.rb,
lib/wx/doc/window.rb

Overview

Window is the base class for all windows and represents any visible object on screen.

All controls, top level windows and so on are windows. Sizers and device contexts are not, however, as they don’t appear on screen themselves. Please note that all children of the window will be deleted automatically by the destructor before the window itself is deleted which means that you don’t have to worry about deleting them manually. Please see the window deletion overview for more information. Also note that in this, and many others, wxWidgets classes some GetXXX() methods may be overloaded (as, for example, #get_size or #get_client_size). In this case, the overloads are non-virtual because having multiple virtual functions with the same name results in a virtual function name hiding at the derived class level (in English, this means that the derived class has to override all overloaded variants if it overrides any of them). To allow overriding them in the derived class, wxWidgets uses a unique protected virtual DoGetXXX() method and all GetXXX() ones are forwarded to it, so overriding the former changes the behaviour of the latter.

Styles

This class supports the following styles:

  • Border::BORDER_DEFAULT: The window class will decide the kind of border to show, if any.

  • Border::BORDER_SIMPLE: Displays a thin border around the window. SIMPLE_BORDER is the old name for this style.

  • Border::BORDER_SUNKEN: Displays a sunken border. SUNKEN_BORDER is the old name for this style.

  • Border::BORDER_RAISED: Displays a raised border. RAISED_BORDER is the old name for this style.

  • Border::BORDER_STATIC: Displays a border suitable for a static control. STATIC_BORDER is the old name for this style. Windows only.

  • Border::BORDER_THEME: Displays a native border suitable for a control, on the current platform. On Windows, this will be a themed border; on most other platforms a sunken border will be used. For more information for themed borders on Windows, please see Themed borders on Windows.

  • Border::BORDER_NONE: Displays no border, overriding the default border style for the window. NO_BORDER is the old name for this style.

  • Border::BORDER_DOUBLE: This style is obsolete and should not be used.

  • TRANSPARENT_WINDOW: The window is transparent, that is, it will not receive paint events. Windows only.

  • TAB_TRAVERSAL: This style is used by wxWidgets for the windows supporting TAB navigation among their children, such as Dialog and Panel. It should almost never be used in the application code.

  • WANTS_CHARS: Use this to indicate that the window wants to get all char/key events for all keys - even for keys like TAB or ENTER which are usually used for dialog navigation and which wouldn't be generated without this style. If you need to use this style in order to get the arrows or etc., but would still like to have normal keyboard navigation take place, you should call Navigate in response to the key events for Tab and Shift-Tab.

  • NO_FULL_REPAINT_ON_RESIZE: On Windows, this style used to disable repainting the window completely when its size is changed. Since this behaviour is now the default, the style is now obsolete and no longer has an effect.

  • VSCROLL: Use this style to enable a vertical scrollbar. Notice that this style cannot be used with native controls which don't support scrollbars nor with top-level windows in most ports.

  • HSCROLL: Use this style to enable a horizontal scrollbar. The same limitations as for VSCROLL apply to this style.

  • ALWAYS_SHOW_SB: If a window has scrollbars, disable them instead of hiding them when they are not needed (i.e. when the size of the window is big enough to not require the scrollbars to navigate it). This style is currently implemented for WXMSW, WXGTK and Universal and does nothing on the other platforms.

  • CLIP_CHILDREN: Use this style to eliminate flicker caused by the background being repainted, then children being painted over them. Windows only.

  • FULL_REPAINT_ON_RESIZE: Use this style to force a complete redraw of the window whenever it is resized instead of redrawing just the part of the window affected by resizing. Note that this was the behaviour by default before 2.5.1 release and that if you experience redraw problems with code which previously used to work you may want to try this. Currently this style applies on GTK+ 2 and Windows only, and full repainting is always done on other platforms.

Extra Styles

This class supports the following extra styles:

  • WS_EX_BLOCK_EVENTS: CommandEvents and the objects of the derived classes are forwarded to the parent window and so on recursively by default. Using this flag for the given window allows blocking this propagation at this window, i.e. prevent the events from being propagated further upwards. Dialogs have this flag on by default for the reasons explained in the Events and Event Handling.

  • WS_EX_TRANSIENT: Don't use this window as an implicit parent for the other windows: this must be used with transient windows as otherwise there is the risk of creating a dialog/frame with this window as a parent, which would lead to a crash if the parent were destroyed before the child.

  • WS_EX_CONTEXTHELP: Under Windows, puts a query button on the caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send a EVT_HELP event if the user clicked on an application window. This style cannot be used (because of the underlying native behaviour) together with MAXIMIZE_BOX or MINIMIZE_BOX, so these two styles are automatically turned off if this one is used.

  • WS_EX_PROCESS_IDLE: This window should always process idle events, even if the mode set by IdleEvent.set_mode is IdleMode::IDLE_PROCESS_SPECIFIED.

  • WS_EX_PROCESS_UI_UPDATES: This window should always process UI update events, even if the mode set by UpdateUIEvent.set_mode is UpdateUIMode::UPDATE_UI_PROCESS_SPECIFIED.

Events emitted by this class

Event handler methods for events emitted by this class:

Category: Miscellaneous Windows

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EvtHandler

add_filter, #add_pending_event, #call_after, clear_filters, #connect, #delete_pending_events, #disconnect, #evt_activate, #evt_activate_app, #evt_aui_pane_activated, #evt_aui_pane_button, #evt_aui_pane_close, #evt_aui_pane_maximize, #evt_aui_pane_restore, #evt_aui_render, #evt_auinotebook_allow_dnd, #evt_auinotebook_begin_drag, #evt_auinotebook_bg_dclick, #evt_auinotebook_button, #evt_auinotebook_drag_done, #evt_auinotebook_drag_motion, #evt_auinotebook_end_drag, #evt_auinotebook_page_changed, #evt_auinotebook_page_changing, #evt_auinotebook_page_close, #evt_auinotebook_page_closed, #evt_auinotebook_tab_middle_down, #evt_auinotebook_tab_middle_up, #evt_auinotebook_tab_right_down, #evt_auinotebook_tab_right_up, #evt_auitoolbar_begin_drag, #evt_auitoolbar_middle_click, #evt_auitoolbar_overflow_click, #evt_auitoolbar_right_click, #evt_auitoolbar_tool_dropdown, #evt_button, #evt_calculate_layout, #evt_calendar, #evt_calendar_page_changed, #evt_calendar_sel_changed, #evt_calendar_week_clicked, #evt_calendar_weekday_clicked, #evt_char, #evt_char_hook, #evt_checkbox, #evt_checklistbox, #evt_child_focus, #evt_choice, #evt_choicebook_page_changed, #evt_choicebook_page_changing, #evt_close, #evt_collapsiblepane_changed, #evt_colourpicker_changed, #evt_colourpicker_current_changed, #evt_colourpicker_dialog_cancelled, #evt_combobox, #evt_combobox_closeup, #evt_combobox_dropdown, #evt_command, #evt_command_enter, #evt_command_kill_focus, #evt_command_left_click, #evt_command_left_dclick, #evt_command_range, #evt_command_right_click, #evt_command_scroll, #evt_command_scroll_bottom, #evt_command_scroll_changed, #evt_command_scroll_linedown, #evt_command_scroll_lineup, #evt_command_scroll_pagedown, #evt_command_scroll_pageup, #evt_command_scroll_thumbrelease, #evt_command_scroll_thumbtrack, #evt_command_scroll_top, #evt_command_set_focus, #evt_context_menu, #evt_date_changed, #evt_dialup_connected, #evt_dialup_disconnected, #evt_dirctrl_fileactivated, #evt_dirctrl_selectionchanged, #evt_dirpicker_changed, #evt_display_changed, #evt_dpi_changed, #evt_drop_files, #evt_end_session, #evt_enter_window, #evt_erase_background, #evt_filectrl_fileactivated, #evt_filectrl_filterchanged, #evt_filectrl_folderchanged, #evt_filectrl_selectionchanged, #evt_filepicker_changed, #evt_find, #evt_find_close, #evt_find_next, #evt_find_replace, #evt_find_replace_all, #evt_fontpicker_changed, #evt_fullscreen, #evt_gesture_pan, #evt_gesture_rotate, #evt_gesture_zoom, #evt_grid_cell_changed, #evt_grid_cell_changing, #evt_grid_cell_left_click, #evt_grid_cell_left_dclick, #evt_grid_cell_right_click, #evt_grid_cell_right_dclick, #evt_grid_cmd_col_size, #evt_grid_cmd_editor_created, #evt_grid_cmd_range_selected, #evt_grid_cmd_range_selecting, #evt_grid_cmd_row_size, #evt_grid_col_auto_size, #evt_grid_col_move, #evt_grid_col_size, #evt_grid_col_sort, #evt_grid_editor_created, #evt_grid_editor_hidden, #evt_grid_editor_shown, #evt_grid_label_left_click, #evt_grid_label_left_dclick, #evt_grid_label_right_click, #evt_grid_label_right_dclick, #evt_grid_range_selected, #evt_grid_range_selecting, #evt_grid_row_auto_size, #evt_grid_row_move, #evt_grid_row_size, #evt_grid_select_cell, #evt_grid_tabbing, #evt_header_begin_reorder, #evt_header_begin_resize, #evt_header_click, #evt_header_dclick, #evt_header_dragging_cancelled, #evt_header_end_reorder, #evt_header_end_resize, #evt_header_middle_click, #evt_header_middle_dclick, #evt_header_resizing, #evt_header_right_click, #evt_header_right_dclick, #evt_header_separator_dclick, #evt_help, #evt_help_range, #evt_hibernate, #evt_html_cell_clicked, #evt_html_cell_hover, #evt_html_link_clicked, #evt_hyperlink, #evt_iconize, #evt_idle, #evt_init_dialog, #evt_joy_button_down, #evt_joy_button_up, #evt_joy_move, #evt_joy_zmove, #evt_joystick_events, #evt_key_down, #evt_key_up, #evt_kill_focus, #evt_leave_window, #evt_left_dclick, #evt_left_down, #evt_left_up, #evt_list_begin_drag, #evt_list_begin_label_edit, #evt_list_begin_rdrag, #evt_list_cache_hint, #evt_list_col_begin_drag, #evt_list_col_click, #evt_list_col_dragging, #evt_list_col_end_drag, #evt_list_col_right_click, #evt_list_delete_all_items, #evt_list_delete_item, #evt_list_end_label_edit, #evt_list_insert_item, #evt_list_item_activated, #evt_list_item_checked, #evt_list_item_deselected, #evt_list_item_focused, #evt_list_item_middle_click, #evt_list_item_right_click, #evt_list_item_selected, #evt_list_item_unchecked, #evt_list_key_down, #evt_listbook_page_changed, #evt_listbook_page_changing, #evt_listbox, #evt_listbox_dclick, #evt_long_press, #evt_magnify, #evt_maximize, #evt_media_finished, #evt_media_loaded, #evt_media_pause, #evt_media_play, #evt_media_statechanged, #evt_media_stop, #evt_menu, #evt_menu_close, #evt_menu_highlight, #evt_menu_highlight_all, #evt_menu_open, #evt_menu_range, #evt_middle_dclick, #evt_middle_down, #evt_middle_up, #evt_motion, #evt_mouse_aux1_dclick, #evt_mouse_aux1_down, #evt_mouse_aux1_up, #evt_mouse_aux2_dclick, #evt_mouse_aux2_down, #evt_mouse_aux2_up, #evt_mouse_capture_changed, #evt_mouse_capture_lost, #evt_mouse_events, #evt_mousewheel, #evt_move, #evt_move_end, #evt_move_start, #evt_moving, #evt_navigation_key, #evt_notebook_page_changed, #evt_notebook_page_changing, #evt_paint, #evt_pg_changed, #evt_pg_changing, #evt_pg_col_begin_drag, #evt_pg_col_dragging, #evt_pg_col_end_drag, #evt_pg_double_click, #evt_pg_highlighted, #evt_pg_item_collapsed, #evt_pg_item_expanded, #evt_pg_label_edit_begin, #evt_pg_label_edit_ending, #evt_pg_page_changed, #evt_pg_right_click, #evt_pg_selected, #evt_press_and_tap, #evt_query_end_session, #evt_query_layout_info, #evt_radiobox, #evt_radiobutton, #evt_ribbonbar_help_click, #evt_ribbonbar_page_changed, #evt_ribbonbar_page_changing, #evt_ribbonbar_tab_left_dclick, #evt_ribbonbar_tab_middle_down, #evt_ribbonbar_tab_middle_up, #evt_ribbonbar_tab_right_down, #evt_ribbonbar_tab_right_up, #evt_ribbonbar_toggled, #evt_ribbonbuttonbar_clicked, #evt_ribbonbuttonbar_dropdown_clicked, #evt_ribbongallery_clicked, #evt_ribbongallery_hover_changed, #evt_ribbongallery_selected, #evt_ribbonpanel_extbutton_activated, #evt_ribbontoolbar_clicked, #evt_ribbontoolbar_dropdown_clicked, #evt_richtext_buffer_reset, #evt_richtext_character, #evt_richtext_consuming_character, #evt_richtext_content_deleted, #evt_richtext_content_inserted, #evt_richtext_delete, #evt_richtext_focus_object_changed, #evt_richtext_left_click, #evt_richtext_left_dclick, #evt_richtext_middle_click, #evt_richtext_properties_changed, #evt_richtext_return, #evt_richtext_right_click, #evt_richtext_selection_changed, #evt_richtext_style_changed, #evt_richtext_stylesheet_changed, #evt_richtext_stylesheet_replaced, #evt_richtext_stylesheet_replacing, #evt_right_dclick, #evt_right_down, #evt_right_up, #evt_sash_dragged, #evt_sash_dragged_range, #evt_scroll, #evt_scroll_bottom, #evt_scroll_changed, #evt_scroll_command, #evt_scroll_linedown, #evt_scroll_lineup, #evt_scroll_pagedown, #evt_scroll_pageup, #evt_scroll_thumbrelease, #evt_scroll_thumbtrack, #evt_scroll_top, #evt_scrollbar, #evt_scrollwin, #evt_scrollwin_bottom, #evt_scrollwin_linedown, #evt_scrollwin_lineup, #evt_scrollwin_pagedown, #evt_scrollwin_pageup, #evt_scrollwin_thumbrelease, #evt_scrollwin_thumbtrack, #evt_scrollwin_top, #evt_search, #evt_search_cancel, #evt_set_cursor, #evt_set_focus, #evt_show, #evt_size, #evt_slider, #evt_spin, #evt_spin_down, #evt_spin_up, #evt_spinctrl, #evt_spinctrldouble, #evt_splitter_dclick, #evt_splitter_sash_pos_changed, #evt_splitter_sash_pos_changing, #evt_splitter_sash_pos_resize, #evt_splitter_unsplit, #evt_stc_autocomp_cancelled, #evt_stc_autocomp_char_deleted, #evt_stc_autocomp_completed, #evt_stc_autocomp_selection, #evt_stc_autocomp_selection_change, #evt_stc_calltip_click, #evt_stc_change, #evt_stc_charadded, #evt_stc_clipboard_copy, #evt_stc_clipboard_paste, #evt_stc_do_drop, #evt_stc_doubleclick, #evt_stc_drag_over, #evt_stc_dwellend, #evt_stc_dwellstart, #evt_stc_hotspot_click, #evt_stc_hotspot_dclick, #evt_stc_hotspot_release_click, #evt_stc_indicator_click, #evt_stc_indicator_release, #evt_stc_macrorecord, #evt_stc_margin_right_click, #evt_stc_marginclick, #evt_stc_modified, #evt_stc_needshown, #evt_stc_painted, #evt_stc_romodifyattempt, #evt_stc_savepointleft, #evt_stc_savepointreached, #evt_stc_start_drag, #evt_stc_styleneeded, #evt_stc_updateui, #evt_stc_userlistselection, #evt_stc_zoom, #evt_sys_colour_changed, #evt_taskbar_click, #evt_taskbar_left_dclick, #evt_taskbar_left_down, #evt_taskbar_left_up, #evt_taskbar_move, #evt_taskbar_right_dclick, #evt_taskbar_right_down, #evt_taskbar_right_up, #evt_text, #evt_text_copy, #evt_text_cut, #evt_text_enter, #evt_text_maxlen, #evt_text_paste, #evt_text_url, #evt_time_changed, #evt_timer, #evt_togglebutton, #evt_tool, #evt_tool_dropdown, #evt_tool_enter, #evt_tool_range, #evt_tool_rclicked, #evt_tool_rclicked_range, #evt_toolbook_page_changed, #evt_toolbook_page_changing, #evt_tree_begin_drag, #evt_tree_begin_label_edit, #evt_tree_begin_rdrag, #evt_tree_delete_item, #evt_tree_end_drag, #evt_tree_end_label_edit, #evt_tree_get_info, #evt_tree_item_activated, #evt_tree_item_collapsed, #evt_tree_item_collapsing, #evt_tree_item_expanded, #evt_tree_item_expanding, #evt_tree_item_gettooltip, #evt_tree_item_menu, #evt_tree_item_middle_click, #evt_tree_item_right_click, #evt_tree_key_down, #evt_tree_sel_changed, #evt_tree_sel_changing, #evt_tree_set_info, #evt_tree_state_image_click, #evt_treebook_node_collapsed, #evt_treebook_node_expanded, #evt_treebook_page_changed, #evt_treebook_page_changing, #evt_two_finger_tap, #evt_update_ui, #evt_update_ui_range, #evt_window_create, #evt_window_destroy, #evt_wizard_before_page_changed, #evt_wizard_cancel, #evt_wizard_finished, #evt_wizard_help, #evt_wizard_page_changed, #evt_wizard_page_changing, #evt_wizard_page_shown, #get_client_object, #get_evt_handler_enabled, #get_next_handler, #get_previous_handler, #is_unlinked, #process_event, #process_event_locally, #process_pending_events, #queue_event, register_class, remove_filter, #safely_process_event, #set_client_object, #set_evt_handler_enabled, #try_after, #try_before, #unlink

Methods inherited from Object

#is_same_as, #un_share

Constructor Details

#initializeWx::Window #initialize(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = 0, name = Wx::PANEL_NAME_STR) ⇒ Wx::Window

Returns a new instance of Window.

Overloads:

  • #initializeWx::Window

    Default constructor.

  • #initialize(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = 0, name = Wx::PANEL_NAME_STR) ⇒ Wx::Window

    Constructs a window, which can be a child of a frame, dialog or any other non-control window.

    Parameters:

    • parent (Wx::Window)

      Pointer to a parent window.

    • id (Integer)

      Window identifier. If StandardID::ID_ANY, will automatically create an identifier. See Window IDs for more information about IDs.

    • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)

      Window position. DEFAULT_POSITION indicates that wxWidgets should generate a default position for the window. If using the Wx::Window class directly, supply an actual position.

    • size (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)

      Window size. DEFAULT_SIZE indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized.

    • style (Integer) (defaults to: 0)

      Window style. For generic window styles, please see Wx::Window.

    • name (String) (defaults to: Wx::PANEL_NAME_STR)

      Window name.



2756
# File 'lib/wx/doc/gen/window.rb', line 2756

def initialize(*args) end

Class Method Details

.find_focusWx::Window

Finds the window or control which currently has the keyboard focus.

Remark:

Note that this is a static function, so it can be called without needing a Wx::Window pointer.

Returns:

See Also:



2673
# File 'lib/wx/doc/gen/window.rb', line 2673

def self.find_focus; end

.find_window_by_id(id, parent = 0) ⇒ Wx::Window

Find the first window with the given id.

If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.

Window with the given id or NULL if not found.

Parameters:

  • id (Integer)
  • parent (Wx::Window) (defaults to: 0)

Returns:

See Also:

  • find_window


2684
# File 'lib/wx/doc/gen/window.rb', line 2684

def self.find_window_by_id(id, parent=0) end

.find_window_by_label(label, parent = 0) ⇒ Wx::Window

Find a window by its label.

Depending on the type of window, the label may be a window title or panel item label. If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases and, unlike with find_window, recurses into top level child windows too.

Window with the given label or NULL if not found.

Parameters:

  • label (String)
  • parent (Wx::Window) (defaults to: 0)

Returns:

See Also:

  • find_window


2696
# File 'lib/wx/doc/gen/window.rb', line 2696

def self.find_window_by_label(label, parent=0) end

.find_window_by_name(name, parent = 0) ⇒ Wx::Window

Find a window by its name (as given in a window constructor or #create function call).

If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases and, unlike find_window, recurses into top level child windows too. If no window with such name is found, find_window_by_label is called, i.e. the name is interpreted as (internal) name first but if this fails, it’s internal as (user-visible) label. As this behaviour may be confusing, it is usually better to use either the find_window overload taking the name or find_window_by_label directly. Window with the given name or NULL if not found.

Parameters:

  • name (String)
  • parent (Wx::Window) (defaults to: 0)

Returns:



2707
# File 'lib/wx/doc/gen/window.rb', line 2707

def self.find_window_by_name(name, parent=0) end

.self.from_dip(sz, w) ⇒ Wx::Size .self.from_dip(pt, w) ⇒ Wx::Point .self.from_dip(d, w) ⇒ Integer

Overloads:

  • .self.from_dip(sz, w) ⇒ Wx::Size

    Non window-specific DPI-independent pixels conversion functions.

    The display resolution depends on the window in general as different windows can appear on different monitors using different resolutions, however sometimes no window is available for converting the resolution independent pixels to the physical values and in this case these static overloads can be used with NULL value for w argument. Using these methods is discouraged as passing NULL will prevent your application from correctly supporting monitors with different resolutions even in the future wxWidgets versions which will add support for them, and passing non-NULL window is just a less convenient way of calling the non-static from_dip method.

    Parameters:

    Returns:

  • .self.from_dip(pt, w) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • .self.from_dip(d, w) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Integer)


676
# File 'lib/wx/doc/gen/window.rb', line 676

def self.from_dip(*args) end

.self.from_phys(sz, w) ⇒ Wx::Size .self.from_phys(pt, w) ⇒ Wx::Point .self.from_phys(d, w) ⇒ Integer

Overloads:

  • .self.from_phys(sz, w) ⇒ Wx::Size

    Convert from physical pixels to logical pixels for any window.

    This function can be used without any window pointer, i.e. w can be NULL. In this case, it uses the content scale factor of the main screen if supported or just does nothing (i.e. uses scale factor of 1) otherwise. Using member overloads is always preferable, if possible, as they always use the actually appropriate content scale factor.

    Parameters:

    Returns:

  • .self.from_phys(pt, w) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • .self.from_phys(d, w) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Integer)


761
# File 'lib/wx/doc/gen/window.rb', line 761

def self.from_phys(*args) end

.get_captureWx::Window

Returns the currently captured window.



2718
# File 'lib/wx/doc/gen/window.rb', line 2718

def self.get_capture; end

.get_class_default_attributes(variant = Wx::WindowVariant::WINDOW_VARIANT_NORMAL) ⇒ Wx::VisualAttributes

Returns the default font and colours which are used by the control.

This is useful if you want to use the same font or colour in your own control as in a standard control which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the users system, especially if it uses themes. The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See #set_window_variant for more about this. This static method is “overridden” in many derived classes and so calling, for example, Button#get_class_default_attributes will typically return the values appropriate for a button which will be normally different from those returned by, say, ListCtrl#get_class_default_attributes. The VisualAttributes structure has at least the fields font, colFg and colBg. All of them may be invalid if it was not possible to determine the default control appearance or, especially for the background colour, if the field doesn’t make sense as is the case for colBg for the controls with themed background.

Parameters:

  • variant (Wx::WindowVariant) (defaults to: Wx::WindowVariant::WINDOW_VARIANT_NORMAL)

Returns:

See Also:



2661
# File 'lib/wx/doc/gen/window.rb', line 2661

def self.get_class_default_attributes(variant=Wx::WindowVariant::WINDOW_VARIANT_NORMAL) end

.new_control_id(count = 1) ⇒ Integer

Create a new ID or range of IDs that are not currently in use.

The IDs will be reserved until assigned to a Wx::Window ID or unreserved with unreserve_control_id. See Window IDs for more information.

Returns the ID or the first ID of the range (i.e. the most negative), or StandardID::ID_NONE if the specified number of identifiers couldn’t be allocated.

Parameters:

  • count (Integer) (defaults to: 1)

    The number of sequential IDs to reserve.

Returns:

  • (Integer)

See Also:



2731
# File 'lib/wx/doc/gen/window.rb', line 2731

def self.new_control_id(count=1) end

.self.to_dip(sz, w) ⇒ Wx::Size .self.to_dip(pt, w) ⇒ Wx::Point .self.to_dip(d, w) ⇒ Integer

Overloads:

  • .self.to_dip(sz, w) ⇒ Wx::Size

    Non window-specific pixel to DPI-independent pixels conversion functions.

    The display resolution depends on the window in general as different windows can appear on different monitors using different resolutions, however sometimes no window is available for converting the resolution independent pixels to the physical values and in this case these static overloads can be used with NULL value for w argument. Using these methods is discouraged as passing NULL will prevent your application from correctly supporting monitors with different resolutions even in the future wxWidgets versions which will add support for them, and passing non-NULL window is just a less convenient way of calling the non-static to_dip method.

    Parameters:

    Returns:

  • .self.to_dip(pt, w) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • .self.to_dip(d, w) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Integer)


721
# File 'lib/wx/doc/gen/window.rb', line 721

def self.to_dip(*args) end

.self.to_phys(sz, w) ⇒ Wx::Size .self.to_phys(pt, w) ⇒ Wx::Point .self.to_phys(d, w) ⇒ Integer

Overloads:

  • .self.to_phys(sz, w) ⇒ Wx::Size

    Convert from logical pixels to physical pixels for any window.

    This function can be used without any window pointer, i.e. w can be NULL. In this case, it uses the content scale factor of the main screen if supported or just does nothing (i.e. uses scale factor of 1) otherwise. Using member overloads is always preferable, if possible, as they always use the actually appropriate content scale factor.

    Parameters:

    Returns:

  • .self.to_phys(pt, w) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • .self.to_phys(d, w) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Integer)


797
# File 'lib/wx/doc/gen/window.rb', line 797

def self.to_phys(*args) end

.unreserve_control_id(id, count = 1) ⇒ void

This method returns an undefined value.

Unreserve an ID or range of IDs that was reserved by new_control_id.

See Window IDs for more information.

Parameters:

  • id (Integer)

    The starting ID of the range of IDs to unreserve.

  • count (Integer) (defaults to: 1)

    The number of sequential IDs to unreserve.

See Also:



2742
# File 'lib/wx/doc/gen/window.rb', line 2742

def self.unreserve_control_id(id, count=1) end

Instance Method Details

#accepts_focusBoolean

This method may be overridden in the derived classes to return false to indicate that this control doesn’t accept input at all (i.e. behaves like e.g. StaticText) and so doesn’t need focus.

Returns:

  • (Boolean)

See Also:



273
# File 'lib/wx/doc/gen/window.rb', line 273

def accepts_focus; end

#accepts_focus_from_keyboardBoolean

This method may be overridden in the derived classes to return false to indicate that while this control can, in principle, have focus if the user clicks it with the mouse, it shouldn’t be included in the TAB traversal chain when using the keyboard.

Returns:

  • (Boolean)


277
# File 'lib/wx/doc/gen/window.rb', line 277

def accepts_focus_from_keyboard; end

#accepts_focus_recursivelyBoolean

Overridden to indicate whether this window or one of its children accepts focus.

Usually it’s the same as #accepts_focus but is overridden for container windows.

Returns:

  • (Boolean)


283
# File 'lib/wx/doc/gen/window.rb', line 283

def accepts_focus_recursively; end

#add_child(child) ⇒ void

This method returns an undefined value.

Adds a child window.

This is called automatically by window creation functions so should not be required by the application programmer. Notice that this function is mostly internal to wxWidgets and shouldn’t be called by the user code.

Parameters:



356
# File 'lib/wx/doc/gen/window.rb', line 356

def add_child(child) end

#adjust_for_layout_direction(x, width, widthTotal) ⇒ Integer

Mirror coordinates for RTL layout if this window uses it and if the mirroring is not done automatically like Win32.

Parameters:

  • x (Integer)
  • width (Integer)
  • widthTotal (Integer)

Returns:

  • (Integer)


2192
# File 'lib/wx/doc/gen/window.rb', line 2192

def adjust_for_layout_direction(x, width, widthTotal) end

#always_show_scrollbars(hflag = true, vflag = true) ⇒ void

This method returns an undefined value.

Call this function to force one or both scrollbars to be always shown, even if the window is big enough to show its entire contents without scrolling.

Remark:

This function is currently not implemented.

Parameters:

  • hflag (Boolean) (defaults to: true)

    Whether the horizontal scroll bar should always be visible.

  • vflag (Boolean) (defaults to: true)

    Whether the vertical scroll bar should always be visible.



431
# File 'lib/wx/doc/gen/window.rb', line 431

def always_show_scrollbars(hflag=true, vflag=true) end

#begin_repositioning_childrenBoolean

Prepare for changing positions of multiple child windows.

This method should be called before changing positions of multiple child windows to reduce flicker and, in MSW case, even avoid display corruption in some cases. It is used internally by wxWidgets and called automatically when the window size changes but it can also be useful to call it from outside of the library if a repositioning involving multiple children is done without changing the window size. If this method returns true, then #end_repositioning_children must be called after setting all children positions. Use ChildrenRepositioningGuard class to ensure that this requirement is satisfied.

Returns:

  • (Boolean)


586
# File 'lib/wx/doc/gen/window.rb', line 586

def begin_repositioning_children; end

#cache_best_size(size) ⇒ void

This method returns an undefined value.

Sets the cached best size value.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



600
# File 'lib/wx/doc/gen/window.rb', line 600

def cache_best_size(size) end

#can_accept_focusBoolean Also known as: can_accept_focus?

Can this window have focus right now?

If this method returns true, it means that calling #set_focus will put focus either to this window or one of its children, if you need to know whether this window accepts focus itself, use #is_focusable

Returns:

  • (Boolean)


300
# File 'lib/wx/doc/gen/window.rb', line 300

def can_accept_focus; end

#can_accept_focus_from_keyboardBoolean Also known as: can_accept_focus_from_keyboard?

Can this window be assigned focus from keyboard right now?

Returns:

  • (Boolean)


305
# File 'lib/wx/doc/gen/window.rb', line 305

def can_accept_focus_from_keyboard; end

#can_scroll(orient) ⇒ Boolean Also known as: can_scroll?

Returns true if this window can have a scroll bar in this orientation.

Parameters:

Returns:

  • (Boolean)


463
# File 'lib/wx/doc/gen/window.rb', line 463

def can_scroll(orient) end

#can_set_transparentBoolean Also known as: can_set_transparent?

Returns true if the system supports transparent windows and calling #set_transparent may succeed.

If this function returns false, transparent windows are definitely not supported by the current system.

Returns:

  • (Boolean)


1681
# File 'lib/wx/doc/gen/window.rb', line 1681

def can_set_transparent; end

#capture_mousevoid

This method returns an undefined value.

Directs all mouse input to this window.

Call #release_mouse to release the capture. Note that wxWidgets maintains the stack of windows having captured the mouse and when the mouse is released the capture returns to the window which had had captured it previously and it is only really released if there were no previous window. In particular, this means that you must release the mouse as many times as you capture it, unless the window receives the MouseCaptureLostEvent event. Any application which captures the mouse in the beginning of some operation must handle MouseCaptureLostEvent and cancel this operation when it receives the event. The event handler must not recapture mouse.



2407
# File 'lib/wx/doc/gen/window.rb', line 2407

def capture_mouse; end

#center(dir = Wx::Orientation::BOTH) ⇒ void

This method returns an undefined value.

A synonym for #centre.

Parameters:

  • dir (Integer) (defaults to: Wx::Orientation::BOTH)


1178
# File 'lib/wx/doc/gen/window.rb', line 1178

def center(dir=Wx::Orientation::BOTH) end

#center_on_parent(dir = Wx::Orientation::BOTH) ⇒ void

This method returns an undefined value.

A synonym for #centre_on_parent.

Parameters:

  • dir (Integer) (defaults to: Wx::Orientation::BOTH)


1183
# File 'lib/wx/doc/gen/window.rb', line 1183

def center_on_parent(dir=Wx::Orientation::BOTH) end

#centre(direction = Wx::Orientation::BOTH) ⇒ void

This method returns an undefined value.

Centres the window.

Remark:

If the window is a top level one (i.e. doesn't have a parent), it will be centred relative to the screen anyhow.

Parameters:

  • direction (Integer) (defaults to: Wx::Orientation::BOTH)

    Specifies the direction for the centring. May be Orientation::HORIZONTAL, Orientation::VERTICAL or Orientation::BOTH. It may also include the CENTRE_ON_SCREEN flag if you want to centre the window on the entire screen and not on its parent window.

See Also:



1195
# File 'lib/wx/doc/gen/window.rb', line 1195

def centre(direction=Wx::Orientation::BOTH) end

#centre_on_parent(direction = Wx::Orientation::BOTH) ⇒ void

This method returns an undefined value.

Centres the window on its parent.

This is a more readable synonym for #centre.

Remark:

This methods provides for a way to centre top level windows over their parents instead of the entire screen. If there is no parent or if the window is not a top level window, then behaviour is the same as #centre.

Parameters:

See Also:



1209
# File 'lib/wx/doc/gen/window.rb', line 1209

def centre_on_parent(direction=Wx::Orientation::BOTH) end

#clear_backgroundvoid

This method returns an undefined value.

Clears the window by filling it with the current background colour.

Does not cause an erase background event to be generated. Notice that this uses ClientDC to draw on the window and the results of doing it while also drawing on PaintDC for this window are undefined. Hence this method shouldn’t be used from EVT_PAINT handlers, just use DC#clear on the PaintDC you already use there instead.



1349
# File 'lib/wx/doc/gen/window.rb', line 1349

def clear_background; end

#client_to_screen(pt) ⇒ Wx::Point

Converts to screen coordinates from coordinates relative to this window.

Parameters:

  • pt (Array(Integer, Integer), Wx::Point)

    The client position for the second form of the function.

Returns:



1299
# File 'lib/wx/doc/gen/window.rb', line 1299

def client_to_screen(pt) end

#client_to_window_size(size) ⇒ Wx::Size

Converts client area size size to corresponding window size.

In other words, the returned value is what would #get_size return if this window had client area of given size. Components with DEFAULT_COORD value are left unchanged. Note that the conversion is not always exact, it assumes that non-client area doesn’t change and so doesn’t take into account things like menu bar (un)wrapping or (dis)appearance of the scrollbars.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

Returns:

See Also:



608
# File 'lib/wx/doc/gen/window.rb', line 608

def client_to_window_size(size) end

#close(force = false) ⇒ Boolean

This function simply generates a CloseEvent whose handler usually tries to close the window.

It doesn’t close the window itself, however.

true if the event was handled and not vetoed, false otherwise.

Remark:

Close calls the close handler for the window, providing an opportunity for the window to choose whether to destroy the window. Usually it is only used with the top level windows (Frame and Dialog classes) as the others are not supposed to have any special OnClose() logic. The close handler should check whether the window is being deleted forcibly, using CloseEvent#can_veto, in which case it should destroy the window using #destroy. Note that calling Close does not guarantee that the window will be destroyed; but it provides a way to simulate a manual close of a window, which may or may not be implemented by destroying the window. The default implementation of Dialog::OnCloseWindow does not necessarily delete the dialog, since it will simply simulate a StandardID::ID_CANCEL event which is handled by the appropriate button event handler and may do anything at all. To guarantee that the window will be destroyed, call #destroy instead

Parameters:

  • force (Boolean) (defaults to: false)

    false if the window’s close handler should be able to veto the destruction of this window, true if it cannot.

Returns:

  • (Boolean)

See Also:



2291
# File 'lib/wx/doc/gen/window.rb', line 2291

def close(force=false) end

#convert_dialog_to_pixels(pt) ⇒ Wx::Point #convert_dialog_to_pixels(sz) ⇒ Wx::Size

Overloads:

  • #convert_dialog_to_pixels(pt) ⇒ Wx::Point

    Converts a point or size from dialog units to pixels.

    For the x dimension, the dialog units are multiplied by the average character width and then divided by 4. For the y dimension, the dialog units are multiplied by the average character height and then divided by 8.

    Remark:

    Dialog units are used for maintaining a dialog's proportions even if the font changes. You can also use these functions programmatically.

    Parameters:

    Returns:

    See Also:

  • #convert_dialog_to_pixels(sz) ⇒ Wx::Size

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:



1318
# File 'lib/wx/doc/gen/window.rb', line 1318

def convert_dialog_to_pixels(*args) end

#convert_pixels_to_dialog(pt) ⇒ Wx::Point #convert_pixels_to_dialog(sz) ⇒ Wx::Size

Overloads:

  • #convert_pixels_to_dialog(pt) ⇒ Wx::Point

    Converts a point or size from pixels to dialog units.

    For the x dimension, the pixels are multiplied by 4 and then divided by the average character width. For the y dimension, the pixels are multiplied by 8 and then divided by the average character height.

    Remark:

    Dialog units are used for maintaining a dialog's proportions even if the font changes.

    Parameters:

    Returns:

    See Also:

  • #convert_pixels_to_dialog(sz) ⇒ Wx::Size

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:



1337
# File 'lib/wx/doc/gen/window.rb', line 1337

def convert_pixels_to_dialog(*args) end

#create(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = 0, name = Wx::PANEL_NAME_STR) ⇒ Boolean

Construct the actual window object after creating the C++ object.

The non-default constructor of Wx::Window class does two things: it initializes the C++ object and it also creates the window object in the underlying graphical toolkit. The #create method can be used to perform the second part later, while the default constructor can be used to perform the first part only. Please note that the underlying window must be created exactly once, i.e. if you use the default constructor, which doesn’t do this, you must call #create before using the window and if you use the non-default constructor, you can not call #create, as the underlying window is already created. Note that it is possible and, in fact, useful, to call some methods on the object between creating the C++ object itself and calling #create on it, e.g. a common pattern to avoid showing the contents of a window before it is fully initialized is:

panel = Wx::Panel.new   # Note: default constructor used.
  panel.hide  # Can be called before actually creating it.
  panel.create(parent, Wx::ID_ANY, ...)   # Won't be shown yet.
  ... create all the panel children ...
  panel.show  # Now everything will be shown at once.

Also note that it is possible to create an object of a derived type and then call #create on it:

# Suppose we have this function (which would typically be in a
  # different file from the rest of the code).
  def my_create_window_object_function
     MyCustomClassDerivingFromWindow.new
  end
  
  # Then we can create a window of MyCustomClassDerivingFromWindow
  # class without really knowing about this type, as we would have
  # to do if we wanted to use the non-default constructor, like this:
  
  # First create the C++ object using the factory function.
  window = my_create_window_object_function
  
  # And now create the underlying window.
  #
  # This should call the base Wx::Window#create.
  # In C++ (wxWidgets) this method is not virtual and cannot be overloaded
  # so the derived class can't customize this part.
  # In wxRuby however this method can be overloaded as long as the following
  # is kept in mind:
  # 1. the overloaded version will **NOT** be called when using a non-default
  #    constructor (Create will than be called from C++ which will always be 
  #    the base Wx::Window version);
  # 2. when calling the overloaded version from Ruby understand that the window
  #    will not actually be created until after the `super` version has been called.
  # In general it's best not to overload this method but to define a different method
  # if a custom initializer is needed.
  window.create(parent, Wx::ID_ANY, ...)

This is notably used by XML Based Resource System (XRC). The parameters of this method have exactly the same meaning as the non-default constructor parameters, please refer to them for their description. true if window creation succeeded or false if it failed

Parameters:

  • parent (Wx::Window)
  • id (Integer)
  • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)
  • size (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)
  • style (Integer) (defaults to: 0)
  • name (String) (defaults to: Wx::PANEL_NAME_STR)

Returns:

  • (Boolean)


2812
# File 'lib/wx/doc/gen/window.rb', line 2812

def create(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::PANEL_NAME_STR) end

#destroyBoolean

Destroys the window safely.

Use this function instead of the delete operator, since different window classes can be destroyed differently. Frames and dialogs are not destroyed immediately when this function is called they are added to a list of windows to be deleted on idle time, when all the window’s events have been processed. This prevents problems with events being sent to non-existent windows. true if the window has either been successfully deleted, or it has been added to the list of windows pending real deletion.

Returns:

  • (Boolean)


2298
# File 'lib/wx/doc/gen/window.rb', line 2298

def destroy; end

#destroy_childrenBoolean

Destroys all children of a window.

Called automatically by the destructor.

Returns:

  • (Boolean)


362
# File 'lib/wx/doc/gen/window.rb', line 362

def destroy_children; end

#disableBoolean

Disables the window.

Same as #enable Enable(false). Returns true if the window has been disabled, false if it had been already disabled before the call to this function.

Returns:

  • (Boolean)


1962
# File 'lib/wx/doc/gen/window.rb', line 1962

def disable; end

#disable_focus_from_keyboardvoid

This method returns an undefined value.

Disable giving focus to this window using the keyboard navigation keys.

Pressing TAB key will skip this window if this function was called on it, but it will still be possible to focus it by clicking on it with a pointing device.



289
# File 'lib/wx/doc/gen/window.rb', line 289

def disable_focus_from_keyboard; end

#do_update_window_ui(event) ⇒ void

This method returns an undefined value.

Does the window-specific updating after processing the update event.

This function is called by #update_window_ui in order to check return values in the UpdateUIEvent and act appropriately. For example, to allow frame and dialog title updating, wxWidgets implements this function as follows:

# do the window-specific processing after processing the update event
  def Wx::TopLevelWindow.do_update_window_ui(event)
    if event.get_set_enabled
      enable(event.get_enabled)
    end
  
    if event.get_set_text
      if event.get_text != get_title
        set_title(event.get_text)
      end
    end
  end

Parameters:



2530
# File 'lib/wx/doc/gen/window.rb', line 2530

def do_update_window_ui(event) end

#drag_accept_files(accept) ⇒ void

This method returns an undefined value.

Enables or disables eligibility for drop file events (OnDropFiles).

Remark:

Windows only until version 2.8.9, available on all platforms since 2.8.10. Cannot be used together with #set_drop_target on non-Windows platforms.

Parameters:

  • accept (Boolean)

    If true, the window is eligible for drop file events. If false, the window will not accept drop file events.

See Also:



2337
# File 'lib/wx/doc/gen/window.rb', line 2337

def drag_accept_files(accept) end

#each_child {|child| ... } ⇒ Object, Enumerator

Yield each child window to the given block. Returns an Enumerator if no block given.

Yield Parameters:

Returns:

  • (Object, Enumerator)

    last result of block or Enumerator if no block given.



61
# File 'lib/wx/doc/window.rb', line 61

def each_child; end

#enable(enable = true) ⇒ Boolean

Enable or disable the window for user input.

Note that when a parent window is disabled, all of its children are disabled as well and they are re-enabled again when the parent is. A window can be created initially disabled by calling this method on it before calling #create to create the actual underlying window, e.g.

w = MyWindow.new # Note: default ctor is used here.
  w.enable(false)
  w.create(parent, ... all the usual non-default ctor arguments ...)

Returns true if the window has been enabled or disabled, false if nothing was done, i.e. if the window had already been in the specified state.

Parameters:

  • enable (Boolean) (defaults to: true)

    If true, enables the window for input. If false, disables the window.

Returns:

  • (Boolean)

See Also:



1980
# File 'lib/wx/doc/gen/window.rb', line 1980

def enable(enable=true) end

#enable_touch_events(eventsMask) ⇒ Boolean

Request generation of touch events for this window.

Each call to this function supersedes the previous ones, i.e. if you want to receive events for both zoom and rotate gestures, you need to call

enable_touch_events(Wx::TOUCH_ZOOM_GESTURE | Wx::TOUCH_ROTATE_GESTURE)

instead of calling it twice in a row as the second call would disable the first gesture.

true if the specified events were enabled or false if the current platform doesn’t support touch events.

Parameters:

Returns:

  • (Boolean)


2484
# File 'lib/wx/doc/gen/window.rb', line 2484

def enable_touch_events(eventsMask) end

#enable_visible_focus(enable) ⇒ void

This method returns an undefined value.

Enables or disables visible indication of keyboard focus.

By default, controls behave in platform-appropriate way and show focus in the same way native applications do. In some very rare circumstances it may be desirable to change the default (notably multiline text controls don’t normally have a focus indicator on Mac), which this method allows. It should only be used if you have a good understanding of the native platform’s guidelines and user expectations. This method is only implemented on Mac.

Parameters:

  • enable (Boolean)


333
# File 'lib/wx/doc/gen/window.rb', line 333

def enable_visible_focus(enable) end

#end_repositioning_childrenvoid

This method returns an undefined value.

Fix child window positions after setting all of them at once.

This method must be called if and only if the previous call to #begin_repositioning_children returned true.



592
# File 'lib/wx/doc/gen/window.rb', line 592

def end_repositioning_children; end

#find_window_by_id(id) ⇒ Wx::Window

Find the first child window with the given id recursively in the window hierarchy of this window.

Window with the given id or nil if not found.

Parameters:

  • id (Integer)

Returns:

See Also:



73
# File 'lib/wx/doc/window.rb', line 73

def find_window_by_id(id) end

#find_window_by_label(label) ⇒ Wx::Window

Find the first child window with the given label recursively in the window hierarchy of this window.

Window with the given label or nil if not found.

Parameters:

  • label (String)

Returns:

See Also:



81
# File 'lib/wx/doc/window.rb', line 81

def find_window_by_label(label) end

#find_window_by_name(name) ⇒ Wx::Window

Find the first child window with the given name (as given in a window constructor or #create function call) recursively in the window hierarchy of this window.

Window with the given name or nil if not found.

Parameters:

  • name (String)

Returns:



88
# File 'lib/wx/doc/window.rb', line 88

def find_window_by_name(name) end

#fitvoid

This method returns an undefined value.

Sizes the window to fit its best size.

Using this function is equivalent to setting window size to the return value of #get_best_size. Note that, unlike #set_sizer_and_fit, this function only changes the current window size and doesn’t change its minimal size.

See Also:



625
# File 'lib/wx/doc/gen/window.rb', line 625

def fit; end

#fit_insidevoid

This method returns an undefined value.

Similar to #fit, but sizes the interior (virtual) size of a window.

Mainly useful with scrolled windows to reset scrollbars after sizing changes that do not trigger a size event, and/or scrolled windows without an interior sizer. This function similarly won’t do anything if there are no subwindows.



631
# File 'lib/wx/doc/gen/window.rb', line 631

def fit_inside; end

#freezevoid

This method returns an undefined value.

Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all.

#thaw must be called to re-enable window redrawing. Calls to these two functions may be nested but to ensure that the window is properly repainted again, you must thaw it exactly as many times as you froze it. If the window has any children, they are recursively frozen too. This method is useful for visual appearance optimization (for example, it is a good idea to use it before doing many large text insertions in a row into a TextCtrl under WXGTK) but is not implemented on all platforms nor for all controls so it is mostly just a hint to wxWidgets and not a mandatory directive.

See Also:



1360
# File 'lib/wx/doc/gen/window.rb', line 1360

def freeze; end

#from_dip(sz) ⇒ Wx::Size #from_dip(pt) ⇒ Wx::Point #from_dip(d) ⇒ Integer

Overloads:

  • #from_dip(sz) ⇒ Wx::Size

    Convert DPI-independent pixel values to the value in pixels appropriate for the current toolkit.

    A DPI-independent pixel is just a pixel at the standard 96 DPI resolution. To keep the same physical size at higher resolution, the physical pixel value must be scaled by #get_dpi_scale_factor but this scaling may be already done by the underlying toolkit (GTK+, Cocoa, …) automatically. This method performs the conversion only if it is not already done by the lower level toolkit and so by using it with pixel values you can guarantee that the physical size of the corresponding elements will remain the same in all resolutions under all platforms. For example, instead of creating a bitmap of the hard coded size of 32 pixels you should use

    bmp = Wx::Bitmap.new(from_dip(Wx::Size.new(32, 32)))
    

    to avoid using tiny bitmaps on high DPI screens. Notice that this function is only needed when using hard coded pixel values. It is not necessary if the sizes are already based on the DPI-independent units such as dialog units or if you are relying on the controls automatic best size determination and using sizers to lay out them. Also note that if either component of sz has the special value of -1, it is returned unchanged independently of the current DPI, to preserve the special value of -1 in wxWidgets API (it is often used to mean “unspecified”).

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #from_dip(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #from_dip(d) ⇒ Integer

    Convert DPI-independent distance in pixels to the value in pixels appropriate for the current toolkit.

    This is the same as FromDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions. If d has the special value of -1, it is returned unchanged independently of the current DPI.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


656
# File 'lib/wx/doc/gen/window.rb', line 656

def from_dip(*args) end

#from_phys(sz) ⇒ Wx::Size #from_phys(pt) ⇒ Wx::Point #from_phys(d) ⇒ Integer

Overloads:

  • #from_phys(sz) ⇒ Wx::Size

    Convert from physical pixels to logical pixels.

    All window coordinates in wxWidgets API are always expressed in logical pixels, but the meaning of logical pixels depends on the platform. Physical pixels always mean the same thing and refer to the actual display pixels or, also, sizes of the bitmaps. Under some platforms logical pixels are actually the same as physical ones (this is the case for MSW), but under other platforms (e.g. GTK or macOS) this is not the case and #get_content_scale_factor defines the ratio between one logical and one physical pixel. This function can be used to convert a value in physical pixels to logical pixels independently of the platform used. It simply does nothing under MSW, but divides the input value by the content scale factor under the other platforms. Note that dividing an integer value by scale factor doesn’t always yield an integer value. This function rounds the resulting value to the closest integer, e.g. 15 physical pixels are translated to 8, not 7, logical pixels in 200% DPI scaling. This ensures that a physical bitmap of size 15 is not truncated if the result of this function is used to create a window to show it, but it does mean that there will be one extra pixel, not covered by this bitmap, left.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

    See Also:

  • #from_phys(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #from_phys(d) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


741
# File 'lib/wx/doc/gen/window.rb', line 741

def from_phys(*args) end

#get_accelerator_tableWx::AcceleratorTable Also known as: accelerator_table

Gets the accelerator table for this window.

See AcceleratorTable.



2264
# File 'lib/wx/doc/gen/window.rb', line 2264

def get_accelerator_table; end

#get_auto_layoutBoolean Also known as: auto_layout

Returns true if #layout is called automatically when the window is resized.

This function is mostly useful for wxWidgets itself and is rarely needed in the application code.

Returns:

  • (Boolean)


2396
# File 'lib/wx/doc/gen/window.rb', line 2396

def get_auto_layout; end

#get_background_colourWx::Colour Also known as: background_colour

Returns the background colour of the window.



1388
# File 'lib/wx/doc/gen/window.rb', line 1388

def get_background_colour; end

#get_background_styleWx::BackgroundStyle Also known as: background_style

Returns the background style of the window.



1399
# File 'lib/wx/doc/gen/window.rb', line 1399

def get_background_style; end

#get_best_height(width) ⇒ Integer Also known as: best_height

Returns the best height needed by this window if it had the given width.

Parameters:

  • width (Integer)

Returns:

  • (Integer)

See Also:

  • do_get_best_client_height


816
# File 'lib/wx/doc/gen/window.rb', line 816

def get_best_height(width) end

#get_best_sizeWx::Size Also known as: best_size

This functions returns the best acceptable minimal size for the window.

For example, for a static control, it will be the minimal size such that the control label is not truncated. For windows containing subwindows (typically Panel), the size returned by this function will be the same as the size the window would have had after calling #fit. Override virtual do_get_best_size or, better, because it’s usually more convenient, do_get_best_client_size when writing your own custom window class to change the value returned by this public non-virtual method. Notice that the best size respects the minimal and maximal size explicitly set for the window, if any. So even if some window believes that it needs 200 pixels horizontally, calling #set_max_size with a width of 100 would ensure that #get_best_size returns the width of at most 100 pixels.



807
# File 'lib/wx/doc/gen/window.rb', line 807

def get_best_size; end

#get_best_virtual_sizeWx::Size Also known as: best_virtual_size

Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)

Returns:



927
# File 'lib/wx/doc/gen/window.rb', line 927

def get_best_virtual_size; end

#get_best_width(height) ⇒ Integer Also known as: best_width

Returns the best width needed by this window if it had the given height.

Parameters:

  • height (Integer)

Returns:

  • (Integer)

See Also:

  • do_get_best_client_width


825
# File 'lib/wx/doc/gen/window.rb', line 825

def get_best_width(height) end

#get_border(flags) ⇒ Wx::Border #get_borderWx::Border Also known as: border

Overloads:



2507
# File 'lib/wx/doc/gen/window.rb', line 2507

def get_border(*args) end

#get_caretWx::Caret Also known as: caret

Returns the caret() associated with the window.

Returns:



2411
# File 'lib/wx/doc/gen/window.rb', line 2411

def get_caret; end

#get_char_heightInteger Also known as: char_height

Returns the character height for this window.

Returns:

  • (Integer)


1404
# File 'lib/wx/doc/gen/window.rb', line 1404

def get_char_height; end

#get_char_widthInteger Also known as: char_width

Returns the average character width for this window.

Returns:

  • (Integer)


1409
# File 'lib/wx/doc/gen/window.rb', line 1409

def get_char_width; end

#get_childrenWx::WindowList Also known as: children

Returns a const reference to the list of the window’s children.

Wx::WindowList is a type-safe List-like class whose elements are of type wxWindow*.

Returns:

  • (Wx::WindowList)


368
# File 'lib/wx/doc/gen/window.rb', line 368

def get_children; end

#get_client_area_originWx::Point Also known as: client_area_origin

Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations…)

Returns:



1245
# File 'lib/wx/doc/gen/window.rb', line 1245

def get_client_area_origin; end

#get_client_rectWx::Rect Also known as: client_rect

Get the client rectangle in window (i.e. client) coordinates.

Returns:



1250
# File 'lib/wx/doc/gen/window.rb', line 1250

def get_client_rect; end

#get_client_sizeWx::Size Also known as: client_size

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:



830
# File 'lib/wx/doc/gen/window.rb', line 830

def get_client_size; end

#get_containing_sizerWx::Sizer Also known as: containing_sizer

Returns the sizer of which this window is a member, if any, otherwise NULL.

Returns:



2341
# File 'lib/wx/doc/gen/window.rb', line 2341

def get_containing_sizer; end

#get_content_scale_factorFloat Also known as: content_scale_factor

Returns the factor mapping logical pixels of this window to physical pixels.

This function can be used to portably determine the number of physical pixels in a window of the given size, by multiplying the window size by the value returned from it. I.e. it returns the factor converting window coordinates to “content view” coordinates, where the view can be just a simple window displaying a Bitmap or GLCanvas or any other kind of window rendering arbitrary “content” on screen. For the platforms not doing any pixel mapping, i.e. where logical and physical pixels are one and the same, this function always returns 1.0 and so using it is, in principle, unnecessary and could be avoided by using preprocessor check for HAS_DPI_INDEPENDENT_PIXELS not being defined, however using this function unconditionally under all platforms is usually simpler and so preferable.

Note:

Current behaviour of this function is compatible with wxWidgets 3.0, but different from its behaviour in versions 3.1.0 to 3.1.3, where it returned the same value as #get_dpi_scale_factor. Please use the other function if you need to use a scaling factor greater than 1.0 even for the platforms without HAS_DPI_INDEPENDENT_PIXELS, such as WXMSW.

Returns:

  • (Float)


941
# File 'lib/wx/doc/gen/window.rb', line 941

def get_content_scale_factor; end

#get_cursorWx::Cursor Also known as: cursor

Return the cursor associated with this window.

Returns:

See Also:



2419
# File 'lib/wx/doc/gen/window.rb', line 2419

def get_cursor; end

#get_default_attributesWx::VisualAttributes Also known as: default_attributes

Currently this is the same as calling get_class_default_attributes(wx_window.

One advantage of using this function compared to the static version is that the call is automatically dispatched to the correct class (as usual with virtual functions) and you don’t have to specify the class name explicitly. The other one is that in the future this function could return different results, for example it might return a different font for an “Ok” button than for a generic button if the users GUI is configured to show such buttons in bold font. Of course, the down side is that it is impossible to call this function without actually having an object to apply it to whereas the static version can be used without having to create an object first.



1417
# File 'lib/wx/doc/gen/window.rb', line 1417

def get_default_attributes; end

#get_dpiWx::Size Also known as: dpi

Return the DPI of the display used by this window.

The returned value can be different for different windows on systems with support for per-monitor DPI values, such as Microsoft Windows 10. If the DPI is not available, returns size(0,0) object.

Returns:

See Also:



1427
# File 'lib/wx/doc/gen/window.rb', line 1427

def get_dpi; end

#get_dpi_scale_factorFloat Also known as: dpi_scale_factor

Returns the ratio of the DPI used by this window to the standard DPI.

The returned value is 1 for standard DPI screens or 2 for “200% scaling” and, unlike for #get_content_scale_factor, is the same under all platforms. This factor should be used to increase the size of icons and similar windows whose best size is not based on text metrics when using DPI scaling. E.g. the program may load a 32px bitmap if the content scale factor is 1.0 or 64px version of the same bitmap if it is 2.0 or bigger. Notice that this method should not be used for window sizes expressed in pixels, as they are already scaled by this factor by the underlying toolkit under some platforms. Use from_dip for anything window-related instead.

Returns:

  • (Float)


952
# File 'lib/wx/doc/gen/window.rb', line 952

def get_dpi_scale_factor; end

#get_drop_targetWx::DropTarget Also known as: drop_target

Returns the associated drop target, which may be NULL.

Returns:

See Also:



2314
# File 'lib/wx/doc/gen/window.rb', line 2314

def get_drop_target; end

#get_effective_min_sizeWx::Size Also known as: effective_min_size

Merges the window’s best size into the min size and returns the result.

This is the value used by sizers to determine the appropriate amount of space to allocate for the widget. This is the method called by a Sizer when it queries the size of a window or control.



841
# File 'lib/wx/doc/gen/window.rb', line 841

def get_effective_min_size; end

#get_event_handlerWx::EvtHandler Also known as: event_handler

Returns the event handler for this window.

By default, the window is its own event handler.



1702
# File 'lib/wx/doc/gen/window.rb', line 1702

def get_event_handler; end

#get_extra_styleInteger Also known as: extra_style

Returns the extra style bits for the window.

Returns:

  • (Integer)


1796
# File 'lib/wx/doc/gen/window.rb', line 1796

def get_extra_style; end

#get_fontWx::Font Also known as: font

Returns the font for this window.

Returns:

See Also:



1435
# File 'lib/wx/doc/gen/window.rb', line 1435

def get_font; end

#get_foreground_colourWx::Colour Also known as: foreground_colour

Returns the foreground colour of the window.

Remark:

The meaning of foreground colour varies according to the window class; it may be the text colour or other colour, or it may not be used at all.



1449
# File 'lib/wx/doc/gen/window.rb', line 1449

def get_foreground_colour; end

#get_grand_parentWx::Window Also known as: grand_parent

Returns the grandparent of a window, or NULL if there isn’t one.

Returns:



380
# File 'lib/wx/doc/gen/window.rb', line 380

def get_grand_parent; end

#get_help_textString Also known as: help_text

Gets the help text to be used as context-sensitive help for this window.

Note that the text is actually stored by the current HelpProvider implementation, and not in the window object itself.



2016
# File 'lib/wx/doc/gen/window.rb', line 2016

def get_help_text; end

#get_help_text_at_point(point, origin) ⇒ String Also known as: help_text_at_point

Gets the help text to be used as context-sensitive help for this window.

This method should be overridden if the help message depends on the position inside the window, otherwise #get_help_text can be used.

Parameters:

Returns:

  • (String)


2035
# File 'lib/wx/doc/gen/window.rb', line 2035

def get_help_text_at_point(point, origin) end

#get_idInteger Also known as: id

Returns the identifier of the window.

Remark:

Each window has an integer identifier. If the application has not provided one (or the default StandardID::ID_ANY) a unique identifier with a negative value will be generated.

Returns:

  • (Integer)

See Also:



2168
# File 'lib/wx/doc/gen/window.rb', line 2168

def get_id; end

#get_labelString Also known as: label

Generic way of getting a label from any window, for identification purposes.

Remark:

The interpretation of this function differs from class to class. For frames and dialogs, the value returned is the title. For buttons or static text controls, it is the button text. This function can be useful for meta-programs (such as testing tools or special-needs access programs) which need to identify windows by name.

Returns:

  • (String)


2179
# File 'lib/wx/doc/gen/window.rb', line 2179

def get_label; end

#get_layout_directionWx::LayoutDirection Also known as: layout_direction

Returns the layout direction for this window, Note that LayoutDirection::Layout_Default is returned if layout direction is not supported.

Returns:



2184
# File 'lib/wx/doc/gen/window.rb', line 2184

def get_layout_direction; end

#get_max_client_sizeWx::Size Also known as: max_client_size

Returns the maximum size of window’s client area.

This is an indication to the sizer layout mechanism that this is the maximum possible size as well as the upper bound on window’s size settable using #set_client_size.

Returns:

See Also:



850
# File 'lib/wx/doc/gen/window.rb', line 850

def get_max_client_size; end

#get_max_heightInteger Also known as: max_height

Returns the vertical component of window maximal size.

The returned value is DEFAULT_COORD if the maximal width was not set.

Returns:

  • (Integer)

See Also:



909
# File 'lib/wx/doc/gen/window.rb', line 909

def get_max_height; end

#get_max_sizeWx::Size Also known as: max_size

Returns the maximum size of the window.

This is an indication to the sizer layout mechanism that this is the maximum possible size as well as the upper bound on window’s size settable using #set_size.



859
# File 'lib/wx/doc/gen/window.rb', line 859

def get_max_size; end

#get_max_widthInteger Also known as: max_width

Returns the horizontal component of window maximal size.

The returned value is DEFAULT_COORD if the maximal width was not set.

Returns:

  • (Integer)

See Also:



901
# File 'lib/wx/doc/gen/window.rb', line 901

def get_max_width; end

#get_min_client_sizeWx::Size Also known as: min_client_size

Returns the minimum size of window’s client area, an indication to the sizer layout mechanism that this is the minimum required size of its client area.

It normally just returns the value set by #set_min_client_size, but it can be overridden to do the calculation on demand.

Returns:

See Also:



868
# File 'lib/wx/doc/gen/window.rb', line 868

def get_min_client_size; end

#get_min_heightInteger Also known as: min_height

Returns the vertical component of window minimal size.

The returned value is DEFAULT_COORD if the minimal height was not set.

Returns:

  • (Integer)

See Also:



893
# File 'lib/wx/doc/gen/window.rb', line 893

def get_min_height; end

#get_min_sizeWx::Size Also known as: min_size

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

This method normally just returns the value set by #set_min_size, but it can be overridden to do the calculation on demand.



877
# File 'lib/wx/doc/gen/window.rb', line 877

def get_min_size; end

#get_min_widthInteger Also known as: min_width

Returns the horizontal component of window minimal size.

The returned value is DEFAULT_COORD if the minimal width was not set.

Returns:

  • (Integer)

See Also:



885
# File 'lib/wx/doc/gen/window.rb', line 885

def get_min_width; end

#get_nameString Also known as: name

Returns the window’s name.

Remark:

This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate name in the window constructor or via #set_name.

Returns:

  • (String)

See Also:



2203
# File 'lib/wx/doc/gen/window.rb', line 2203

def get_name; end

#get_next_siblingWx::Window Also known as: next_sibling

Returns the next window after this one among the parent’s children or NULL if this window is the last child.

Returns:

See Also:



388
# File 'lib/wx/doc/gen/window.rb', line 388

def get_next_sibling; end

#get_parentWx::Window Also known as: parent

Returns the parent of the window, or NULL if there is no parent.

Returns:



393
# File 'lib/wx/doc/gen/window.rb', line 393

def get_parent; end

#get_popup_menu_selection_from_user(menu, pos = Wx::DEFAULT_POSITION) ⇒ Integer #get_popup_menu_selection_from_user(menu, x, y) ⇒ Integer Also known as: popup_menu_selection_from_user

Overloads:

  • #get_popup_menu_selection_from_user(menu, pos = Wx::DEFAULT_POSITION) ⇒ Integer

    This function shows a popup menu at the given position in this window and returns the selected id.

    It can be more convenient than the general purpose #popup_menu function for simple menus proposing a choice in a list of strings to the user. Notice that to avoid unexpected conflicts between the (usually consecutive range of) ids used by the menu passed to this function and the existing EVT_UPDATE_UI() handlers, this function temporarily disables UI updates for the window, so you need to manually disable (or toggle or …) any items which should be disabled in the menu before showing it. The parameter menu is the menu to show. The parameter pos (or the parameters x and y) is the position at which to show the menu in client coordinates. It is recommended to not explicitly specify coordinates when calling this method in response to mouse click, because some of the ports (namely, WXGTK) can do a better job of positioning the menu in that case. The selected menu item id or StandardID::ID_NONE if none selected or an error occurred.

    Parameters:

    • menu (Wx::Menu)
    • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)

    Returns:

    • (Integer)
  • #get_popup_menu_selection_from_user(menu, x, y) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • menu (Wx::Menu)
    • x (Integer)
    • y (Integer)

    Returns:

    • (Integer)


2087
# File 'lib/wx/doc/gen/window.rb', line 2087

def get_popup_menu_selection_from_user(*args) end

#get_positionWx::Point Also known as: position

This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows.

Returns:

See Also:



1216
# File 'lib/wx/doc/gen/window.rb', line 1216

def get_position; end

#get_prev_siblingWx::Window Also known as: prev_sibling

Returns the previous window before this one among the parent’s children or NULL if this window is the first child.

Returns:

See Also:



401
# File 'lib/wx/doc/gen/window.rb', line 401

def get_prev_sibling; end

#get_rectWx::Rect Also known as: rect

Returns the position and size of the window as a Rect object.

Returns:

See Also:



1224
# File 'lib/wx/doc/gen/window.rb', line 1224

def get_rect; end

#get_screen_positionWx::Point Also known as: screen_position

Returns the window position in screen coordinates, whether the window is a child window or a top level one.

Returns:

See Also:



1232
# File 'lib/wx/doc/gen/window.rb', line 1232

def get_screen_position; end

#get_screen_rectWx::Rect Also known as: screen_rect

Returns the position and size of the window on the screen as a Rect object.

Returns:

See Also:



1240
# File 'lib/wx/doc/gen/window.rb', line 1240

def get_screen_rect; end

#get_scroll_pos(orientation) ⇒ Integer Also known as: scroll_pos

Returns the built-in scrollbar position.

Parameters:

  • orientation (Integer)

Returns:

  • (Integer)

See Also:



439
# File 'lib/wx/doc/gen/window.rb', line 439

def get_scroll_pos(orientation) end

#get_scroll_range(orientation) ⇒ Integer Also known as: scroll_range

Returns the built-in scrollbar range.

Parameters:

  • orientation (Integer)

Returns:

  • (Integer)

See Also:



448
# File 'lib/wx/doc/gen/window.rb', line 448

def get_scroll_range(orientation) end

#get_scroll_thumb(orientation) ⇒ Integer Also known as: scroll_thumb

Returns the built-in scrollbar thumb size.

Parameters:

  • orientation (Integer)

Returns:

  • (Integer)

See Also:



457
# File 'lib/wx/doc/gen/window.rb', line 457

def get_scroll_thumb(orientation) end

#get_sizeWx::Size Also known as: size

See the GetSize(int,int) overload for more info.

Returns:



914
# File 'lib/wx/doc/gen/window.rb', line 914

def get_size; end

#get_sizerWx::Sizer Also known as: sizer

Returns the sizer associated with the window by a previous call to #set_sizer, or NULL.

Returns:



2346
# File 'lib/wx/doc/gen/window.rb', line 2346

def get_sizer; end

#get_text_extent(string) ⇒ Wx::Size Also known as: text_extent

Gets the dimensions of the string as it would be drawn on the window with the currently selected font.

Parameters:

  • string (String)

Returns:



1455
# File 'lib/wx/doc/gen/window.rb', line 1455

def get_text_extent(string) end

#get_theme_enabledBoolean Also known as: theme_enabled

Returns true if the window uses the system theme for drawing its background.

Returns:

  • (Boolean)

See Also:



1674
# File 'lib/wx/doc/gen/window.rb', line 1674

def get_theme_enabled; end

#get_tool_tipWx::ToolTip Also known as: tool_tip

Get the associated tooltip or NULL if none.

Returns:



2040
# File 'lib/wx/doc/gen/window.rb', line 2040

def get_tool_tip; end

#get_tool_tip_textString Also known as: tool_tip_text

Get the text of the associated tooltip or empty string if none.

Returns:

  • (String)


2045
# File 'lib/wx/doc/gen/window.rb', line 2045

def get_tool_tip_text; end

#get_update_client_rectWx::Rect Also known as: update_client_rect

Get the update rectangle bounding box in client coords.

Returns:



1469
# File 'lib/wx/doc/gen/window.rb', line 1469

def get_update_client_rect; end

#get_update_regionWx::Region Also known as: update_region

Returns the region specifying which parts of the window have been damaged.

Should only be called within a PaintEvent handler.

Returns:

See Also:



1464
# File 'lib/wx/doc/gen/window.rb', line 1464

def get_update_region; end

#get_validatorWx::Validator Also known as: validator

Validator functions.

Returns a pointer to the current validator for the window, or NULL if there is none.

Returns:



2119
# File 'lib/wx/doc/gen/window.rb', line 2119

def get_validator; end

#get_virtual_sizeWx::Size Also known as: virtual_size

This gets the virtual size of the window in pixels.

By default it returns the client size of the window, but after a call to #set_virtual_size it will return the size set with that method.

Returns:

See Also:



922
# File 'lib/wx/doc/gen/window.rb', line 922

def get_virtual_size; end

#get_window_border_sizeWx::Size Also known as: window_border_size

Returns the size of the left/right and top/bottom borders of this window in x and y components of the result respectively.

Returns:



957
# File 'lib/wx/doc/gen/window.rb', line 957

def get_window_border_size; end

#get_window_styleInteger Also known as: window_style

See #get_window_style_flag for more info.

Returns:

  • (Integer)


1808
# File 'lib/wx/doc/gen/window.rb', line 1808

def get_window_style; end

#get_window_style_flagInteger Also known as: window_style_flag

Gets the window style that was passed to the constructor or #create method.

#get_window_style is another name for the same function.

Returns:

  • (Integer)


1803
# File 'lib/wx/doc/gen/window.rb', line 1803

def get_window_style_flag; end

#get_window_variantWx::WindowVariant Also known as: window_variant

Returns the value previously passed to #set_window_variant.

Returns:



2208
# File 'lib/wx/doc/gen/window.rb', line 2208

def get_window_variant; end

#handle_as_navigation_key(event) ⇒ Boolean

This function will generate the appropriate call to #navigate if the key event is one normally used for keyboard navigation and return true in this case.

Returns true if the key pressed was for navigation and was handled, false otherwise.

Parameters:

Returns:

  • (Boolean)

See Also:



1711
# File 'lib/wx/doc/gen/window.rb', line 1711

def handle_as_navigation_key(event) end

#handle_window_event(event) ⇒ Boolean

Shorthand for:

get_event_handler.safely_process_event(event)

Parameters:

Returns:

  • (Boolean)

See Also:



1721
# File 'lib/wx/doc/gen/window.rb', line 1721

def handle_window_event(event) end

#has_captureBoolean Also known as: has_capture?

Returns true if this window has the current mouse capture.



2430
# File 'lib/wx/doc/gen/window.rb', line 2430

def has_capture; end

#has_extra_style(exFlag) ⇒ Boolean Also known as: has_extra_style?

Returns true if the window has the given exFlag bit set in its extra styles.

Parameters:

  • exFlag (Integer)

Returns:

  • (Boolean)

See Also:



1817
# File 'lib/wx/doc/gen/window.rb', line 1817

def has_extra_style(exFlag) end

#has_flag(flag) ⇒ Boolean Also known as: has_flag?

Returns true if the window has the given flag bit set.

Parameters:

  • flag (Integer)

Returns:

  • (Boolean)


1823
# File 'lib/wx/doc/gen/window.rb', line 1823

def has_flag(flag) end

#has_focusBoolean Also known as: has_focus?

Returns true if the window (or in case of composite controls, its main child window) has focus.

Returns:

  • (Boolean)

See Also:



313
# File 'lib/wx/doc/gen/window.rb', line 313

def has_focus; end

#has_multiple_pagesBoolean Also known as: has_multiple_pages?

This method should be overridden to return true if this window has multiple pages.

All standard class with multiple pages such as Notebook, Listbook and Treebook already override it to return true and user-defined classes with similar behaviour should also do so, to allow the library to handle such windows appropriately.

Returns:

  • (Boolean)


2536
# File 'lib/wx/doc/gen/window.rb', line 2536

def has_multiple_pages; end

#has_scrollbar(orient) ⇒ Boolean Also known as: has_scrollbar?

Returns true if this window currently has a scroll bar for this orientation.

This method may return false even when #can_scroll for the same orientation returns true, but if #can_scroll returns false, i.e. scrolling in this direction is not enabled at all, #has_scrollbar always returns false as well.

Parameters:

Returns:

  • (Boolean)


471
# File 'lib/wx/doc/gen/window.rb', line 471

def has_scrollbar(orient) end

#has_transparent_backgroundBoolean Also known as: has_transparent_background?

Returns true if this window background is transparent (as, for example, for StaticText) and should show the parent window background.

This method is mostly used internally by the library itself and you normally shouldn’t have to call it. You may, however, have to override it in your Wx::Window-derived class to ensure that background is painted correctly.

Returns:

  • (Boolean)


1476
# File 'lib/wx/doc/gen/window.rb', line 1476

def has_transparent_background; end

#hideBoolean

Equivalent to calling #show(false).

Returns:

  • (Boolean)


1898
# File 'lib/wx/doc/gen/window.rb', line 1898

def hide; end

#hide_with_effect(effect, timeout = 0) ⇒ Boolean

This function hides a window, like #hide, but using a special visual effect if possible.

The parameters of this function are the same as for #show_with_effect, please see their description there.

Parameters:

Returns:

  • (Boolean)


1906
# File 'lib/wx/doc/gen/window.rb', line 1906

def hide_with_effect(effect, timeout=0) end

#hit_test(x, y) ⇒ Wx::HitTest #hit_test(pt) ⇒ Wx::HitTest

Overloads:

  • #hit_test(x, y) ⇒ Wx::HitTest

    Return where the given point lies, exactly.

    This method is used to test whether the point lies inside the client window area or on one of its scrollbars. The point coordinates are specified in client window coordinates.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

  • #hit_test(pt) ⇒ Wx::HitTest

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:



2498
# File 'lib/wx/doc/gen/window.rb', line 2498

def hit_test(*args) end

#inform_first_direction(direction, size, availableOtherDir) ⇒ Boolean

Sizer and friends use this to give a chance to a component to recalc its min size once one of the final size components is known.

Override this function when that is useful (such as for StaticText which can stretch over several lines). Parameter availableOtherDir tells the item how much more space there is available in the opposite direction (-1 if unknown).

Parameters:

  • direction (Integer)
  • size (Integer)
  • availableOtherDir (Integer)

Returns:

  • (Boolean)


967
# File 'lib/wx/doc/gen/window.rb', line 967

def inform_first_direction(direction, size, availableOtherDir) end

#inherit_attributesvoid

This method returns an undefined value.

This function is (or should be, in case of custom controls) called during window creation to intelligently set up the window visual attributes, that is the font and the foreground and background colours.

By “intelligently” the following is meant: by default, all windows use their own get_class_default_attributes default attributes. However if some of the parents attributes are explicitly (that is, using #set_font and not #set_own_font) changed and if the corresponding attribute hadn’t been explicitly set for this window itself, then this window takes the same value as used by the parent. In addition, if the window overrides #should_inherit_colours to return false, the colours will not be changed no matter what and only the font might. This rather complicated logic is necessary in order to accommodate the different usage scenarios. The most common one is when all default attributes are used and in this case, nothing should be inherited as in modern GUIs different controls use different fonts (and colours) than their siblings so they can’t inherit the same value from the parent. However it was also deemed desirable to allow to simply change the attributes of all children at once by just changing the font or colour of their common parent, hence in this case we do inherit the parents attributes.



2544
# File 'lib/wx/doc/gen/window.rb', line 2544

def inherit_attributes; end

#inherits_background_colourBoolean

Return true if this window inherits the background colour from its parent.

Returns:

  • (Boolean)

See Also:



1608
# File 'lib/wx/doc/gen/window.rb', line 1608

def inherits_background_colour; end

#inherits_foreground_colourBoolean

Return true if this window inherits the foreground colour from its parent.

Returns:

  • (Boolean)

See Also:



1650
# File 'lib/wx/doc/gen/window.rb', line 1650

def inherits_foreground_colour; end

#init_dialogvoid

This method returns an undefined value.

Sends an EVT_INIT_DIALOG event, whose handler usually transfers data to the dialog via validators.



2548
# File 'lib/wx/doc/gen/window.rb', line 2548

def init_dialog; end

#invalidate_best_sizevoid

This method returns an undefined value.

Resets the cached best size value so it will be recalculated the next time it is needed.

See Also:



974
# File 'lib/wx/doc/gen/window.rb', line 974

def invalidate_best_size; end

#is_being_deletedBoolean Also known as: being_deleted?

Returns true if this window is in process of being destroyed.

Top level windows are not deleted immediately but are rather scheduled for later destruction to give them time to process any pending messages; see #destroy description. This function returns true if this window, or one of its parent windows, is scheduled for destruction and can be useful to avoid manipulating it as it’s usually useless to do something with a window which is at the point of disappearing anyhow.

Returns:

  • (Boolean)


2305
# File 'lib/wx/doc/gen/window.rb', line 2305

def is_being_deleted; end

#is_descendant(win) ⇒ Boolean Also known as: descendant?

Check if the specified window is a descendant of this one.

Returns true if the window is a descendant (i.e. a child or grand-child or grand-grand-child or …) of this one. Notice that a window can never be a descendant of another one if they are in different top level windows, i.e. a child of a Dialog is not considered to be a descendant of dialogs parent Frame.

Parameters:

  • win (Wx::Window)

    Any window, possible NULL (false is always returned then).

Returns:

  • (Boolean)


410
# File 'lib/wx/doc/gen/window.rb', line 410

def is_descendant(win) end

#is_double_bufferedBoolean Also known as: double_buffered?

Returns true if the window contents is double-buffered by the system, i.e. if any drawing done on the window is really done on a temporary backing surface and transferred to the screen all at once later.

Returns:

  • (Boolean)

See Also:



2555
# File 'lib/wx/doc/gen/window.rb', line 2555

def is_double_buffered; end

#is_enabledBoolean Also known as: enabled?

Returns true if the window is enabled, i.e. if it accepts user input, false otherwise.

Notice that this method can return false even if this window itself hadn’t been explicitly disabled when one of its parent windows is disabled. To get the intrinsic status of this window, use #is_this_enabled

Returns:

  • (Boolean)

See Also:



1913
# File 'lib/wx/doc/gen/window.rb', line 1913

def is_enabled; end

#is_exposed(x, y) ⇒ Boolean #is_exposed(pt) ⇒ Boolean #is_exposed(x, y, w, h) ⇒ Boolean #is_exposed(rect) ⇒ Boolean Also known as: exposed?

Overloads:

  • #is_exposed(x, y) ⇒ Boolean

    Returns true if the given point or rectangle area has been exposed since the last repaint.

    Call this in a paint event handler to optimize redrawing by only redrawing those areas, which have been exposed.

    Parameters:

    • x (Integer)
    • y (Integer)

    Returns:

    • (Boolean)
  • #is_exposed(pt) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Boolean)
  • #is_exposed(x, y, w, h) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • x (Integer)
    • y (Integer)
    • w (Integer)
    • h (Integer)

    Returns:

    • (Boolean)
  • #is_exposed(rect) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

    • (Boolean)


1938
# File 'lib/wx/doc/gen/window.rb', line 1938

def is_exposed(*args) end

#is_focusableBoolean Also known as: focusable?

Can this window itself have focus?

Returns:

  • (Boolean)


293
# File 'lib/wx/doc/gen/window.rb', line 293

def is_focusable; end

#is_frozenBoolean Also known as: frozen?

Returns true if the window is currently frozen by a call to #freeze.

Returns:

  • (Boolean)

See Also:



1378
# File 'lib/wx/doc/gen/window.rb', line 1378

def is_frozen; end

#is_retainedBoolean Also known as: retained?

Returns true if the window is retained, false otherwise.

Remark:

Retained windows are only available on X platforms.

Returns:

  • (Boolean)


2572
# File 'lib/wx/doc/gen/window.rb', line 2572

def is_retained; end

#is_scrollbar_always_shown(orient) ⇒ Boolean Also known as: scrollbar_always_shown?

Return whether a scrollbar is always shown.

Parameters:

Returns:

  • (Boolean)

See Also:



480
# File 'lib/wx/doc/gen/window.rb', line 480

def is_scrollbar_always_shown(orient) end

#is_shownBoolean Also known as: shown?

Returns true if the window is shown, false if it has been hidden.

Returns:

  • (Boolean)

See Also:



1946
# File 'lib/wx/doc/gen/window.rb', line 1946

def is_shown; end

#is_shown_on_screenBoolean Also known as: shown_on_screen?

Returns true if the window is physically visible on the screen, i.e. it is shown and all its parents up to the toplevel window are shown as well.

Returns:

  • (Boolean)

See Also:



1954
# File 'lib/wx/doc/gen/window.rb', line 1954

def is_shown_on_screen; end

#is_this_enabledBoolean Also known as: this_enabled?

Returns true if this window is intrinsically enabled, false otherwise, i.e. if #enable Enable(false) had been called.

This method is mostly used for wxWidgets itself, user code should normally use #is_enabled instead.

Returns:

  • (Boolean)


2579
# File 'lib/wx/doc/gen/window.rb', line 2579

def is_this_enabled; end

#is_top_levelBoolean Also known as: top_level?

Returns true if the given window is a top-level one.

Currently all frames and dialogs are considered to be top-level windows (even if they have a parent window).

Returns:

  • (Boolean)


2586
# File 'lib/wx/doc/gen/window.rb', line 2586

def is_top_level; end

#is_transparent_background_supported(reason = nil) ⇒ Boolean Also known as: transparent_background_supported?

Checks whether using transparent background might work.

If this function returns false, calling #set_background_style with BackgroundStyle::BG_STYLE_TRANSPARENT is not going to work. If it returns true, setting transparent style should normally succeed. Notice that this function would typically be called on the parent of a window you want to set transparent background style for as the window for which this method is called must be fully created.

true if background transparency is supported.

Parameters:

  • reason (String) (defaults to: nil)

    If not NULL, a reason message is provided if transparency is not supported.

Returns:

  • (Boolean)


1561
# File 'lib/wx/doc/gen/window.rb', line 1561

def is_transparent_background_supported(reason=nil) end

#layoutBoolean

Lays out the children of this window using the associated sizer.

If a sizer hadn’t been associated with this window (see #set_sizer), this function doesn’t do anything, unless this is a top level window (see TopLevelWindow#layout). Note that this method is called automatically when the window size changes if it has the associated sizer (or if #set_auto_layout with true argument had been explicitly called), ensuring that it is always laid out correctly.

Always returns true, the return value is not useful.

Returns:

  • (Boolean)

See Also:



2380
# File 'lib/wx/doc/gen/window.rb', line 2380

def layout; end

#line_downBoolean

Same as ScrollLines (1).

Returns:

  • (Boolean)


530
# File 'lib/wx/doc/gen/window.rb', line 530

def line_down; end

#line_upBoolean

Same as ScrollLines (-1).

Returns:

  • (Boolean)


526
# File 'lib/wx/doc/gen/window.rb', line 526

def line_up; end

#locked(&block) ⇒ Object

Locks the window from updates while executing the given block.

Parameters:

  • block (Proc)


65
# File 'lib/wx/doc/window.rb', line 65

def locked(&block); end

#lower_windowvoid Also known as: send_to_back

This method returns an undefined value.

Lowers the window to the bottom of the window hierarchy (Z-order). This method has been renamed in wxRuby to be consistent with the renamed #raise_window method.

Remark:

This function only works for TopLevelWindow-derived classes.

See Also:



22
# File 'lib/wx/doc/window.rb', line 22

def lower_window; end

#move(x, y, flags = Wx::SIZE_USE_EXISTING) ⇒ void #move(pt, flags = Wx::SIZE_USE_EXISTING) ⇒ void

Overloads:

  • #move(x, y, flags = Wx::SIZE_USE_EXISTING) ⇒ void

    This method returns an undefined value.

    Moves the window to the given position.

    Remark:

    Implementations of SetSize can also implicitly implement the #move function, which is defined in the base Wx::Window class as the call: ```ruby set_size(x, y, Wx::DEFAULT_COORD, Wx::DEFAULT_COORD, Wx::SIZE_USE_EXISTING) ```

    Parameters:

    • x (Integer)

      Required x position.

    • y (Integer)

      Required y position.

    • flags (Integer) (defaults to: Wx::SIZE_USE_EXISTING)

      See #set_size for more info about this parameter.

    See Also:

  • #move(pt, flags = Wx::SIZE_USE_EXISTING) ⇒ void

    This method returns an undefined value.

    Moves the window to the given position.

    Remark:

    Implementations of #set_size can also implicitly implement the #move function, which is defined in the base Wx::Window class as the call: ```ruby set_size(x, y, Wx::DEFAULT_COORD, Wx::DEFAULT_COORD, Wx::SIZE_USE_EXISTING) ```

    Parameters:

    • pt (Array(Integer, Integer), Wx::Point)

      Point object representing the position.

    • flags (Integer) (defaults to: Wx::SIZE_USE_EXISTING)

      See #set_size for more info about this parameter.

    See Also:



1286
# File 'lib/wx/doc/gen/window.rb', line 1286

def move(*args) end

#move_after_in_tab_order(win) ⇒ void

This method returns an undefined value.

Moves this window in the tab navigation order after the specified win.

This means that when the user presses TAB key on that other window, the focus switches to this window. Default tab order is the same as creation order, this function and #move_before_in_tab_order allow to change it after creating all the windows.

Parameters:

  • win (Wx::Window)

    A sibling of this window which should precede it in tab order, must not be NULL



1867
# File 'lib/wx/doc/gen/window.rb', line 1867

def move_after_in_tab_order(win) end

#move_before_in_tab_order(win) ⇒ void

This method returns an undefined value.

Same as #move_after_in_tab_order except that it inserts this window just before win instead of putting it right after it.

Parameters:



1872
# File 'lib/wx/doc/gen/window.rb', line 1872

def move_before_in_tab_order(win) end

Performs a keyboard navigation action starting from this window.

This method is equivalent to calling #navigate_in method on the parent window.

Returns true if the focus was moved to another window or false if nothing changed.

Remark:

You may wish to call this from a text control custom keypress handler to do the default navigation behaviour for the tab key, since the standard default behaviour for a multiline text control with the TE_PROCESS_TAB style is to insert a tab and not navigate to the next control. See also NavigationKeyEvent and HandleAsNavigationKey.

Parameters:

Returns:

  • (Boolean)


1887
# File 'lib/wx/doc/gen/window.rb', line 1887

def navigate(flags=NavigationKeyEvent::IsForward) end

Performs a keyboard navigation action inside this window.

See #navigate for more information.

Parameters:

  • flags (Integer) (defaults to: NavigationKeyEvent::IsForward)

Returns:

  • (Boolean)


1894
# File 'lib/wx/doc/gen/window.rb', line 1894

def navigate_in(flags=NavigationKeyEvent::IsForward) end

#on_internal_idlevoid

This method returns an undefined value.

This virtual function is normally only used internally, but sometimes an application may need it to implement functionality that should not be disabled by an application defining an OnIdle handler in a derived class.

This function may be used to do delayed painting, for example, and most implementations call #update_window_ui in order to send update events to the window in idle time.



2593
# File 'lib/wx/doc/gen/window.rb', line 2593

def on_internal_idle; end

#page_downBoolean

Same as ScrollPages (1).

Returns:

  • (Boolean)


538
# File 'lib/wx/doc/gen/window.rb', line 538

def page_down; end

#page_upBoolean

Same as ScrollPages (-1).

Returns:

  • (Boolean)


534
# File 'lib/wx/doc/gen/window.rb', line 534

def page_up; end

#paint {|dc| ... } ⇒ ::Object

Creates an appropriate (temporary) DC to paint on and passes that to the given block. Deletes the DC when the block returns. Creates a Wx::PaintDC when called from an evt_paint handler and a Wx::ClientDC otherwise.

Yield Parameters:

Returns:

  • (::Object)

    result from block



48
# File 'lib/wx/doc/window.rb', line 48

def paint; end

#paint_buffered {|dc| ... } ⇒ ::Object

Similar to #paint but this time creates a buffered paint DC (which will be either a ‘regular’ Wx::PaintDC if the platform natively supports double buffering or a Wx::BufferedPaintDC otherwise) when called from an evt_paint handler and a Wx::ClientDC otherwise.

Yield Parameters:

Returns:

  • (::Object)

    result from block



55
# File 'lib/wx/doc/window.rb', line 55

def paint_buffered; end

Overloads:

  • #popup_menu(menu, pos = Wx::DEFAULT_POSITION) ⇒ Boolean

    Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu.

    If a menu item is selected, the corresponding menu event is generated and will be processed as usual. If coordinates are not specified, the current mouse cursor position is used. menu is the menu to pop up. The position where the menu will appear can be specified either as a Point pos or by two integers (x and y). Note that this function switches focus to this window before showing the menu.

    Remark:

    Just before the menu is popped up, Menu::UpdateUI is called to ensure that the menu items are in the correct state. The menu does not get deleted by the window. It is recommended to not explicitly specify coordinates when calling PopupMenu in response to mouse click, because some of the ports (namely, WXGTK) can do a better job of positioning the menu in that case.

    Parameters:

    • menu (Wx::Menu)
    • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)

    Returns:

    • (Boolean)

    See Also:

  • #popup_menu(menu, x, y) ⇒ Boolean

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • menu (Wx::Menu)
    • x (Integer)
    • y (Integer)

    Returns:

    • (Boolean)


2113
# File 'lib/wx/doc/gen/window.rb', line 2113

def popup_menu(*args) end

#post_size_eventvoid

This method returns an undefined value.

Posts a size event to the window.

This is the same as #send_size_event with SEND_EVENT_POST argument.



980
# File 'lib/wx/doc/gen/window.rb', line 980

def post_size_event; end

#post_size_event_to_parentvoid

This method returns an undefined value.

Posts a size event to the parent of this window.

This is the same as #send_size_event_to_parent with SEND_EVENT_POST argument.



986
# File 'lib/wx/doc/gen/window.rb', line 986

def post_size_event_to_parent; end

#process_window_event(event) ⇒ Boolean

Convenient wrapper for EvtHandler#process_event.

This is the same as writing

get_event_handler.process_event(event)

but more convenient. Notice that EvtHandler#process_event itself can’t be called for Wx::Window objects as it ignores the event handlers associated with the window; use this function instead.

Parameters:

Returns:

  • (Boolean)


1732
# File 'lib/wx/doc/gen/window.rb', line 1732

def process_window_event(event) end

#process_window_event_locally(event) ⇒ Boolean

Wrapper for EvtHandler#process_event_locally.

This method is similar to #process_window_event but can be used to search for the event handler only in this window and any event handlers pushed on top of it. Unlike #process_window_event it won’t propagate the event upwards. But it will use the validator and event handlers associated with this window, if any.

Parameters:

Returns:

  • (Boolean)


1739
# File 'lib/wx/doc/gen/window.rb', line 1739

def process_window_event_locally(event) end

#push_event_handler(handler) ⇒ void

This method returns an undefined value.

Pushes this event handler onto the event stack for the window.

An event handler is an object that is capable of processing the events sent to a window. By default, the window is its own event handler, but an application may wish to substitute another, for example to allow central implementation of event-handling for a variety of different window classes. #push_event_handler allows an application to set up a stack of event handlers, where an event not handled by one event handler is handed to the next one in the chain. E.g. if you have two event handlers A and B and a Wx::Window instance W and you call:

W.push_event_handler(A)
  W.push_event_handler(B)

you will end up with the following situation:

Note that you can use #pop_event_handler to remove the event handler.

Parameters:

See Also:

  • Events are Processed


1756
# File 'lib/wx/doc/gen/window.rb', line 1756

def push_event_handler(handler) end

#raise_windowvoid Also known as: bring_to_front

This method returns an undefined value.

Raises the window to the top of the window hierarchy (Z-order). This method has been renamed in wxRuby to avoid clashing with the standard Kernel#raise method.

Notice that this function only requests the window manager to raise this window to the top of Z-order. Depending on its configuration, the window manager may raise the window, not do it at all or indicate that a window requested to be raised in some other way, e.g. by flashing its icon if it is minimized.

Remark:

This function only works for TopLevelWindow-derived classes.

See Also:



39
# File 'lib/wx/doc/window.rb', line 39

def raise_window; end

#refresh(eraseBackground = true, rect = nil) ⇒ void

This method returns an undefined value.

Causes this window, and all of its children recursively, to be repainted.

Note that repainting doesn’t happen immediately but only during the next event loop iteration, if you need to update the window immediately you should use #update instead.

Parameters:

  • eraseBackground (Boolean) (defaults to: true)

    If true, the background will be erased too. Note that in non-MSW ports background is always erased.

  • rect (Wx::Rect) (defaults to: nil)

    If non-NULL, only the given rectangle will be treated as damaged.

See Also:



1486
# File 'lib/wx/doc/gen/window.rb', line 1486

def refresh(eraseBackground=true, rect=nil) end

#refresh_rect(rect, eraseBackground = true) ⇒ void

This method returns an undefined value.

Redraws the contents of the given rectangle: only the area inside it will be repainted.

This is the same as #refresh but has a nicer syntax as it can be called with a temporary Rect object as argument like this RefreshRect(wxRect(x, y, w, h)).

Parameters:

  • rect (Wx::Rect)
  • eraseBackground (Boolean) (defaults to: true)


1494
# File 'lib/wx/doc/gen/window.rb', line 1494

def refresh_rect(rect, eraseBackground=true) end

#register_hot_key(hotkeyId, modifiers, virtualKeyCode) ⇒ Boolean

Registers a system wide hotkey.

Every time the user presses the hotkey registered here, this window will receive a hotkey event. It will receive the event even if the application is in the background and does not have the input focus because the user is working with some other application.

true if the hotkey was registered successfully. false if some other application already registered a hotkey with this modifier/virtualKeyCode combination.

Remark:

Use EVT_HOTKEY(hotkeyId, fnc) in the event table to capture the event. This function is currently only implemented under MSW and macOS and always returns false in the other ports.

Parameters:

  • hotkeyId (Integer)

    Numeric identifier of the hotkey. For applications this must be between 0 and 0xBFFF. If this function is called from a shared DLL, it must be a system wide unique identifier between 0xC000 and 0xFFFF. This is a MSW specific detail.

  • modifiers (Integer)

    A bitwise combination of KeyModifier::MOD_SHIFT, KeyModifier::MOD_CONTROL, KeyModifier::MOD_ALT or KeyModifier::MOD_WIN specifying the modifier keys that have to be pressed along with the key.

  • virtualKeyCode (Integer)

    The key code of the hotkey, e.g. an ASCII character such as 'K' or one of elements of KeyCode enum.

Returns:

  • (Boolean)

See Also:

Requires:

  • USE_HOTKEY


2613
# File 'lib/wx/doc/gen/window.rb', line 2613

def register_hot_key(hotkeyId, modifiers, virtualKeyCode) end

#release_mousevoid

This method returns an undefined value.

Releases mouse input captured with #capture_mouse.



2442
# File 'lib/wx/doc/gen/window.rb', line 2442

def release_mouse; end

#remove_child(child) ⇒ void

This method returns an undefined value.

Removes a child window.

This is called automatically by window deletion functions so should not be required by the application programmer. Notice that this function is mostly internal to wxWidgets and shouldn’t be called by the user code.

Parameters:



376
# File 'lib/wx/doc/gen/window.rb', line 376

def remove_child(child) end

#remove_event_handler(handler) ⇒ Boolean

Find the given handler in the windows event handler stack and removes (but does not delete) it from the stack.

See EvtHandler#unlink for more info.

Returns true if it was found and false otherwise (this also results in an assert failure so this function should only be called when the handler is supposed to be there).

Parameters:

  • handler (Wx::EvtHandler)

    The event handler to remove, must be non-NULL and must be present in this windows event handlers stack.

Returns:

  • (Boolean)

See Also:



1767
# File 'lib/wx/doc/gen/window.rb', line 1767

def remove_event_handler(handler) end

#reparent(newParent) ⇒ Boolean

Reparents the window, i.e. the window will be removed from its current parent window (e.g.

a non-standard toolbar in a Frame) and then re-inserted into another. Notice that currently you need to explicitly call Notebook#remove_page before reparenting a notebook page.

Parameters:

Returns:

  • (Boolean)


419
# File 'lib/wx/doc/gen/window.rb', line 419

def reparent(newParent) end

#screen_to_client(pt) ⇒ Wx::Point

Converts from screen to client window coordinates.

Parameters:

  • pt (Array(Integer, Integer), Wx::Point)

    The screen position.

Returns:



1342
# File 'lib/wx/doc/gen/window.rb', line 1342

def screen_to_client(pt) end

#scroll_lines(lines) ⇒ Boolean

Scrolls the window by the given number of lines down (if lines is positive) or up.

Returns true if the window was scrolled, false if it was already on top/bottom and nothing was done.

Remark:

This function is currently only implemented under MSW and TextCtrl under WXGTK (it also works for Scrolled classes under all platforms).

Parameters:

  • lines (Integer)

Returns:

  • (Boolean)

See Also:



495
# File 'lib/wx/doc/gen/window.rb', line 495

def scroll_lines(lines) end

#scroll_pages(pages) ⇒ Boolean

Scrolls the window by the given number of pages down (if pages is positive) or up.

Returns true if the window was scrolled, false if it was already on top/bottom and nothing was done.

Remark:

This function is currently only implemented under MSW and WXGTK.

Parameters:

  • pages (Integer)

Returns:

  • (Boolean)

See Also:



509
# File 'lib/wx/doc/gen/window.rb', line 509

def scroll_pages(pages) end

#scroll_window(dx, dy, rect = nil) ⇒ void

This method returns an undefined value.

Physically scrolls the pixels in the window and move child windows accordingly.

Remark:

Note that you can often use Scrolled instead of using this function directly.

Parameters:

  • dx (Integer)

    Amount to scroll horizontally.

  • dy (Integer)

    Amount to scroll vertically.

  • rect (Wx::Rect) (defaults to: nil)

    Rectangle to scroll, if it is NULL, the whole window is scrolled (this is always the case under WXGTK which doesn’t support this parameter)



522
# File 'lib/wx/doc/gen/window.rb', line 522

def scroll_window(dx, dy, rect=nil) end

#send_size_event(flags = 0) ⇒ void

This method returns an undefined value.

This function sends a dummy size event to the window allowing it to re-layout its children positions.

It is sometimes useful to call this function after adding or deleting a children after the frame creation or if a child size changes. Note that if the frame is using either sizers or constraints for the children layout, it is enough to call #layout directly and this function should not be used in this case. If flags includes SEND_EVENT_POST value, this function posts the event, i.e. schedules it for later processing, instead of dispatching it directly. You can also use #post_size_event as a more readable equivalent of calling this function with this flag.

Parameters:

  • flags (Integer) (defaults to: 0)

    May include SEND_EVENT_POST. Default value is 0.



994
# File 'lib/wx/doc/gen/window.rb', line 994

def send_size_event(flags=0) end

#send_size_event_to_parent(flags = 0) ⇒ void

This method returns an undefined value.

Safe wrapper for #get_parent->#send_size_event.

This function simply checks that the window has a valid parent which is not in process of being deleted and calls #send_size_event on it. It is used internally by windows such as toolbars changes to whose state should result in parent re-layout (e.g. when a toolbar is added to the top of the window, all the other windows must be shifted down).

Parameters:

  • flags (Integer) (defaults to: 0)

    See description of this parameter in #send_size_event documentation.

See Also:



1002
# File 'lib/wx/doc/gen/window.rb', line 1002

def send_size_event_to_parent(flags=0) end

#set_accelerator_table(accel) ⇒ void Also known as: accelerator_table=

This method returns an undefined value.

Sets the accelerator table for this window.

See AcceleratorTable.

Parameters:



2272
# File 'lib/wx/doc/gen/window.rb', line 2272

def set_accelerator_table(accel) end

#set_auto_layout(autoLayout) ⇒ void Also known as: auto_layout=

This method returns an undefined value.

Determines whether the #layout function will be called automatically when the window is resized.

This method is called implicitly by #set_sizer but if you use set_constraints you should call it manually or otherwise the window layout won’t be correctly updated when its size changes.

Parameters:

  • autoLayout (Boolean)

    Set this to true if you wish the #layout function to be called automatically when the window is resized.

See Also:



2389
# File 'lib/wx/doc/gen/window.rb', line 2389

def set_auto_layout(autoLayout) end

#set_background_colour(colour) ⇒ Boolean Also known as: background_colour=

Sets the background colour of the window.

Notice that as with #set_foreground_colour, setting the background colour of a native control may not affect the entire control and could be not supported at all depending on the control and platform. Please see #inherit_attributes for explanation of the difference between this method and #set_own_background_colour.

Remark:

The background colour is usually painted by the default EraseEvent event handler function under Windows and automatically under GTK. Note that setting the background colour does not cause an immediate refresh, so you may wish to call #clear_background or #refresh after calling this function. Using this function will disable attempts to use themes for this window, if the system supports them. Use with care since usually the themes represent the appearance chosen by the user to be used for all applications on the system.

true if the colour was really changed, false if it was already set to this colour and nothing was done.

Parameters:

  • colour (Wx::Colour, String, Symbol)

    The colour to be used as the background colour; pass NULL_COLOUR to reset to the default colour. Note that you may want to use SystemSettings.get_colour to retrieve a suitable colour to use rather than setting a hard-coded one.

Returns:

  • (Boolean)

See Also:



1523
# File 'lib/wx/doc/gen/window.rb', line 1523

def set_background_colour(colour) end

#set_background_style(style) ⇒ Boolean Also known as: background_style=

Sets the background style of the window.

The default background style is BackgroundStyle::BG_STYLE_ERASE which indicates that the window background may be erased in EVT_ERASE_BACKGROUND handler. This is a safe, compatibility default; however you may want to change it to BackgroundStyle::BG_STYLE_SYSTEM if you don’t define any erase background event handlers at all, to avoid unnecessary generation of erase background events and always let system erase the background. And you should change the background style to BackgroundStyle::BG_STYLE_PAINT if you define an EVT_PAINT handler which completely overwrites the window background as in this case erasing it previously, either in EVT_ERASE_BACKGROUND handler or in the system default handler, would result in flicker as the background pixels will be repainted twice every time the window is redrawn. Do ensure that the background is entirely erased by your EVT_PAINT handler in this case however as otherwise garbage may be left on screen. Notice that in previous versions of wxWidgets a common way to work around the above mentioned flickering problem was to define an empty EVT_ERASE_BACKGROUND handler. Setting background style to BackgroundStyle::BG_STYLE_PAINT is a simpler and more efficient solution to the same problem. Under WXGTK and WXOSX, you can use BackgroundStyle::BG_STYLE_TRANSPARENT to obtain full transparency of the window background. Note that WXGTK supports this only since GTK 2.12 with a compositing manager enabled, call #is_transparent_background_supported to check whether this is the case, see the example of doing it in the shapedsample“. Also, in order for SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) to work, it must be called before #create. If you’re using your own Wx::Window-derived class you should write your code in the following way:

class MyWidget < Wx::Window
    def initialize(parent, ...)
      super() # Use default ctor here!
       # Do this first:
       set_background_style(Wx::BG_STYLE_TRANSPARENT)

       # And really create the window afterwards:
       create(parent, ...)
    end
  end


1550
# File 'lib/wx/doc/gen/window.rb', line 1550

def set_background_style(style) end

#set_can_focus(canFocus) ⇒ void Also known as: can_focus=

This method returns an undefined value.

This method is only implemented by ports which have support for native TAB traversal (such as GTK+ 2.0).

It is called by wxWidgets’ container control code to give the native system a hint when doing TAB traversal. A call to this does not disable or change the effect of programmatically calling #set_focus.

Parameters:

  • canFocus (Boolean)

See Also:



324
# File 'lib/wx/doc/gen/window.rb', line 324

def set_can_focus(canFocus) end

#set_caret(caret) ⇒ void Also known as: caret=

This method returns an undefined value.

Sets the caret() associated with the window.

Parameters:



2447
# File 'lib/wx/doc/gen/window.rb', line 2447

def set_caret(caret) end

#set_client_size(width, height) ⇒ void #set_client_size(size) ⇒ void #set_client_size(rect) ⇒ void Also known as: client_size=

Overloads:

  • #set_client_size(width, height) ⇒ void

    This method returns an undefined value.

    This sets the size of the window client area in pixels.

    Using this function to size a window tends to be more device-independent than #set_size, since the application need not worry about what dimensions the border or title bar have when trying to fit the window around panel items, for example. Note that special value of -1 which can be used in some other functions to preserve the existing size is not supported for width and height here, i.e. they both must be valid, positive integers.

    Parameters:

    • width (Integer)
    • height (Integer)

    See Also:

  • #set_client_size(size) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • size (Array(Integer, Integer), Wx::Size)
  • #set_client_size(rect) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



1021
# File 'lib/wx/doc/gen/window.rb', line 1021

def set_client_size(*args) end

#set_containing_sizer(sizer) ⇒ void Also known as: containing_sizer=

This method returns an undefined value.

Used by Sizer internally to notify the window about being managed by the given sizer.

This method should not be called from outside the library, unless you’re implementing a custom sizer class and in the latter case you must call this method with the pointer to the sizer itself whenever a window is added to it and with NULL argument when the window is removed from it.

Parameters:



1029
# File 'lib/wx/doc/gen/window.rb', line 1029

def set_containing_sizer(sizer) end

#set_cursor(cursor) ⇒ Boolean Also known as: cursor=

Sets the window’s cursor.

Notice that the window cursor also sets it for the children of the window implicitly. The cursor may be NULL_CURSOR in which case the window cursor will be reset back to default.

Parameters:

  • cursor (Wx::Cursor)

    Specifies the cursor that the window should normally display.

Returns:

  • (Boolean)

See Also:



2458
# File 'lib/wx/doc/gen/window.rb', line 2458

def set_cursor(cursor) end

#set_double_buffered(on) ⇒ void Also known as: double_buffered=

This method returns an undefined value.

Turn on or off double buffering of the window if the system supports it.

Parameters:

  • on (Boolean)


2561
# File 'lib/wx/doc/gen/window.rb', line 2561

def set_double_buffered(on) end

#set_drop_target(target) ⇒ void Also known as: drop_target=

This method returns an undefined value.

Associates a drop target with this window.

If the window already has a drop target, it is deleted.

Parameters:

See Also:



2324
# File 'lib/wx/doc/gen/window.rb', line 2324

def set_drop_target(target) end

#set_event_handler(handler) ⇒ void Also known as: event_handler=

This method returns an undefined value.

Sets the event handler for this window.

Note that if you use this function you may want to use as the “next” handler of handler the window itself; in this way when handler doesn’t process an event, the window itself will have a chance to do it.

Parameters:

  • handler (Wx::EvtHandler)

    Specifies the handler to be set. Cannot be NULL.

See Also:

  • Events are Processed


1775
# File 'lib/wx/doc/gen/window.rb', line 1775

def set_event_handler(handler) end

#set_extra_style(exStyle) ⇒ void Also known as: extra_style=

This method returns an undefined value.

Sets the extra style bits for the window.

The currently defined extra style bits are reported in the class description.

Parameters:

  • exStyle (Integer)


1831
# File 'lib/wx/doc/gen/window.rb', line 1831

def set_extra_style(exStyle) end

#set_focusvoid

This method returns an undefined value.

This sets the window to receive keyboard input.



343
# File 'lib/wx/doc/gen/window.rb', line 343

def set_focus; end

#set_focus_from_kbdvoid

This method returns an undefined value.

This function is called by wxWidgets keyboard navigation code when the user gives the focus to this window from keyboard (e.g. using TAB key).

By default this method simply calls #set_focus but can be overridden to do something in addition to this in the derived classes.



349
# File 'lib/wx/doc/gen/window.rb', line 349

def set_focus_from_kbd; end

#set_font(font) ⇒ Boolean Also known as: font=

Sets the font for this window.

This function should not be called for the parent window if you don’t want its font to be inherited by its children, use #set_own_font instead in this case and see #inherit_attributes for more explanations. Please notice that the given font is not automatically used for PaintDC objects associated with this window, you need to call DC#set_font too. However this font is used by any standard controls for drawing their text as well as by #get_text_extent.

true if the font was really changed, false if it was already set to this font and nothing was done.

Parameters:

Returns:

  • (Boolean)

See Also:



1574
# File 'lib/wx/doc/gen/window.rb', line 1574

def set_font(font) end

#set_foreground_colour(colour) ⇒ Boolean Also known as: foreground_colour=

Sets the foreground colour of the window.

The meaning of foreground colour varies according to the window class; it may be the text colour or other colour, or it may not be used at all. Additionally, not all native controls support changing their foreground colour so this method may change their colour only partially or even not at all. Please see #inherit_attributes for explanation of the difference between this method and #set_own_foreground_colour.

true if the colour was really changed, false if it was already set to this colour and nothing was done.

Parameters:

  • colour (Wx::Colour, String, Symbol)

    The colour to be used as the foreground colour; pass NULL_COLOUR to reset to the default colour.

Returns:

  • (Boolean)

See Also:



1589
# File 'lib/wx/doc/gen/window.rb', line 1589

def set_foreground_colour(colour) end

#set_help_text(helpText) ⇒ void Also known as: help_text=

This method returns an undefined value.

Sets the help text to be used as context-sensitive help for this window.

Note that the text is actually stored by the current HelpProvider implementation, and not in the window object itself.

Parameters:

  • helpText (String)

See Also:



2026
# File 'lib/wx/doc/gen/window.rb', line 2026

def set_help_text(helpText) end

#set_id(winid) ⇒ void Also known as: id=

This method returns an undefined value.

Sets the identifier of the window.

Remark:

Each window has an integer identifier. If the application has not provided one, an identifier will be generated. Normally, the identifier should be provided on creation and should not be modified subsequently.

Parameters:

  • winid (Integer)

See Also:



2222
# File 'lib/wx/doc/gen/window.rb', line 2222

def set_id(winid) end

#set_initial_size(size = Wx::DEFAULT_SIZE) ⇒ void Also known as: initial_size=

This method returns an undefined value.

A smart SetSize that will fill in default size components with the window’s best size values.

Also sets the window’s minsize to the value passed in for use with sizers. This means that if a full or partial size is passed to this function then the sizers will use that size instead of the results of #get_best_size to determine the minimum needs of the window for layout. Most controls will use this to set their initial size, and their min size to the passed in value (if any.)

Parameters:

  • size (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)

See Also:



1042
# File 'lib/wx/doc/gen/window.rb', line 1042

def set_initial_size(size=Wx::DEFAULT_SIZE) end

#set_label(label) ⇒ void Also known as: label=

This method returns an undefined value.

Sets the window’s label.

Parameters:

  • label (String)

    The window label.

See Also:



2231
# File 'lib/wx/doc/gen/window.rb', line 2231

def set_label(label) end

#set_layout_direction(dir) ⇒ void Also known as: layout_direction=

This method returns an undefined value.

Sets the layout direction for this window.

This function is only supported under MSW and GTK platforms, but not under Mac currently.

Parameters:



2239
# File 'lib/wx/doc/gen/window.rb', line 2239

def set_layout_direction(dir) end

#set_max_client_size(size) ⇒ void Also known as: max_client_size=

This method returns an undefined value.

Sets the maximum client size of the window, to indicate to the sizer layout mechanism that this is the maximum possible size of its client area.

Note that this method is just a shortcut for:

set_max_size(client_to_window_size(size))

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



1055
# File 'lib/wx/doc/gen/window.rb', line 1055

def set_max_client_size(size) end

#set_max_size(size) ⇒ void Also known as: max_size=

This method returns an undefined value.

Sets the maximum size of the window, to indicate to the sizer layout mechanism that this is the maximum possible size.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



1065
# File 'lib/wx/doc/gen/window.rb', line 1065

def set_max_size(size) end

#set_min_client_size(size) ⇒ void Also known as: min_client_size=

This method returns an undefined value.

Sets the minimum client size of the window, to indicate to the sizer layout mechanism that this is the minimum required size of window’s client area.

You may need to call this if you change the window size after construction and before adding to its parent sizer. Note, that just as with #set_min_size, calling this method doesn’t prevent the program from explicitly making the window smaller than the specified size. Note that this method is just a shortcut for:

set_min_size(client_to_window_size(size))

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



1080
# File 'lib/wx/doc/gen/window.rb', line 1080

def set_min_client_size(size) end

#set_min_size(size) ⇒ void Also known as: min_size=

This method returns an undefined value.

Sets the minimum size of the window, to indicate to the sizer layout mechanism that this is the minimum required size.

You may need to call this if you change the window size after construction and before adding to its parent sizer. Notice that calling this method doesn’t prevent the program from making the window explicitly smaller than the specified size by calling #set_size, it just ensures that it won’t become smaller than this size during the automatic layout.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



1091
# File 'lib/wx/doc/gen/window.rb', line 1091

def set_min_size(size) end

#set_name(name) ⇒ void Also known as: name=

This method returns an undefined value.

Sets the window’s name.

Parameters:

  • name (String)

    A name to set for the window.

See Also:



2248
# File 'lib/wx/doc/gen/window.rb', line 2248

def set_name(name) end

#set_next_handler(handler) ⇒ void Also known as: next_handler=

This method returns an undefined value.

Wx::Windows cannot be used to form event handler chains; this function thus will assert when called.

Note that instead you can use #push_event_handler or #set_event_handler to implement a stack of event handlers to override Wx::Window‘s own event handling mechanism.

Parameters:



1783
# File 'lib/wx/doc/gen/window.rb', line 1783

def set_next_handler(handler) end

#set_own_background_colour(colour) ⇒ void Also known as: own_background_colour=

This method returns an undefined value.

Sets the background colour of the window but prevents it from being inherited by the children of this window.

Parameters:

See Also:



1599
# File 'lib/wx/doc/gen/window.rb', line 1599

def set_own_background_colour(colour) end

#set_own_font(font) ⇒ void Also known as: own_font=

This method returns an undefined value.

Sets the font of the window but prevents it from being inherited by the children of this window.

Parameters:

See Also:



1627
# File 'lib/wx/doc/gen/window.rb', line 1627

def set_own_font(font) end

#set_own_foreground_colour(colour) ⇒ void Also known as: own_foreground_colour=

This method returns an undefined value.

Sets the foreground colour of the window but prevents it from being inherited by the children of this window.

Parameters:

See Also:



1637
# File 'lib/wx/doc/gen/window.rb', line 1637

def set_own_foreground_colour(colour) end

#set_position(pt) ⇒ void Also known as: position=

This method returns an undefined value.

Moves the window to the specified position.

This is exactly the same as calling #move with the default arguments.

Parameters:



1293
# File 'lib/wx/doc/gen/window.rb', line 1293

def set_position(pt) end

#set_previous_handler(handler) ⇒ void Also known as: previous_handler=

This method returns an undefined value.

Wx::Windows cannot be used to form event handler chains; this function thus will assert when called.

Note that instead you can use #push_event_handler or #set_event_handler to implement a stack of event handlers to override Wx::Window‘s own event handling mechanism.

Parameters:



1791
# File 'lib/wx/doc/gen/window.rb', line 1791

def set_previous_handler(handler) end

#set_scroll_pos(orientation, pos, refresh = true) ⇒ void

This method returns an undefined value.

Sets the position of one of the built-in scrollbars.

Remark:

This function does not directly affect the contents of the window: it is up to the application to take note of scrollbar attributes and redraw contents accordingly.

Parameters:

  • orientation (Integer)

    Determines the scrollbar whose position is to be set. May be Orientation::HORIZONTAL or Orientation::VERTICAL.

  • pos (Integer)

    Position in scroll units.

  • refresh (Boolean) (defaults to: true)

    true to redraw the scrollbar, false otherwise.

See Also:



556
# File 'lib/wx/doc/gen/window.rb', line 556

def set_scroll_pos(orientation, pos, refresh=true) end

#set_scrollbar(orientation, position, thumbSize, range, refresh = true) ⇒ void

This method returns an undefined value.

Sets the scrollbar properties of a built-in scrollbar.

Remark:

Let's say you wish to display 50 lines of text, using the same font. The window is sized so that you can only see 16 lines at a time. You would use: ```ruby set_scrollbar(Wx::VERTICAL, 0, 16, 50) ``` Note that with the window at this size, the thumb position can never go above 50 minus 16, or 34. You can determine how many lines are currently visible by dividing the current view size by the character height in pixels. When defining your own scrollbar behaviour, you will always need to recalculate the scrollbar settings when the window size changes. You could therefore put your scrollbar calculations and SetScrollbar call into a function named AdjustScrollbars, which can be called initially and also from your SizeEvent handler function.

Parameters:

  • orientation (Integer)

    Determines the scrollbar whose page size is to be set. May be Orientation::HORIZONTAL or Orientation::VERTICAL.

  • position (Integer)

    The position of the scrollbar in scroll units.

  • thumbSize (Integer)

    The size of the thumb, or visible portion of the scrollbar, in scroll units.

  • range (Integer)

    The maximum position of the scrollbar. Value of -1 can be used to ask for the scrollbar to be shown but in the disabled state: this can be used to avoid removing the scrollbar even when it is not needed (currently this is only implemented in WXMSW port).

  • refresh (Boolean) (defaults to: true)

    true to redraw the scrollbar, false otherwise.

See Also:



579
# File 'lib/wx/doc/gen/window.rb', line 579

def set_scrollbar(orientation, position, thumbSize, range, refresh=true) end

#set_size(x, y, width, height, sizeFlags = Wx::SIZE_AUTO) ⇒ void #set_size(rect) ⇒ void #set_size(size) ⇒ void Also known as: size=

Overloads:

  • #set_size(x, y, width, height, sizeFlags = Wx::SIZE_AUTO) ⇒ void

    This method returns an undefined value.

    Sets the size of the window in pixels.

    Remark:

    This overload sets the position and optionally size, of the window. Parameters may be DEFAULT_COORD to indicate either that a default should be supplied by wxWidgets, or that the current value of the dimension should be used.

    Parameters:

    • x (Integer)

      Required x position in pixels, or DEFAULT_COORD to indicate that the existing value should be used.

    • y (Integer)

      Required y position in pixels, or DEFAULT_COORD to indicate that the existing value should be used.

    • width (Integer)

      Required width in pixels, or DEFAULT_COORD to indicate that the existing value should be used.

    • height (Integer)

      Required height position in pixels, or DEFAULT_COORD to indicate that the existing value should be used.

    • sizeFlags (Integer) (defaults to: Wx::SIZE_AUTO)

      Indicates the interpretation of other parameters. It is a bit list of the following:

      • SIZE_AUTO_WIDTH: a DEFAULT_COORD width value is taken to indicate a wxWidgets-supplied default width.

      • SIZE_AUTO_HEIGHT: a DEFAULT_COORD height value is taken to indicate a wxWidgets-supplied default height.

      • SIZE_AUTO: DEFAULT_COORD size values are taken to indicate a wxWidgets-supplied default size.

      • SIZE_USE_EXISTING: existing dimensions should be used if DEFAULT_COORD values are supplied.

      • SIZE_ALLOW_MINUS_ONE: allow negative dimensions (i.e. value of DEFAULT_COORD) to be interpreted as real dimensions, not default values.

      • SIZE_FORCE: normally, if the position and the size of the window are already the same as the parameters of this function, nothing is done. but with this flag a window resize may be forced even in this case (supported in wx 2.6.2 and later and only implemented for MSW and ignored elsewhere currently).

    See Also:

  • #set_size(rect) ⇒ void

    This method returns an undefined value.

    Sets the size of the window in pixels.

    The size is specified using a Rect, Size or by a couple of int objects.

    Remark:

    This form must be used with non-default width and height values.

    Parameters:

    See Also:

  • #set_size(size) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • size (Array(Integer, Integer), Wx::Size)


1135
# File 'lib/wx/doc/gen/window.rb', line 1135

def set_size(*args) end

#set_size_hints(minSize, maxSize = Wx::DEFAULT_SIZE, incSize = Wx::DEFAULT_SIZE) ⇒ void #set_size_hints(minW, minH, maxW = -1, maxH = -1, incW = -1, incH = -1) ⇒ void Also known as: size_hints=

Overloads:

  • #set_size_hints(minSize, maxSize = Wx::DEFAULT_SIZE, incSize = Wx::DEFAULT_SIZE) ⇒ void

    This method returns an undefined value.

    Use of this function for windows which are not toplevel windows (such as Dialog or Frame) is discouraged.

    Please use #set_min_size and #set_max_size instead.

    Parameters:

    • minSize (Array(Integer, Integer), Wx::Size)
    • maxSize (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)
    • incSize (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)

    See Also:

  • #set_size_hints(minW, minH, maxW = -1, maxH = -1, incW = -1, incH = -1) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • minW (Integer)
    • minH (Integer)
    • maxW (Integer) (defaults to: -1)
    • maxH (Integer) (defaults to: -1)
    • incW (Integer) (defaults to: -1)
    • incH (Integer) (defaults to: -1)


1157
# File 'lib/wx/doc/gen/window.rb', line 1157

def set_size_hints(*args) end

#set_sizer(sizer) ⇒ void Also known as: sizer=

This method returns an undefined value.

Sets the window to have the given layout sizer.

The window will then own the object, and will take care of its deletion. If an existing layout constraints object is already owned by the window, it will be deleted if the deleteOld parameter is true. Note that this function will also call #set_auto_layout implicitly with true parameter if the sizer is non-NULL and false otherwise so that the sizer will be effectively used to layout the window children whenever it is resized.

Remark:

SetSizer enables and disables Layout automatically.

Parameters:

  • sizer (Wx::Sizer)

    The sizer to set. Pass NULL to disassociate and conditionally delete the window’s sizer. See below.



2361
# File 'lib/wx/doc/gen/window.rb', line 2361

def set_sizer(sizer) end

#set_sizer_and_fit(sizer) ⇒ void Also known as: sizer_and_fit=

This method returns an undefined value.

Associate the sizer with the window and set the window size and minimal size accordingly.

This method calls #set_sizer and then Sizer#set_size_hints which sets the initial window size to the size needed to accommodate all sizer elements and sets the minimal size to the same size, this preventing the user from resizing this window to be less than this minimal size (if it’s a top-level window which can be directly resized by the user).

Parameters:



2369
# File 'lib/wx/doc/gen/window.rb', line 2369

def set_sizer_and_fit(sizer) end

#set_theme_enabled(enable) ⇒ void Also known as: theme_enabled=

This method returns an undefined value.

This function tells a window if it should use the system’s “theme” code to draw the windows’ background instead of its own background drawing code.

This does not always have any effect since the underlying platform obviously needs to support the notion of themes in user defined windows. One such platform is GTK+ where windows can have (very colourful) backgrounds defined by a user’s selected theme. Dialogs, notebook pages and the status bar have this flag set to true by default so that the default look and feel is simulated best.

Parameters:

  • enable (Boolean)

See Also:



1666
# File 'lib/wx/doc/gen/window.rb', line 1666

def set_theme_enabled(enable) end

#set_tool_tip(tipString) ⇒ void #set_tool_tip(tip) ⇒ void Also known as: tool_tip=

Overloads:

  • #set_tool_tip(tipString) ⇒ void

    This method returns an undefined value.

    Attach a tooltip to the window.

    ToolTip pointer can be NULL in the overload taking the pointer, meaning to unset any existing tooltips; however #unset_tool_tip provides a more readable alternative to this operation. Notice that these methods are always available, even if wxWidgets was compiled with Setup::USE_TOOLTIPS set to 0, but don’t do anything in this case.

    Parameters:

    • tipString (String)

    See Also:

  • #set_tool_tip(tip) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:



2061
# File 'lib/wx/doc/gen/window.rb', line 2061

def set_tool_tip(*args) end

#set_transparent(alpha) ⇒ Boolean Also known as: transparent=

Set the transparency of the window.

If the system supports transparent windows, returns true, otherwise returns false and the window remains fully opaque. See also #can_set_transparent. The parameter alpha is in the range 0..255 where 0 corresponds to a fully transparent window and 255 to the fully opaque one. The constants IMAGE_ALPHA_TRANSPARENT and IMAGE_ALPHA_OPAQUE can be used.

Parameters:

  • alpha (Integer)

Returns:

  • (Boolean)


1690
# File 'lib/wx/doc/gen/window.rb', line 1690

def set_transparent(alpha) end

#set_validator(validator) ⇒ void Also known as: validator=

This method returns an undefined value.

Deletes the current validator (if any) and sets the window validator, having called Validator#clone to create a new validator of this type.

Parameters:



2125
# File 'lib/wx/doc/gen/window.rb', line 2125

def set_validator(validator) end

#set_virtual_size(width, height) ⇒ void #set_virtual_size(size) ⇒ void Also known as: virtual_size=

Overloads:

  • #set_virtual_size(width, height) ⇒ void

    This method returns an undefined value.

    Sets the virtual size of the window in pixels.

    Parameters:

    • width (Integer)
    • height (Integer)

    See Also:

  • #set_virtual_size(size) ⇒ void

    This method returns an undefined value.

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • size (Array(Integer, Integer), Wx::Size)


1172
# File 'lib/wx/doc/gen/window.rb', line 1172

def set_virtual_size(*args) end

#set_window_style(style) ⇒ void Also known as: window_style=

This method returns an undefined value.

See #set_window_style_flag for more info.

Parameters:

  • style (Integer)


1847
# File 'lib/wx/doc/gen/window.rb', line 1847

def set_window_style(style) end

#set_window_style_flag(style) ⇒ void Also known as: window_style_flag=

This method returns an undefined value.

Sets the style of the window.

Please note that some styles cannot be changed after the window creation and that #refresh might need to be called after changing the others for the change to take place immediately. See Window styles for more information about flags.

Parameters:

  • style (Integer)

See Also:



1841
# File 'lib/wx/doc/gen/window.rb', line 1841

def set_window_style_flag(style) end

#set_window_variant(variant) ⇒ void Also known as: window_variant=

This method returns an undefined value.

Chooses a different variant of the window display to use.

Window variants currently just differ in size, as can be seen from Wx::WindowVariant documentation. Under all platforms but macOS, this function does nothing more than change the font used by the window. However under macOS it is implemented natively and selects the appropriate variant of the native widget, which has better appearance than just scaled down or up version of the normal variant, so it should be preferred to directly tweaking the font size. By default the controls naturally use the normal variant.

Parameters:



2257
# File 'lib/wx/doc/gen/window.rb', line 2257

def set_window_variant(variant) end

#should_inherit_coloursBoolean

Return true from here to allow the colours of this window to be changed by #inherit_attributes.

Returning false forbids inheriting them from the parent window. The base class version returns false, but this method is overridden in Control where it returns true.

Returns:

  • (Boolean)


1657
# File 'lib/wx/doc/gen/window.rb', line 1657

def should_inherit_colours; end

#show(show = true) ⇒ Boolean

Shows or hides the window.

You may need to call raise for a top level window if you want to bring it to top, although this is not needed if #show is called immediately after the frame creation. Notice that the default state of newly created top level windows is hidden (to allow you to create their contents without flicker) unlike for all the other, not derived from TopLevelWindow, windows that are by default created in the shown state.

true if the window has been shown or hidden or false if nothing was done because it already was in the requested state.

Parameters:

  • show (Boolean) (defaults to: true)

    If true displays the window. Otherwise, hides it.

Returns:

  • (Boolean)

See Also:



1994
# File 'lib/wx/doc/gen/window.rb', line 1994

def show(show=true) end

#show_with_effect(effect, timeout = 0) ⇒ Boolean

This function shows a window, like #show, but using a special visual effect if possible.

Note:

Currently this function is only implemented in WXMSW and WXOSX and does the same thing as #show in the other ports.

Parameters:

  • effect (Wx::ShowEffect)

    The effect to use.

  • timeout (Integer) (defaults to: 0)

    The timeout parameter specifies the time of the animation, in milliseconds. If the default value of 0 is used, the default animation time for the current platform is used.

Returns:

  • (Boolean)

See Also:



2007
# File 'lib/wx/doc/gen/window.rb', line 2007

def show_with_effect(effect, timeout=0) end

#switch_sizer(new_sizer) ⇒ Wx::Sizer

Switches the current sizer with the given sizer and detaches and returns the ‘old’ sizer.

Parameters:

  • new_sizer (Wx::Sizer)

    new sizer for window

Returns:



93
# File 'lib/wx/doc/window.rb', line 93

def switch_sizer(new_sizer) end

#thawvoid

This method returns an undefined value.

Re-enables window updating after a previous call to #freeze.

To really thaw the control, it must be called exactly the same number of times as #freeze. If the window has any children, they are recursively thawed too.

See Also:



1370
# File 'lib/wx/doc/gen/window.rb', line 1370

def thaw; end

#to_dip(sz) ⇒ Wx::Size #to_dip(pt) ⇒ Wx::Point #to_dip(d) ⇒ Integer

Overloads:

  • #to_dip(sz) ⇒ Wx::Size

    Convert pixel values of the current toolkit to DPI-independent pixel values.

    A DPI-independent pixel is just a pixel at the standard 96 DPI resolution. To keep the same physical size at higher resolution, the physical pixel value must be scaled by #get_dpi_scale_factor but this scaling may be already done by the underlying toolkit (GTK+, Cocoa, …) automatically. This method performs the conversion only if it is not already done by the lower level toolkit, For example, you may want to use this to store window sizes and positions so that they can be re-used regardless of the display DPI:

    pt = Wx::Point.new(to_dip(get_position))
      size = Wx::Size.new(to_dip(get_size))
    

    Also note that if either component of sz has the special value of -1, it is returned unchanged independently of the current DPI, to preserve the special value of -1 in wxWidgets API (it is often used to mean “unspecified”).

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #to_dip(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #to_dip(d) ⇒ Integer

    Convert pixel values of the current toolkit to DPI-independent pixel values.

    This is the same as ToDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions. If d has the special value of -1, it is returned unchanged independently of the current DPI.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


701
# File 'lib/wx/doc/gen/window.rb', line 701

def to_dip(*args) end

#to_phys(sz) ⇒ Wx::Size #to_phys(pt) ⇒ Wx::Point #to_phys(d) ⇒ Integer

Overloads:

  • #to_phys(sz) ⇒ Wx::Size

    Convert from logical pixels to physical pixels.

    This function performs the transformation in the converse direction compared to from_phys.

    Parameters:

    • sz (Array(Integer, Integer), Wx::Size)

    Returns:

  • #to_phys(pt) ⇒ Wx::Point

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    Returns:

  • #to_phys(d) ⇒ Integer

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

    • d (Integer)

    Returns:

    • (Integer)


777
# File 'lib/wx/doc/gen/window.rb', line 777

def to_phys(*args) end

#toggle_window_style(flag) ⇒ Boolean

Turns the given flag on if it’s currently turned off and vice versa.

This function cannot be used if the value of the flag is 0 (which is often the case for default flags). Also, please notice that not all styles can be changed after the control creation. Returns true if the style was turned on by this function, false if it was switched off.

Parameters:

  • flag (Integer)

Returns:

  • (Boolean)

See Also:



1859
# File 'lib/wx/doc/gen/window.rb', line 1859

def toggle_window_style(flag) end

#transfer_data_from_windowBoolean

Transfers values from child controls to data areas specified by their validators.

Returns false if a transfer failed. Notice that this also calls #transfer_data_from_window for all children recursively.

Returns:

  • (Boolean)

See Also:



2136
# File 'lib/wx/doc/gen/window.rb', line 2136

def transfer_data_from_window; end

#transfer_data_to_windowBoolean

Transfers values to child controls from data areas specified by their validators.

Notice that this also calls #transfer_data_to_window for all children recursively. Returns false if a transfer failed.

Returns:

  • (Boolean)

See Also:



2146
# File 'lib/wx/doc/gen/window.rb', line 2146

def transfer_data_to_window; end

#unregister_hot_key(hotkeyId) ⇒ Boolean

Unregisters a system wide hotkey.

true if the hotkey was unregistered successfully, false if the id was invalid.

Remark:

This function is currently only implemented under MSW.

Parameters:

  • hotkeyId (Integer)

    Numeric identifier of the hotkey. Must be the same id that was passed to #register_hot_key.

Returns:

  • (Boolean)

See Also:

Requires:

  • USE_HOTKEY


2628
# File 'lib/wx/doc/gen/window.rb', line 2628

def unregister_hot_key(hotkeyId) end

#unset_tool_tipvoid

This method returns an undefined value.

Unset any existing tooltip.

See Also:



2069
# File 'lib/wx/doc/gen/window.rb', line 2069

def unset_tool_tip; end

#updatevoid

This method returns an undefined value.

Calling this method immediately repaints the invalidated area of the window and all of its children recursively (this normally only happens when the flow of control returns to the event loop).

Notice that this function doesn’t invalidate any area of the window so nothing happens if nothing has been invalidated (i.e. marked as requiring a redraw). Use #refresh first if you want to immediately redraw the window unconditionally.



1500
# File 'lib/wx/doc/gen/window.rb', line 1500

def update; end

#update_window_ui(flags = Wx::UpdateUI::UPDATE_UI_NONE) ⇒ void

This method returns an undefined value.

This function sends one or more UpdateUIEvent to the window.

The particular implementation depends on the window; for example a ToolBar will send an update UI event for each toolbar button, and a Frame will send an update UI event for each menubar menu item. You can call this function from your application to ensure that your UI is up-to-date at this point (as far as your UpdateUIEvent handlers are concerned). This may be necessary if you have called UpdateUIEvent.set_mode or UpdateUIEvent.set_update_interval to limit the overhead that wxWidgets incurs by sending update UI events in idle time. flags should be a bitlist of one or more of the UpdateUI enumeration. If you are calling this function from an OnInternalIdle or OnIdle function, make sure you pass the UpdateUI::UPDATE_UI_FROMIDLE flag, since this tells the window to only update the UI elements that need to be updated in idle time. Some windows update their elements only when necessary, for example when a menu is about to be shown. The following is an example of how to call UpdateWindowUI from an idle function.

class MyWindow
    ...
    def on_internal_idle
      update_window_ui(Wx::UPDATE_UI_FROMIDLE) if Wx::UpdateUIEvent.can_update(self)
    end
    ...
  end

Parameters:

  • flags (Integer) (defaults to: Wx::UpdateUI::UPDATE_UI_NONE)

See Also:



2650
# File 'lib/wx/doc/gen/window.rb', line 2650

def update_window_ui(flags=Wx::UpdateUI::UPDATE_UI_NONE) end

#use_background_colourBoolean

Return true if a background colour has been set for this window.

Same as #use_bg_col

Returns:

  • (Boolean)


1618
# File 'lib/wx/doc/gen/window.rb', line 1618

def use_background_colour; end

#use_bg_colBoolean

Return true if a background colour has been set for this window.

Returns:

  • (Boolean)


1612
# File 'lib/wx/doc/gen/window.rb', line 1612

def use_bg_col; end

#use_foreground_colourBoolean

Return true if a foreground colour has been set for this window.

Returns:

  • (Boolean)


1642
# File 'lib/wx/doc/gen/window.rb', line 1642

def use_foreground_colour; end

#validateBoolean

Validates the current values of the child controls using their validators.

Notice that this also calls #validate for all children recursively. Returns false if any of the validations failed.



2156
# File 'lib/wx/doc/gen/window.rb', line 2156

def validate; end

#warp_pointer(x, y) ⇒ void

This method returns an undefined value.

Moves the pointer to the given position on the window.

Note:

Apple Human Interface Guidelines forbid moving the mouse cursor programmatically so you should avoid using this function in Mac applications (and probably avoid using it under the other platforms without good reason as well).

Parameters:

  • x (Integer)

    The new x position for the cursor.

  • y (Integer)

    The new y position for the cursor.



2471
# File 'lib/wx/doc/gen/window.rb', line 2471

def warp_pointer(x, y) end

#window_to_client_size(size) ⇒ Wx::Size

Converts window size size to corresponding client area size In other words, the returned value is what would #get_client_size return if this window had given window size.

Components with DEFAULT_COORD value are left unchanged. Note that the conversion is not always exact, it assumes that non-client area doesn’t change and so doesn’t take into account things like menu bar (un)wrapping or (dis)appearance of the scrollbars.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

Returns:

See Also:



617
# File 'lib/wx/doc/gen/window.rb', line 617

def window_to_client_size(size) end