nobody at rubyforge.org
2006-Dec-02  11:34 UTC
[Wxruby-development] [770] trunk/wxsugar/lib/wx_sugar/keyword_classes.rb: Fix some broken ones (Alex Spelling), add some new & missing ones; add
<!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>[770] trunk/wxsugar/lib/wx_sugar/keyword_classes.rb: Fix some
broken ones (Alex Spelling), add some new & missing ones; add</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>770</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2006-12-02 06:34:23 -0500 (Sat, 02 Dec
2006)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix some broken ones (Alex Spelling), add some new & missing
ones; add
check for duplicate definitions</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxsugarlibwx_sugarkeyword_classesrb">trunk/wxsugar/lib/wx_sugar/keyword_classes.rb</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxsugarlibwx_sugarkeyword_classesrb"></a>
<div class="modfile"><h4>Modified:
trunk/wxsugar/lib/wx_sugar/keyword_classes.rb (769 => 770)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxsugar/lib/wx_sugar/keyword_classes.rb        2006-12-02
11:22:09 UTC (rev 769)
+++
trunk/wxsugar/lib/wx_sugar/keyword_classes.rb        2006-12-02
11:34:23 UTC (rev 770)
</span><span class="lines">@@ -13,12 +13,21 @@
</span><span class="cx"> $VERBOSE = v
</span><span class="cx"> 
</span><span class="cx"> module WxSugar
</span><ins>+  @defined_classes = {}
+
</ins><span class="cx">   # accepts a string unadorned
name of a WxWidgets class, and block, which
</span><span class="cx">   # defines the constructor
parameters and style flags for that class.
</span><span class="cx">   # If the named class exists in
the available WxRuby, the block is run and
</span><span class="cx">   # the class may use keyword
constructors. If the class is not available, the
</span><span class="cx">   # block is ignored.
</span><span class="cx">   def
self.define_keyword_ctors(klass_name, &block)
</span><ins>+    # check this class hasn''t already been
defined
+    if @defined_classes[klass_name]
+      raise ArgumentError, "Keyword ctor for #{klass_name} already
defined"
+    else
+      @defined_classes[klass_name] = true
+    end
+
</ins><span class="cx">     begin     
</span><span class="cx">       klass = 
Wx::const_get(klass_name)
</span><span class="cx">     rescue NameError
</span><span class="lines">@@ -34,8 +43,14 @@
</span><span class="cx">   end
</span><span class="cx"> end
</span><span class="cx"> 
</span><ins>+# Window : base class for all widgets and frames
+WxSugar.define_keyword_ctors(''Window'') do
+   wx_ctor_params :pos, :size, :style
+   wx_ctor_params :name => ''window''
+end
+
+
</ins><span class="cx"> ### FRAMES
</span><del>-# Normal frame
</del><span class="cx"> 
</span><span class="cx"> # wxTopLevelWindow
        ABSTRACT:
Any top level window, dialog or frame
</span><span class="cx"> 
</span><span class="lines">@@ -146,7 +161,7 @@
</span><span class="cx"> 
</span><span class="cx"> # wxSashLayoutWindow: Window that
can be involved in an IDE-like layout
</span><span class="cx"> # arrangement
</span><del>-WxSugar.define_keyword_ctors(''SashWindow'')
do
</del><ins>+WxSugar.define_keyword_ctors(''SashLayoutWindow'')
do
</ins><span class="cx">   wx_ctor_params :pos, :size
</span><span class="cx">   wx_ctor_params :style => 
Wx::CLIP_CHILDREN|Wx::SW_3D
</span><span class="cx">   wx_ctor_params :name =>
''layoutWindow''
</span><span class="lines">@@ -223,8 +238,16 @@
</span><span class="cx"> 
</span><span class="cx"> # wxFontDialog
        Font
chooser dialog
</span><span class="cx"> # wxPageSetupDialog
        Standard
page setup dialog
</span><ins>+WxSugar.define_keyword_ctors(''PageSetupDialog'')
do
+  wx_ctor_params :data
+end
+
</ins><span class="cx"> # wxPrintDialog
        Standard
