# :stopdoc:
# This file is automatically generated by the WXRuby3 documentation
# generator. Do not alter this file.
# :startdoc:
module Wx
#
#
#
#
# @wxrb_require USE_ODCOMBOBOX
class OwnerDrawnComboBoxPaintingFlags < Wx::Enum
# Combo control is being painted, instead of a list item.
#
ODCB_PAINTING_CONTROL = Wx::OwnerDrawnComboBoxPaintingFlags.new(1)
# An item with selection background is being painted.
#
ODCB_PAINTING_SELECTED = Wx::OwnerDrawnComboBoxPaintingFlags.new(2)
end # OwnerDrawnComboBoxPaintingFlags
# Double-clicking cycles item if {Wx::CB_READONLY} is also used.
#
ODCB_DCLICK_CYCLES = 256
# If used, control itself is not custom paint using callback.
#
ODCB_STD_CONTROL_PAINT = 4096
# {Wx::OwnerDrawnComboBox} is a combobox with owner-drawn list items.
#
# In essence, it is a {Wx::ComboCtrl} with {Wx::VListBox} popup and {Wx::ControlWithItems} interface.
# Implementing item drawing and measuring is similar to {Wx::VListBox}. Application needs to subclass {Wx::OwnerDrawnComboBox} and implement {Wx::OwnerDrawnComboBox#on_draw_item}, {Wx::OwnerDrawnComboBox#on_measure_item} and {Wx::OwnerDrawnComboBox#on_measure_item_width}.
# ### Styles
#
# This class supports the following styles:
#
# - {Wx::ODCB_DCLICK_CYCLES}: Double-clicking cycles item if {Wx::CB_READONLY} is also used. Synonymous with {Wx::CC_SPECIAL_DCLICK}.
#
# - {Wx::ODCB_STD_CONTROL_PAINT}: Control itself is not custom painted using OnDrawItem. Even if this style is not used, writable {Wx::OwnerDrawnComboBox} is never custom painted unless {Wx::OwnerDrawnComboBox#set_custom_paint_width} is called.
#
# ### Events emitted by this class
#
# The following event-handler methods redirect the events to member method or handler blocks for {Wx::CommandEvent} events.
# Event handler methods for events emitted by this class:
#
# - {Wx::EvtHandler#evt_combobox}(id, meth = nil, &block): Process a {Wx::EVT_COMBOBOX} event, when an item on the list is selected. Note that calling {Wx::OwnerDrawnComboBox#get_value} returns the new value of selection.
#
# Category: {Wx::Controls}
Appearance: WXMSW Appearance
# | WXGTK Appearance
# | WXOSX Appearance
# |
# @see Wx::ComboCtrl window styles and Window Styles.
#
# @see Events emitted by Wx::ComboCtrl.
#
# @see Wx::ComboCtrl
# @see Wx::ComboBox
# @see Wx::VListBox
# @see Wx::CommandEvent
#
#
# @wxrb_require USE_ODCOMBOBOX
class OwnerDrawnComboBox < ComboCtrl
# @overload create(parent, id, value=(''), pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::COMBO_BOX_NAME_STR)
# Creates the combobox for two-step construction.
#
# See {Wx::OwnerDrawnComboBox#initialize} for further details.
#
#
# @param parent [Wx::Window]
# @param id [Integer]
# @param value [String]
# @param pos [Array(Integer, Integer), Wx::Point]
# @param size [Array(Integer, Integer), Wx::Size]
# @param style [Integer]
# @param validator [Wx::Validator]
# @param name [String]
# @return [Boolean]
# @overload create(parent, id, value, pos, size, choices, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::COMBO_BOX_NAME_STR)
# Creates the combobox for two-step construction.
#
# See {Wx::OwnerDrawnComboBox#initialize} for further details.
#
#
# @param parent [Wx::Window]
# @param id [Integer]
# @param value [String]
# @param pos [Array(Integer, Integer), Wx::Point]
# @param size [Array(Integer, Integer), Wx::Size]
# @param choices [Array]
# @param style [Integer]
# @param validator [Wx::Validator]
# @param name [String]
# @return [Boolean]
def create(*args) end
# @overload initialize()
# Default constructor.
# @return [Wx::OwnerDrawnComboBox]
# @overload initialize(parent, id, value, pos, size, choices, style=0, validator=Wx::DEFAULT_VALIDATOR, name=("COMBO_BOX"))
# Constructor, creating and showing a owner-drawn combobox.
#
#
# @see Wx::OwnerDrawnComboBox#create
# @see Wx::Validator
# @param parent [Wx::Window] Parent window. Must not be NULL.
# @param id [Integer] Window identifier. The value {Wx::StandardID::ID_ANY} indicates a default value.
# @param value [String] Initial selection string. An empty string indicates no selection.
# @param pos [Array(Integer, Integer), Wx::Point] Window position.
# @param size [Array(Integer, Integer), Wx::Size] Window size. If {Wx::DEFAULT_SIZE} is specified then the window is sized appropriately.
# @param choices [Array] An array of strings with which to initialise the control.
# @param style [Integer] Window style. See {Wx::OwnerDrawnComboBox}.
# @param validator [Wx::Validator] Window validator.
# @param name [String] Window name.
# @return [Wx::OwnerDrawnComboBox]
def initialize(*args) end
# {Wx::OwnerDrawnComboBox#is_empty} is not available in this class.
#
# This method is documented here only to notice that it can't be used with this class because of the ambiguity between the methods with the same name inherited from {Wx::ItemContainer} and {Wx::TextEntry} base classes.
# Because of this, any attempt to call it results in a compilation error and you should use either {Wx::OwnerDrawnComboBox#is_list_empty} or {Wx::OwnerDrawnComboBox#is_text_empty} depending on what exactly do you want to test.
# @return [Boolean]
def is_empty; end
alias_method :empty?, :is_empty
# Returns true if the list of combobox choices is empty.
#
# Use this method instead of (not available in this class) {Wx::OwnerDrawnComboBox#is_empty} to test if the list of items is empty.
# @return [Boolean]
def is_list_empty; end
alias_method :list_empty?, :is_list_empty
# Returns true if the text of the combobox is empty.
#
# Use this method instead of (not available in this class) {Wx::OwnerDrawnComboBox#is_empty} to test if the text currently entered into the combobox is empty.
# @return [Boolean]
def is_text_empty; end
alias_method :text_empty?, :is_text_empty
# Returns index to the widest item in the list.
# @return [Integer]
def get_widest_item; end
alias_method :widest_item, :get_widest_item
# Returns width of the widest item in the list.
# @return [Integer]
def get_widest_item_width; end
alias_method :widest_item_width, :get_widest_item_width
# @overload append(item)
# Appends item into the control.
#
# The return value is the index of the newly inserted item. Note that this may be different from the last one if the control is sorted (e.g. has {Wx::LB_SORT} or {Wx::CB_SORT} style).
# @param item [String] String to add.
# @return [Integer]
# @overload append(item, clientData)
# Appends item into the control.
#
# The return value is the index of the newly inserted item. Note that this may be different from the last one if the control is sorted (e.g. has {Wx::LB_SORT} or {Wx::CB_SORT} style).
# @param item [String] String to add.
# @param clientData [Object] Pointer to client data to associate with the new item.
# @return [Integer]
# @overload append(items)
# Appends several items at once into the control.
#
# Notice that calling this method is usually much faster than appending them one by one if you need to add a lot of items.
# @param items [Array] Array of strings to insert.
# @return [Integer]
# @overload append(items, clientData)
# Appends several items at once into the control.
#
# Notice that calling this method is usually much faster than appending them one by one if you need to add a lot of items.
# @param items [Array] Array of strings to insert.
# @param clientData [Wx::ClientData] Array of client data pointers of the same size as items to associate with the new items.
# @return [Integer]
def append(*args) end
# Returns a pointer to the client data associated with the given item (if any).
#
# It is an error to call this function for a control which doesn't have typed client data at all although it is OK to call it even if the given item doesn't have any client data associated with it (but other items do).
# Notice that the returned pointer is still owned by the control and will be deleted by it, use {Wx::OwnerDrawnComboBox#detach_client_object} if you want to remove the pointer from the control.
#
# A pointer to the client data, or NULL if not present.
# @param n [Integer] The zero-based position of the item.
# @return [Object]
def get_client_object(n) end
alias_method :client_object, :get_client_object
# Associates the given typed client data pointer with the given item: the data object will be deleted when the item is deleted (either explicitly by using {Wx::OwnerDrawnComboBox#delete} or implicitly when the control itself is destroyed).
#
# Note that it is an error to call this function if any untyped client data pointers had been associated with the control items before.
# @param n [Integer] The zero-based item index.
# @param data [Object] The client data to associate with the item.
# @return [void]
def set_client_object(n, data) end
# @overload insert(item, pos)
# Inserts item into the control.
#
# The return value is the index of the newly inserted item. If the insertion failed for some reason, -1 is returned.
# @param item [String] String to add.
# @param pos [Integer] Position to insert item before, zero based.
# @return [Integer]
# @overload insert(item, pos, clientData)
# Inserts item into the control.
#
# The return value is the index of the newly inserted item. If the insertion failed for some reason, -1 is returned.
# @param item [String] String to add.
# @param pos [Integer] Position to insert item before, zero based.
# @param clientData [Object] Pointer to client data to associate with the new item.
# @return [Integer]
# @overload insert(items, pos)
# Inserts several items at once into the control.
#
# Notice that calling this method is usually much faster than inserting them one by one if you need to insert a lot of items.
#
# The return value is the index of the last inserted item. If the insertion failed for some reason, -1 is returned.
# @param items [Array] Array of strings to insert.
# @param pos [Integer] Position to insert the items before, zero based.
# @return [Integer]
# @overload insert(items, pos, clientData)
# Inserts several items at once into the control.
#
# Notice that calling this method is usually much faster than inserting them one by one if you need to insert a lot of items.
#
# The return value is the index of the last inserted item. If the insertion failed for some reason, -1 is returned.
# @param items [Array] Array of strings to insert.
# @param pos [Integer] Position to insert the items before, zero based.
# @param clientData [Wx::ClientData] Array of client data pointers of the same size as items to associate with the new items.
# @return [Integer]
def insert(*args) end
# @overload set(items)
# Replaces the current control contents with the given items.
#
# Notice that calling this method is usually much faster than appending them one by one if you need to add a lot of items.
# @param items [Array] Array of strings to insert.
# @return [void]
# @overload set(items, clientData)
# Replaces the current control contents with the given items.
#
# Notice that calling this method is usually much faster than appending them one by one if you need to add a lot of items.
# @param items [Array] Array of strings to insert.
# @param clientData [Wx::ClientData] Array of client data pointers of the same size as items to associate with the new items.
# @return [void]
def set(*args) end
# Deletes an item from the control.
#
# The client data associated with the item will be also deleted if it is owned by the control. Note that it is an error (signalled by an assert failure in debug builds) to remove an item with the index negative or greater or equal than the number of items in the control.
# If there is a currently selected item below the item being deleted, i.e. if {Wx::OwnerDrawnComboBox#get_selection} returns a valid index greater than or equal to n, the selection is invalidated when this function is called. However if the selected item appears before the item being deleted, the selection is preserved unchanged.
# @see Wx::OwnerDrawnComboBox#clear
# @param n [Integer] The zero-based item index.
# @return [void]
def delete(n) end
# Returns the client object associated with the given item and transfers its ownership to the caller.
#
# This method, unlike {Wx::OwnerDrawnComboBox#get_client_object}, expects the caller to delete the returned pointer. It also replaces the internally stored pointer with NULL, i.e. completely detaches the client object pointer from the control.
# It's an error to call this method unless {Wx::OwnerDrawnComboBox#has_client_object_data} returns true.
#
# The associated client object pointer to be deleted by caller or NULL.
# @param n [Integer] The zero-based item index.
# @return [Object]
def detach_client_object(n) end
# Returns true, if either untyped data (void*
) or object data ({Wx::ClientData}*) is associated with the items of the control.
# @return [Boolean]
def has_client_data; end
alias_method :has_client_data?, :has_client_data
# Returns true, if object data is associated with the items of the control.
#
# Object data pointers have the type wxClientData*
instead of void*
and, importantly, are owned by the control, i.e. will be deleted by it, unlike their untyped counterparts.
# @return [Boolean]
def has_client_object_data; end
alias_method :has_client_object_data?, :has_client_object_data
protected
# This method is used to draw the items background and, maybe, a border around it.
#
# The base class version implements a reasonable default behaviour which consists in drawing the selected item with the standard background colour and drawing a border around the item if it is either selected or current.
#
#
# @param dc [Wx::DC]
# @param rect [Wx::Rect]
# @param item [Integer]
# @param flags [Integer]
# @return [void]
def on_draw_background(dc, rect, item, flags) end
# The derived class may implement this function to actually draw the item with the given index on the provided DC.
#
# If function is not implemented, the item text is simply drawn, as if the control was a normal combobox.
# @param dc [Wx::DC] The device context to use for drawing
# @param rect [Wx::Rect] The bounding rectangle for the item being drawn (DC clipping region is set to this rectangle before calling this function)
# @param item [Integer] The index of the item to be drawn
# @param flags [Integer] A combination of the {Wx::OwnerDrawnComboBoxPaintingFlags} enumeration values.
# @return [void]
def on_draw_item(dc, rect, item, flags) end
# The derived class may implement this method to return the height of the specified item (in pixels).
#
# The default implementation returns text height, as if this control was a normal combobox.
# @param item [Integer]
# @return [Integer]
def on_measure_item(item) end
# The derived class may implement this method to return the width of the specified item (in pixels).
#
# If -1 is returned, then the item text width is used.
# The default implementation returns -1.
# @param item [Integer]
# @return [Integer]
def on_measure_item_width(item) end
end # OwnerDrawnComboBox
end