Class: Wx::PG::EnumProperty

Inherits:
PGProperty show all
Defined in:
lib/wx/doc/gen/pg/pg_properties.rb

Overview

You can derive custom properties with choices from this class.

See BaseEnumProperty for remarks.

Remark:

- Updating private index is important. You can do this either by calling #set_index in IntToValue, and then letting Wx::BaseEnumProperty::OnSetValue be called (by not implementing it, or by calling super class function in it) -OR- you can just call SetIndex in OnSetValue.

Requires:

  • USE_PROPGRID

Instance Method Summary collapse

Methods inherited from PGProperty

#adapt_list_to_value, #add_choice, #add_private_child, #append_child, #are_all_children_specified, #are_children_components, #change_flag, #child_changed, #clear_cells, #delete_children, #delete_choice, #do_get_attribute, #do_get_editor_class, #do_get_validator, #do_get_value, #do_set_attribute, #each_attribute, #empty, #enable, #enable_common_value, #ensure_cells, #generate_composed_value, #get_attribute, #get_attribute_as_double, #get_attribute_as_long, #get_attributes, #get_attributes_as_list, #get_base_name, #get_cell, #get_cell_or_default, #get_child_count, #get_children_height, #get_choices, #get_client_object, #get_column_editor, #get_common_value, #get_default_value, #get_depth, #get_displayed_common_value_count, #get_displayed_string, #get_editor_class, #get_editor_dialog, #get_flags_as_string, #get_grid, #get_grid_if_displayed, #get_help_string, #get_hint_text, #get_image_offset, #get_index_in_parent, #get_item_at_y, #get_label, #get_last_visible_sub_item, #get_main_parent, #get_max_length, #get_name, #get_parent, #get_property_by_name, #get_property_by_name_wh, #get_validator, #get_value, #get_value_as_string, #get_value_image, #get_value_type, #get_y, #has_flag, #has_flags_exact, #has_visible_children, #hide, #insert_child, #insert_choice, #is_category, #is_child_selected, #is_enabled, #is_expanded, #is_root, #is_some_parent, #is_sub_property, #is_text_editable, #is_value_unspecified, #is_visible, #item, #last, #on_custom_paint, #on_event, #on_measure_image, #on_validation_failure, #recreate_editor, #refresh_children, #refresh_editor, #set_attribute, #set_attributes, #set_auto_unspecified, #set_background_colour, #set_cell, #set_choice_selection, #set_choices, #set_client_object, #set_common_value, #set_default_colours, #set_default_value, #set_editor, #set_expanded, #set_flag_recursively, #set_flags_from_string, #set_help_string, #set_label, #set_max_length, #set_modified_status, #set_name, #set_parental_type, #set_text_colour, #set_validator, #set_value, #set_value_from_int, #set_value_from_string, #set_value_image, #set_value_in_event, #set_value_to_unspecified, #set_was_modified, #update_parent_values, #uses_auto_unspecified

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initialize(label, name, choices, value = 0) ⇒ Wx::PG::EnumProperty #initialize(label, name, labels, values = (Wx::ArrayInt.new()), value = 0) ⇒ Wx::PG::EnumProperty

Returns a new instance of EnumProperty.

Overloads:

  • #initialize(label, name, choices, value = 0) ⇒ Wx::PG::EnumProperty

    Parameters:

    • label (String)
    • name (String)
    • choices (Wx::PG::PGChoices)
    • value (Integer) (defaults to: 0)
  • #initialize(label, name, labels, values = (Wx::ArrayInt.new()), value = 0) ⇒ Wx::PG::EnumProperty

    Parameters:

    • label (String)
    • name (String)
    • labels (Array<String>)
    • values (Array<Integer>) (defaults to: (Wx::ArrayInt.new()))
    • value (Integer) (defaults to: 0)


2237
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2237

def initialize(*args) end

Instance Method Details

#get_choice_selectionInteger Also known as: choice_selection

Returns which choice is currently selected.

