Re: Cocoa Classes from C++?

2008-05-28 Thread Uli Kusterer
Am 28.05.2008 um 01:50 schrieb Todd Heberlein: The gotchas that I often run into are: (1) Changing an Objective-C file to an Objective-C++ object (by renaming it to a .mm file) often causes me to rename a lot of files to .mm, because if the Objective- C class definition has a C++ object in

Re: Cocoa Classes from C++?

2008-05-28 Thread jeffs87
like C++ objects as member variables of an ObjC object I have a little sample program from 2002 by Aaron Hillegass that shows you how to do that. It doesn't show you how to use Cocoa from a C++ object though. I looked for it online but couldn't find it again. I can email it to whoever is

Cocoa Classes from C++?

2008-05-27 Thread J. Todd Slack
Hi All, 1. I wish to create an NSStatusItem. I have ObjC Code to do so, but how can I do this in C++? I dont see any examples anyplace. Must I use ObjC to use NSStatusItem? I would think not! Does anyone have an example dealing with NSStatusItem? 2. Can anyone point me to a reference of

Re: Cocoa Classes from C++?

2008-05-27 Thread Nick Zitzmann
On May 27, 2008, at 5:12 PM, J. Todd Slack wrote: 1. I wish to create an NSStatusItem. I have ObjC Code to do so, but how can I do this in C++? You can't. 2. Can anyone point me to a reference of using Apple's Frameworks with C++ rather than ObjC? There aren't any. ObjC is dynamically

Re: Cocoa Classes from C++?

2008-05-27 Thread Andrew Farmer
On 27 May 08, at 16:12, J. Todd Slack wrote: 1. I wish to create an NSStatusItem. I have ObjC Code to do so, but how can I do this in C++? You can't. Cocoa is a Objective-C framework, and you'll need to write Objective-C code to use it effectively. 2. Can anyone point me to a reference of

Re: Cocoa Classes from C++?

2008-05-27 Thread Kiel Gillard
Hi Jason, Addressing point one, you must use ObjC to use the Cocoa frameworks. For the other points, I suggest you take a look at http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_12_section_2.html to begin with. Also see

Re: Cocoa Classes from C++?

2008-05-27 Thread Jens Alfke
On 27 May '08, at 4:24 PM, Andrew Farmer wrote: don't expect anything really creative (like C++ objects as member variables of an ObjC object) to work quite correctly. We did that the PubSub framework and it works fine, actually. You just have to check the Call C++ Ctors/Dtors in Obj-C

Re: Cocoa Classes from C++?

2008-05-27 Thread Todd Heberlein
On Tuesday, May 27, 2008, at 04:32PM, Jens Alfke [EMAIL PROTECTED] wrote: We did that the PubSub framework and it works fine, actually. You just have to check the Call C++ Ctors/Dtors in Obj-C build option in Xcode. Ooh, I can learn something every day in these mailing lists. :-) Just to

Re: Cocoa Classes from C++?

2008-05-27 Thread Scott Ribe
like C++ objects as member variables of an ObjC object This works fine if you set the right compiler options, which I think has been around since 10.3. -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ___

Re: Cocoa Classes from C++?

2008-05-27 Thread Stefan Werner
On May 27, 2008, at 4:50 PM, Todd Heberlein wrote: The gotchas that I often run into are: (1) Changing an Objective-C file to an Objective-C++ object (by renaming it to a .mm file) often causes me to rename a lot of files to .mm, because if the Objective- C class definition has a C++

Re: Cocoa Classes from C++?

2008-05-27 Thread Chris Hanson
On May 27, 2008, at 5:14 PM, Scott Ribe wrote: like C++ objects as member variables of an ObjC object This works fine if you set the right compiler options, which I think has been around since 10.3. It requires both Mac OS X 10.4 and GCC 4, actually: There is Objective-C runtime

Re: Cocoa Classes from C++?

2008-05-27 Thread Scott Ribe
It requires both Mac OS X 10.4 and GCC 4, actually OK. I thought I had used it earlier, but thinking back more carefully, no, it was not until Tiger that I was able to do this. -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice

Re: Cocoa Classes from C++?

2008-05-27 Thread Jens Alfke
On 27 May '08, at 4:50 PM, Todd Heberlein wrote: (1) Changing an Objective-C file to an Objective-C++ object (by renaming it to a .mm file) often causes me to rename a lot of files to .mm, because if the Objective-C class definition has a C++ object in it, every source code file that

Re: Cocoa Classes from C++?

2008-05-27 Thread Bill Bumgarner
On May 27, 2008, at 8:43 PM, Jens Alfke wrote: This basically tells a white lie to any non-C++-savvy source file that imports the header, telling them that MyCppClass* is just some kind of pointer, and not to worry its pretty little head about exactly what it is. This is safe because (a)

Re: Cocoa Classes from C++?

2008-05-27 Thread Jens Alfke
On 27 May '08, at 8:59 PM, Bill Bumgarner wrote: In this case, it will change the way that GC handles the pointer, depending on how the class is compiled. GC is aware of the layout of objects and will scan only the fields that are marked __strong or are of an Objective-C object reference

Re: Cocoa Classes from C++?

2008-05-27 Thread Bill Bumgarner
On May 27, 2008, at 9:09 PM, Jens Alfke wrote: On 27 May '08, at 8:59 PM, Bill Bumgarner wrote: In this case, it will change the way that GC handles the pointer, depending on how the class is compiled. GC is aware of the layout of objects and will scan only the fields that are marked