# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # Valid values for {Wx::Window#show_with_effect} and {Wx::Window#hide_with_effect}. # # # class ShowEffect < Wx::Enum # No effect, equivalent to normal {Wx::Window#show} or Hide() call. # SHOW_EFFECT_NONE = Wx::ShowEffect.new(0) # Roll window to the left. # SHOW_EFFECT_ROLL_TO_LEFT = Wx::ShowEffect.new(1) # Roll window to the right. # SHOW_EFFECT_ROLL_TO_RIGHT = Wx::ShowEffect.new(2) # Roll window to the top. # SHOW_EFFECT_ROLL_TO_TOP = Wx::ShowEffect.new(3) # Roll window to the bottom. # SHOW_EFFECT_ROLL_TO_BOTTOM = Wx::ShowEffect.new(4) # Slide window to the left. # SHOW_EFFECT_SLIDE_TO_LEFT = Wx::ShowEffect.new(5) # Slide window to the right. # SHOW_EFFECT_SLIDE_TO_RIGHT = Wx::ShowEffect.new(6) # Slide window to the top. # SHOW_EFFECT_SLIDE_TO_TOP = Wx::ShowEffect.new(7) # Slide window to the bottom. # SHOW_EFFECT_SLIDE_TO_BOTTOM = Wx::ShowEffect.new(8) # Fade in or out effect. # SHOW_EFFECT_BLEND = Wx::ShowEffect.new(9) # Expanding or collapsing effect. # SHOW_EFFECT_EXPAND = Wx::ShowEffect.new(10) # # SHOW_EFFECT_MAX = Wx::ShowEffect.new(11) end # ShowEffect # Don't generate any touch events. # TOUCH_NONE = 0 # Generate {Wx::PanGestureEvent} for vertical pans. # TOUCH_VERTICAL_PAN_GESTURE = 1 # Generate {Wx::PanGestureEvent} for horizontal pans. # TOUCH_HORIZONTAL_PAN_GESTURE = 2 # Generate {Wx::PanGestureEvent} for any pans. # TOUCH_PAN_GESTURES = 3 # Generate {Wx::ZoomGestureEvent}. # TOUCH_ZOOM_GESTURE = 4 # Generate {Wx::RotateGestureEvent}. # TOUCH_ROTATE_GESTURE = 8 # Generate events for press or tap gestures such as {Wx::TwoFingerTapEvent}, {Wx::LongPressEvent} and {Wx::PressAndTapEvent}. # TOUCH_PRESS_GESTURES = 16 # Enable all supported gesture events. # TOUCH_ALL_GESTURES = 31 # # SEND_EVENT_POST = 1 # Different window variants, on platforms like eg mac uses different rendering sizes. # # # class WindowVariant < Wx::Enum # Normal size. # WINDOW_VARIANT_NORMAL = Wx::WindowVariant.new(0) # Smaller size (about 25 % smaller than normal) # WINDOW_VARIANT_SMALL = Wx::WindowVariant.new(1) # Mini size (about 33 % smaller than normal) # WINDOW_VARIANT_MINI = Wx::WindowVariant.new(2) # Large size (about 25 % larger than normal) # WINDOW_VARIANT_LARGE = Wx::WindowVariant.new(3) # # WINDOW_VARIANT_MAX = Wx::WindowVariant.new(4) end # WindowVariant # Find the deepest window at the mouse pointer position, returning the window and current pointer position in screen coordinates. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Window] def self.find_window_at_pointer(pt) end # Gets the currently active window (implemented for MSW and GTK only currently, always returns NULL in the other ports). # @return [Wx::Window] def self.get_active_window; end # Returns the first top level parent of the given window, or in other words, the frame or dialog containing it, or NULL. # # Notice that if window is itself already a TLW, it is returned directly. # @param window [Wx::Window] # @return [Wx::Window] def self.get_top_level_parent(window) end # Return a string with human-readable platform-specific description of the window useful for diagnostic purposes. # # The string returned from this function doesn't have any fixed form and can vary between different wxWidgets ports and versions, but contains some useful description of the window and uniquely identifies it. This can be useful to include in debug or tracing messages. # @param window [Wx::Window] Window pointer which is allowed to be NULL. # @return [String] def self.dump_window(window) end # {Wx::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, {Wx::Window#get_size} or {Wx::Window#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: # # - {Wx::Border::BORDER_DEFAULT}: The window class will decide the kind of border to show, if any. # # - {Wx::Border::BORDER_SIMPLE}: Displays a thin border around the window. {Wx::SIMPLE_BORDER} is the old name for this style. # # - {Wx::Border::BORDER_SUNKEN}: Displays a sunken border. {Wx::SUNKEN_BORDER} is the old name for this style. # # - {Wx::Border::BORDER_RAISED}: Displays a raised border. {Wx::RAISED_BORDER} is the old name for this style. # # - {Wx::Border::BORDER_STATIC}: Displays a border suitable for a static control. {Wx::STATIC_BORDER} is the old name for this style. Windows only. # # - {Wx::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. # # - {Wx::Border::BORDER_NONE}: Displays no border, overriding the default border style for the window. {Wx::NO_BORDER} is the old name for this style. # # - {Wx::Border::BORDER_DOUBLE}: This style is obsolete and should not be used. # # - {Wx::TRANSPARENT_WINDOW}: The window is transparent, that is, it will not receive paint events. Windows only. # # - {Wx::TAB_TRAVERSAL}: This style is used by wxWidgets for the windows supporting TAB navigation among their children, such as {Wx::Dialog} and {Wx::Panel}. It should almost never be used in the application code. # # - {Wx::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. # # - {Wx::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. # # - {Wx::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. # # - {Wx::HSCROLL}: Use this style to enable a horizontal scrollbar. The same limitations as for {Wx::VSCROLL} apply to this style. # # - {Wx::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 {Wx::Universal} and does nothing on the other platforms. # # - {Wx::CLIP_CHILDREN}: Use this style to eliminate flicker caused by the background being repainted, then children being painted over them. Windows only. # # - {Wx::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: # # - {Wx::WS_EX_BLOCK_EVENTS}: {Wx::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. # # - {Wx::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. # # - {Wx::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 {Wx::EVT_HELP} event if the user clicked on an application window. This style cannot be used (because of the underlying native behaviour) together with {Wx::MAXIMIZE_BOX} or {Wx::MINIMIZE_BOX}, so these two styles are automatically turned off if this one is used. # # - {Wx::WS_EX_PROCESS_IDLE}: This window should always process idle events, even if the mode set by {Wx::IdleEvent.set_mode} is {Wx::IdleMode::IDLE_PROCESS_SPECIFIED}. # # - {Wx::WS_EX_PROCESS_UI_UPDATES}: This window should always process UI update events, even if the mode set by {Wx::UpdateUIEvent.set_mode} is {Wx::UpdateUIMode::UPDATE_UI_PROCESS_SPECIFIED}. # # ### Events emitted by this class # # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#EVT_ACTIVATE}(meth = nil, &block): Process a {Wx::EVT_ACTIVATE} event. See {Wx::ActivateEvent}. # # - {Wx::EvtHandler#evt_child_focus}(meth = nil, &block): Process a {Wx::EVT_CHILD_FOCUS} event. See {Wx::ChildFocusEvent}. # # - {Wx::EvtHandler#evt_context_menu}(meth = nil, &block): A right click (or other context menu command depending on platform) has been detected. See {Wx::ContextMenuEvent}. # # - {Wx::EvtHandler#evt_help}(id, meth = nil, &block): Process a {Wx::EVT_HELP} event. See {Wx::HelpEvent}. # # - {Wx::EvtHandler#evt_help_range}(id1, id2, meth = nil, &block): Process a {Wx::EVT_HELP} event for a range of ids. See {Wx::HelpEvent}. # # - {Wx::EvtHandler#evt_drop_files}(meth = nil, &block): Process a {Wx::EVT_DROP_FILES} event. See {Wx::DropFilesEvent}. # # - {Wx::EvtHandler#evt_erase_background}(meth = nil, &block): Process a {Wx::EVT_ERASE_BACKGROUND} event. See {Wx::EraseEvent}. # # - {Wx::EvtHandler#evt_set_focus}(meth = nil, &block): Process a {Wx::EVT_SET_FOCUS} event. See {Wx::FocusEvent}. # # - {Wx::EvtHandler#evt_kill_focus}(meth = nil, &block): Process a {Wx::EVT_KILL_FOCUS} event. See {Wx::FocusEvent}. # # - {Wx::EvtHandler#evt_idle}(meth = nil, &block): Process a {Wx::EVT_IDLE} event. See {Wx::IdleEvent}. # # - {Wx::EvtHandler}evt_joy_*(meth = nil, &block): Processes joystick events. See {Wx::JoystickEvent}. # # - {Wx::EvtHandler#evt_key_down}(meth = nil, &block): Process a {Wx::EVT_KEY_DOWN} event (any key has been pressed). See {Wx::KeyEvent}. # # - {Wx::EvtHandler#evt_key_up}(meth = nil, &block): Process a {Wx::EVT_KEY_UP} event (any key has been released). See {Wx::KeyEvent}. # # - {Wx::EvtHandler#evt_char}(meth = nil, &block): Process a {Wx::EVT_CHAR} event. See {Wx::KeyEvent}. # # - {Wx::EvtHandler#evt_char_hook}(meth = nil, &block): Process a {Wx::EVT_CHAR_HOOK} event. See {Wx::KeyEvent}. # # - {Wx::EvtHandler#evt_mouse_capture_lost}(meth = nil, &block): Process a {Wx::EVT_MOUSE_CAPTURE_LOST} event. See {Wx::MouseCaptureLostEvent}. # # - {Wx::EvtHandler#evt_mouse_capture_changed}(meth = nil, &block): Process a {Wx::EVT_MOUSE_CAPTURE_CHANGED} event. See {Wx::MouseCaptureChangedEvent}. # # - {Wx::EvtHandler}evt_mouse_*(meth = nil, &block): See {Wx::MouseEvent}. # # - {Wx::EvtHandler#evt_paint}(meth = nil, &block): Process a {Wx::EVT_PAINT} event. See {Wx::PaintEvent}. # # - {Wx::EvtHandler}evt_power_*(meth = nil, &block): The system power state changed. See {Wx::PowerEvent}. # # - {Wx::EvtHandler}evt_scrollwin_*(meth = nil, &block): Process scroll events. See {Wx::ScrollWinEvent}. # # - {Wx::EvtHandler#evt_set_cursor}(meth = nil, &block): Process a {Wx::EVT_SET_CURSOR} event. See {Wx::SetCursorEvent}. # # - {Wx::EvtHandler#evt_size}(meth = nil, &block): Process a {Wx::EVT_SIZE} event. See {Wx::SizeEvent}. # # - {Wx::EvtHandler#evt_sys_colour_changed}(meth = nil, &block): Process a {Wx::EVT_SYS_COLOUR_CHANGED} event. See {Wx::SysColourChangedEvent}. # # Category: Miscellaneous Windows # @see Events and Event Handling # @see Window Sizing Overview # # class Window < EvtHandler # 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. {Wx::StaticText}) and so doesn't need focus. # # # @see Wx::Window#accepts_focus_from_keyboard # @return [Boolean] def accepts_focus; end # 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. # @return [Boolean] def accepts_focus_from_keyboard; end # Overridden to indicate whether this window or one of its children accepts focus. # # Usually it's the same as {Wx::Window#accepts_focus} but is overridden for container windows. # @return [Boolean] def accepts_focus_recursively; end # 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. # @return [void] def disable_focus_from_keyboard; end # Can this window itself have focus? # @return [Boolean] def is_focusable; end alias_method :focusable?, :is_focusable # Can this window have focus right now? # # If this method returns true, it means that calling {Wx::Window#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 {Wx::Window#is_focusable} # @return [Boolean] def can_accept_focus; end alias_method :can_accept_focus?, :can_accept_focus # Can this window be assigned focus from keyboard right now? # @return [Boolean] def can_accept_focus_from_keyboard; end alias_method :can_accept_focus_from_keyboard?, :can_accept_focus_from_keyboard # Returns true if the window (or in case of composite controls, its main child window) has focus. # # # @see Wx::Window.find_focus # @return [Boolean] def has_focus; end alias_method :has_focus?, :has_focus # 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 {Wx::Window#set_focus}. # @see Wx::FocusEvent # @see Wx::Panel#set_focus # @see Wx::Panel#set_focus_ignoring_children # @param canFocus [Boolean] # @return [void] def set_can_focus(canFocus) end alias_method :can_focus=, :set_can_focus # 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. # @param enable [Boolean] # @return [void] def enable_visible_focus(enable) end # This sets the window to receive keyboard input. # # # @see Wx::Window#has_focus # @see Wx::FocusEvent # @see Wx::Panel#set_focus # @see Wx::Panel#set_focus_ignoring_children # @return [void] def set_focus; end # 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 {Wx::Window#set_focus} but can be overridden to do something in addition to this in the derived classes. # @return [void] def set_focus_from_kbd; end # 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. # @param child [Wx::Window] Child window to add. # @return [void] def add_child(child) end # Destroys all children of a window. # # Called automatically by the destructor. # @return [Boolean] def destroy_children; end # Returns a const reference to the list of the window's children. # # {Wx::WindowList} is a type-safe {Wx::List}-like class whose elements are of type wxWindow*. # @return [Wx::WindowList] def get_children; end alias_method :children, :get_children # 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. # @param child [Wx::Window] Child window to remove. # @return [void] def remove_child(child) end # Returns the grandparent of a window, or NULL if there isn't one. # @return [Wx::Window] def get_grand_parent; end alias_method :grand_parent, :get_grand_parent # Returns the next window after this one among the parent's children or NULL if this window is the last child. # # # @see Wx::Window#get_prev_sibling # @return [Wx::Window] def get_next_sibling; end alias_method :next_sibling, :get_next_sibling # Returns the parent of the window, or NULL if there is no parent. # @return [Wx::Window] def get_parent; end alias_method :parent, :get_parent # Returns the previous window before this one among the parent's children or NULL if this window is the first child. # # # @see Wx::Window#get_next_sibling # @return [Wx::Window] def get_prev_sibling; end alias_method :prev_sibling, :get_prev_sibling # 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 {Wx::Dialog} is not considered to be a descendant of dialogs parent {Wx::Frame}. # @param win [Wx::Window] Any window, possible NULL (false is always returned then). # @return [Boolean] def is_descendant(win) end alias_method :descendant?, :is_descendant # Reparents the window, i.e. the window will be removed from its current parent window (e.g. # # a non-standard toolbar in a {Wx::Frame}) and then re-inserted into another. # Notice that currently you need to explicitly call {Wx::Notebook#remove_page} before reparenting a notebook page. # @param newParent [Wx::Window] New parent. # @return [Boolean] def reparent(newParent) end # 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. #

