nobody at rubyforge.org
2006-Dec-12 00:14 UTC
[Wxruby-development] [782] trunk/wxruby2/samples/bigdemo: HtmlHelpWindow sample with helpfile
<!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>[782] trunk/wxruby2/samples/bigdemo: HtmlHelpWindow sample with helpfile</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>782</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2006-12-11 19:14:41 -0500 (Mon, 11 Dec 2006)</dd> </dl> <h3>Log Message</h3> <pre>HtmlHelpWindow sample with helpfile</pre> <h3>Added Paths</h3> <ul> <li><a href="#trunkwxruby2samplesbigdemohelpfilehtb">trunk/wxruby2/samples/bigdemo/helpfile.htb</a></li> <li><a href="#trunkwxruby2samplesbigdemowxHtmlHelpControllerrbw">trunk/wxruby2/samples/bigdemo/wxHtmlHelpController.rbw</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2samplesbigdemohelpfilehtb"></a> <div class="binary"><h4>Added: trunk/wxruby2/samples/bigdemo/helpfile.htb</h4> <pre class="diff"><span> <span class="cx">(Binary files differ) </span></span></pre></div> <span class="cx">Property changes on: trunk/wxruby2/samples/bigdemo/helpfile.htb </span><span class="cx">___________________________________________________________________ </span><span class="cx">Name: svn:mime-type </span><span class="cx"> + application/octet-stream </span><a id="trunkwxruby2samplesbigdemowxHtmlHelpControllerrbw"></a> <div class="addfile"><h4>Added: trunk/wxruby2/samples/bigdemo/wxHtmlHelpController.rbw (0 => 782)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/bigdemo/wxHtmlHelpController.rbw         (rev 0) +++ trunk/wxruby2/samples/bigdemo/wxHtmlHelpController.rbw        2006-12-12 00:14:41 UTC (rev 782) </span><span class="lines">@@ -0,0 +1,57 @@ </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 + + +class TestPanel < Wx::Panel + def initialize(parent, log) + super(parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, + Wx::NO_FULL_REPAINT_ON_RESIZE) + @log = log + + b = Wx::Button.new(self, -1, ''Give me some help!'', + Wx::Point.new(50,50)) + + evt_button(b.get_id) { on_button } + end + + def on_button + help = Wx::HtmlHelpController.instance + help_file = File.join( File.dirname(__FILE__), ''helpfile.htb'') + exit if not File.exists?(help_file) + help.add_book( File.expand_path(help_file), false ) + help.display_contents + end +end + +module Demo + def Demo.run(frame, nb, log) + TestPanel.new(nb, log) + end + + def Demo.overview + "Wx::HtmlHelpController is a sophisticated viewer for online help\n" + + "documentation in HTML format. It uses a format based on the Microsoft\n" + + "HTML Help format, but is available on all platforms. It includes a\n" + + "contents page, index and keyword search." + end +end + + +if __FILE__ == $0 + run_solo_lib = File.join( File.dirname(__FILE__), ''run.rb'') + load run_solo_lib + run File.basename($0) +end </ins></span></pre> </div> </div> </body> </html>
Reasonably Related Threads
- [1116] trunk/wxruby2/samples/bigdemo/wxStaticBitmap.rbw: Fix hardcoded image paths, tidy up indenting
- [1078] trunk/wxruby2: Map evt_spinctrl to SpinEvent instead of CommandEvent; add example to bigdemo
- [1124] trunk/wxruby2/samples/bigdemo/wxGauge.rbw: Use Wx::Timer instead of evt_idle to drive Gauge sample, to avoid 100%
- [778] trunk/wxruby2: Remove broken and deprecated LayoutConstraints, update samples & docs
- [734] trunk/wxruby2/samples/bigdemo/bigdemo.rb: Remove debug output line I forgot to remove before I did a commit.