print dialog
</span><ins>+WxSugar.define_keyword_ctors(''PrintDialog'')
do
+  wx_ctor_params :data
+end
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> # Simple message box dialog
</span><span class="cx">
WxSugar.define_keyword_ctors(''MessageDialog'') do
</span><span class="cx">   wx_ctor_params :message =>
''''
</span><span class="lines">@@ -297,6 +320,17 @@
</span><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> # wxGenericDirCtrl
        A
control for displaying a directory tree
</span><ins>+WxSugar.define_keyword_ctors(''GenericDirCtrl'')
do
+  # TODO :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
+  wx_ctor_params :dir => '''' 
+  wx_ctor_params :pos, :size, 
+                 :style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER
+  wx_ctor_params :filter => ''''
+  wx_ctor_params :default_filter => 0
+  wx_ctor_params :name => ''genericDirCtrl''
+end
+
+
</ins><span class="cx"> # wxHtmlListBox
        A
listbox showing HTML content
</span><span class="cx"> # wxListBox
        A list
of strings for single or multiple selection
</span><span class="cx">
WxSugar.define_keyword_ctors(''ListBox'') do
</span><span class="lines">@@ -354,13 +388,11 @@
</span><span class="cx">   wx_ctor_params :pos, :size,
:choices => []
</span><span class="cx">   wx_ctor_params :major_dimension
=> 0
</span><span class="cx">   wx_ctor_params :style =>
Wx::RA_SPECIFY_COLS
</span><del>-
-#  wx_ctor_params :validator, :name => ''radioBox''
</del><ins>+  #  wx_ctor_params :validator, :name =>
''radioBox''
</ins><span class="cx"> end
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> # wxRadioButton
        A round
button to be used with others in a mutually exclusive way
</span><del>-WxSugar.define_keyword_ctors(''RadioBox'')
do
</del><ins>+WxSugar.define_keyword_ctors(''RadioButton'')
do
</ins><span class="cx">   wx_ctor_params :label =>
''''
</span><span class="cx">   wx_ctor_params :pos, :size,
:style => 0
</span><span class="cx">   #  wx_ctor_params :validator,
:name => ''radioButton''
</span><span class="lines">@@ -368,16 +400,30 @@
</span><span class="cx"> 
</span><span class="cx"> # wxSlider
        A slider
that can be dragged by the user
</span><span class="cx">
WxSugar.define_keyword_ctors(''Slider'') do
</span><ins>+  wx_ctor_params :value => 0
</ins><span class="cx">   wx_ctor_params :min_value,
:max_value
</span><span class="cx">   wx_ctor_params :pos, :size,
:style => Wx::SL_HORIZONTAL
</span><span class="cx">   #  wx_ctor_params :validator,
:name => ''radioButton''
</span><span class="cx"> end
</span><span class="cx"> 
</span><ins>+
+# wxSpinButton - Has two small up and down (or left and right) arrow buttons
+WxSugar.define_keyword_ctors(''SpinButton'') do
+   wx_ctor_params :pos, :size, :style => Wx::SP_HORIZONTAL
+   wx_ctor_params :name => ''spinButton''
+end
+
</ins><span class="cx"> # wxVListBox
        A
listbox supporting variable height rows
</span><span class="cx"> 
</span><span class="cx"> # wxTextCtrl
        Single
or multiline text editing control
</span><span class="cx">
WxSugar.define_keyword_ctors(''TextCtrl'') do
</span><span class="cx">   wx_ctor_params :value =>
''''
</span><span class="cx">   wx_ctor_params :pos, :size,
:style
</span><ins>+  # wx_ctor_params validator, :name =>
''textCtrl''
</ins><span class="cx"> end
</span><span class="cx"> 
</span><ins>+# wxHtmlWindow - Control for displaying HTML
+WxSugar.define_keyword_ctors(''HtmlWindow'') do
+  wx_ctor_params :pos, :size, :style => Wx::HW_DEFAULT_STYLE
+  wx_ctor_params :name => ''htmlWindow''
+end
</ins></span></pre>
</div>
</div>
</body>
</html>
Reasonably Related Threads
- [764] trunk/wxsugar/lib/wx_sugar/keyword_classes.rb: Correct duplicate and incorrect definition of SpinCtrl constructor
- [836] trunk/wxsugar/lib/wx_sugar: Make :validator and :name sugary ctor args work for Controls classes
- [805] trunk/wxsugar/lib/wx_sugar/keyword_classes.rb: NULL_BITMAP is now defined when wxruby2 is loaded, so dummy def not needed
- [972] trunk/wxsugar/lib/wx_sugar/keyword_classes.rb: Fix missing keyword param for Wx::Gauge
- wxSugar control problem
