nobody at rubyforge.org
2006-Nov-12 16:24 UTC
[Wxruby-development] [724] trunk/wxruby2: Initial commit of HtmlWindow functionality
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[724] trunk/wxruby2: Initial commit of HtmlWindow functionality</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>724</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2006-11-12 11:24:34 -0500 (Sun, 12 Nov 2006)</dd> </dl> <h3>Log Message</h3> <pre>Initial commit of HtmlWindow functionality</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2swigclassesincludewxHtmlCellh">trunk/wxruby2/swig/classes/include/wxHtmlCell.h</a></li> <li><a href="#trunkwxruby2swigclassesincludewxHtmlContainerCellh">trunk/wxruby2/swig/classes/include/wxHtmlContainerCell.h</a></li> <li><a href="#trunkwxruby2swigclassesincludewxHtmlEasyPrintingh">trunk/wxruby2/swig/classes/include/wxHtmlEasyPrinting.h</a></li> <li><a href="#trunkwxruby2swigclassesincludewxHtmlWindowh">trunk/wxruby2/swig/classes/include/wxHtmlWindow.h</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href="#trunkwxruby2libwxclasseshtmlwindowrb">trunk/wxruby2/lib/wx/classes/htmlwindow.rb</a></li> <li>trunk/wxruby2/samples/html/</li> <li><a href="#trunkwxruby2sampleshtmlhtmlrb">trunk/wxruby2/samples/html/html.rb</a></li> <li><a href="#trunkwxruby2swigclassesHtmlCelli">trunk/wxruby2/swig/classes/HtmlCell.i</a></li> <li><a href="#trunkwxruby2swigclassesHtmlContainerCelli">trunk/wxruby2/swig/classes/HtmlContainerCell.i</a></li> <li><a href="#trunkwxruby2swigclassesHtmlEasyPrintingi">trunk/wxruby2/swig/classes/HtmlEasyPrinting.i</a></li> <li><a href="#trunkwxruby2swigclassesHtmlLinkInfoi">trunk/wxruby2/swig/classes/HtmlLinkInfo.i</a></li> <li><a href="#trunkwxruby2swigclassesHtmlWidgetCelli">trunk/wxruby2/swig/classes/HtmlWidgetCell.i</a></li> <li><a href="#trunkwxruby2swigclassesHtmlWindowi">trunk/wxruby2/swig/classes/HtmlWindow.i</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2libwxclasseshtmlwindowrb"></a> <div class="addfile"><h4>Added: trunk/wxruby2/lib/wx/classes/htmlwindow.rb (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/lib/wx/classes/htmlwindow.rb         (rev 0) +++ trunk/wxruby2/lib/wx/classes/htmlwindow.rb        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,6 @@ </span><ins>+class Wx::HtmlWindow + # imitate the in-built LoadFile method + def load_file(file) + set_page( File.read(file) ) + end +end </ins></span></pre></div> <a id="trunkwxruby2sampleshtmlhtmlrb"></a> <div class="addfile"><h4>Added: trunk/wxruby2/samples/html/html.rb (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/html/html.rb         (rev 0) +++ trunk/wxruby2/samples/html/html.rb        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,238 @@ </span><ins>+#!/usr/bin/env ruby +# wxRuby2 Sample Code. Copyright (c) 2004-2006 Kevin B. Smith +# Freely reusable code: see SAMPLES-LICENSE.TXT for details + +begin + require ''wx'' +rescue LoadError => no_wx_err + begin + require ''rubygems'' + require ''wx'' + rescue LoadError + raise no_wx_err + end +end + +require ''net/http'' +require ''uri'' + +class MyHtmlWindow < Wx::HtmlWindow + attr_reader :html_src + def load_page_from_uri(uri) + case uri + when URI::HTTP + Wx::BusyCursor.busy do + res = Net::HTTP.start(uri.host, uri.port) do | http | + http.get(uri.path) + end + @loaded_uri = uri + set_page(res.body) + end + return @loaded_uri + when URI::Generic + if @loaded_uri and @loaded_uri.kind_of?(URI::HTTP) + return load_page_from_uri( @loaded_uri.merge(uri) ) + elsif @loaded_uri # current viewing a file + if uri.to_s =~ /^\// + return load_file(uri.path) + elsif not uri.path.empty? + local_file = File.join( File.dirname(@loaded_uri.path), uri.path) + return load_file( local_file ) + end + end + end + + dlg = Wx::MessageDialog.new(nil, "Can''t load link", + "Unable to load the link #{uri}", + Wx::ICON_ERROR) + dlg.show_modal + end + + def load_file(file) + @loaded_uri = URI.parse("file:////" + file) + super file + @loaded_uri + end + + def set_page(html) + super html + @html_src = html + get_related_frame.addr_bar.set_value(@loaded_uri.to_s) + end + + def on_link_clicked(link) + link_uri = URI.parse(link.get_href) + @loaded_uri = load_page_from_uri(link_uri) + end + + def on_cell_mouse_hover(cell, x, y) + if link = cell.get_link + get_related_frame.set_status_text(link.get_href) + else + get_related_frame.set_status_text('''') + end + end +end + +# The frame or self-contained window for this application +class HtmlFrame < Wx::Frame + attr_reader :html_win, :addr_bar + + def initialize(title, pos, size, style = Wx::DEFAULT_FRAME_STYLE) + # A main application frame has no parent (nil) + # -1 means this frame will be supplied a default id + super(nil, -1, title, pos, size, style) + setup_menus + setup_panel + create_status_bar(2) + set_status_text("Welcome to wxRuby!") + end + + def setup_panel + sizer = Wx::BoxSizer.new(Wx::VERTICAL) + top_sizer = Wx::BoxSizer.new(Wx::HORIZONTAL) + + @go_butt = Wx::StaticText.new(self, -1, ''Location:'') + top_sizer.add(@go_butt, 0, Wx::ALL, 4) + @addr_bar = Wx::TextCtrl.new(self, -1, ''HOME'', Wx::DEFAULT_POSITION, + Wx::DEFAULT_SIZE, Wx::TE_READONLY) + top_sizer.add(@addr_bar, 1, Wx::ALL, 4) + sizer.add(top_sizer, 0, Wx::EXPAND|Wx::TOP|Wx::BOTTOM, 4) + + @html_win = MyHtmlWindow.new(self, -1) + @html_win.set_related_frame(self, ''HTML Window: %s'') + @html_win.set_related_status_bar(2) + @html_win.set_page(DATA.read) + sizer.add(@html_win, 1, Wx::ALL|Wx::GROW, 4) + self.set_sizer(sizer) + end + + def setup_menus + menu_file = Wx::Menu.new() + menu_help = Wx::Menu.new() + # Using Wx::ID_ABOUT default id means the menu item will be placed + # in the correct platform-specific place + menu_help.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog") + menu_file.append(Wx::ID_OPEN, "&Open File...\tCtrl-O", "Open File") + menu_file.append(Wx::ID_PRINT, "&Print...\tCtrl-P", "Print") + + menu_file.append(Wx::ID_PREVIEW, "&Preview...\tCtrl-Shift-P", + "Print Preview") + menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program") + + menu_bar = Wx::MenuBar.new() + menu_bar.append(menu_file, "&File") + menu_bar.append(menu_help, "&Help") + # Assign the menus to this frame + set_menu_bar(menu_bar) + # handle menu events + evt_menu(Wx::ID_OPEN) { on_open_file } + evt_menu(Wx::ID_PRINT) { on_print } + evt_menu(Wx::ID_PREVIEW) { on_preview } + evt_menu(Wx::ID_EXIT) { on_quit } + evt_menu(Wx::ID_ABOUT) { on_about } + end + + # end the application + def on_quit + close + end + + def on_open_file + f_dlg = Wx::FileDialog.new(self, "Open an HTML file", "", "", + "HTML files (*.html;*.htm)|.html;.htm)", + Wx::OPEN) + if not f_dlg.show_modal == Wx::ID_OK + return + end + html_file = f_dlg.get_path + + @html_win.load_file(html_file) + end + + # show an ''About'' dialog + def on_about + msg = sprintf("This is the About dialog of the HTML sample.\n" \ + "Welcome to wxRuby, version %s", Wx::WXRUBY_VERSION) + + # create a simple message dialog with OK button + about_dlg = Wx::MessageDialog.new( self, msg, ''About WxRuby HTML'', + Wx::OK|Wx::ICON_INFORMATION ) + about_dlg.show_modal() +        about_dlg.destroy() + end + + def on_preview + print = Wx::HtmlEasyPrinting.new(''Print HTML'', self) + print.preview_text(@html_win.html_src) + end + + def on_print + print = Wx::HtmlEasyPrinting.new(''Print HTML'', self) + print.print_text(@html_win.html_src) + end + + # utility function to find an icon relative to this ruby script + def local_icon_file(icon_name) + File.join( File.dirname(__FILE__), icon_name) + end +end + +# Wx::App is the container class for any wxruby app - only a single +# instance is required +class HtmlApp < Wx::App + def on_init + frame = HtmlFrame.new("Minimal wxRuby App", + Wx::Point.new(50, 50), + Wx::Size.new(450, 340)) + set_app_name(''HtmlDemo'') + # required + frame.show() + end +end + +# Create an instance ... +app = HtmlApp.new +# ... and run the application +app.main_loop() + +__END__ +<html> +<head> +<title>WxRuby HTML Demo</title> +</head> + +<body bgcolor="#ffffff"> +<h1>The HtmlWindow widget</h1> +<p>This is a very simple demonstration of +<strong>Wx::HtmlWindow</strong>, a control for displaying hypertext. The + control understands most HTML tags, including links, tables, images, + lists and the venerable FONT tag. It does not know about CSS or + Javascript; it is not really intended for building a general-purpose + web browser.</p> +<h2>This demo</h2> +<p>In this demo you can open local files for viewing (by choosing the +File / Open). If you have an internet connection http:// links will be +downloaded as well. Its features are otherwise limited - for example, +this example doesn''t know about HTML anchor targets, because it has +over-ridden default link handling to show how to subclass and +specialise HtmlWindow in Ruby.</a> +<h2>Html Easy Printing</h2> +<p>A useful feature included with WxRuby is a simple interface for +printing HTML. You can see this in action by choosing ''Print'' or +''Preview'' from the File menu.</p> +<h3>Further information</h3> +<p>Here''s a table with some links</p> +<table border="1"> +<tr> +<td>WxRuby online documentation</td> +<td><a href="http://wxruby.rubyforge.org/doc/">http://wxruby.rubyforge.org/doc/</a></td> +</tr> +<tr> +<td>WxRuby Wiki</td> +<td><a href="http://wxruby.rubyforge.org/wiki/wiki.pl">http://wxruby.rubyforge.org/wiki/wiki.pl</a></td> +</tr> +</table> + +</body> +</html> </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlCelli"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlCell.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlCell.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlCell.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,14 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlCell + +%{ +#include <wx/html/htmlcell.h> +%} + +%import "include/wxObject.h" + +%include "include/wxHtmlCell.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlContainerCelli"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlContainerCell.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlContainerCell.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlContainerCell.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,15 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlContainerCell + +%{ +#include <wx/html/htmlcell.h> +%} + +%import "include/wxObject.h" +%import "include/wxHtmlCell.h" + +%include "include/wxHtmlContainerCell.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlEasyPrintingi"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlEasyPrinting.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlEasyPrinting.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlEasyPrinting.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,15 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlEasyPrinting + +%{ +#include <wx/html/htmprint.h> +%} + + +%import "include/wxObject.h" + +%include "include/wxHtmlEasyPrinting.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlLinkInfoi"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlLinkInfo.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlLinkInfo.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlLinkInfo.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,18 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlLinkInfo + +%{ +#include <wx/html/htmlcell.h> +%} + +// for some reason this ignore doesn''t actually ignore +// so then there is a problem b/c the ''redirect'' string isn''t +// mapped as output + +%import "include/wxObject.h" + +%include "include/wxHtmlLinkInfo.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlWidgetCelli"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlWidgetCell.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlWidgetCell.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlWidgetCell.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,15 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlWidgetCell + +%{ +#include <wx/html/htmlcell.h> +%} + +%import "include/wxObject.h" +%import "include/wxHtmlCell.h" + +%include "include/wxHtmlWidgetCell.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesHtmlWindowi"></a> <div class="addfile"><h4>Added: trunk/wxruby2/swig/classes/HtmlWindow.i (0 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/HtmlWindow.i         (rev 0) +++ trunk/wxruby2/swig/classes/HtmlWindow.i        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -0,0 +1,41 @@ </span><ins>+# Copyright 2004-2006 by Kevin Smith +# released under the MIT-style wxruby2 license + +%include "../common.i" + +%module(directors="1") wxHtmlWindow + +%{ +#include <wx/html/htmlwin.h> +%} + +// enums for wxHtmlWindow::OnOpeningURL +enum wxHtmlOpeningStatus +{ + wxHTML_OPEN, + wxHTML_BLOCK, + wxHTML_REDIRECT +}; + +// implement in ruby +%ignore wxHtmlWindow::LoadFile; + +// OnOpeningURL: for some reason this ignore doesn''t actually ignore +// %ignore wxHtmlWindow::OnOpeningURL(wxHtmlURLType type , const wxString& url , wxString * redirect ) const; + +// TODO: fix typemaps so that on_opening_url will be called in subclass method. +// The default typemap for WxString. * is not correct for this method, but ignore doesn''t seem to be working (SWIG 1.3.29). The typemaps below just stop a compile error +%typemap(in, numinputs=0) wxString * redirect "//*$1 = *$1;"; +%typemap(directorargin) wxString * redirect "$1 = obj2;"; +%typemap(directorargout, fragment="output_helper") wxString * redirect { + //VALUE o = rb_str_new2((const char*)$1->mb_str()); + //$result = output_helper($result, o); +} + +%import "include/wxObject.h" +%import "include/wxEvtHandler.h" +%import "include/wxWindow.h" +%import "include/wxPanel.h" +%import "include/wxScrolledWindow.h" + +%include "include/wxHtmlWindow.h" </ins></span></pre></div> <a id="trunkwxruby2swigclassesincludewxHtmlCellh"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxHtmlCell.h (723 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxHtmlCell.h        2006-11-07 21:47:19 UTC (rev 723) +++ trunk/wxruby2/swig/classes/include/wxHtmlCell.h        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -13,182 +13,25 @@ </span><span class="cx">         */ </span><span class="cx"> </span><span class="cx"> wxHtmlCell() ; </span><del>-        /** -         * \brief This method is used to adjust pagebreak position. The parameter is -variable that contains y-coordinate of page break (= horizontal line that -should not be crossed by words, images etc.). If this cell cannot be divided -into two pieces (each one on another page) then it moves the pagebreak -few pixels up. - -Returns true if pagebreak was modified, false otherwise - -Usage: -         * \param int * -        */ - </del><span class="cx"> virtual bool AdjustPagebreak(int * pagebreak ) ; </span><del>-        /** -         * \brief Renders the cell. -         * \param wxDC& -         * \param int -         * \param int -         * \param int -         * \param int -        */ - - virtual void Draw(wxDC& dc , int x , int y , int view_y1 , int view_y2 ) ; -        /** -         * \brief This method is called instead of when the -cell is certainly out of the screen (and thus invisible). This is not -nonsense - some tags (like -or font setter) must be drawn even if they are invisible! -         * \param wxDC& -         * \param int -         * \param int -        */ - - virtual void DrawInvisible(wxDC& dc , int x , int y ) ; -        /** -         * \brief Returns pointer to itself if this cell matches condition (or if any of the cells -following in the list matches), NULL otherwise. -(In other words if you call top-level container''s Find it will -return pointer to the first cell that matches the condition) - -It is recommended way how to obtain pointer to particular cell or -to cell of some type (e.g. wxHtmlAnchorCell reacts on -wxHTML_COND_ISANCHOR condition) - - - - - - - -\wxheading{Defined conditions} -         * \param int -         * \param const void* -        */ - </del><ins>+ virtual void Draw(wxDC& dc , int x , int y , int view_y1 , int view_y2, wxHtmlRenderingInfo info) ; + virtual void DrawInvisible(wxDC& dc , int x , int y, wxHtmlRenderingInfo info ) ; </ins><span class="cx"> virtual const wxHtmlCell* Find(int condition , const void* param ) ; </span><del>-        /** -         * \brief Returns descent value of the cell (m_Descent member). -\helponly{See explanation: - -\image{}{descent.bmp} -} -        */ - </del><span class="cx"> int GetDescent() const; </span><del>-        /** -         * \brief Returns height of the cell (m_Height member). -        */ - </del><span class="cx"> int GetHeight() const; </span><del>-        /** -         * \brief Returns unique cell identifier if there is any, empty string otherwise. -        */ - </del><span class="cx"> virtual wxString GetId() const; </span><del>-        /** -         * \brief Returns hypertext link if associated with this cell or NULL otherwise. -See . -(Note: this makes sense only for visible tags). -         * \param int -         * \param int -        */ - </del><span class="cx"> virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; </span><del>-        /** -         * \brief Returns pointer to the next cell in list (see htmlcell.h if you''re -interested in details). -        */ - </del><span class="cx"> wxHtmlCell* GetNext() const; </span><del>-        /** -         * \brief Returns pointer to parent container. -        */ - </del><span class="cx"> wxHtmlContainerCell* GetParent() const; </span><del>-        /** -         * \brief Returns X position within parent (the value is relative to parent''s -upper left corner). The returned value is meaningful only if -parent''s was called before! -        */ - </del><span class="cx"> int GetPosX() const; </span><del>-        /** -         * \brief Returns Y position within parent (the value is relative to parent''s -upper left corner). The returned value is meaningful only if -parent''s was called before! -        */ - </del><span class="cx"> int GetPosY() const; </span><del>-        /** -         * \brief Returns width of the cell (m_Width member). -        */ - </del><span class="cx"> int GetWidth() const; </span><del>-        /** -         * \brief This method performs two actions: - -\begin{enumerate}\itemsep=0pt -\item adjusts the cell''s width according to the fact that maximal possible width is . -(this has sense when working with horizontal lines, tables etc.) -\item prepares layout (=fill-in m_PosX, m_PosY (and sometimes m_Height) members) -based on actual width -\end{enumerate} - -It must be called before displaying cells structure because -m_PosX and m_PosY are undefined (or invalid) -before calling Layout. -         * \param int -        */ - </del><span class="cx"> virtual void Layout(int w ) ; </span><del>-        /** -         * \brief This function is simple event handler. Each time the user clicks mouse button over a cell -within this method of that cell is called. Default behavior is -that it calls . -         * \param wxWindow* -         * \param int -         * \param int -         * \param const wxMouseEvent& -        */ - </del><span class="cx"> virtual void OnMouseClick(wxWindow* parent , int x , int y , const wxMouseEvent& event ) ; </span><del>-        /** -         * \brief Sets unique cell identifier. Default value is no identifier, i.e. empty string. -         * \param const wxString& -        */ - </del><span class="cx"> void SetId(const wxString& id ) ; </span><del>-        /** -         * \brief Sets the hypertext link associated with this cell. (Default value -is ("", "") (no link)) -         * \param const wxHtmlLinkInfo& -        */ - </del><span class="cx"> void SetLink(const wxHtmlLinkInfo& link ) ; </span><del>-        /** -         * \brief Sets the next cell in the list. This shouldn''t be called by user - it is -to be used only by . -         * \param wxHtmlCell -        */ - </del><span class="cx"> void SetNext(wxHtmlCell *cell ) ; </span><del>-        /** -         * \brief Sets parent container of this cell. This is called from - . -         * \param wxHtmlContainerCell -        */ - </del><span class="cx"> void SetParent(wxHtmlContainerCell *p ) ; </span><del>-        /** -         * \brief Sets the cell''s position within parent container. -         * \param int -         * \param int -        */ - </del><span class="cx"> void SetPos(int x , int y ) ; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigclassesincludewxHtmlContainerCellh"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxHtmlContainerCell.h (723 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxHtmlContainerCell.h        2006-11-07 21:47:19 UTC (rev 723) +++ trunk/wxruby2/swig/classes/include/wxHtmlContainerCell.h        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -8,148 +8,22 @@ </span><span class="cx"> class wxHtmlContainerCell : public wxHtmlCell </span><span class="cx"> { </span><span class="cx"> public: </span><del>-        /** -         * \brief Constructor. is pointer to parent container or NULL. -         * \param wxHtmlContainerCell -        */ - </del><span class="cx"> wxHtmlContainerCell(wxHtmlContainerCell *parent ) ; </span><del>-        /** -         * \brief Returns container''s horizontal alignment. -        */ - </del><span class="cx"> int GetAlignHor() const; </span><del>-        /** -         * \brief Returns container''s vertical alignment. -        */ - </del><span class="cx"> int GetAlignVer() const; </span><del>-        /** -         * \brief Returns the background colour of the container or if no background -colour is set. -        */ - </del><span class="cx"> wxColour GetBackgroundColour() ; </span><del>-        /** -         * \brief Returns pointer to the first cell in the list. -You can then use wxHtmlCell''s GetNext method to obtain pointer to the next -cell in list. - - This shouldn''t be used by the end user. If you need some way of -finding particular cell in the list, try method -instead. -        */ - </del><span class="cx"> wxHtmlCell* GetFirstCell() ; </span><del>-        /** -         * \brief Returns the indentation. is one of the constants. - - You must call -with same parameter in order to correctly interpret the returned integer value. -It is NOT always in pixels! -         * \param int -        */ - </del><span class="cx"> int GetIndent(int ind ) const; </span><del>-        /** -         * \brief Returns the units of indentation for where is one -of the constants. -         * \param int -        */ - </del><span class="cx"> int GetIndentUnits(int ind ) const; </span><del>-        /** -         * \brief Inserts new cell into the container. -         * \param wxHtmlCell -        */ - </del><span class="cx"> void InsertCell(wxHtmlCell *cell ) ; </span><del>-        /** -         * \brief Sets the container''s alignment (both horizontal and vertical) according to -the values stored in . (Tags parameter is extracted.) In fact -it is only a front-end to -and . -         * \param const wxHtmlTag& -        */ - </del><span class="cx"> void SetAlign(const wxHtmlTag& tag ) ; </span><del>-        /** -         * \brief Sets the container''s . During -each line is aligned according to value. -         * \param int -        */ - </del><span class="cx"> void SetAlignHor(int al ) ; </span><del>-        /** -         * \brief Sets the container''s . This is per-line alignment! -         * \param int -        */ - </del><span class="cx"> void SetAlignVer(int al ) ; </span><del>-        /** -         * \brief Sets the background colour for this container. -         * \param const wxColour& -        */ - </del><span class="cx"> void SetBackgroundColour(const wxColour& clr ) ; </span><del>-        /** -         * \brief Sets the border (frame) colours. A border is a rectangle around the container. -         * \param const wxColour& -         * \param const wxColour& -        */ - </del><span class="cx"> void SetBorder(const wxColour& clr1 , const wxColour& clr2 ) ; </span><del>-        /** -         * \brief Sets the indentation (free space between borders of container and subcells). -         * \param int -         * \param int -         * \param int -        */ - </del><span class="cx"> void SetIndent(int i , int what , int units = wxHTML_UNITS_PIXELS) ; </span><del>-        /** -         * \brief Sets minimal height of the container. - -When container''s is called, m_Height -is set depending on layout of subcells to the height of area covered -by layed-out subcells. Calling this method guarantees you that the height -of container is never smaller than - even if the subcells cover -much smaller area. -         * \param int -         * \param int -        */ - </del><span class="cx"> void SetMinHeight(int h , int align = wxHTML_ALIGN_TOP) ; </span><del>-        /** -         * \brief -         * \param int -         * \param int -        */ - </del><span class="cx"> void SetWidthFloat(int w , int units ) ; </span><del>-        /** -         * \brief Sets floating width adjustment. - -The normal behaviour of container is that its width is the same as the width of -parent container (and thus you can have only one sub-container per line). -You can change this by setting FWA. - - is number of real pixels that equals to 1 HTML pixel. - - - - - - - - - -\pythonnote{The second form of this method is named -SetWidthFloatFromTag in wxPython.} -         * \param const wxHtmlTag& -         * \param double -        */ - </del><span class="cx"> void SetWidthFloat(const wxHtmlTag& tag , double pixel_scale = 1.0) ; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigclassesincludewxHtmlEasyPrintingh"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxHtmlEasyPrinting.h (723 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxHtmlEasyPrinting.h        2006-11-07 21:47:19 UTC (rev 723) +++ trunk/wxruby2/swig/classes/include/wxHtmlEasyPrinting.h        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -8,99 +8,19 @@ </span><span class="cx"> class wxHtmlEasyPrinting : public wxObject </span><span class="cx"> { </span><span class="cx"> public: </span><del>-        /** -         * \brief Constructor. -         * \param const wxString& -         * \param wxWindow* -        */ </del><span class="cx"> </span><span class="cx"> wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow* parentWindow = NULL) ; </span><del>-        /** -         * \brief Preview HTML file. - -Returns false in case of error -- call - to get detailed -information about the kind of the error. -         * \param const wxString& -        */ - </del><span class="cx"> bool PreviewFile(const wxString& htmlfile ) ; </span><del>-        /** -         * \brief Preview HTML text (not file!). - -Returns false in case of error -- call - to get detailed -information about the kind of the error. -         * \param const wxString& -         * \param const wxString& -        */ - </del><span class="cx"> bool PreviewText(const wxString& htmltext , const wxString& basepath = wxEmptyString) ; </span><del>-        /** -         * \brief Print HTML file. - -Returns false in case of error -- call - to get detailed -information about the kind of the error. -         * \param const wxString& -        */ - </del><span class="cx"> bool PrintFile(const wxString& htmlfile ) ; </span><del>-        /** -         * \brief Print HTML text (not file!). - -Returns false in case of error -- call - to get detailed -information about the kind of the error. -         * \param const wxString& -         * \param const wxString& -        */ - </del><span class="cx"> bool PrintText(const wxString& htmltext , const wxString& basepath = wxEmptyString) ; </span><del>-        /** -         * \brief Display printer setup dialog and allows the user to modify settings. -        */ - - void PrinterSetup() ; -        /** -         * \brief Display page setup dialog and allows the user to modify settings. -        */ - </del><ins>+ // Not defined in 2.6.3 headers + // void PrinterSetup() ; </ins><span class="cx"> void PageSetup() ; </span><del>-        /** -         * \brief Sets fonts. See for -detailed description. -         * \param wxString -         * \param wxString -         * \param const int -        */ - </del><span class="cx"> void SetFonts(wxString normal_face , wxString fixed_face , const int *sizes = NULL) ; </span><del>-        /** -         * \brief Set page header. -         * \param const wxString& -         * \param int -        */ - </del><span class="cx"> void SetHeader(const wxString& header , int pg = wxPAGE_ALL) ; </span><del>-        /** -         * \brief Set page footer. -         * \param const wxString& -         * \param int -        */ - </del><span class="cx"> void SetFooter(const wxString& footer , int pg = wxPAGE_ALL) ; </span><del>-        /** -         * \brief Returns pointer to instance used by this class. You can -set its parameters (via SetXXXX methods). -        */ - </del><span class="cx"> wxPrintData* GetPrintData() ; </span><del>-        /** -         * \brief Returns a pointer to instance used by -this class. You can set its parameters (via SetXXXX methods). -        */ - </del><span class="cx"> wxPageSetupDialogData* GetPageSetupData() ; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2swigclassesincludewxHtmlWindowh"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/include/wxHtmlWindow.h (723 => 724)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/include/wxHtmlWindow.h        2006-11-07 21:47:19 UTC (rev 723) +++ trunk/wxruby2/swig/classes/include/wxHtmlWindow.h        2006-11-12 16:24:34 UTC (rev 724) </span><span class="lines">@@ -8,236 +8,33 @@ </span><span class="cx"> class wxHtmlWindow : public wxScrolledWindow </span><span class="cx"> { </span><span class="cx"> public: </span><del>-        /** -         * \brief Default constructor. -        */ - </del><span class="cx"> wxHtmlWindow() ; </span><del>-        /** -         * \brief Constructor. The parameters are the same as for the constructor. -         * \param wxWindow -         * \param wxWindowID -         * \param const wxPoint& -         * \param const wxSize& -         * \param long -         * \param const wxString& -        */ - </del><span class="cx"> wxHtmlWindow(wxWindow *parent , wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_AUTO, const wxString& name = wxT("htmlWindow")) ; </span><del>-        /** -         * \brief Adds to the static list of available -filters. These filters are present by default: -         * \param wxHtmlFilter -        */ - </del><span class="cx"> static void AddFilter(wxHtmlFilter *filter ) ; </span><del>-        /** -         * \brief Appends HTML fragment to currently displayed text and refreshes the window. -         * \param const wxString& -        */ - </del><span class="cx"> bool AppendToPage(const wxString& source ) ; </span><del>-        /** -         * \brief Returns pointer to the top-level container. - -See also: , -        */ - </del><span class="cx"> wxHtmlContainerCell* GetInternalRepresentation() const; </span><del>-        /** -         * \brief Returns anchor within currently opened page -(see ). -If no page is opened or if the displayed page wasn''t -produced by call to LoadPage, empty string is returned. -        */ - </del><span class="cx"> wxString GetOpenedAnchor() ; </span><del>-        /** -         * \brief Returns full location of the opened page. If no page is opened or if the displayed page wasn''t -produced by call to LoadPage, empty string is returned. -        */ - </del><span class="cx"> wxString GetOpenedPage() ; </span><del>-        /** -         * \brief Returns title of the opened page or wxEmptyString if current page does not contain tag. -        */ - </del><span class="cx"> wxString GetOpenedPageTitle() ; </span><del>-        /** -         * \brief Returns the related frame. -        */ - </del><span class="cx"> wxFrame* GetRelatedFrame() const; </span><del>-        /** -         * \brief Moves back to the previous page. (each page displayed using - is stored in history list.) -        */ - </del><span class="cx"> bool HistoryBack() ; </span><del>-        /** -         * \brief Returns true if it is possible to go back in the history (i.e. HistoryBack() -won''t fail). -        */ - </del><span class="cx"> bool HistoryCanBack() ; </span><del>-        /** -         * \brief Returns true if it is possible to go forward in the history (i.e. HistoryBack() -won''t fail). -        */ - </del><span class="cx"> bool HistoryCanForward() ; </span><del>-        /** -         * \brief Clears history. -        */ - </del><span class="cx"> void HistoryClear() ; </span><del>-        /** -         * \brief Moves to next page in history. -        */ - </del><span class="cx"> bool HistoryForward() ; </span><del>-        /** -         * \brief Loads HTML page from file and displays it. -         * \param const wxFileName& -        */ - </del><span class="cx"> virtual bool LoadFile(const wxFileName& filename ) ; </span><del>-        /** -         * \brief Unlike SetPage this function first loads HTML page from -and then displays it. See example: -         * \param const wxString& -        */ - </del><span class="cx"> virtual bool LoadPage(const wxString& location ) ; </span><del>-        /** -         * \brief This method is called when a mouse button is clicked inside wxHtmlWindow. -The default behaviour is to call - if the cell contains a -hypertext link. -         * \param wxHtmlCell -         * \param wxCoord -         * \param wxCoord -         * \param const wxMouseEvent& -        */ - </del><span class="cx"> virtual void OnCellClicked(wxHtmlCell *cell , wxCoord x , wxCoord y , const wxMouseEvent& event ) ; </span><del>-        /** -         * \brief This method is called when a mouse moves over an HTML cell. -         * \param wxHtmlCell -         * \param wxCoord -         * \param wxCoord -        */ - </del><span class="cx"> virtual void OnCellMouseHover(wxHtmlCell *cell , wxCoord x , wxCoord y ) ; </span><del>-        /** -         * \brief Called when user clicks on hypertext link. Default behaviour is to call - and do nothing else. - -Also see . -         * \param const wxHtmlLinkInfo& -        */ - </del><span class="cx"> virtual void OnLinkClicked(const wxHtmlLinkInfo& link ) ; </span><del>-        /** -         * \brief 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 OnOpeningURL returns - . This method is called by - . -You can override OnOpeningURL to selectively block some -URLs (e.g. for security reasons) or to redirect them elsewhere. Default -behaviour is to always return . -         * \param wxHtmlURLType -         * \param const wxString& -         * \param wxString * -        */ - - virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type , const wxString& url , wxString * redirect ) ; -        /** -         * \brief Called on parsing tag. -         * \param const wxString& -        */ - </del><ins>+ virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type , const wxString& url , wxString * redirect ) const; </ins><span class="cx"> virtual void OnSetTitle(const wxString& title ) ; </span><del>-        /** -         * \brief This reads custom settings from wxConfig. It uses the path ''path'' -if given, otherwise it saves info into currently selected path. -The values are stored in sub-path - -Read values: all things set by SetFonts, SetBorders. -         * \param wxConfigBase -         * \param wxString -        */ - </del><span class="cx"> virtual void ReadCustomization(wxConfigBase *cfg , wxString path = wxEmptyString) ; </span><del>-        /** -         * \brief This function sets the space between border of window and HTML contents. See image: - -\helponly{\image{}{border.bmp}} -         * \param int -        */ - </del><span class="cx"> void SetBorders(int b ) ; </span><del>-        /** -         * \brief This function sets font sizes and faces. - - - - - - - - - -\wxheading{Defaults} - -Default font sizes are defined by constants wxHTML_FONT_SIZE_1, -wxHTML_FONT_SIZE_2, ..., wxHTML_FONT_SIZE_7. Note that they differ among -platforms. Default face names are empty strings. -         * \param wxString -         * \param wxString -         * \param const int -        */ - </del><span class="cx"> void SetFonts(wxString normal_face , wxString fixed_face , const int *sizes = NULL) ; </span><del>-        /** -         * \brief Sets HTML page and display it. This won''t the page!! -It will display the . See example: - - - -If you want to load a document from some location use - instead. -         * \param const wxString& -        */ - </del><span class="cx"> bool SetPage(const wxString& source ) ; </span><del>-        /** -         * \brief Sets the frame in which page title will be displayed. is format of -frame title, e.g. "HtmlHelp : -         * \param wxFrame* -         * \param const wxString& -        */ - </del><span class="cx"> void SetRelatedFrame(wxFrame* frame , const wxString& format ) ; </span><del>-        /** -         * \brief calling , -this sets statusbar slot where messages will be displayed. -(Default is -1 = no messages.) -         * \param int -        */ - </del><span class="cx"> void SetRelatedStatusBar(int bar ) ; </span><del>-        /** -         * \brief Saves custom settings into wxConfig. 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 - . - -Saved values: all things set by SetFonts, SetBorders. -         * \param wxConfigBase -         * \param wxString -        */ - </del><span class="cx"> virtual void WriteCustomization(wxConfigBase *cfg , wxString path = wxEmptyString) ; </span><span class="cx"> }; </span><span class="cx"> </span></span></pre> </div> </div> </body> </html>
Possibly Parallel Threads
- [883] branches/wxruby2/wxwidgets_282/swig: API changes for move to WxWidgets 2.8
- HtmlWindow and friends
- [1081] trunk/wxruby2: Added HyperlinkCtrl from the 2.8 API plus event mappings
- [1138] trunk/wxruby2/samples/html/html.rb: Place HTMLWindow in a panel so gets correct bg color on MSW
- [950] branches/wxruby2/wxwidgets_282: Changes in GenericDirCtrl API 2.6->2.8, fix TreeItemId mapping, remove cruft