#
# @param hflag [Boolean] Whether the horizontal scroll bar should always be visible. # @param vflag [Boolean] Whether the vertical scroll bar should always be visible. # @return [void] def always_show_scrollbars(hflag=true, vflag=true) end # Returns the built-in scrollbar position. # # # @see Wx::Window#set_scrollbar # @param orientation [Integer] # @return [Integer] def get_scroll_pos(orientation) end alias_method :scroll_pos, :get_scroll_pos # Returns the built-in scrollbar range. # # # @see Wx::Window#set_scrollbar # @param orientation [Integer] # @return [Integer] def get_scroll_range(orientation) end alias_method :scroll_range, :get_scroll_range # Returns the built-in scrollbar thumb size. # # # @see Wx::Window#set_scrollbar # @param orientation [Integer] # @return [Integer] def get_scroll_thumb(orientation) end alias_method :scroll_thumb, :get_scroll_thumb # Returns true if this window can have a scroll bar in this orientation. # @param orient [Integer] Orientation to check, either {Wx::Orientation::HORIZONTAL} or {Wx::Orientation::VERTICAL}. # @return [Boolean] def can_scroll(orient) end alias_method :can_scroll?, :can_scroll # Returns true if this window currently has a scroll bar for this orientation. # # This method may return false even when {Wx::Window#can_scroll} for the same orientation returns true, but if {Wx::Window#can_scroll} returns false, i.e. scrolling in this direction is not enabled at all, {Wx::Window#has_scrollbar} always returns false as well. # @param orient [Integer] Orientation to check, either {Wx::Orientation::HORIZONTAL} or {Wx::Orientation::VERTICAL}. # @return [Boolean] def has_scrollbar(orient) end alias_method :has_scrollbar?, :has_scrollbar # Return whether a scrollbar is always shown. # # # @see Wx::Window#always_show_scrollbars # @param orient [Integer] Orientation to check, either {Wx::Orientation::HORIZONTAL} or {Wx::Orientation::VERTICAL}. # @return [Boolean] def is_scrollbar_always_shown(orient) end alias_method :scrollbar_always_shown?, :is_scrollbar_always_shown # 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 {Wx::TextCtrl} under WXGTK (it also works for {Wx::Scrolled} classes under all platforms). #

#
# @see Wx::Window#scroll_pages # @param lines [Integer] # @return [Boolean] def scroll_lines(lines) end # 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. #

#
# @see Wx::Window#scroll_lines # @param pages [Integer] # @return [Boolean] def scroll_pages(pages) end # Physically scrolls the pixels in the window and move child windows accordingly. # #
# Remark: #

Note that you can often use {Wx::Scrolled} instead of using this function directly. #

#
# @param dx [Integer] Amount to scroll horizontally. # @param dy [Integer] Amount to scroll vertically. # @param rect [Wx::Rect] 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) # @return [void] def scroll_window(dx, dy, rect=nil) end # Same as {Wx::Window#scroll_lines} (-1). # @return [Boolean] def line_up; end # Same as {Wx::Window#scroll_lines} (1). # @return [Boolean] def line_down; end # Same as {Wx::Window#scroll_pages} (-1). # @return [Boolean] def page_up; end # Same as {Wx::Window#scroll_pages} (1). # @return [Boolean] def page_down; end # 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. #

#
# @see Wx::Window#set_scrollbar # @see Wx::Window#get_scroll_pos # @see Wx::Window#get_scroll_thumb # @see Wx::ScrollBar # @see Wx::Scrolled # @param orientation [Integer] Determines the scrollbar whose position is to be set. May be {Wx::Orientation::HORIZONTAL} or {Wx::Orientation::VERTICAL}. # @param pos [Integer] Position in scroll units. # @param refresh [Boolean] true to redraw the scrollbar, false otherwise. # @return [void] def set_scroll_pos(orientation, pos, refresh=true) end # 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 {Wx::SizeEvent} handler function. #

