Class: Wx::PG::FlagsProperty
- Inherits:
-
PGProperty
- Object
- Object
- PGProperty
- Wx::PG::FlagsProperty
- Defined in:
- lib/wx/doc/gen/pg/pg_properties.rb
Overview
Represents a bit set that fits in a long integer.
BoolProperty sub-properties are created for editing individual bits. Textctrl is created to manually edit the flags as a text; a continuous sequence of spaces, commas and semicolons is considered as a flag id separator. Note: When changing “choices” (ie. flag labels) of FlagsProperty, you will need to use SetPropertyChoices - otherwise they will not get updated properly.
Instance Method Summary collapse
-
#child_changed(thisValue, childIndex, childValue) ⇒ Wx::Variant
Called after value of a child property has been altered.
-
#do_set_attribute(name, value) ⇒ Boolean
Reimplement this member function to add special handling for attributes of this property.
-
#get_choice_selection ⇒ Integer
(also: #choice_selection)
Returns which choice is currently selected.
- #get_item_count ⇒ Integer (also: #item_count)
- #get_item_label(ind) ⇒ Wx::String (also: #item_label)
-
#initialize(*args) ⇒ FlagsProperty
constructor
A new instance of FlagsProperty.
-
#on_set_value ⇒ void
This virtual function is called after m_value has been set.
-
#refresh_children ⇒ void
Refresh values of child properties.
-
#string_to_value(variant, text, argFlags) ⇒ Boolean
Converts text into Variant value appropriate for this property.
- #value_ ⇒ Wx::Variant
- #value_=(val) ⇒ void
-
#value_to_string(value, argFlags = 0) ⇒ String
Converts property value into a text representation.
Methods inherited from PGProperty
#adapt_list_to_value, #add_choice, #add_private_child, #append_child, #are_all_children_specified, #are_children_components, #change_flag, #clear_cells, #delete_children, #delete_choice, #do_get_attribute, #do_get_editor_class, #do_get_validator, #do_get_value, #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, #index, #insert_child, #insert_choice, #int_to_value, #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_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, #validate_value
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize(label, name, choices, value = 0) ⇒ Wx::PG::FlagsProperty #initialize(label = Wx::PG::PG_LABEL, name = Wx::PG::PG_LABEL, labels = (Wx::ArrayString.new()), values = (Wx::ArrayInt.new()), value = 0) ⇒ Wx::PG::FlagsProperty
Returns a new instance of FlagsProperty.
251 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 251 def initialize(*args) end |
Instance Method Details
#child_changed(thisValue, childIndex, childValue) ⇒ Wx::Variant
Called after value of a child property has been altered.
Must return new value of the whole property (after any alterations warranted by child’s new value). Note that this function is usually called at the time that value of this property, or given child property, is still pending for change, and as such, result of PGProperty#get_value or m_value should not be relied on. Sample pseudo-code implementation:
class MyProperty < Wx::PG::FlagsProperty
def child_changed(thisValue, childIndex, childValue)
# Acquire reference to actual type of data stored in variant
flags = thisValue.object;
case childIndex
when 0
flags.sub_prop1 = childValue.to_i
when 1
flags.sub_prop2 = childValue.to_s
# ...
end
# return altered data
Wx::Variant.new(flags)
end
end
Modified value of the whole property.
328 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 328 def child_changed(thisValue, childIndex, childValue) end |
#do_set_attribute(name, value) ⇒ Boolean
Reimplement this member function to add special handling for attributes of this property.
Return false to have the attribute automatically stored in m_attributes. Default implementation simply does that and nothing else.
To actually set property attribute values from the application, use PGProperty#set_attribute instead.
348 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 348 def do_set_attribute(name, value) end |
#get_choice_selection ⇒ Integer 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.
355 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 355 def get_choice_selection; end |
#get_item_count ⇒ Integer Also known as: item_count
359 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 359 def get_item_count; end |
#get_item_label(ind) ⇒ Wx::String Also known as: item_label
364 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 364 def get_item_label(ind) end |
#on_set_value ⇒ void
This method returns an undefined value.
This virtual function is called after m_value has been set.
- 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.
266 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 266 def on_set_value; end |
#refresh_children ⇒ void
This method returns an undefined value.
Refresh values of child properties.
Automatically called after value is set.
334 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 334 def refresh_children; end |
#string_to_value(variant, text, argFlags) ⇒ Boolean
Converts text into Variant value appropriate for this property.
Returns true if resulting Variant value was different.
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).
295 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 295 def string_to_value(variant, text, argFlags) end |
#value_=(val) ⇒ void
This method returns an undefined value.
373 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 373 def value_=(val); end |
#value_to_string(value, argFlags = 0) ⇒ String
Converts property value into a text representation.
Default implementation calls PGProperty#generate_composed_value.
278 |
# File 'lib/wx/doc/gen/pg/pg_properties.rb', line 278 def value_to_string(value, argFlags=0) end |