# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx::HTML # # # # class HtmlURLType < Wx::Enum # # HTML_URL_PAGE = Wx::HTML::HtmlURLType.new(0) # # HTML_URL_IMAGE = Wx::HTML::HtmlURLType.new(1) # # HTML_URL_OTHER = Wx::HTML::HtmlURLType.new(2) end # HtmlURLType # HW_SCROLLBAR_NEVER = 2 # HW_SCROLLBAR_AUTO = 4 # HW_NO_SELECTION = 8 # HW_DEFAULT_STYLE = 4 # Enum for {Wx::HTML::HtmlWindow#on_opening_url} and Wx::HtmlWindowInterface::OnOpeningURL. # # # class HtmlOpeningStatus < Wx::Enum # Open the requested URL. # HTML_OPEN = Wx::HTML::HtmlOpeningStatus.new(0) # Do not open the URL. # HTML_BLOCK = Wx::HTML::HtmlOpeningStatus.new(1) # Redirect to another URL (returned from OnOpeningURL) # HTML_REDIRECT = Wx::HTML::HtmlOpeningStatus.new(2) end # HtmlOpeningStatus # # EVT_HTML_CELL_CLICKED = 10348 # # EVT_HTML_CELL_HOVER = 10349 # # EVT_HTML_LINK_CLICKED = 10350 # {Wx::HTML::HtmlWindow} is probably the only class you will directly use unless you want to do something special (like adding new tag handlers or MIME filters). # The purpose of this class is to display rich content pages (either local file or downloaded via HTTP protocol) in a window based on a subset of the HTML standard. The width of the window is constant, given in the constructor and virtual height is changed dynamically depending on page size. Once the window is created you can set its content by calling {Wx::HTML::HtmlWindow#set_page} with raw HTML, {Wx::HTML::HtmlWindow#load_page} with a {Wx::FileSystem} location or {Wx::HTML::HtmlWindow#load_file} with a filename. # If you want complete HTML/CSS support as well as a Javascript engine, consider using {Wx::WebView} instead. # # {Wx::HTML::HtmlWindow} uses the {Wx::Image} class for displaying images, so you need to initialize the handlers for any image formats you use before loading a page. See {Wx::InitAllImageHandlers} and {Wx::Image.add_handler}. # === Styles # # This class supports the following styles: # # - {Wx::HTML::HW_SCROLLBAR_NEVER}: Never display scrollbars, not even when the page is larger than the window. # - {Wx::HTML::HW_SCROLLBAR_AUTO}: Display scrollbars only if page's size exceeds window's size. # - {Wx::HTML::HW_NO_SELECTION}: Don't allow the user to select text. # # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::HTML::HtmlLinkEvent} events. # Event handler methods for events emitted by this class: # - {Wx::EvtHandler#evt_html_cell_clicked}(id, meth = nil, &block): A {Wx::HTML::HtmlCell} was clicked. # - {Wx::EvtHandler#evt_html_cell_hover}(id, meth = nil, &block): The mouse passed over a {Wx::HTML::HtmlCell}. # - {Wx::EvtHandler#evt_html_link_clicked}(id, meth = nil, &block): A {Wx::HTML::HtmlCell} which contains a hyperlink was clicked. # # === # # Category: {Wx::HTML} # @see Wx::HTML::HtmlLinkEvent # @see Wx::HTML::HtmlCellEvent # # class HtmlWindow < ScrolledWindow # @overload initialize() # Default ctor. # @return [HtmlWindow] # @overload initialize(parent, id=Wx::ID_ANY, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::HW_DEFAULT_STYLE, name=("Wx::HTML_WINDOW")) # Constructor. # The parameters are the same as Wx::Scrolled#initialize constructor. # @param parent [Wx::Window] # @param id [Integer] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param name [String] # @return [HtmlWindow] def initialize(*args) end # Appends HTML fragment to currently displayed text and refreshes the window. # false if an error occurred, true otherwise. # @param source [String] HTML code fragment # @return [true,false] def append_to_page(source) end # Returns pointer to the top-level container. # # @see Cells and Containers # @see Printing Framework Overview # @return [Wx::HtmlContainerCell] def get_internal_representation; end alias_method :internal_representation, :get_internal_representation # Returns anchor within currently opened page (see {Wx::HTML::HtmlWindow#get_opened_page}). # If no page is opened or if the displayed page wasn't produced by call to {Wx::HTML::HtmlWindow#load_page}, empty string is returned. # @return [String] def get_opened_anchor; end alias_method :opened_anchor, :get_opened_anchor # Returns full location of the opened page. # If no page is opened or if the displayed page wasn't produced by call to {Wx::HTML::HtmlWindow#load_page}, empty string is returned. # @return [String] def get_opened_page; end alias_method :opened_page, :get_opened_page # Returns title of the opened page or {Wx::EmptyString} if the current page does not contain tag. # @return [String] def get_opened_page_title; end alias_method :opened_page_title, :get_opened_page_title # Returns a pointer to the current parser. # @return [Wx::HtmlWinParser] def get_parser; end alias_method :parser, :get_parser # Returns the related frame. # @return [Wx::Frame] def get_related_frame; end alias_method :related_frame, :get_related_frame # Moves back to the previous page. # Only pages displayed using {Wx::HTML::HtmlWindow#load_page} are stored in history list. # @return [true,false] def history_back; end # Returns true if it is possible to go back in the history i.e. # {Wx::HTML::HtmlWindow#history_back} won't fail. # @return [true,false] def history_can_back; end # Returns true if it is possible to go forward in the history i.e. # {Wx::HTML::HtmlWindow#history_forward} won't fail. # @return [true,false] def history_can_forward; end # Clears history. # @return [void] def history_clear; end # Moves to next page in history. # Only pages displayed using {Wx::HTML::HtmlWindow#load_page} are stored in history list. # @return [true,false] def history_forward; end # Loads an HTML page from a file and displays it. # false if an error occurred, true otherwise # @see Wx::HTML::HtmlWindow#load_page # @param filename [String] # @return [true,false] def load_file(filename) end # Unlike {Wx::HTML::HtmlWindow#set_page} this function first loads the HTML page from location and then displays it. # false if an error occurred, true otherwise # @see Wx::HTML::HtmlWindow#load_file # @param location [String] The address of the document. See the wxFileSystem Overview for details on the address format and {Wx::FileSystem} for a description of how the file is opened. # @return [true,false] def load_page(location) end # Called when an URL is being opened (either when the user clicks on a link or an image is loaded). # The URL will be opened only if {Wx::HTML::HtmlWindow#on_opening_url} returns {Wx::HTML::HtmlOpeningStatus::HTML_OPEN}. This method is called by Wx::HtmlParser::OpenURL. # You can override {Wx::HTML::HtmlWindow#on_opening_url} to selectively block some URLs (e.g. for security reasons) or to redirect them elsewhere. Default behaviour is to always return {Wx::HTML::HtmlOpeningStatus::HTML_OPEN}. # # The return value is: # - {Wx::HTML::HtmlOpeningStatus::HTML_OPEN}: Open the URL.- {Wx::HTML::HtmlOpeningStatus::HTML_BLOCK}: Deny access to the URL, Wx::HtmlParser::OpenURL will return NULL.- {Wx::HTML::HtmlOpeningStatus::HTML_REDIRECT}: Don't open url, redirect to another URL. {Wx::HTML::HtmlWindow#on_opening_url} must fill *redirect with the new URL. {Wx::HTML::HtmlWindow#on_opening_url} will be called again on returned URL. # @param type [HtmlURLType] Indicates type of the resource. Is one of # - {Wx::HTML::HtmlURLType::HTML_URL_PAGE}: Opening a HTML page.- {Wx::HTML::HtmlURLType::HTML_URL_IMAGE}: Opening an image.- {Wx::HTML::HtmlURLType::HTML_URL_OTHER}: Opening a resource that doesn't fall into any other category. # @param url [String] URL being opened. # @return [HtmlOpeningStatus] def on_opening_url(type, url) end # Called on parsing <TITLE> tag. # @param title [String] # @return [void] def on_set_title(title) end # This reads custom settings from {Wx::Config}. # It uses the path 'path' if given, otherwise it saves info into currently selected path. The values are stored in sub-path {Wx::HTML::HtmlWindow}. Read values: all things set by {Wx::HTML::HtmlWindow#set_fonts}, {Wx::HTML::HtmlWindow#set_borders}. # @param cfg [Wx::ConfigBase] {Wx::Config} from which you want to read the configuration. # @param path [String] Optional path in config tree. If not given current path is used. # @return [void] def read_customization(cfg, path=Wx::EMPTY_STRING) end # Selects all text in the window. # # @see Wx::HTML::HtmlWindow#select_line # @see Wx::HTML::HtmlWindow#select_word # @return [void] def select_all; end # Selects the line of text that pos points at. # Note that pos is relative to the top of displayed page, not to window's origin, use Wx::Scrolled#calc_unscrolled_position to convert physical coordinate. # @see Wx::HTML::HtmlWindow#select_all # @see Wx::HTML::HtmlWindow#select_word # @param pos [Array(Integer, Integer), Wx::Point] # @return [void] def select_line(pos) end # Selects the word at position pos. # Note that pos is relative to the top of displayed page, not to window's origin, use Wx::Scrolled#calc_unscrolled_position to convert physical coordinate. # @see Wx::HTML::HtmlWindow#select_all # @see Wx::HTML::HtmlWindow#select_line # @param pos [Array(Integer, Integer), Wx::Point] # @return [void] def select_word(pos) end # Returns the current selection as plain text. # Returns an empty string if no text is currently selected. # @return [String] def selection_to_text; end # This function sets the space between border of window and HTML contents. # See image: # @param b [Integer] indentation from borders in pixels # @return [void] def set_borders(b) end alias_method :borders=, :set_borders # This function sets font sizes and faces. # See Wx::HtmlDCRenderer::SetFonts for detailed description. # @see SetSize() # @param normal_face [String] # @param fixed_face [String] # @param sizes [Array(Integer,Integer,Integer,Integer,Integer,Integer,Integer), nil] # @return [void] def set_fonts(normal_face, fixed_face, sizes=nil) end # Sets default font sizes and/or default font size. # See Wx::HtmlDCRenderer::SetStandardFonts for detailed description. # @see Wx::HTML::HtmlWindow#set_fonts # @param size [Integer] # @param normal_face [String] # @param fixed_face [String] # @return [void] def set_standard_fonts(size=-1, normal_face=Wx::EMPTY_STRING, fixed_face=Wx::EMPTY_STRING) end alias_method :standard_fonts=, :set_standard_fonts # Sets the source of a page and displays it, for example: # htmlwin -> SetPage("<html><body>Hello, world!</body></html>"); # # If you want to load a document from some location use {Wx::HTML::HtmlWindow#load_page} instead. # # false if an error occurred, true otherwise. # @param source [String] The HTML to be displayed. # @return [true,false] def set_page(source) end alias_method :page=, :set_page # Sets the frame in which page title will be displayed. # format is the format of the frame title, e.g. "HtmlHelp : %s". It must contain exactly one s. This s is substituted with HTML page title. # @param frame [Wx::Frame] # @param format [String] # @return [void] def set_related_frame(frame, format) end # @overload set_related_status_bar(index) # <b>After</b> calling {Wx::HTML::HtmlWindow#set_related_frame}, this sets statusbar slot where messages will be displayed. # (Default is -1 = no messages.) # @param index [Integer] Statusbar slot number (0..n) # @return [void] # @overload set_related_status_bar(statusbar, index=0) # <b>Sets</b> the associated statusbar where messages will be displayed. # Call this instead of {Wx::HTML::HtmlWindow#set_related_frame} if you want statusbar updates only, no changing of the frame title. # @param statusbar [Wx::StatusBar] Statusbar pointer # @param index [Integer] Statusbar slot number (0..n) # @return [void] def set_related_status_bar(*args) end alias_method :related_status_bar=, :set_related_status_bar # Returns content of currently displayed page as plain text. # @return [String] def to_text; end # Saves custom settings into {Wx::Config}. # It uses the path 'path' if given, otherwise it saves info into currently selected path. Regardless of whether the path is given or not, the function creates sub-path {Wx::HTML::HtmlWindow}. # Saved values: all things set by {Wx::HTML::HtmlWindow#set_fonts}, {Wx::HTML::HtmlWindow#set_borders}. # @param cfg [Wx::ConfigBase] {Wx::Config} to which you want to save the configuration. # @param path [String] Optional path in config tree. If not given, the current path is used. # @return [void] def write_customization(cfg, path=Wx::EMPTY_STRING) end # Adds an input filter to the static list of available filters. # These filters are present by default: # # text/html # text/plain # image/* # # The plain text filter will be used if no other filter matches. # @param filter [Wx::HtmlFilter] # @return [void] def self.add_filter(filter) end # Retrieves the default cursor for a given HTMLCursor type. # @param type [HTMLCursor] HTMLCursor type to retrieve. # @return [Wx::Cursor] def self.get_default_html_cursor(type) end # Sets the default cursor for a given HTMLCursor type. # These cursors are used for all {Wx::HTML::HtmlWindow} objects by default, but can be overridden on a per-window basis. # @param type [HTMLCursor] HTMLCursor type to retrieve. # @param cursor [Wx::Cursor] The default cursor for the specified cursor type. # @return [void] def self.set_default_html_cursor(type, cursor) end end # HtmlWindow # This class is the parent class of input filters for {Wx::HTML::HtmlWindow}. # It allows you to read and display files of different file formats. # === # # Category: {Wx::HTML} # @see Input Filters # # class HtmlFilter < Object # Constructor. # @return [HtmlFilter] def initialize; end # Returns true if this filter is capable of reading file file. # Example: # # bool MyFilter::CanRead(const wxFSFile& file) # { # return (file.GetMimeType() == "application/x-ugh"); # } # @param file [Wx::FSFile] # @return [true,false] def can_read(file) end alias_method :can_read?, :can_read # Reads the file and returns string with HTML document. # Example: # # wxString MyImgFilter::ReadFile(const wxFSFile& file) # { # return "<html><body><img src=\"" + file.GetLocation() + # "\"></body></html>"; # } # @param file [Wx::FSFile] # @return [String] def read_file(file) end end # HtmlFilter end