Class: Wx::RTC::RichTextField
- Inherits:
-
RichTextParagraphLayoutBox
- Object
- Object
- RichTextObject
- RichTextCompositeObject
- RichTextParagraphLayoutBox
- Wx::RTC::RichTextField
- Defined in:
- lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb
Overview
This class is untracked and should not be derived from nor instances extended!
This class implements the general concept of a field, an object that represents additional functionality such as a footnote, a bookmark, a page number, a table of contents, and so on.
Extra information (such as a bookmark name) can be stored in the object properties. Drawing, layout, and property editing is delegated to classes derived from RichTextFieldType, such as instances of RichTextFieldTypeStandard; this makes the use of fields an efficient method of introducing extra functionality, since most of the information required to draw a field (such as a bitmap) is kept centrally in a single field type definition. The FieldType property, accessed by SetFieldType/GetFieldType, is used to retrieve the field type definition. So be careful not to overwrite this property. RichTextField is derived from RichTextParagraphLayoutBox, which means that it can contain its own read-only content, refreshed when the application calls the UpdateField function. Whether a field is treated as a composite or a single graphic is determined by the field type definition. If using RichTextFieldTypeStandard, passing the display type Wx::RTC::RichTextFieldTypeStandard::RICHTEXT_FIELD_STYLE_COMPOSITE to the field type definition causes the field to behave like a composite; the other display styles display a simple graphic. When implementing a composite field, you will still need to derive from RichTextFieldTypeStandard or RichTextFieldType, if only to implement UpdateField to refresh the field content appropriately. RichTextFieldTypeStandard is only one possible implementation, but covers common needs especially for simple, static fields using text or a bitmap. Register field types on application initialisation with the static function Wx::RTC::RichTextBuffer.add_field_type. They will be deleted automatically on application exit. An application can write a field to a control with Wx::RTC::RichTextCtrl#write_field, taking a field type, the properties for the field, and optional attributes.
Category: Rich Text
Instance Method Summary collapse
-
#accepts_focus ⇒ Boolean
Returns true if objects of this class can accept the focus, i.e.
-
#calculate_range(start, end_) ⇒ Integer
Calculates the range of the object.
-
#can_edit_properties ⇒ Boolean
(also: #can_edit_properties?)
Returns true if we can edit the object’s properties via a GUI.
-
#clone ⇒ Wx::RTC::RichTextObject
Clones the object.
- #copy(obj) ⇒ void
-
#draw(dc, context, range, selection, rect, descent, style) ⇒ Boolean
Draw the item, within the given range.
-
#edit_properties(parent, buffer) ⇒ Boolean
Edits the object’s properties via a GUI.
- #get_field_type ⇒ String (also: #field_type)
-
#get_properties_menu_label ⇒ String
(also: #properties_menu_label)
Returns the label to be used for the properties context menu item.
-
#get_range_size(range, size, descent, dc, context, flags, position = (Wx::Point.new(0, 0)), parentSize = Wx::DEFAULT_SIZE, partialExtents = nil) ⇒ Boolean
(also: #range_size)
Returns the object size for the given range.
-
#get_xml_node_name ⇒ String
(also: #xml_node_name)
Returns the XML node name of this object.
-
#initialize(*args) ⇒ RichTextField
constructor
A new instance of RichTextField.
-
#is_atomic ⇒ Boolean
(also: #atomic?)
If a field has children, we don’t want the user to be able to edit it.
-
#is_empty ⇒ Boolean
(also: #empty?)
Returns true if the buffer is empty.
-
#is_top_level ⇒ Boolean
(also: #top_level?)
Returns true if this object is top-level, i.e.
-
#layout(dc, context, rect, parentRect, style) ⇒ Boolean
Lay the item out at the specified position with the given size constraint.
- #set_field_type(fieldType) ⇒ void (also: #field_type=)
-
#update_field(buffer) ⇒ Boolean
Update the field; delegated to the associated field type.
Methods inherited from RichTextParagraphLayoutBox
#add_image, #add_paragraph, #add_paragraphs, #apply_style_sheet, #clear, #clear_list_style, #collect_style, #copy_fragment, #delete_range, #delete_range_with_undo, #do_get_style, #do_invalidate, #do_number_list, #draw_floats, #find_next_paragraph_number, #get_basic_style, #get_default_style, #get_float_collector, #get_floating_object_count, #get_floating_objects, #get_invalid_range, #get_leaf_object_at_position, #get_line_at_position, #get_line_at_y_position, #get_line_count, #get_line_for_visible_line_number, #get_line_size_at_position, #get_paragraph_at_line, #get_paragraph_at_position, #get_paragraph_count, #get_paragraph_for_line, #get_paragraph_length, #get_paragraph_text, #get_partial_paragraph, #get_rich_text_ctrl, #get_style, #get_style_for_new_paragraph, #get_style_for_range, #get_style_sheet, #get_text, #get_text_for_range, #get_uncombined_style, #get_visible_line_number, #has_character_attributes, #has_paragraph_attributes, #hit_test, #import_from_xml, #init, #insert_field_with_undo, #insert_fragment, #insert_image_with_undo, #insert_newline_with_undo, #insert_object_with_undo, #insert_paragraphs_with_undo, #insert_text_with_undo, #invalidate, #invalidate_hierarchy, #is_dirty, #move_anchored_object_to_paragraph, #number_list, #position_to_xy, #prepare_content, #promote_list, #reset, #set_basic_style, #set_default_style, #set_list_style, #set_object_properties_with_undo, #set_partial_paragraph, #set_properties, #set_rich_text_ctrl, #set_style, #update_floating_objects, #update_ranges, #xy_to_position
Methods inherited from RichTextCompositeObject
#append_child, #defragment, #delete_children, #delete_range, #dump, #each_child, #find_position, #get_child, #get_child_at_position, #get_child_count, #get_children, #get_text_for_range, #hit_test, #insert_child, #invalidate, #is_composite, #move, #remove_child
Methods inherited from RichTextObject
#adjust_attributes, adjust_available_space, #can_merge, #can_split, #convert_pixels_to_tenths_mm, convert_pixels_to_tenths_mm, #convert_tenths_mm_to_pixels, convert_tenths_mm_to_pixels, #delete_range, #dereference, #do_split, draw_border, draw_box_attributes, #dump, #find_position, #get_absolute_position, #get_attributes, #get_available_content_area, #get_best_size, #get_bottom_margin, get_box_rects, #get_buffer, #get_cached_size, #get_container, #get_descent, #get_float_direction, #get_left_margin, #get_max_size, #get_min_size, #get_name, #get_natural_size, #get_own_range, #get_own_range_if_top_level, #get_parent, #get_parent_container, #get_position, #get_properties, #get_range, #get_rect, #get_right_margin, #get_selection, #get_text_for_range, #get_top_margin, get_total_margin, #handles_child_selections, #hit_test, #import_from_xml, #invalidate, #is_composite, #is_floatable, #is_floating, #is_shown, #layout_to_best_size, #merge, #move, #reference, #set_attributes, #set_cached_size, #set_descent, #set_margins, #set_max_size, #set_min_size, #set_name, #set_own_range, #set_parent, #set_position, #set_properties, #set_range, #show, #split, #uses_paragraph_attributes
Methods inherited from Object
Constructor Details
#initialize(fieldType = (''), parent = nil) ⇒ Wx::RTC::RichTextField #initialize(obj) ⇒ Wx::RTC::RichTextField
Returns a new instance of RichTextField.
756 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 756 def initialize(*args) end |
Instance Method Details
#accepts_focus ⇒ Boolean
Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible.
For example, containers supporting text, such as a text box object, can accept the focus, but a table can’t (set the focus to individual cells instead).
825 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 825 def accepts_focus; end |
#calculate_range(start, end_) ⇒ Integer
Calculates the range of the object.
By default, guess that the object is 1 unit long.
833 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 833 def calculate_range(start, end_) end |
#can_edit_properties ⇒ Boolean Also known as: can_edit_properties?
Returns true if we can edit the object’s properties via a GUI.
807 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 807 def can_edit_properties; end |
#clone ⇒ Wx::RTC::RichTextObject
Clones the object.
868 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 868 def clone; end |
#copy(obj) ⇒ void
This method returns an undefined value.
872 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 872 def copy(obj) end |
#draw(dc, context, range, selection, rect, descent, style) ⇒ Boolean
Draw the item, within the given range.
Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)
769 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 769 def draw(dc, context, range, selection, rect, descent, style) end |
#edit_properties(parent, buffer) ⇒ Boolean
Edits the object’s properties via a GUI.
814 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 814 def edit_properties(parent, buffer) end |
#get_field_type ⇒ String Also known as: field_type
856 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 856 def get_field_type; end |
#get_properties_menu_label ⇒ String Also known as:
Returns the label to be used for the properties context menu item.
818 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 818 def ; end |
#get_range_size(range, size, descent, dc, context, flags, position = (Wx::Point.new(0, 0)), parentSize = Wx::DEFAULT_SIZE, partialExtents = nil) ⇒ Boolean Also known as: range_size
Returns the object size for the given range.
Returns false if the range is invalid for this object.
795 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 795 def get_range_size(range, size, descent, dc, context, flags, position=(Wx::Point.new(0, 0)), parentSize=Wx::DEFAULT_SIZE, partialExtents=nil) end |
#get_xml_node_name ⇒ String Also known as: xml_node_name
Returns the XML node name of this object.
This must be overridden for XmlNode-base XML export to work.
802 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 802 def get_xml_node_name; end |
#is_atomic ⇒ Boolean Also known as: atomic?
If a field has children, we don’t want the user to be able to edit it.
837 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 837 def is_atomic; end |
#is_empty ⇒ Boolean Also known as: empty?
Returns true if the buffer is empty.
842 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 842 def is_empty; end |
#is_top_level ⇒ Boolean Also known as: top_level?
Returns true if this object is top-level, i.e. contains its own paragraphs, such as a text box.
847 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 847 def is_top_level; end |
#layout(dc, context, rect, parentRect, style) ⇒ Boolean
Lay the item out at the specified position with the given size constraint.
Layout must set the cached size. rect is the available space for the object, and parentRect is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).
780 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 780 def layout(dc, context, rect, parentRect, style) end |
#set_field_type(fieldType) ⇒ void Also known as: field_type=
This method returns an undefined value.
852 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 852 def set_field_type(fieldType) end |
#update_field(buffer) ⇒ Boolean
Update the field; delegated to the associated field type.
This would typically expand the field to its value, if this is a dynamically changing and/or composite field.
864 |
# File 'lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb', line 864 def update_field(buffer) end |