#
# @see Scrolled Windows # @see Wx::ScrollBar # @see Wx::Scrolled # @see Wx::ScrollWinEvent # @param orientation [Integer] Determines the scrollbar whose page size is to be set. May be {Wx::Orientation::HORIZONTAL} or {Wx::Orientation::VERTICAL}. # @param position [Integer] The position of the scrollbar in scroll units. # @param thumbSize [Integer] The size of the thumb, or visible portion of the scrollbar, in scroll units. # @param 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). # @param refresh [Boolean] true to redraw the scrollbar, false otherwise. # @return [void] def set_scrollbar(orientation, position, thumbSize, range, refresh=true) end # 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 {Wx::Window#end_repositioning_children} must be called after setting all children positions. Use {Wx::ChildrenRepositioningGuard} class to ensure that this requirement is satisfied. # @return [Boolean] def begin_repositioning_children; end # Fix child window positions after setting all of them at once. # # This method must be called if and only if the previous call to {Wx::Window#begin_repositioning_children} returned true. # @return [void] def end_repositioning_children; end # Sets the cached best size value. # # # @see Wx::Window#get_best_size # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def cache_best_size(size) end # Converts client area size size to corresponding window size. # # In other words, the returned value is what would {Wx::Window#get_size} return if this window had client area of given size. Components with {Wx::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. # @see Wx::Window#window_to_client_size # @param size [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] def client_to_window_size(size) end # Converts window size size to corresponding client area size In other words, the returned value is what would {Wx::Window#get_client_size} return if this window had given window size. # # Components with {Wx::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. # @see Wx::Window#client_to_window_size # @param size [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] def window_to_client_size(size) end # Sizes the window to fit its best size. # # Using this function is equivalent to setting window size to the return value of {Wx::Window#get_best_size}. # Note that, unlike {Wx::Window#set_sizer_and_fit}, this function only changes the current window size and doesn't change its minimal size. # @see Window Sizing Overview # @return [void] def fit; end # Similar to {Wx::Window#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. # @return [void] def fit_inside; end # @overload from_dip(sz) # 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 {Wx::Window#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 # ```ruby # 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"). # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] # @overload from_dip(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload from_dip(d) # Convert DPI-independent distance in pixels to the value in pixels appropriate for the current toolkit. # # This is the same as FromDIP(const {Wx::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. # @param d [Integer] # @return [Integer] def from_dip(*args) end # @overload self.from_dip(sz, w) # 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 {Wx::Window#from_dip} method. # @param sz [Array(Integer, Integer), Wx::Size] # @param w [Wx::Window] # @return [Wx::Size] # @overload self.from_dip(pt, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @param w [Wx::Window] # @return [Wx::Point] # @overload self.from_dip(d, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @param w [Wx::Window] # @return [Integer] def self.from_dip(*args) end # @overload to_dip(sz) # 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 {Wx::Window#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: # ```ruby # 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"). # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] # @overload to_dip(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload to_dip(d) # Convert pixel values of the current toolkit to DPI-independent pixel values. # # This is the same as ToDIP(const {Wx::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. # @param d [Integer] # @return [Integer] def to_dip(*args) end # @overload self.to_dip(sz, w) # 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 {Wx::Window#to_dip} method. # @param sz [Array(Integer, Integer), Wx::Size] # @param w [Wx::Window] # @return [Wx::Size] # @overload self.to_dip(pt, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @param w [Wx::Window] # @return [Wx::Point] # @overload self.to_dip(d, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @param w [Wx::Window] # @return [Integer] def self.to_dip(*args) end # @overload from_phys(sz) # 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 {Wx::Window#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. # @see Wx::Window#from_dip # @see Wx::Window#to_phys # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] # @overload from_phys(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload from_phys(d) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @return [Integer] def from_phys(*args) end # @overload self.from_phys(sz, w) # 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. # @param sz [Array(Integer, Integer), Wx::Size] # @param w [Wx::Window] # @return [Wx::Size] # @overload self.from_phys(pt, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @param w [Wx::Window] # @return [Wx::Point] # @overload self.from_phys(d, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @param w [Wx::Window] # @return [Integer] def self.from_phys(*args) end # @overload to_phys(sz) # Convert from logical pixels to physical pixels. # # This function performs the transformation in the converse direction compared to {Wx::Window#from_phys}. # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] # @overload to_phys(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload to_phys(d) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @return [Integer] def to_phys(*args) end # @overload self.to_phys(sz, w) # 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. # @param sz [Array(Integer, Integer), Wx::Size] # @param w [Wx::Window] # @return [Wx::Size] # @overload self.to_phys(pt, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @param w [Wx::Window] # @return [Wx::Point] # @overload self.to_phys(d, w) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param d [Integer] # @param w [Wx::Window] # @return [Integer] def self.to_phys(*args) end # 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 {Wx::Panel}), the size returned by this function will be the same as the size the window would have had after calling {Wx::Window#fit}. # Override virtual {Wx::Window#do_get_best_size} or, better, because it's usually more convenient, {Wx::Window#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 {Wx::Window#set_max_size} with a width of 100 would ensure that {Wx::Window#get_best_size} returns the width of at most 100 pixels. # @see Wx::Window#cache_best_size # @see Window Sizing Overview # @return [Wx::Size] def get_best_size; end alias_method :best_size, :get_best_size # Returns the best height needed by this window if it had the given width. # # # @see Wx::Window#do_get_best_client_height # @param width [Integer] # @return [Integer] def get_best_height(width) end alias_method :best_height, :get_best_height # Returns the best width needed by this window if it had the given height. # # # @see Wx::Window#do_get_best_client_width # @param height [Integer] # @return [Integer] def get_best_width(height) end alias_method :best_width, :get_best_width # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @return [Wx::Size] def get_client_size; end alias_method :client_size, :get_client_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 {Wx::Sizer} when it queries the size of a window or control. # @see Wx::Window#get_best_size # @see Wx::Window#set_initial_size # @see Window Sizing Overview # @return [Wx::Size] def get_effective_min_size; end alias_method :effective_min_size, :get_effective_min_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 {Wx::Window#set_client_size}. # @see Wx::Window#get_max_size # @see Window Sizing Overview # @return [Wx::Size] def get_max_client_size; end alias_method :max_client_size, :get_max_client_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 {Wx::Window#set_size}. # @see Wx::Window#get_max_client_size # @see Window Sizing Overview # @return [Wx::Size] def get_max_size; end alias_method :max_size, :get_max_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 {Wx::Window#set_min_client_size}, but it can be overridden to do the calculation on demand. # @see Wx::Window#get_min_size # @see Window Sizing Overview # @return [Wx::Size] def get_min_client_size; end alias_method :min_client_size, :get_min_client_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 {Wx::Window#set_min_size}, but it can be overridden to do the calculation on demand. # @see Wx::Window#get_min_client_size # @see Window Sizing Overview # @return [Wx::Size] def get_min_size; end alias_method :min_size, :get_min_size # Returns the horizontal component of window minimal size. # # The returned value is {Wx::DEFAULT_COORD} if the minimal width was not set. # @see Wx::Window#get_min_size # @return [Integer] def get_min_width; end alias_method :min_width, :get_min_width # Returns the vertical component of window minimal size. # # The returned value is {Wx::DEFAULT_COORD} if the minimal height was not set. # @see Wx::Window#get_min_size # @return [Integer] def get_min_height; end alias_method :min_height, :get_min_height # Returns the horizontal component of window maximal size. # # The returned value is {Wx::DEFAULT_COORD} if the maximal width was not set. # @see Wx::Window#get_max_size # @return [Integer] def get_max_width; end alias_method :max_width, :get_max_width # Returns the vertical component of window maximal size. # # The returned value is {Wx::DEFAULT_COORD} if the maximal width was not set. # @see Wx::Window#get_max_size # @return [Integer] def get_max_height; end alias_method :max_height, :get_max_height # See the GetSize(int*,int*) overload for more info. # @return [Wx::Size] def get_size; end alias_method :size, :get_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 {Wx::Window#set_virtual_size} it will return the size set with that method. # @see Window Sizing Overview # @return [Wx::Size] def get_virtual_size; end alias_method :virtual_size, :get_virtual_size # Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means) # @return [Wx::Size] def get_best_virtual_size; end alias_method :best_virtual_size, :get_best_virtual_size # 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 {Wx::Bitmap} or {Wx::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 {Wx::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 {Wx::Window#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 {Wx::HAS_DPI_INDEPENDENT_PIXELS}, such as WXMSW. #

#
# @return [Float] def get_content_scale_factor; end alias_method :content_scale_factor, :get_content_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 {Wx::Window#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 {Wx::Window#from_dip} for anything window-related instead. # @return [Float] def get_dpi_scale_factor; end alias_method :dpi_scale_factor, :get_dpi_scale_factor # Returns the size of the left/right and top/bottom borders of this window in x and y components of the result respectively. # @return [Wx::Size] def get_window_border_size; end alias_method :window_border_size, :get_window_border_size # {Wx::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 {Wx::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). # @param direction [Integer] # @param size [Integer] # @param availableOtherDir [Integer] # @return [Boolean] def inform_first_direction(direction, size, availableOtherDir) end # Resets the cached best size value so it will be recalculated the next time it is needed. # # # @see Wx::Window#cache_best_size # @return [void] def invalidate_best_size; end # Posts a size event to the window. # # This is the same as {Wx::Window#send_size_event} with {Wx::SEND_EVENT_POST} argument. # @return [void] def post_size_event; end # Posts a size event to the parent of this window. # # This is the same as {Wx::Window#send_size_event_to_parent} with {Wx::SEND_EVENT_POST} argument. # @return [void] def post_size_event_to_parent; end # 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 {Wx::Window#layout} directly and this function should not be used in this case. # If flags includes {Wx::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 {Wx::Window#post_size_event} as a more readable equivalent of calling this function with this flag. # @param flags [Integer] May include {Wx::SEND_EVENT_POST}. Default value is 0. # @return [void] def send_size_event(flags=0) end # Safe wrapper for {Wx::Window#get_parent}->{Wx::Window#send_size_event}. # # This function simply checks that the window has a valid parent which is not in process of being deleted and calls {Wx::Window#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). # @see Wx::Window#post_size_event_to_parent # @param flags [Integer] See description of this parameter in {Wx::Window#send_size_event} documentation. # @return [void] def send_size_event_to_parent(flags=0) end # @overload set_client_size(width, height) # 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 {Wx::Window#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. # @see Window Sizing Overview # @param width [Integer] # @param height [Integer] # @return [void] # @overload set_client_size(size) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param size [Array(Integer, Integer), Wx::Size] # @return [void] # @overload set_client_size(rect) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param rect [Wx::Rect] # @return [void] def set_client_size(*args) end alias_method :client_size=, :set_client_size # Used by {Wx::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. # @param sizer [Wx::Sizer] # @return [void] def set_containing_sizer(sizer) end alias_method :containing_sizer=, :set_containing_sizer # 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 {Wx::Window#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.) # @see Wx::Window#set_size # @see Wx::Window#get_best_size # @see Wx::Window#get_effective_min_size # @see Window Sizing Overview # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_initial_size(size=Wx::DEFAULT_SIZE) end alias_method :initial_size=, :set_initial_size # 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: # ```ruby # set_max_size(client_to_window_size(size)) # ``` # @see Wx::Window#set_max_size # @see Window Sizing Overview # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_max_client_size(size) end alias_method :max_client_size=, :set_max_client_size # Sets the maximum size of the window, to indicate to the sizer layout mechanism that this is the maximum possible size. # # # @see Wx::Window#set_max_client_size # @see Window Sizing Overview # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_max_size(size) end alias_method :max_size=, :set_max_size # 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 {Wx::Window#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: # ```ruby # set_min_size(client_to_window_size(size)) # ``` # @see Wx::Window#set_min_size # @see Window Sizing Overview # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_min_client_size(size) end alias_method :min_client_size=, :set_min_client_size # 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 {Wx::Window#set_size}, it just ensures that it won't become smaller than this size during the automatic layout. # @see Wx::Window#set_min_client_size # @see Window Sizing Overview # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_min_size(size) end alias_method :min_size=, :set_min_size # @overload set_size(x, y, width, height, sizeFlags=Wx::SIZE_AUTO) # Sets the size of the window in pixels. # #
# Remark: #

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

