nobody at rubyforge.org
2007-Jun-28 18:42 UTC
[Wxruby-development] [1095] trunk/wxruby2: Remove useless methods from Wx::Object and add wx_class method for info; document
<!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>[1095] trunk/wxruby2: Remove useless methods from Wx::Object and
add wx_class method for info; document</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1095</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2007-06-28 14:42:03 -0400 (Thu, 28 Jun
2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove useless methods from Wx::Object and add wx_class method for
info; document</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxruby2doctextileobjecttxtl">trunk/wxruby2/doc/textile/object.txtl</a></li>
<li><a
href="#trunkwxruby2swigclassesObjecti">trunk/wxruby2/swig/classes/Object.i</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxruby2doctextileobjecttxtl"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/doc/textile/object.txtl (1094 => 1095)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/doc/textile/object.txtl        2007-06-28
08:35:04 UTC (rev 1094)
+++
trunk/wxruby2/doc/textile/object.txtl        2007-06-28
18:42:03 UTC (rev 1095)
</span><span class="lines">@@ -1,39 +1,17 @@
</span><span class="cx"> h1(#wxobject). Wx::Object
</span><span class="cx">
</span><del>-This is the root class of all Widgets classes.
-It declares a virtual destructor which ensures that
-destructors get called for all derived class objects where necessary.
</del><ins>+This is the base class for most wxRuby classes. Almost
all of the useful
+functions it provides to the C++ library, such as exploration of
+object-oriented class relationships and memory management, are handled
+within the Ruby language or the wxRuby wrapping. Therefore, this class
+has very few methods.
</ins><span class="cx">
</span><del>-Object is the hub of a dynamic object creation
-scheme, enabling a program to create instances of a class only knowing
-its string class name, and to query the class hierarchy.
-
-The class contains optional debugging versions
-of *new* and *delete*, which can help trace memory allocation
-and deallocation problems.
-
-Object can be used to implement reference counted objects, such as
-Pen, Bitmap and others.
-
-h2. See also
-
-"ClassInfo":classinfo.html, "Debugging
overview":debuggingoverview.html,
"ObjectRefData":objectrefdata.html
-
</del><span class="cx"> <div id="methods">
</span><span class="cx">
</span><span class="cx"> h2. Methods
</span><span class="cx">
</span><span class="cx"> *
"Object.new":#Object_new
</span><del>-* "Object#m__ref_data":#Object_mrefdata
-* "Object#dump":#Object_dump
-* "Object#get_class_info":#Object_getclassinfo
-* "Object#get_ref_data":#Object_getrefdata
-* "Object#is_kind_of":#Object_iskindof
-* "Object#ref":#Object_ref
-* "Object#set_ref_data":#Object_setrefdata
-* "Object#un_ref":#Object_unref
-* "wxObject::operator new":#Object_new
-* "wxObject::operator delete":#Object_delete
</del><ins>+* "Object#wx_class":#Object_wxclass
</ins><span class="cx">
</span><span class="cx"> </div>
</span><span class="cx">
</span><span class="lines">@@ -42,139 +20,16 @@
</span><span class="cx">
</span><span class="cx"> *Object.new*(%(arg-type)Object%
other)
</span><span class="cx">
</span><del>-Default and copy constructors.
</del><ins>+Default constructor. Should not need to be called in
ruby code.
</ins><span class="cx">
</span><del>-h3(#Object_mrefdata). Object#m__ref_data
</del><ins>+h3(#Object_wxclass). Object#wx_class
</ins><span class="cx">
</span><del>-ObjectRefData* m_refData
</del><ins>+ String *wx_class*()
</ins><span class="cx">
</span><del>-Pointer to an object which is the object''s
reference-counted data.
</del><ins>+Returns the name of the C++ wxWidgets class which this
object is
+wrapping, for example ''wxTextCtrl'' or
''wxFrame''. Note that if a wxRuby
+class has been subclassed, this will still return the name of the core
+C++ class which this object is wrapping.
</ins><span class="cx">
</span><del>-h4. See also
-
-"Object#ref":object.html#Object_ref,
"Object#un_ref":object.html#Object_unref,
"Object#set_ref_data":object.html#Object_setrefdata,
"Object#get_ref_data":object.html#Object_getrefdata,
"ObjectRefData":objectrefdata.html
-
-h3(#Object_dump). Object#dump
-
- *dump*(%(arg-type)ostream% stream)
-
-A virtual function that may be redefined by derived classes to allow dumping of
-memory states.
-
-This function is only defined in debug build and doesn''t exist at all
if
-@__WXDEBUG__@ is not defined.
-
-h4. Parameters
-
-* _stream_ Stream on which to output dump information.
-
-h4. Remarks
-
-Currently Widgets does not define Dump for derived classes, but
-programmers may wish to use it for their own applications. Be sure to
-call the Dump member of the class''s base class to allow all
information to be
-dumped.
-
-The implementation of this function in Object just writes the class name of
-the object.
-
-h3(#Object_getclassinfo). Object#get_class_info
-
- "ClassInfo":classinfo.html *get_class_info*()
-
-This virtual function is redefined for every class that requires run-time
-type information, when using DECLARE_CLASS macros.
-
-h3(#Object_getrefdata). Object#get_ref_data
-
- "ObjectRefData":objectrefdata.html *get_ref_data*()
-
-Returns the *m_refData* pointer.
-
-h4. See also
-
-"Object#ref":object.html#Object_ref,
"Object#un_ref":object.html#Object_unref,
"Object#m__ref_data":object.html#Object_mrefdata,
"Object#set_ref_data":object.html#Object_setrefdata,
"ObjectRefData":objectrefdata.html
-
-h3(#Object_iskindof). Object#is_kind_of
-
- Boolean *is_kind_of*(%(arg-type)ClassInfo% info)
-
-Determines whether this class is a subclass of (or the same class as)
-the given class.
-
-h4. Parameters
-
-* _info_ A pointer to a class information object, which may be obtained
-by using the CLASSINFO macro.
-
-h4. Return value
-
-true if the class represented by _info_ is the same class as
-this one or is derived from it.
-
-h4. Example
-
-
- bool tmp = obj->IsKindOf(CLASSINFO(Frame));
-
-
-h3(#Object_ref). Object#ref
-
- *ref*(%(arg-type)Object% clone)
-
-Makes this object refer to the data in _clone_.
-
-h4. Parameters
-
-* _clone_ The object to `clone''.
-
-h4. Remarks
-
-First this function calls "Object#un_ref":object.html#Object_unref on
itself
-to decrement (and perhaps free) the data it is currently referring to.
-
-It then sets its own m_refData to point to that of _clone_, and increments the
reference count
-inside the data.
-
-h4. See also
-
-"Object#un_ref":object.html#Object_unref,
"Object#m__ref_data":object.html#Object_mrefdata,
"Object#set_ref_data":object.html#Object_setrefdata,
"Object#get_ref_data":object.html#Object_getrefdata,
"ObjectRefData":objectrefdata.html
-
-h3(#Object_setrefdata). Object#set_ref_data
-
- *set_ref_data*(%(arg-type)ObjectRefData% data)
-
-Sets the *m_refData* pointer.
-
-h4. See also
-
-"Object#ref":object.html#Object_ref,
"Object#un_ref":object.html#Object_unref,
"Object#m__ref_data":object.html#Object_mrefdata,
"Object#get_ref_data":object.html#Object_getrefdata,
"ObjectRefData":objectrefdata.html
-
-h3(#Object_unref). Object#un_ref
-
- *un_ref*()
-
-Decrements the reference count in the associated data, and if it is zero,
deletes the data.
-The *m_refData* member is set to NULL.
-
-h4. See also
-
-"Object#ref":object.html#Object_ref,
"Object#m__ref_data":object.html#Object_mrefdata,
"Object#set_ref_data":object.html#Object_setrefdata,
"Object#get_ref_data":object.html#Object_getrefdata,
"ObjectRefData":objectrefdata.html
-
-h3(#Object_new). Object::operator new
-
- *new*(%(arg-type)size_t% size, %(arg-type)String% filename = nil,
- %(arg-type)Integer% lineNum = 0)
-
-The _new_ operator is defined for debugging versions of the library only, when
-the identifier __WXDEBUG__ is defined. It takes over memory allocation,
allowing
-DebugContext operations.
-
-h3(#Object_delete). Object::operator delete
-
- *delete*(%(arg-type)% buf)
-
-The _delete_ operator is defined for debugging versions of the library only,
when
-the identifier __WXDEBUG__ is defined. It takes over memory deallocation,
allowing
-DebugContext operations.
-
</del><ins>+This method is normally only required for development
and debugging -
+user code should not need to call it.
</ins></span></pre></div>
<a id="trunkwxruby2swigclassesObjecti"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/swig/classes/Object.i (1094 => 1095)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/swig/classes/Object.i        2007-06-28
08:35:04 UTC (rev 1094)
+++
trunk/wxruby2/swig/classes/Object.i        2007-06-28
18:42:03 UTC (rev 1095)
</span><span class="lines">@@ -6,7 +6,26 @@
</span><span class="cx"> %module(directors="1")
wxObject
</span><span class="cx"> GC_MANAGE_AS_OBJECT(wxObject);
</span><span class="cx">
</span><ins>+// These methods are useless, and possibly dangerous if
called from Ruby
</ins><span class="cx"> %ignore wxObject(wxObject const
&other);
</span><span class="cx"> %ignore wxObject::Dump;
</span><ins>+%ignore wxObject::Ref;
+%ignore wxObject::UnRef;
+%ignore wxObject::GetRefData;
</ins><span class="cx">
</span><ins>+// not dangerous, but not useful?
+%ignore wxObject::IsKindOf;
+%ignore wxObject::GetClassInfo;
+
+%extend wxObject {
+ // Returns the string name of the C++ wx class which this object is wrapping.
+ // The doubled wx name is to fool renamer.rb, which strips the wx prefix.
+ // The actual final method is called wx_class
+ VALUE wxwx_class() {
+        wxString
class_name( self->GetClassInfo()->GetClassName() );
+        VALUE
rb_class_name = rb_str_new2((const char *)class_name.mb_str(wxConvUTF8));
+        return
rb_class_name;
+ }
+}
+
</ins><span class="cx"> %include
"include/wxObject.h"
</span></span></pre>
</div>
</div>
</body>
</html>
Apparently Analagous Threads
- 1.9.3 release, rakefile
- [911] trunk/wxsugar/lib/wx_sugar/wx_classes: Added default? method for size and position
- [938] trunk/wxsugar/lib/wx_sugar/wx_classes: Enable enumerable_controls for ListCtrl and ControlWithItems family
- [842] trunk/wxsugar/lib/wx_sugar/wx_classes/treectrl.rb: Fix for TreeItemIds as Integers
- [793] trunk/wxsugar/lib/wx_sugar/wx_classes/treectrl.rb: Moved traverse method in wxSugar
