Update of /cvsroot/wxlua/wxLua/docs
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6261/docs
Modified Files:
wxlua.html
Log Message:
add comments for virtual functions and how to use them for wxLuaPrintout and wxLuaHtmlWindow
Index: wxlua.html
===================================================================
RCS file: /cvsroot/wxlua/wxLua/docs/wxlua.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** wxlua.html 19 Dec 2006 17:06:16 -0000 1.11
--- wxlua.html 5 Feb 2007 23:23:56 -0000 1.12
***************
*** 942,948 ****
operator to copy the values from pt1. We then change the value of pt1,
test if pt2 has changed, it hasn't, and the test to see if they're
! still equal and as expected, they're not.<br>
! </li>
</ul>
--- 942,993 ----
operator to copy the values from pt1. We then change the value of pt1,
test if pt2 has changed, it hasn't, and the test to see if they're
! still equal and as expected, they're not.</li>
! </ul>
!
! <li><b>Extending classes</b> </li>
!
! <ul>
!
! <li>You cannot arbitrarily override "virtual" functions
! in wxLua as this must be done in C++. The class must be subclassed and
! the virtual functions overridden to check to see if there is a
! lua function to call instead of the base class function. This has only
! been done for cases where it is necessary, in many cases you can
! intercept the appropriate wxEvent and change the behavior from within
! the handler. Examples of virtual functions that must or can be
! overridden are in wxLuaPrintout class, see the printing
! sample, and wxLuaHtmlWindow, see html sample. The only virtual
! functions that you can override are marked with comments in the binding
! files and wxluaref.htm. </li>
!
! <li>You may also add your own functions to classes that
! will not be called by C++, but can be called from lua. This makes sense
! if you would rather keep functions that act on a particular class with
! it rather than having global functions that take that class as a
! parameter.</li>
!
! <ul>
!
! <li>Example : <i>"r =
! wx.wxRect(1,2,3,4); r.PrintXY = function(self) print(self:GetX(),
! self:GetY()) end; r:PrintXY()"</i> adds the function PrintXY to
! the wxRect instance r. The userdata, class instance, r is
! passed to the lua function as the parameter "self" which is pushed onto
! the stack when the PrintXY function is called with the ":" notation.</li>
!
! <li>Note that the above example is the same as <i>"</i><i>r
! = wx.wxRect(1,2,3,4); </i><i>function wxRect_PrintXY(r)
! print(r:GetX(), r:GetY()) end; wxRect_PrintXY(r)"</i>.</li>
!
! <li>You may also create the lua function beforehand and
! then assign it to the rect object. <i>"function
! wxRect_PrintXY_func(self) print(self:GetX(), self:GetY()) end;
! r1 = wx.wxRect(1,2,3,4); r1.PrintXY = wxRect_PrintXY_func; r1:PrintXY()"</i>.
! You can see that using this idea you can make a lua function
! that creates a new wxRect, sets your extra functions
! for it, and returns it for use.</li>
!
! </ul>
</ul>
|