#
# @see Wx::Window#move # @see Window Sizing Overview # @param x [Integer] Required x position in pixels, or {Wx::DEFAULT_COORD} to indicate that the existing value should be used. # @param y [Integer] Required y position in pixels, or {Wx::DEFAULT_COORD} to indicate that the existing value should be used. # @param width [Integer] Required width in pixels, or {Wx::DEFAULT_COORD} to indicate that the existing value should be used. # @param height [Integer] Required height position in pixels, or {Wx::DEFAULT_COORD} to indicate that the existing value should be used. # @param sizeFlags [Integer] Indicates the interpretation of other parameters. It is a bit list of the following: # # - {Wx::SIZE_AUTO_WIDTH}: a {Wx::DEFAULT_COORD} width value is taken to indicate a wxWidgets-supplied default width. # - {Wx::SIZE_AUTO_HEIGHT}: a {Wx::DEFAULT_COORD} height value is taken to indicate a wxWidgets-supplied default height. # - {Wx::SIZE_AUTO}: {Wx::DEFAULT_COORD} size values are taken to indicate a wxWidgets-supplied default size. # - {Wx::SIZE_USE_EXISTING}: existing dimensions should be used if {Wx::DEFAULT_COORD} values are supplied. # - {Wx::SIZE_ALLOW_MINUS_ONE}: allow negative dimensions (i.e. value of {Wx::DEFAULT_COORD}) to be interpreted as real dimensions, not default values. # - {Wx::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). # @return [void] # @overload set_size(rect) # Sets the size of the window in pixels. # # The size is specified using a {Wx::Rect}, {Wx::Size} or by a couple of int objects. # #
# Remark: #

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

#
# @see Wx::Window#move # @see Window Sizing Overview # @param rect [Wx::Rect] # @return [void] # @overload set_size(size) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_size(*args) end alias_method :size=, :set_size # @overload set_size_hints(minSize, maxSize=Wx::DEFAULT_SIZE, incSize=Wx::DEFAULT_SIZE) # Use of this function for windows which are not toplevel windows (such as {Wx::Dialog} or {Wx::Frame}) is discouraged. # # Please use {Wx::Window#set_min_size} and {Wx::Window#set_max_size} instead. # @see Wx::TopLevelWindow#set_size_hints # @see Window Sizing Overview # @param minSize [Array(Integer, Integer), Wx::Size] # @param maxSize [Array(Integer, Integer), Wx::Size] # @param incSize [Array(Integer, Integer), Wx::Size] # @return [void] # @overload set_size_hints(minW, minH, maxW=-1, maxH=-1, incW=-1, incH=-1) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param minW [Integer] # @param minH [Integer] # @param maxW [Integer] # @param maxH [Integer] # @param incW [Integer] # @param incH [Integer] # @return [void] def set_size_hints(*args) end alias_method :size_hints=, :set_size_hints # @overload set_virtual_size(width, height) # Sets the virtual size of the window in pixels. # # # @see Window Sizing Overview # @param width [Integer] # @param height [Integer] # @return [void] # @overload set_virtual_size(size) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param size [Array(Integer, Integer), Wx::Size] # @return [void] def set_virtual_size(*args) end alias_method :virtual_size=, :set_virtual_size # A synonym for {Wx::Window#centre}. # @param dir [Integer] # @return [void] def center(dir=Wx::Orientation::BOTH) end # A synonym for {Wx::Window#centre_on_parent}. # @param dir [Integer] # @return [void] def center_on_parent(dir=Wx::Orientation::BOTH) end # 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. #

#
# @see Wx::Window#center # @param direction [Integer] Specifies the direction for the centring. May be {Wx::Orientation::HORIZONTAL}, {Wx::Orientation::VERTICAL} or {Wx::Orientation::BOTH}. It may also include the {Wx::CENTRE_ON_SCREEN} flag if you want to centre the window on the entire screen and not on its parent window. # @return [void] def centre(direction=Wx::Orientation::BOTH) end # Centres the window on its parent. # # This is a more readable synonym for {Wx::Window#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 {Wx::Window#centre}. #

#
# @see Wx::TopLevelWindow#centre_on_screen # @param direction [Integer] Specifies the direction for the centring. May be {Wx::Orientation::HORIZONTAL}, {Wx::Orientation::VERTICAL} or {Wx::Orientation::BOTH}. # @return [void] def centre_on_parent(direction=Wx::Orientation::BOTH) end # 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. # # # @see Wx::Window#get_screen_position # @return [Wx::Point] def get_position; end alias_method :position, :get_position # Returns the position and size of the window as a {Wx::Rect} object. # # # @see Wx::Window#get_screen_rect # @return [Wx::Rect] def get_rect; end alias_method :rect, :get_rect # Returns the window position in screen coordinates, whether the window is a child window or a top level one. # # # @see Wx::Window#get_position # @return [Wx::Point] def get_screen_position; end alias_method :screen_position, :get_screen_position # Returns the position and size of the window on the screen as a {Wx::Rect} object. # # # @see Wx::Window#get_rect # @return [Wx::Rect] def get_screen_rect; end alias_method :screen_rect, :get_screen_rect # 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...) # @return [Wx::Point] def get_client_area_origin; end alias_method :client_area_origin, :get_client_area_origin # Get the client rectangle in window (i.e. client) coordinates. # @return [Wx::Rect] def get_client_rect; end alias_method :client_rect, :get_client_rect # @overload move(x, y, flags=Wx::SIZE_USE_EXISTING) # Moves the window to the given position. # #
# Remark: #

