Class: Wx::RTC::RichTextHTMLHandler

Inherits:
RichTextFileHandler show all
Defined in:
lib/wx/doc/gen/rtc/rich_text_html_handler.rb

Overview

Handles HTML output (only) for RichTextCtrl content.

The most flexible way to use this class is to create a temporary object and call its functions directly, rather than use Wx::RTC::RichTextBuffer#save_file or Wx::RTC::RichTextCtrl#save_file. Image handling requires a little extra work from the application, to choose an appropriate image format for the target HTML viewer and to clean up the temporary images later. If you are planning to load the HTML into a standard web browser, you can specify the handler flag RICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 (the default) and no extra work is required: the images will be written with the HTML. However, if you want HTML compatibility, you will need to use RICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY or RICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES. In this case, you must either call #delete_temporary_images before the next load operation, or you must store the image locations and delete them yourself when appropriate. You can call #get_temporary_image_locations to get the array of temporary image names.

Handler flags

The following flags can be used with this handler, via the handler’s Wx::RTC::RichTextFileHandler#set_flags function or the buffer or control’s SetHandlerFlags() function:

Category: Rich Text

Requires:

  • USE_RICHTEXT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RichTextFileHandler

#can_handle, #can_load, #can_save, #get_encoding, #get_extension, #get_flags, #get_name, #get_type, #is_visible, #load_file, #save_file, #set_encoding, #set_extension, #set_flags, #set_name, #set_type, #set_visible

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initialize(name = ("Wx::HTML"), ext = ("Wx::HTML"), type = Wx::RTC::RichTextFileType::RICHTEXT_TYPE_HTML) ⇒ Wx::RTC::RichTextHTMLHandler

Constructor.

Parameters:

  • name (String) (defaults to: ("Wx::HTML"))
  • ext (String) (defaults to: ("Wx::HTML"))
  • type (Integer) (defaults to: Wx::RTC::RichTextFileType::RICHTEXT_TYPE_HTML)


39
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 39

def initialize(name=("Wx::HTML"), ext=("Wx::HTML"), type=Wx::RTC::RichTextFileType::RICHTEXT_TYPE_HTML) end

Class Method Details

.delete_temporary_images(flags, imageLocations) ⇒ Boolean

Delete the in-memory or temporary files generated by the last operation.

This is a static function that can be used to delete the saved locations from an earlier operation, for example after the user has viewed the HTML file.

Parameters:

  • flags (Integer)
  • imageLocations (Array<String>)

Returns:

  • (Boolean)


51
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 51

def self.delete_temporary_images(flags, imageLocations) end

.set_file_counter(counter) ⇒ void

This method returns an undefined value.

Reset the file counter, in case, for example, the same names are required each time.

Parameters:

  • counter (Integer)


96
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 96

def self.set_file_counter(counter) end

Instance Method Details

#clear_temporary_image_locationsvoid

This method returns an undefined value.

Clears the image locations generated by the last operation.



43
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 43

def clear_temporary_image_locations; end

#get_font_size_mappingArray<Integer> Also known as: font_size_mapping

Returns the mapping for converting point sizes to HTML font sizes.

Returns:

  • (Array<Integer>)


55
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 55

def get_font_size_mapping; end

#get_temp_dirWx::String Also known as: temp_dir

Returns the directory used to store temporary image files.

Returns:

  • (Wx::String)


60
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 60

def get_temp_dir; end

#get_temporary_image_locationsWx::ArrayString Also known as: temporary_image_locations

Returns the image locations for the last operation.

Returns:

  • (Wx::ArrayString)


65
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 65

def get_temporary_image_locations; end

#set_font_size_mapping(fontSizeMapping) ⇒ void Also known as: font_size_mapping=

This method returns an undefined value.

Sets the mapping for converting point sizes to HTML font sizes.

There should be 7 elements, one for each HTML font size, each element specifying the maximum point size for that HTML font size. For example:

html_handler.set_font_size_mapping([7,9,11,12,14,22,100])

Parameters:

  • fontSizeMapping (Array<Integer>)


76
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 76

def set_font_size_mapping(fontSizeMapping) end

#set_temp_dir(tempDir) ⇒ void Also known as: temp_dir=

This method returns an undefined value.

Sets the directory for storing temporary files.

If empty, the system temporary directory will be used.

Parameters:

  • tempDir (String)


84
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 84

def set_temp_dir(tempDir) end

#set_temporary_image_locations(locations) ⇒ void Also known as: temporary_image_locations=

This method returns an undefined value.

Sets the list of image locations generated by the last operation.

Parameters:

  • locations (Array<String>)


90
# File 'lib/wx/doc/gen/rtc/rich_text_html_handler.rb', line 90

def set_temporary_image_locations(locations) end