Only applies to properties which have choices. Needs to reimplemented in derived class if property value does not map directly to a choice. Integer as index, bool, and string usually do.

Returns:

  • (Integer)


2335
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2335

def get_choice_selection; end

#get_indexInteger Also known as: index

Returns:

  • (Integer)


2339
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2339

def get_index; end

#get_index_for_value(value) ⇒ Integer Also known as: index_for_value

Parameters:

  • value (Integer)

Returns:

  • (Integer)


2327
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2327

def get_index_for_value(value) end

#get_item_countInteger Also known as: item_count

Returns:

  • (Integer)


2240
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2240

def get_item_count; end

#int_to_value(variant, number, argFlags = 0) ⇒ Boolean

Converts integer (possibly a choice selection) into Variant value appropriate for this property.

Returns true if resulting Variant value was different.

Remark:

- If property is not supposed to use choice or spinctrl or other editor with int-based value, it is not necessary to implement this method. - Default implementation simply assign given int to m_value. - If property uses choice control, and displays a dialog on some choice items, then it is preferred to display that dialog in IntToValue instead of OnEvent. - You might want to take into account that m_value is Mull variant if property value is unspecified (which is usually only case if you explicitly enabled that sort behaviour).

Parameters:

  • variant (Wx::Variant)

    On function entry this is the old value (should not be NullVariant in normal cases). Translated value must be assigned back to it.

  • number (Integer)

    Integer to be translated into variant.

  • argFlags (Integer) (defaults to: 0)

    If PG_MISC_ARG_FLAGS::PG_FULL_VALUE is set, returns complete, storable value instead of displayable one.

Returns:

  • (Boolean)


2323
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2323

def int_to_value(variant, number, argFlags=0) end

#on_set_valuevoid

This method returns an undefined value.

This virtual function is called after m_value has been set.

Remark:

- If m_value was set to Null variant (i.e. unspecified value), #on_set_value will not be called. - m_value may be of any variant type. Typically properties internally support only one variant type, and as such #on_set_value provides a good opportunity to convert supported values into internal type. - Default implementation does nothing.



2256
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2256

def on_set_value; end

#set_index(index) ⇒ void Also known as: index=

This method returns an undefined value.

Parameters:

  • index (Integer)


2344
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2344

def set_index(index) end

#string_to_value(variant, text, argFlags = 0) ⇒ Boolean

Converts text into Variant value appropriate for this property.

Returns true if resulting Variant value was different.

Remark:

Default implementation converts semicolon delimited tokens into child values. Only works for properties with children.

You might want to take into account that m_value is Null variant if property value is unspecified (which is usually only case if you explicitly enabled that sort behaviour).

Parameters:

  • variant (Wx::Variant)

    On function entry this is the old value (should not be NullVariant in normal cases). Translated value must be assigned back to it.

  • text (String)

    Text to be translated into variant.

  • argFlags (Integer) (defaults to: 0)

    If PG_MISC_ARG_FLAGS::PG_FULL_VALUE is set, returns complete, storable value instead of displayable one (they may be different). If PG_MISC_ARG_FLAGS::PG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of composite property string value (as generated by #value_to_string called with this same flag).

Returns:

  • (Boolean)


2285
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2285

def string_to_value(variant, text, argFlags=0) end

#validate_value(value, validationInfo) ⇒ Boolean

Implement this function in derived class to check the value.

Return true if it is ok. Returning false prevents property change events from occurring.

Remark:

- Default implementation always returns true.

Parameters:

Returns:

  • (Boolean)


2302
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2302

def validate_value(value, validationInfo) end

#value_Wx::Variant

Returns:



2349
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2349

def value_; end

#value_=(val) ⇒ void

This method returns an undefined value.

Parameters:



2353
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2353

def value_=(val); end

#value_to_string(value, argFlags = 0) ⇒ String

Converts property value into a text representation.

Remark:

Default implementation calls PGProperty#generate_composed_value.

Parameters:

Returns:

  • (String)


2268
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 2268

def value_to_string(value, argFlags=0) end