# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # A listbox-like control allowing the user to rearrange the items and to enable or disable them. # This class allows changing the order of the items shown in it as well as checking or unchecking them individually. The data structure used to allow this is the order array which contains the items indices indexed by their position with an added twist that the unchecked items are represented by the bitwise complement of the corresponding index (for any architecture using two's complement for negative numbers representation (i.e. just about any at all) this means that a checked item N is represented by -N-1 in unchecked state). In practice this means that you must apply the C bitwise complement operator when constructing the order array, e.g. # ``` # wxArrayInt order; # order.push_back(0); // checked item #0 # order.push_back(~1); // unchecked item #1 # ``` # # So, for example, the array order [1 -3 0] used in conjunction with the items array ["first", "second", "third"] means that the items order is "second", "third", "first" and the "third" item is unchecked while the other two are checked. # This convention is used both for the order argument of the control ctor or {Wx::RearrangeList#create} and for the array returned from {Wx::RearrangeList#get_current_order}. # Usually this control will be used together with other controls allowing to move the items around in it interactively. The simplest possible solution is to use {Wx::RearrangeCtrl} which combines it with two standard buttons to move the current item up or down. # Note that while most of the methods for items manipulation such as {Wx::RearrangeList#append}, {Wx::RearrangeList#insert} or {Wx::RearrangeList#delete}, inherited from {Wx::ItemContainer} work as expected for this class, {Wx::RearrangeList#set} somewhat unexpectedly resets the order of the items as it clears the control first, also clearing the order as a side effect, before adding the new items. # # === # # Category: {Wx::Controls}
Appearance:
Generic Appearance #
# class RearrangeList < CheckListBox # @overload initialize() # Default constructor. # {Wx::RearrangeList#create} must be called later to effectively create the control. # @return [Wx::RearrangeList] # @overload initialize(parent, id, pos, size, order, items, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::RearrangeListNameStr) # Constructor really creating the control. # Please see {Wx::RearrangeList#create} for the parameters description. # @param parent [Wx::Window] # @param id [Integer] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param order [Array] # @param items [Array] # @param style [Integer] # @param validator [Wx::Validator] # @param name [String] # @return [Wx::RearrangeList] def initialize(*args) end # Effectively creates the window for an object created using the default constructor. # This function is very similar to {Wx::CheckListBox#create} except that it has an additional parameter specifying the initial order of the items. Please see the class documentation for the explanation of the conventions used by the order argument. # @param parent [Wx::Window] The parent window, must be non-NULL. # @param id [Integer] The window identifier. # @param pos [Array(Integer, Integer), Wx::Point] The initial window position. # @param size [Array(Integer, Integer), Wx::Size] The initial window size. # @param order [Array] Array specifying the initial order of the items in items array. # @param items [Array] The items to display in the list. # @param style [Integer] The control style, there are no special styles for this class but the base class styles can be used here. # @param validator [Wx::Validator] Optional window validator. # @param name [String] Optional window name. # @return [Boolean] def create(parent, id, pos, size, order, items, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::RearrangeListNameStr) end # Return the current order of the items. # The order may be different from the one passed to the constructor if {Wx::RearrangeList#move_current_up} or {Wx::RearrangeList#move_current_down} were called. # @return [Wx::ArrayInt] def get_current_order; end alias_method :current_order, :get_current_order # Return true if the currently selected item can be moved up. # This function is useful for EVT_UPDATE_UI handler for the standard "Up" button often used together with this control and {Wx::RearrangeCtrl} uses it in this way. # true if the currently selected item can be moved up in the listbox, false if there is no selection or the current item is the first one. # @see Wx::RearrangeList#can_move_current_down # @return [Boolean] def can_move_current_up; end alias_method :can_move_current_up?, :can_move_current_up # Return true if the currently selected item can be moved down. # # @see Wx::RearrangeList#can_move_current_up # @return [Boolean] def can_move_current_down; end alias_method :can_move_current_down?, :can_move_current_down # Move the currently selected item one position above. # This method is useful to implement the standard "Up" button behaviour and {Wx::RearrangeCtrl} uses it for this. # true if the item was moved or false if this couldn't be done. # @see Wx::RearrangeList#move_current_down # @return [Boolean] def move_current_up; end # Move the currently selected item one position below. # # @see Wx::RearrangeList#move_current_up # @return [Boolean] def move_current_down; end end # RearrangeList end