nobody at rubyforge.org
2006-Dec-29 12:32 UTC
[Wxruby-development] [808] trunk/wxruby2: Make Wx::Colour#== work correctly as documented, tidy docs for that class
<!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>[808] trunk/wxruby2: Make Wx::Colour#== work correctly as
documented, tidy docs for that class</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>808</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2006-12-29 07:32:29 -0500 (Fri, 29 Dec
2006)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make Wx::Colour#== work correctly as documented, tidy docs for that
class</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxruby2doctextilecolourtxtl">trunk/wxruby2/doc/textile/colour.txtl</a></li>
<li><a
href="#trunkwxruby2libwxclassescolourrb">trunk/wxruby2/lib/wx/classes/colour.rb</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxruby2doctextilecolourtxtl"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/doc/textile/colour.txtl (807 => 808)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/doc/textile/colour.txtl        2006-12-28
19:24:03 UTC (rev 807)
+++
trunk/wxruby2/doc/textile/colour.txtl        2006-12-29
12:32:29 UTC (rev 808)
</span><span class="lines">@@ -1,13 +1,15 @@
</span><span class="cx"> h1(#wxcolour). Wx::Colour
</span><span class="cx">
</span><del>-A colour is an object representing a combination of
Red, Green, and Blue (RGB) intensity values,
-and is used to determine drawing colours. See the
-entry for "ColourDatabase":colourdatabase.html for how a pointer to a
predefined,
-named colour may be returned instead of creating a new colour.
</del><ins>+A colour is an object representing a combination of Red,
Green, and Blue
+(RGB) intensity values, and is used to determine drawing colours. See
+the entry for "ColourDatabase":colourdatabase.html for how a pointer
to
+a predefined, named colour may be returned instead of creating a new
+colour.
</ins><span class="cx">
</span><span class="cx"> Valid RGB values are in the range
0 to 255.
</span><span class="cx">
</span><del>-You can retrieve the current system colour settings
with "SystemSettings":systemsettings.html.
</del><ins>+You can retrieve the current system colour settings for
different UI
+elements with "SystemSettings":systemsettings.html.
</ins><span class="cx">
</span><span class="cx"> h2. Derived from
</span><span class="cx">
</span><span class="lines">@@ -15,21 +17,17 @@
</span><span class="cx">
</span><span class="cx"> h2. Predefined objects
</span><span class="cx">
</span><del>-Objects:
</del><ins>+These predefined colours are defined as constants in
wxRuby.
</ins><span class="cx">
</span><del>-*NullColour*
</del><ins>+ Wx::NULL_COLOUR
+ Wx::BLACK
+ Wx::WHITE
+ Wx::RED
+ Wx::BLUE
+ Wx::GREEN
+ Wx::CYAN
+ Wx::LIGHT_GREY
</ins><span class="cx">
</span><del>-Pointers:
-
-*BLACK
-
-WHITE\\
-RED\\
-BLUE\\
-GREEN\\
-CYAN\\
-LIGHT_GREY*
-
</del><span class="cx"> h2. See also
</span><span class="cx">
</span><span class="cx">
"ColourDatabase":colourdatabase.html, "Pen":pen.html,
"Brush":brush.html, "ColourDialog":colourdialog.html,
"SystemSettings":systemsettings.html
</span><span class="lines">@@ -48,39 +46,29 @@
</span><span class="cx">
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-
-
</del><span class="cx"> h3(#Colour_constr). Colour.new
</span><span class="cx">
</span><del>- *Colour.new*(%(arg-type)Integer% red,
%(arg-type)Integer% green, %(arg-type)Integer% blue)
</del><ins>+ *Colour.new*(%(arg-type)Integer% red,
%(arg-type)Integer% green, %(arg-type)Integer% blue)
</ins><span class="cx">
</span><del>-Constructs a colour from red, green and blue values.
</del><ins>+Constructs a colour from red, green and blue values.
Each value should
+be between 0 and 255.
</ins><span class="cx">
</span><span class="cx"> *Colour.new*(%(arg-type)String%
colourNname)
</span><span class="cx">
</span><del>-Constructs a colour object using a colour name
-listed in *TheColourDatabase*.
</del><ins>+Constructs a colour object using a colour name listed in
the global
+colour database *Wx::TheColourDatabase*.
</ins><span class="cx">
</span><del>- *Colour.new*(%(arg-type)Colour% colour)
-
-Copy constructor.
-
</del><span class="cx"> h4. Parameters
</span><span class="cx">
</span><span class="cx"> * _red_ The red value.
</span><span class="cx"> * _green_ The green value.
</span><span class="cx"> * _blue_ The blue value.
</span><span class="cx"> * _colourName_ The colour name.
</span><del>-* _colour_ The colour to copy.
</del><span class="cx">
</span><span class="cx"> h4. See also
</span><span class="cx">
</span><span class="cx">
"ColourDatabase":colourdatabase.html
</span><span class="cx">
</span><del>-
-
-
-
</del><span class="cx"> h3(#Colour_blue). Colour#blue
</span><span class="cx">
</span><span class="cx"> Integer *blue*()
</span><span class="lines">@@ -118,39 +106,19 @@
</span><span class="cx">
</span><span class="cx"> Returns the red intensity.
</span><span class="cx">
</span><del>-
</del><span class="cx"> h3(#Colour_set). Colour#set
</span><span class="cx">
</span><span class="cx"> *set*(%(arg-type)Integer% red,
%(arg-type)Integer% green, %(arg-type)Integer% blue)
</span><span class="cx">
</span><span class="cx"> Sets the RGB intensity values.
</span><span class="cx">
</span><del>-
-h3(#Colour_assign). Colour#-
- "Colour":colour.html *operator $=$*(%(arg-type)Colour% colour)
-
-Assignment operator, taking another colour object.
-
- "Colour":colour.html *operator $=$*(%(arg-type)String% colourName)
-
-Assignment operator, using a colour name to be found in the colour database.
-
</del><span class="cx"> h4. See also
</span><span class="cx">
</span><span class="cx">
"ColourDatabase":colourdatabase.html
</span><span class="cx">
</span><del>-
</del><span class="cx"> h3(#Colour_equality).
Colour#=</span><span class="cx">
</span><del>- Boolean *operator $==$*(%(arg-type)Colour% colour)
</del><ins>+ Boolean *operator ==*(%(arg-type)Colour% colour)
</ins><span class="cx">
</span><span class="cx"> Tests the equality of two colours
by comparing individual red, green blue colours.
</span><span class="cx">
</span><del>-
-h3(#Colour_inequality). Colour#!-
- Boolean *operator $!=$*(%(arg-type)Colour% colour)
-
-Tests the inequality of two colours by comparing individual red, green blue
colours.
-
</del></span></pre></div>
<a id="trunkwxruby2libwxclassescolourrb"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/lib/wx/classes/colour.rb (807 => 808)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/lib/wx/classes/colour.rb        2006-12-28
19:24:03 UTC (rev 807)
+++
trunk/wxruby2/lib/wx/classes/colour.rb        2006-12-29
12:32:29 UTC (rev 808)
</span><span class="lines">@@ -1,5 +1,4 @@
</span><span class="cx"> class Wx::Colour
</span><del>-
</del><span class="cx"> # Redefine the initialize method
so it raises an exception if an
</span><span class="cx"> # invalid colour value is
given. This might be an unknown colour
</span><span class="cx"> # string (eg ''dark
blue'') or out-of-bounds integer values (<0 or >255)
</span><span class="lines">@@ -17,6 +16,15 @@
</span><span class="cx"> end
</span><span class="cx"> end
</span><span class="cx">
</span><ins>+ # Colours are equal to one another if they have the
same red, green
+ # and blue intensity.
+ def ==(other)
+ if not other.is_a?(self.class)
+ raise ArgumentError, "No comparison of #{self} to #{other}"
+ end
+ [ red, green, blue ] == [ other.red, other.green, other.blue ]
+ end
+
</ins><span class="cx"> # More informative output for
inspect etc
</span><span class="cx"> def to_s
</span><span class="cx"> "#<Wx::Colour:
(#{red}, #{green}, #{blue})>"
</span></span></pre>
</div>
</div>
</body>
</html>
Apparently Analagous Threads
- [904] branches/wxruby2/wxwidgets_282: Changes in Wx::Colour API 2.6 -> 2.8
- [933] branches/wxruby2/wxwidgets_282: Font API 2.6 -> 2.8, corrections to Event doc
- [1084] trunk/wxruby2/swig/classes/SystemSettings.i: Fix missing punctuation in SystemSettings typemaps
- [1080] trunk/wxruby2/swig: Moved typemaps specific to SystemSetting out of general typemap file
- [1118] trunk/wxruby2/swig: Move Wx::message_box function from wx.i to Functions.i, where it belongs
