home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!liuida!isy!isy.liu.se!svan
- From: svan@isy.liu.se (Jonas Svanberg)
- Newsgroups: comp.windows.open-look
- Subject: Re: Q: C++ and callback problems.
- Keywords: callback OI
- Message-ID: <1992Aug30.171624.1330@isy.liu.se>
- Date: 30 Aug 92 17:16:24 GMT
- References: <Btpy3G.Dnu@solbourne.com>
- Sender: news@isy.liu.se (Lord of the News)
- Reply-To: svan@isy.liu.se
- Organization: Linkoping University
- Lines: 38
-
- imp@solbourne.com (Warner Losh) replies on my article #5299 about
- C++ and callbacks. (article #5306)
-
- >>How then do these toolkits handle callbacks/events?
- >
- >OI does a variation of method 1 (except that it does do non-static
- >member functions correctly). Interviews uses a variation of method 2.
- >
- >>1) Cloning & modifying.
- >> You create a Button-object and then modifies it by
- >> registering your c-style callbackfunction.
- >
- >In OI, you can regstier a C or a C++ style callback. Just an
- >overloaded call. For example,
- > OI_menu_cell *cellp;
- > MyClass *mcp;
- >
- > // call ::foo when button activated.
- > cellp->change_action( &foo );
- >
- > // call MyClass::bar when button activated
- > cellp->change_action( mcp, (OI_action_memfnp) &MyClass::bar );
-
- What is OI_action_memfnp? For this to be a legal and portable (?) cast it
- has to be of type pointer-to-member-of-MyClass or a pointer-to-member-of-a-
- -baseclass-of-MyClass.
- I suppose in this case that MyClass is derived from an OI-class? (hence the
- lacking of a cast of mcp in the last call.) Is it really safe to make a
- member-function-call when both the objectpointer and the pointer-to-member-
- -function have been casted "towards the baseclass"?
-
- ---
- --------------------------------------------------------------
- Jonas Svanberg
- Department of Electrical Engineering
- Linkvping University
- S-581 83 Linkvping, Sweden Email: svan@isy.liu.se
- --------------------------------------------------------------
-