Implementations of SetSize can also implicitly implement the {Wx::Window#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) # ``` # #

#
# @see Wx::Window#set_size # @param x [Integer] Required x position. # @param y [Integer] Required y position. # @param flags [Integer] See {Wx::Window#set_size} for more info about this parameter. # @return [void] # @overload move(pt, flags=Wx::SIZE_USE_EXISTING) # Moves the window to the given position. # #
# Remark: #

Implementations of {Wx::Window#set_size} can also implicitly implement the {Wx::Window#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) # ``` # #

#
# @see Wx::Window#set_size # @param pt [Array(Integer, Integer), Wx::Point] {Wx::Point} object representing the position. # @param flags [Integer] See {Wx::Window#set_size} for more info about this parameter. # @return [void] def move(*args) end # Moves the window to the specified position. # # This is exactly the same as calling {Wx::Window#move} with the default arguments. # @param pt [Array(Integer, Integer), Wx::Point] # @return [void] def set_position(pt) end alias_method :position=, :set_position # Converts to screen coordinates from coordinates relative to this window. # @param pt [Array(Integer, Integer), Wx::Point] The client position for the second form of the function. # @return [Wx::Point] def client_to_screen(pt) end # @overload convert_dialog_to_pixels(pt) # 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. #

#
# @see Wx::Window#convert_pixels_to_dialog # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload convert_dialog_to_pixels(sz) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] def convert_dialog_to_pixels(*args) end # @overload convert_pixels_to_dialog(pt) # 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. #

#
# @see Wx::Window#convert_dialog_to_pixels # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::Point] # @overload convert_pixels_to_dialog(sz) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::Size] def convert_pixels_to_dialog(*args) end # Converts from screen to client window coordinates. # @param pt [Array(Integer, Integer), Wx::Point] The screen position. # @return [Wx::Point] def screen_to_client(pt) end # 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 {Wx::ClientDC} to draw on the window and the results of doing it while also drawing on {Wx::PaintDC} for this window are undefined. Hence this method shouldn't be used from EVT_PAINT handlers, just use {Wx::DC#clear} on the {Wx::PaintDC} you already use there instead. # @return [void] def clear_background; end # Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all. # # {Wx::Window#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 {Wx::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 Wx::WindowUpdateLocker # @see Wx::Window#thaw # @see Wx::Window#is_frozen # @return [void] def freeze; end # Re-enables window updating after a previous call to {Wx::Window#freeze}. # # To really thaw the control, it must be called exactly the same number of times as {Wx::Window#freeze}. # If the window has any children, they are recursively thawed too. # @see Wx::WindowUpdateLocker # @see Wx::Window#freeze # @see Wx::Window#is_frozen # @return [void] def thaw; end # Returns true if the window is currently frozen by a call to {Wx::Window#freeze}. # # # @see Wx::Window#freeze # @see Wx::Window#thaw # @return [Boolean] def is_frozen; end alias_method :frozen?, :is_frozen # Returns the background colour of the window. # # # @see Wx::Window#set_background_colour # @see Wx::Window#set_foreground_colour # @see Wx::Window#get_foreground_colour # @return [Wx::Colour] def get_background_colour; end alias_method :background_colour, :get_background_colour # Returns the background style of the window. # # # @see Wx::Window#set_background_colour # @see Wx::Window#get_foreground_colour # @see Wx::Window#set_background_style # @see Wx::Window#set_transparent # @return [Wx::BackgroundStyle] def get_background_style; end alias_method :background_style, :get_background_style # Returns the character height for this window. # @return [Integer] def get_char_height; end alias_method :char_height, :get_char_height # Returns the average character width for this window. # @return [Integer] def get_char_width; end alias_method :char_width, :get_char_width # Currently this is the same as calling {Wx::Window.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. # @return [Wx::VisualAttributes] def get_default_attributes; end alias_method :default_attributes, :get_default_attributes # 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. # @see Wx::Display#get_ppi # @see Wx::DPIChangedEvent # @return [Wx::Size] def get_dpi; end alias_method :dpi, :get_dpi # Returns the font for this window. # # # @see Wx::Window#set_font # @return [Wx::Font] def get_font; end alias_method :font, :get_font # 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. #

#
# @see Wx::Window#set_foreground_colour # @see Wx::Window#set_background_colour # @see Wx::Window#get_background_colour # @return [Wx::Colour] def get_foreground_colour; end alias_method :foreground_colour, :get_foreground_colour # Gets the dimensions of the string as it would be drawn on the window with the currently selected font. # @param string [String] # @return [Wx::Size] def get_text_extent(string) end alias_method :text_extent, :get_text_extent # Returns the region specifying which parts of the window have been damaged. # # Should only be called within a {Wx::PaintEvent} handler. # @see Wx::Region # @see Wx::RegionIterator # @return [Wx::Region] def get_update_region; end alias_method :update_region, :get_update_region # Get the update rectangle bounding box in client coords. # @return [Wx::Rect] def get_update_client_rect; end alias_method :update_client_rect, :get_update_client_rect # Returns true if this window background is transparent (as, for example, for {Wx::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. # @return [Boolean] def has_transparent_background; end alias_method :has_transparent_background?, :has_transparent_background # 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 {Wx::Window#update} instead. # @see Wx::Window#refresh_rect # @param eraseBackground [Boolean] If true, the background will be erased too. Note that in non-MSW ports background is always erased. # @param rect [Wx::Rect] If non-NULL, only the given rectangle will be treated as damaged. # @return [void] def refresh(eraseBackground=true, rect=nil) end # Redraws the contents of the given rectangle: only the area inside it will be repainted. # # This is the same as {Wx::Window#refresh} but has a nicer syntax as it can be called with a temporary {Wx::Rect} object as argument like this RefreshRect(wxRect(x, y, w, h)). # @param rect [Wx::Rect] # @param eraseBackground [Boolean] # @return [void] def refresh_rect(rect, eraseBackground=true) end # 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 {Wx::Window#refresh} first if you want to immediately redraw the window unconditionally. # @return [void] def update; end # Sets the background colour of the window. # # Notice that as with {Wx::Window#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 {Wx::Window#inherit_attributes} for explanation of the difference between this method and {Wx::Window#set_own_background_colour}. # #
# Remark: #

The background colour is usually painted by the default {Wx::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 {Wx::Window#clear_background} or {Wx::Window#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. # @see Wx::Window#get_background_colour # @see Wx::Window#set_foreground_colour # @see Wx::Window#get_foreground_colour # @see Wx::Window#clear_background # @see Wx::Window#refresh # @see Wx::EraseEvent # @see Wx::SystemSettings # @param colour [Wx::Colour,String,Symbol] The colour to be used as the background colour; pass {Wx::NULL_COLOUR} to reset to the default colour. Note that you may want to use {Wx::SystemSettings.get_colour} to retrieve a suitable colour to use rather than setting a hard-coded one. # @return [Boolean] def set_background_colour(colour) end alias_method :background_colour=, :set_background_colour # Sets the background style of the window. # # The default background style is {Wx::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 {Wx::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 {Wx::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 {Wx::BackgroundStyle::BG_STYLE_PAINT} is a simpler and more efficient solution to the same problem. # Under WXGTK and WXOSX, you can use {Wx::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 {Wx::Window#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 {Wx::Window#create}. If you're using your own {Wx::Window}-derived class you should write your code in the following way: # ```ruby # 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 # ``` # @see Wx::Window#set_background_colour # @see Wx::Window#get_foreground_colour # @see Wx::Window#set_transparent # @see Wx::Window#is_transparent_background_supported # @param style [Wx::BackgroundStyle] # @return [Boolean] def set_background_style(style) end alias_method :background_style=, :set_background_style # Checks whether using transparent background might work. # # If this function returns false, calling {Wx::Window#set_background_style} with {Wx::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. # @param reason [String] If not NULL, a reason message is provided if transparency is not supported. # @return [Boolean] def is_transparent_background_supported(reason=nil) end alias_method :transparent_background_supported?, :is_transparent_background_supported # 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 {Wx::Window#set_own_font} instead in this case and see {Wx::Window#inherit_attributes} for more explanations. # Please notice that the given font is not automatically used for {Wx::PaintDC} objects associated with this window, you need to call {Wx::DC#set_font} too. However this font is used by any standard controls for drawing their text as well as by {Wx::Window#get_text_extent}. # # true if the font was really changed, false if it was already set to this font and nothing was done. # @see Wx::Window#get_font # @see Wx::Window#inherit_attributes # @param font [Wx::Font,Wx::FontInfo] Font to associate with this window, pass {Wx::NULL_FONT} to reset to the default font. # @return [Boolean] def set_font(font) end alias_method :font=, :set_font # 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 {Wx::Window#inherit_attributes} for explanation of the difference between this method and {Wx::Window#set_own_foreground_colour}. # # true if the colour was really changed, false if it was already set to this colour and nothing was done. # @see Wx::Window#get_foreground_colour # @see Wx::Window#set_background_colour # @see Wx::Window#get_background_colour # @see Wx::Window#should_inherit_colours # @param colour [Wx::Colour,String,Symbol] The colour to be used as the foreground colour; pass {Wx::NULL_COLOUR} to reset to the default colour. # @return [Boolean] def set_foreground_colour(colour) end alias_method :foreground_colour=, :set_foreground_colour # Sets the background colour of the window but prevents it from being inherited by the children of this window. # # # @see Wx::Window#set_background_colour # @see Wx::Window#inherit_attributes # @param colour [Wx::Colour,String,Symbol] # @return [void] def set_own_background_colour(colour) end alias_method :own_background_colour=, :set_own_background_colour # Return true if this window inherits the background colour from its parent. # # # @see Wx::Window#set_own_background_colour # @see Wx::Window#inherit_attributes # @return [Boolean] def inherits_background_colour; end # Return true if a background colour has been set for this window. # @return [Boolean] def use_bg_col; end # Return true if a background colour has been set for this window. # # Same as {Wx::Window#use_bg_col} # @return [Boolean] def use_background_colour; end # Sets the font of the window but prevents it from being inherited by the children of this window. # # # @see Wx::Window#set_font # @see Wx::Window#inherit_attributes # @param font [Wx::Font,Wx::FontInfo] # @return [void] def set_own_font(font) end alias_method :own_font=, :set_own_font # Sets the foreground colour of the window but prevents it from being inherited by the children of this window. # # # @see Wx::Window#set_foreground_colour # @see Wx::Window#inherit_attributes # @param colour [Wx::Colour,String,Symbol] # @return [void] def set_own_foreground_colour(colour) end alias_method :own_foreground_colour=, :set_own_foreground_colour # Return true if a foreground colour has been set for this window. # @return [Boolean] def use_foreground_colour; end # Return true if this window inherits the foreground colour from its parent. # # # @see Wx::Window#set_own_foreground_colour # @see Wx::Window#inherit_attributes # @return [Boolean] def inherits_foreground_colour; end # Return true from here to allow the colours of this window to be changed by {Wx::Window#inherit_attributes}. # # Returning false forbids inheriting them from the parent window. # The base class version returns false, but this method is overridden in {Wx::Control} where it returns true. # @return [Boolean] def should_inherit_colours; end # 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. # @see Wx::Window#get_theme_enabled # @param enable [Boolean] # @return [void] def set_theme_enabled(enable) end alias_method :theme_enabled=, :set_theme_enabled # Returns true if the window uses the system theme for drawing its background. # # # @see Wx::Window#set_theme_enabled # @return [Boolean] def get_theme_enabled; end alias_method :theme_enabled, :get_theme_enabled # Returns true if the system supports transparent windows and calling {Wx::Window#set_transparent} may succeed. # # If this function returns false, transparent windows are definitely not supported by the current system. # @return [Boolean] def can_set_transparent; end alias_method :can_set_transparent?, :can_set_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 {Wx::Window#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 {Wx::IMAGE_ALPHA_TRANSPARENT} and {Wx::IMAGE_ALPHA_OPAQUE} can be used. # @param alpha [Integer] # @return [Boolean] def set_transparent(alpha) end alias_method :transparent=, :set_transparent # Returns the event handler for this window. # # By default, the window is its own event handler. # @see Wx::Window#set_event_handler # @see Wx::Window#push_event_handler # @see Wx::Window#pop_event_handler # @see Wx::EvtHandler#process_event # @see Wx::EvtHandler # @return [Wx::EvtHandler] def get_event_handler; end alias_method :event_handler, :get_event_handler # This function will generate the appropriate call to {Wx::Window#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. # @see Wx::Window#navigate # @param event [Wx::KeyEvent] # @return [Boolean] def handle_as_navigation_key(event) end # Shorthand for: # # ```ruby # get_event_handler.safely_process_event(event) # ``` # @see Wx::Window#process_window_event # @param event [Wx::Event] # @return [Boolean] def handle_window_event(event) end # Convenient wrapper for {Wx::Window#process_event}. # # This is the same as writing # ```ruby # get_event_handler.process_event(event) # ``` # but more convenient. Notice that {Wx::Window#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. # @param event [Wx::Event] # @return [Boolean] def process_window_event(event) end # Wrapper for {Wx::EvtHandler#process_event_locally}. # # This method is similar to {Wx::Window#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 {Wx::Window#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. # @param event [Wx::Event] # @return [Boolean] def process_window_event_locally(event) end # 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. # {Wx::Window#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: # ```ruby # W.push_event_handler(A) # W.push_event_handler(B) # ``` # you will end up with the following situation: # # Note that you can use {Wx::Window#pop_event_handler} to remove the event handler. # @see How Events are Processed # @param handler [Wx::EvtHandler] Specifies the handler to be pushed. It must not be part of a {Wx::EvtHandler} chain; an assert will fail if it's not unlinked (see {Wx::EvtHandler#is_unlinked}). # @return [void] def push_event_handler(handler) end # Find the given handler in the windows event handler stack and removes (but does not delete) it from the stack. # # See {Wx::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). # @see Wx::Window#push_event_handler # @see Wx::Window#pop_event_handler # @param handler [Wx::EvtHandler] The event handler to remove, must be non-NULL and must be present in this windows event handlers stack. # @return [Boolean] def remove_event_handler(handler) end # 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. # @see How Events are Processed # @param handler [Wx::EvtHandler] Specifies the handler to be set. Cannot be NULL. # @return [void] def set_event_handler(handler) end alias_method :event_handler=, :set_event_handler # {Wx::WINDOWS} cannot be used to form event handler chains; this function thus will assert when called. # # Note that instead you can use {Wx::Window#push_event_handler} or {Wx::Window#set_event_handler} to implement a stack of event handlers to override {Wx::Window}'s own event handling mechanism. # @param handler [Wx::EvtHandler] # @return [void] def set_next_handler(handler) end alias_method :next_handler=, :set_next_handler # {Wx::WINDOWS} cannot be used to form event handler chains; this function thus will assert when called. # # Note that instead you can use {Wx::Window#push_event_handler} or {Wx::Window#set_event_handler} to implement a stack of event handlers to override {Wx::Window}'s own event handling mechanism. # @param handler [Wx::EvtHandler] # @return [void] def set_previous_handler(handler) end alias_method :previous_handler=, :set_previous_handler # Returns the extra style bits for the window. # @return [Integer] def get_extra_style; end alias_method :extra_style, :get_extra_style # Gets the window style that was passed to the constructor or {Wx::Window#create} method. # # {Wx::Window#get_window_style} is another name for the same function. # @return [Integer] def get_window_style_flag; end alias_method :window_style_flag, :get_window_style_flag # See {Wx::Window#get_window_style_flag} for more info. # @return [Integer] def get_window_style; end alias_method :window_style, :get_window_style # Returns true if the window has the given exFlag bit set in its extra styles. # # # @see Wx::Window#set_extra_style # @param exFlag [Integer] # @return [Boolean] def has_extra_style(exFlag) end alias_method :has_extra_style?, :has_extra_style # Returns true if the window has the given flag bit set. # @param flag [Integer] # @return [Boolean] def has_flag(flag) end alias_method :has_flag?, :has_flag # Sets the extra style bits for the window. # # The currently defined extra style bits are reported in the class description. # @param exStyle [Integer] # @return [void] def set_extra_style(exStyle) end alias_method :extra_style=, :set_extra_style # Sets the style of the window. # # Please note that some styles cannot be changed after the window creation and that {Wx::Window#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. # @see Wx::Window#get_window_style_flag # @param style [Integer] # @return [void] def set_window_style_flag(style) end alias_method :window_style_flag=, :set_window_style_flag # See {Wx::Window#set_window_style_flag} for more info. # @param style [Integer] # @return [void] def set_window_style(style) end alias_method :window_style=, :set_window_style # 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. # @see Wx::Window#set_window_style_flag # @see Wx::Window#has_flag # @param flag [Integer] # @return [Boolean] def toggle_window_style(flag) end # 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 {Wx::Window#move_before_in_tab_order} allow to change it after creating all the windows. # @param win [Wx::Window] A sibling of this window which should precede it in tab order, must not be NULL # @return [void] def move_after_in_tab_order(win) end # Same as {Wx::Window#move_after_in_tab_order} except that it inserts this window just before win instead of putting it right after it. # @param win [Wx::Window] # @return [void] def move_before_in_tab_order(win) end # Performs a keyboard navigation action starting from this window. # # This method is equivalent to calling {Wx::Window#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 {Wx::TE_PROCESS_TAB} style is to insert a tab and not navigate to the next control. See also {Wx::NavigationKeyEvent} and HandleAsNavigationKey. #

#
# @param flags [Integer] A combination of {Wx::NavigationKeyEvent::NavigationKeyEventFlags::IsForward} and {Wx::NavigationKeyEvent::NavigationKeyEventFlags::WinChange}. # @return [Boolean] def navigate(flags=NavigationKeyEvent::IsForward) end # Performs a keyboard navigation action inside this window. # # See {Wx::Window#navigate} for more information. # @param flags [Integer] # @return [Boolean] def navigate_in(flags=NavigationKeyEvent::IsForward) end # Equivalent to calling {Wx::Window#show}(false). # @return [Boolean] def hide; end # This function hides a window, like {Wx::Window#hide}, but using a special visual effect if possible. # # The parameters of this function are the same as for {Wx::Window#show_with_effect}, please see their description there. # @param effect [Wx::ShowEffect] # @param timeout [Integer] # @return [Boolean] def hide_with_effect(effect, timeout=0) end # 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 {Wx::Window#is_this_enabled} # @see Wx::Window#enable # @return [Boolean] def is_enabled; end alias_method :enabled?, :is_enabled # @overload is_exposed(x, y) # 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. # @param x [Integer] # @param y [Integer] # @return [Boolean] # @overload is_exposed(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Boolean] # @overload is_exposed(x, y, w, h) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param x [Integer] # @param y [Integer] # @param w [Integer] # @param h [Integer] # @return [Boolean] # @overload is_exposed(rect) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param rect [Wx::Rect] # @return [Boolean] def is_exposed(*args) end alias_method :exposed?, :is_exposed # Returns true if the window is shown, false if it has been hidden. # # # @see Wx::Window#is_shown_on_screen # @return [Boolean] def is_shown; end alias_method :shown?, :is_shown # 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. # # # @see Wx::Window#is_shown # @return [Boolean] def is_shown_on_screen; end alias_method :shown_on_screen?, :is_shown_on_screen # Disables the window. # # Same as {Wx::Window#enable} Enable(false). # Returns true if the window has been disabled, false if it had been already disabled before the call to this function. # @return [Boolean] def disable; end # 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 {Wx::Window#create} to create the actual underlying window, e.g. # ```ruby # 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. # @see Wx::Window#is_enabled # @see Wx::Window#disable # @see Wx::RadioBox#enable # @param enable [Boolean] If true, enables the window for input. If false, disables the window. # @return [Boolean] def enable(enable=true) end # Shows or hides the window. # # You may need to call {Wx::Window#raise} for a top level window if you want to bring it to top, although this is not needed if {Wx::Window#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 {Wx::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. # @see Wx::Window#is_shown # @see Wx::Window#hide # @see Wx::RadioBox#show # @see Wx::ShowEvent. # @param show [Boolean] If true displays the window. Otherwise, hides it. # @return [Boolean] def show(show=true) end # This function shows a window, like {Wx::Window#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 {Wx::Window#show} in the other ports. #

#
# @see Wx::Window#hide_with_effect # @param effect [Wx::ShowEffect] The effect to use. # @param timeout [Integer] 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. # @return [Boolean] def show_with_effect(effect, timeout=0) end # Gets the help text to be used as context-sensitive help for this window. # # Note that the text is actually stored by the current {Wx::HelpProvider} implementation, and not in the window object itself. # @see Wx::Window#set_help_text # @see Wx::Window#get_help_text_at_point # @see Wx::HelpProvider # @return [String] def get_help_text; end alias_method :help_text, :get_help_text # Sets the help text to be used as context-sensitive help for this window. # # Note that the text is actually stored by the current {Wx::HelpProvider} implementation, and not in the window object itself. # @see Wx::Window#get_help_text # @see Wx::HelpProvider#add_help # @param helpText [String] # @return [void] def set_help_text(helpText) end alias_method :help_text=, :set_help_text # 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 {Wx::Window#get_help_text} can be used. # @param point [Array(Integer, Integer), Wx::Point] Coordinates of the mouse at the moment of help event emission. # @param origin [Wx::HelpEvent::Origin] Help event origin, see also {Wx::HelpEvent#get_origin}. # @return [String] def get_help_text_at_point(point, origin) end alias_method :help_text_at_point, :get_help_text_at_point # Get the associated tooltip or NULL if none. # @return [Wx::ToolTip] def get_tool_tip; end alias_method :tool_tip, :get_tool_tip # Get the text of the associated tooltip or empty string if none. # @return [String] def get_tool_tip_text; end alias_method :tool_tip_text, :get_tool_tip_text # @overload set_tool_tip(tipString) # Attach a tooltip to the window. # # {Wx::ToolTip} pointer can be NULL in the overload taking the pointer, meaning to unset any existing tooltips; however {Wx::Window#unset_tool_tip} provides a more readable alternative to this operation. # Notice that these methods are always available, even if wxWidgets was compiled with {Wx::Setup::USE_TOOLTIPS} set to 0, but don't do anything in this case. # @see Wx::Window#get_tool_tip # @see Wx::ToolTip # @param tipString [String] # @return [void] # @overload set_tool_tip(tip) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param tip [Wx::ToolTip] # @return [void] def set_tool_tip(*args) end alias_method :tool_tip=, :set_tool_tip # Unset any existing tooltip. # # # @see Wx::Window#set_tool_tip # @return [void] def unset_tool_tip; end # @overload get_popup_menu_selection_from_user(menu, pos=Wx::DEFAULT_POSITION) # 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 {Wx::Window#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 {Wx::StandardID::ID_NONE} if none selected or an error occurred. # @param menu [Wx::Menu] # @param pos [Array(Integer, Integer), Wx::Point] # @return [Integer] # @overload get_popup_menu_selection_from_user(menu, x, y) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param menu [Wx::Menu] # @param x [Integer] # @param y [Integer] # @return [Integer] def get_popup_menu_selection_from_user(*args) end alias_method :popup_menu_selection_from_user, :get_popup_menu_selection_from_user # @overload popup_menu(menu, pos=Wx::DEFAULT_POSITION) # 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 {Wx::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, {Wx::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. #

#
# @see Wx::Menu # @param menu [Wx::Menu] # @param pos [Array(Integer, Integer), Wx::Point] # @return [Boolean] # @overload popup_menu(menu, x, y) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param menu [Wx::Menu] # @param x [Integer] # @param y [Integer] # @return [Boolean] def popup_menu(*args) end # Validator functions. # # Returns a pointer to the current validator for the window, or NULL if there is none. # @return [Wx::Validator] def get_validator; end alias_method :validator, :get_validator # Deletes the current validator (if any) and sets the window validator, having called {Wx::Validator#clone} to create a new validator of this type. # @param validator [Wx::Validator] # @return [void] def set_validator(validator) end alias_method :validator=, :set_validator # Transfers values from child controls to data areas specified by their validators. # # Returns false if a transfer failed. # Notice that this also calls {Wx::Window#transfer_data_from_window} for all children recursively. # @see Wx::Window#transfer_data_to_window # @see Wx::Validator # @see Wx::Window#validate # @return [Boolean] def transfer_data_from_window; end # Transfers values to child controls from data areas specified by their validators. # # Notice that this also calls {Wx::Window#transfer_data_to_window} for all children recursively. # Returns false if a transfer failed. # @see Wx::Window#transfer_data_from_window # @see Wx::Validator # @see Wx::Window#validate # @return [Boolean] def transfer_data_to_window; end # Validates the current values of the child controls using their validators. # # Notice that this also calls {Wx::Window#validate} for all children recursively. # Returns false if any of the validations failed. # @see Wx::Window#transfer_data_from_window # @see Wx::Window#transfer_data_to_window # @see Wx::Validator # @return [Boolean] def validate; end # Returns the identifier of the window. # #
# Remark: #

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

#
# @see Wx::Window#set_id # @see Window IDs # @return [Integer] def get_id; end alias_method :id, :get_id # 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. #

#
# @return [String] def get_label; end alias_method :label, :get_label # Returns the layout direction for this window, Note that {Wx::LayoutDirection::Layout_Default} is returned if layout direction is not supported. # @return [Wx::LayoutDirection] def get_layout_direction; end alias_method :layout_direction, :get_layout_direction # Mirror coordinates for RTL layout if this window uses it and if the mirroring is not done automatically like Win32. # @param x [Integer] # @param width [Integer] # @param widthTotal [Integer] # @return [Integer] def adjust_for_layout_direction(x, width, widthTotal) end # 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 {Wx::Window#set_name}. #

#
# @see Wx::Window#set_name # @return [String] def get_name; end alias_method :name, :get_name # Returns the value previously passed to {Wx::Window#set_window_variant}. # @return [Wx::WindowVariant] def get_window_variant; end alias_method :window_variant, :get_window_variant # 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. #

#
# @see Wx::Window#get_id # @see Window IDs # @param winid [Integer] # @return [void] def set_id(winid) end alias_method :id=, :set_id # Sets the window's label. # # # @see Wx::Window#get_label # @param label [String] The window label. # @return [void] def set_label(label) end alias_method :label=, :set_label # Sets the layout direction for this window. # # This function is only supported under MSW and GTK platforms, but not under Mac currently. # @param dir [Wx::LayoutDirection] # @return [void] def set_layout_direction(dir) end alias_method :layout_direction=, :set_layout_direction # Sets the window's name. # # # @see Wx::Window#get_name # @param name [String] A name to set for the window. # @return [void] def set_name(name) end alias_method :name=, :set_name # 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. # @param variant [Wx::WindowVariant] # @return [void] def set_window_variant(variant) end alias_method :window_variant=, :set_window_variant # Gets the accelerator table for this window. # # See {Wx::AcceleratorTable}. # @return [Wx::AcceleratorTable] def get_accelerator_table; end alias_method :accelerator_table, :get_accelerator_table # Returns the accessible object for this window, if any. # # See also {Wx::Accessible}. # @return [Wx::Accessible] def get_accessible; end alias_method :accessible, :get_accessible # Sets the accelerator table for this window. # # See {Wx::AcceleratorTable}. # @param accel [Wx::AcceleratorTable] # @return [void] def set_accelerator_table(accel) end alias_method :accelerator_table=, :set_accelerator_table # Sets the accessible for this window. # # Any existing accessible for this window will be deleted first, if not identical to accessible. See also {Wx::Accessible}. # @param accessible [Wx::Accessible] # @return [void] def set_accessible(accessible) end alias_method :accessible=, :set_accessible # This function simply generates a {Wx::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 ({Wx::Frame} and {Wx::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 {Wx::CloseEvent#can_veto}, in which case it should destroy the window using {Wx::Window#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 {Wx::Dialog::OnCloseWindow} does not necessarily delete the dialog, since it will simply simulate a {Wx::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 {Wx::Window#destroy} instead #

#
# @see Window Deletion Overview # @see Wx::Window#destroy # @see Wx::CloseEvent # @param force [Boolean] false if the window's close handler should be able to veto the destruction of this window, true if it cannot. # @return [Boolean] def close(force=false) end # 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. # @return [Boolean] def destroy; end # 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 {Wx::Window#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. # @return [Boolean] def is_being_deleted; end alias_method :being_deleted?, :is_being_deleted # Returns the associated drop target, which may be NULL. # # # @see Wx::Window#set_drop_target # @see Drag and Drop Overview # @return [Wx::DropTarget] def get_drop_target; end alias_method :drop_target, :get_drop_target # Associates a drop target with this window. # # If the window already has a drop target, it is deleted. # @see Wx::Window#get_drop_target # @see Drag and Drop Overview # @param target [Wx::DropTarget] # @return [void] def set_drop_target(target) end alias_method :drop_target=, :set_drop_target # 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 {Wx::Window#set_drop_target} on non-Windows platforms. #

#
# @see Wx::Window#set_drop_target # @param accept [Boolean] If true, the window is eligible for drop file events. If false, the window will not accept drop file events. # @return [void] def drag_accept_files(accept) end # Returns the sizer of which this window is a member, if any, otherwise NULL. # @return [Wx::Sizer] def get_containing_sizer; end alias_method :containing_sizer, :get_containing_sizer # Returns the sizer associated with the window by a previous call to {Wx::Window#set_sizer}, or NULL. # @return [Wx::Sizer] def get_sizer; end alias_method :sizer, :get_sizer # 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 {Wx::Window#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. #

#
# @param sizer [Wx::Sizer] The sizer to set. Pass NULL to disassociate and conditionally delete the window's sizer. See below. # @return [void] def set_sizer(sizer) end alias_method :sizer=, :set_sizer # Associate the sizer with the window and set the window size and minimal size accordingly. # # This method calls {Wx::Window#set_sizer} and then {Wx::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). # @param sizer [Wx::Sizer] # @return [void] def set_sizer_and_fit(sizer) end alias_method :sizer_and_fit=, :set_sizer_and_fit # Lays out the children of this window using the associated sizer. # # If a sizer hadn't been associated with this window (see {Wx::Window#set_sizer}), this function doesn't do anything, unless this is a top level window (see {Wx::TopLevelWindow#layout}). # Note that this method is called automatically when the window size changes if it has the associated sizer (or if {Wx::Window#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. # @see Window Sizing Overview # @return [Boolean] def layout; end # Determines whether the {Wx::Window#layout} function will be called automatically when the window is resized. # # This method is called implicitly by {Wx::Window#set_sizer} but if you use {Wx::Window#set_constraints} you should call it manually or otherwise the window layout won't be correctly updated when its size changes. # @see Wx::Window#set_sizer # @see Wx::Window#set_constraints # @param autoLayout [Boolean] Set this to true if you wish the {Wx::Window#layout} function to be called automatically when the window is resized. # @return [void] def set_auto_layout(autoLayout) end alias_method :auto_layout=, :set_auto_layout # Returns true if {Wx::Window#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. # @return [Boolean] def get_auto_layout; end alias_method :auto_layout, :get_auto_layout # Directs all mouse input to this window. # # Call {Wx::Window#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 {Wx::MouseCaptureLostEvent} event. # Any application which captures the mouse in the beginning of some operation must handle {Wx::MouseCaptureLostEvent} and cancel this operation when it receives the event. The event handler must not recapture mouse. # @see Wx::Window#release_mouse # @see Wx::MouseCaptureLostEvent # @return [void] def capture_mouse; end # Returns the caret() associated with the window. # @return [Wx::Caret] def get_caret; end alias_method :caret, :get_caret # Return the cursor associated with this window. # # # @see Wx::Window#set_cursor # @return [Wx::Cursor] def get_cursor; end alias_method :cursor, :get_cursor # Returns true if this window has the current mouse capture. # # # @see Wx::Window#capture_mouse # @see Wx::Window#release_mouse # @see Wx::MouseCaptureLostEvent # @see Wx::MouseCaptureChangedEvent # @return [Boolean] def has_capture; end alias_method :has_capture?, :has_capture # Releases mouse input captured with {Wx::Window#capture_mouse}. # # # @see Wx::Window#capture_mouse # @see Wx::Window#has_capture # @see Wx::Window#release_mouse # @see Wx::MouseCaptureLostEvent # @see Wx::MouseCaptureChangedEvent # @return [void] def release_mouse; end # Sets the caret() associated with the window. # @param caret [Wx::Caret] # @return [void] def set_caret(caret) end alias_method :caret=, :set_caret # Sets the window's cursor. # # Notice that the window cursor also sets it for the children of the window implicitly. # The cursor may be {Wx::NULL_CURSOR} in which case the window cursor will be reset back to default. # @see Wx::SetCursor # @see Wx::Cursor # @param cursor [Wx::Cursor] Specifies the cursor that the window should normally display. # @return [Boolean] def set_cursor(cursor) end alias_method :cursor=, :set_cursor # 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). #

#
# @param x [Integer] The new x position for the cursor. # @param y [Integer] The new y position for the cursor. # @return [void] def warp_pointer(x, y) end # 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 # ```ruby # 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. # @param eventsMask [Integer] Either {Wx::TOUCH_NONE} or {Wx::TOUCH_ALL_GESTURES} to disable or enable gesture events for this window. # @return [Boolean] def enable_touch_events(eventsMask) end # @overload hit_test(x, y) # 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. # @param x [Integer] # @param y [Integer] # @return [Wx::HitTest] # @overload hit_test(pt) # This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. # @param pt [Array(Integer, Integer), Wx::Point] # @return [Wx::HitTest] def hit_test(*args) end # @overload get_border(flags) # Get the window border style from the given flags: this is different from simply doing flags & {Wx::Border::BORDER_MASK} because it uses GetDefaultBorder() to translate {Wx::Border::BORDER_DEFAULT} to something reasonable. # @param flags [Integer] # @return [Wx::Border] # @overload get_border() # Get border for the flags of this window. # @return [Wx::Border] def get_border(*args) end alias_method :border, :get_border # Does the window-specific updating after processing the update event. # # This function is called by {Wx::Window#update_window_ui} in order to check return values in the {Wx::UpdateUIEvent} and act appropriately. For example, to allow frame and dialog title updating, wxWidgets implements this function as follows: # # ```ruby # # 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 # ``` # @param event [Wx::UpdateUIEvent] # @return [void] def do_update_window_ui(event) end # This method should be overridden to return true if this window has multiple pages. # # All standard class with multiple pages such as {Wx::Notebook}, {Wx::Listbook} and {Wx::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. # @return [Boolean] def has_multiple_pages; end alias_method :has_multiple_pages?, :has_multiple_pages # 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 {Wx::Window.get_class_default_attributes} default attributes. However if some of the parents attributes are explicitly (that is, using {Wx::Window#set_font} and not {Wx::Window#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 {Wx::Window#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. # @return [void] def inherit_attributes; end # Sends an {Wx::EVT_INIT_DIALOG} event, whose handler usually transfers data to the dialog via validators. # @return [void] def init_dialog; end # 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. # # # @see Wx::BufferedDC # @return [Boolean] def is_double_buffered; end alias_method :double_buffered?, :is_double_buffered # Turn on or off double buffering of the window if the system supports it. # @param on [Boolean] # @return [void] def set_double_buffered(on) end alias_method :double_buffered=, :set_double_buffered # Returns true if the window is retained, false otherwise. # #
# Remark: #

Retained windows are only available on X platforms. #

#
# @return [Boolean] def is_retained; end alias_method :retained?, :is_retained # Returns true if this window is intrinsically enabled, false otherwise, i.e. if {Wx::Window#enable} Enable(false) had been called. # # This method is mostly used for wxWidgets itself, user code should normally use {Wx::Window#is_enabled} instead. # @return [Boolean] def is_this_enabled; end alias_method :this_enabled?, :is_this_enabled # 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). # @return [Boolean] def is_top_level; end alias_method :top_level?, :is_top_level # 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 {Wx::Window#update_window_ui} in order to send update events to the window in idle time. # @return [void] def on_internal_idle; end # 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. #

#
# @see Wx::Window#unregister_hot_key # @param 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. # @param modifiers [Integer] A bitwise combination of {Wx::KeyModifier::MOD_SHIFT}, {Wx::KeyModifier::MOD_CONTROL}, {Wx::KeyModifier::MOD_ALT} or {Wx::KeyModifier::MOD_WIN} specifying the modifier keys that have to be pressed along with the key. # @param virtualKeyCode [Integer] The key code of the hotkey, e.g. an ASCII character such as 'K' or one of elements of {Wx::KeyCode} enum. # @return [Boolean] # @wxrb_require USE_HOTKEY def register_hot_key(hotkeyId, modifiers, virtualKeyCode) end # 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. #

#
# @see Wx::Window#register_hot_key # @param hotkeyId [Integer] Numeric identifier of the hotkey. Must be the same id that was passed to {Wx::Window#register_hot_key}. # @return [Boolean] # @wxrb_require USE_HOTKEY def unregister_hot_key(hotkeyId) end # This function sends one or more {Wx::UpdateUIEvent} to the window. # # The particular implementation depends on the window; for example a {Wx::ToolBar} will send an update UI event for each toolbar button, and a {Wx::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 {Wx::UpdateUIEvent} handlers are concerned). This may be necessary if you have called {Wx::UpdateUIEvent.set_mode} or {Wx::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 {Wx::UpdateUI} enumeration. # If you are calling this function from an OnInternalIdle or OnIdle function, make sure you pass the {Wx::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. # # ```ruby # class MyWindow # ... # def on_internal_idle # update_window_ui(Wx::UPDATE_UI_FROMIDLE) if Wx::UpdateUIEvent.can_update(self) # end # ... # end # ``` # @see Wx::UpdateUIEvent # @see Wx::Window#do_update_window_ui # @see Wx::Window#on_internal_idle # @param flags [Integer] # @return [void] def update_window_ui(flags=Wx::UpdateUI::UPDATE_UI_NONE) end # 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 {Wx::Window#set_window_variant} for more about this. # This static method is "overridden" in many derived classes and so calling, for example, {Wx::Button#get_class_default_attributes} will typically return the values appropriate for a button which will be normally different from those returned by, say, {Wx::ListCtrl#get_class_default_attributes}. # The {Wx::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. # @see Wx::Window#inherit_attributes # @param variant [Wx::WindowVariant] # @return [Wx::VisualAttributes] def self.get_class_default_attributes(variant=Wx::WindowVariant::WINDOW_VARIANT_NORMAL) end # 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. #

#
# @see Wx::Window#set_focus # @see Wx::Window#has_focus # @return [Wx::Window] def self.find_focus; end # 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. # @see Wx::Window#find_window # @param id [Integer] # @param parent [Wx::Window] # @return [Wx::Window] def self.find_window_by_id(id, parent=0) end # 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 {Wx::Window#find_window}, recurses into top level child windows too. # # Window with the given label or NULL if not found. # @see Wx::Window#find_window # @param label [String] # @param parent [Wx::Window] # @return [Wx::Window] def self.find_window_by_label(label, parent=0) end # Find a window by its name (as given in a window constructor or {Wx::Window#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 {Wx::Window#find_window}, recurses into top level child windows too. # If no window with such name is found, {Wx::Window.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 {Wx::Window#find_window} overload taking the name or {Wx::Window.find_window_by_label} directly. # Window with the given name or NULL if not found. # @param name [String] # @param parent [Wx::Window] # @return [Wx::Window] def self.find_window_by_name(name, parent=0) end # Returns the currently captured window. # # # @see Wx::Window#has_capture # @see Wx::Window#capture_mouse # @see Wx::Window#release_mouse # @see Wx::MouseCaptureLostEvent # @see Wx::MouseCaptureChangedEvent # @return [Wx::Window] def self.get_capture; end # 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 {Wx::Window.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 {Wx::StandardID::ID_NONE} if the specified number of identifiers couldn't be allocated. # @see Wx::Window.unreserve_control_id # @see Wx::IdManager # @see Window IDs # @param count [Integer] The number of sequential IDs to reserve. # @return [Integer] def self.new_control_id(count=1) end # Unreserve an ID or range of IDs that was reserved by {Wx::Window.new_control_id}. # # See Window IDs for more information. # @see Wx::Window.new_control_id # @see Wx::IdManager # @see Window IDs # @param id [Integer] The starting ID of the range of IDs to unreserve. # @param count [Integer] The number of sequential IDs to unreserve. # @return [void] def self.unreserve_control_id(id, count=1) end # @overload initialize() # Default constructor. # @return [Wx::Window] # @overload initialize(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::PANEL_NAME_STR) # Constructs a window, which can be a child of a frame, dialog or any other non-control window. # @param parent [Wx::Window] Pointer to a parent window. # @param id [Integer] Window identifier. If {Wx::StandardID::ID_ANY}, will automatically create an identifier. See Window IDs for more information about IDs. # @param pos [Array(Integer, Integer), Wx::Point] Window position. {Wx::DEFAULT_POSITION} indicates that wxWidgets should generate a default position for the window. If using the {Wx::Window} class directly, supply an actual position. # @param size [Array(Integer, Integer), Wx::Size] Window size. {Wx::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. # @param style [Integer] Window style. For generic window styles, please see {Wx::Window}. # @param name [String] Window name. # @return [Wx::Window] def initialize(*args) end # 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 {Wx::Window#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 {Wx::Window#create} before using the window and if you use the non-default constructor, you can not call {Wx::Window#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 {Wx::Window#create} on it, e.g. a common pattern to avoid showing the contents of a window before it is fully initialized is: # ```ruby # 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 {Wx::Window#create} on it: # ```ruby # # 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 # @param parent [Wx::Window] # @param id [Integer] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param name [String] # @return [Boolean] def create(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, name=Wx::PANEL_NAME_STR) end end # Window # Struct containing all the visual attributes of a control. # # # # # @note This class is untracked and should not be derived from nor instances extended! class VisualAttributes < ::Object # The font used for control label/text inside it. # # # @return [Wx::Font] def font; end # The font used for control label/text inside it. # # # @param val [Wx::Font] # @return [void] def font=(val); end # The foreground colour. # # # @return [Wx::Colour] def col_fg; end # The foreground colour. # # # @param val [Wx::Colour] # @return [void] def col_fg=(val); end # The background colour. # May be {Wx::NULL_COLOUR} if the controls background colour is not solid. # # @return [Wx::Colour] def col_bg; end # The background colour. # May be {Wx::NULL_COLOUR} if the controls background colour is not solid. # # @param val [Wx::Colour] # @return [void] def col_bg=(val); end end # VisualAttributes end