ruby-****@sourc*****
ruby-****@sourc*****
2005年 3月 17日 (木) 21:00:30 JST
------------------------- REMOTE_ADDR = 84.220.101.75 REMOTE_HOST = REMOTE_USER = ruby-gnome2-hiki URL = http://ruby-gnome2.sourceforge.jp/cgi-bin/hiki/hiki.cgi?Gtk%3A%3AMozEmbed ------------------------- @@ -1,10 +1,18 @@ = class Gtk::MozEmbed -This class wraps the GtkMozEmbed widget in a Ruby class. -The GtkMozEmbed is provided by either Mozilla or Firefox. -You need to have libgtkmozembed.so in your library path -to use and mozilla-gtkmozembed.pc and gtkmozembed.h in -order to compile. +This class wraps the GtkMozEmbed widget in a Ruby class. The +GtkMozEmbed is an HTML rendering widget based on Mozilla Gecko +provided by either Mozilla or Firefox. You need to have +libgtkmozembed.so in your library path to use and +mozilla-gtkmozembed.pc and gtkmozembed.h in order to compile. + Gtk::MozEmbed.new + ... + Gtk::MozEmbed.location="http://ruby-gnome2.sf.net" + ... + +Please see the sample application ruby-gecko for more info and +examples. + == Object Hierarchy * Object * GLib::Instantiatable @@ -17,61 +25,67 @@ == Class Methods --- Gtk::MozEmbed.new - Constructor for the Gtk::MozEmbed object. - * Returns: a newly created Gtk::MozEmbed widget. --- Gtk::MozEmbed.set_comp_path(path) - You should call this method before the constructor. The path should be something like /usr/lib/mozilla or /usr/lib/mozilla-firefox depending on your installation and distribution. - FIXME - Not sure if this is needed, perhaps we should call this inside Init_gtkmozembed() and set the value at compile time before initializing XPCOM. - * path: the mozilla component path (String). * Returns: nil. --- Gtk::MozEmbed.set_profile_path(profile_path, profile_name) - You should call this method before the constructor. The profile_path parameter should be set to $ENV['HOME']+'/.mozilla'. - A new profile directory with this name will be created in the profile_path directory. - * profile_name: the name of the application using the widget (String). * profile_path: the path to store the profile (String). * Returns: nil. == Instance Methods +--- append_data(data) + You should feed data to the rendering stream via this method. + The data should be in the mime format if you want to send some + self drawn PNG or JPEG data from a Pixbuf please see: + http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gdk%3A%3APixbuf#save_to_buffer + * data: The data do be added to the rendering stream (String). + * Returns: self. --- can_go_back? - This method reflects the status of the browsing history. - * Returns: True if the browser can go back one page. --- can_go_forward? - This method reflects the status of the browsing history. - * Returns: True if the browser can go forward one page. ---- chrome_mask=(flags) +--- chrome_mask + Get the chrome mask. + * Returns: a combination of Moz::GtkEmbed::ChromeFlags. - This method returns the given parameter 'flags'. - - * flags: a combination of Gtk::MozEmbed::ChromeFlags Set the chrome mask. +--- chrome_mask=flags + Set the chrome mask. + * flags: a combination of Gtk::MozEmbed::ChromeFlags. * Returns: the given parameter 'flags'. ---- get_chrome_mask(flags) - Get the chrome mask. - * Returns: a combination of Gtk::MozEmbed::ChromeFlags. +--- close_stream + This closes the stream. This way Gtk::MozEmbed knows we + are finished. + * Returns: self. --- go_back Tells the browser to go back one page in the history. @@ -82,40 +88,96 @@ * Returns: the object itself. --- js_status - The ECMAScript status message, useful when the "js_status" signal - is raised. - * Returns: the selected url. + The JavaScript|ECMAScript status message, useful when the + "js_status" signal is raised. + * Returns: the selected url (String). --- link_message The location of the selected link, useful when the "link_message" signal is raised. * Returns: the selected url. +--- load_url(url) + This method starts loading the given url, and returns + immediately. The url should be in the form "http://www.gnome.org". + * url: the url to load (String). + * Returns: the object itself. + --- location The current location, usefull when the "location" signal is raised. * Returns: the current location (String). ---- location=(url) - This method starts loading the given url, and returns - immediately. The url should be in the form "http://www.gnome.org". - * url: the url to load (String). - * Returns: the given parameter 'url'. +--- location=url + See Gtk::MozEmbed#load_url + * Returns: self. ---- reload +--- no_new_window + This method clears the code block associated via the + Gtk::MozEmbed#on_new_window method. + * Returns: self. + +--- on_new_window { |widget, chromemask| block } + The new_window signal should not be connected directly, this method + should be used instead. The block should eval to the newly created + Gtk::MozEmbed widget. This method serves the purpose of creating + a new window around the widget when requested. + * Returns: self. + +--- open_stream(base_uri, mime_type) + This method sould be called to visualize self feeded html. + The base_uri must be a valid base uri, this should contain + the protocol name and the path separated by a colon. + The mime_type should be a valid mime-type and instucts + GtkMozEmbed about the data that we'll send with "<<": + * "text/html" if an HTML is to be displayed. + * "text/plain" if TXT data are to be displayed. + * "image/png" if we want to send some PNG data. + * "image/jpeg" if our data are in JPEG format. + * "image/gif" if our data are in GIF format. + * See /etc/mime.types for more. + moz.open_stream("file:///basepath/", "text/html") + moz.append_data(" + <html> + <body> + test + <a href=\"hello.html\">this is resolved against base_path</a> + </body> + </html>") + moz.close_stream + See also #render_data. + * base_uri: the uri that Gtk::MozEmbed will use to resolve relative addresses (String). + * mime_type: the mime type of the data (String). + * Returns: self. + +--- reload(flags) Forces a page reload of a specific type. - * flags: one of the Gtk::MozEmbed::ReloadFlags. + * flags: one of the Gtk::MozEmbed::ReloadFlags (Gtk::MozEmbed::RELOADNORMAL, Gtk::MozEmbed::RELOADBYPASSCACHE, Gtk::MozEmbed::RELOADBYPASSPROXY, Gtk::MozEmbed::RELOADBYPASSPROXYANDCACHE). * Returns: the object itself. +--- render_data(data, base_uri, mime_type) + This function will allow you to take a chunk of random data and + render it into the Gtk::MozEmbed window. See also + Gtk::MozEmbed#open_stream, Gtk::MozEmbed#append_data and + Gtk::MozEmbed#close_stream. + * base_uri: the base uri for the resolver. + * mime_type: the mime/type of the data to be rendered. + * data: the data to be rendered. + * Returns: self. + --- set_chrome_mask(flags) - This method returns the object itself. - * flags: a combination of Gtk::MozEmbed::ChromeFlags Set the chrome mask. + Set the chrome mask. + * flags: a combination of Gtk::MozEmbed::ChromeFlags. * Returns: the object itself. --- set_location(url) - This method starts loading the given url, and returns - immediately. The url should be in the form "http://www.gnome.org". - * url: the url to load (String). - * Returns: the object itself. + See Gtk::MozEmbed#load_url + * Returns: self. --- stop_load Stops loading the current page. @@ -124,7 +180,63 @@ --- title The title of the currently loaded page, usefull when the "title" signal is raised. - * Returns: the page title. + * Returns: the page title (String). == Constants