I have an objc program and i would like to use a widget that is written in objc++ (namely https://launchpad.net/scintilla-cocoa). How do i go about this? Basically i want a new window controller object to interface with this objc++ library to define a scintilla text editor widget. Simply creating a new ‘objc class’ and accessing the library from there generates a bunch of errors related to the C++ class keyword and so on.
Thanks in advance
Since I’m the one who put you into the (hopefully rewarding :-)) trouble of using Scintilla, here I am.
Let’s say we create a
ScintillaViewsubclass, namedppScintillaEditor.The file should have an
.mmextension (e.g.ppScintillaEditor.mm)The code would be roughly like this…
Interface
Now, as for the implementation part, remember to put some initialization method to set up the view properly (as in the example accompanying Scintilla-cocoa; I mean the Test project)
Sidenote : Of course, you can create subclasses, categories or whatever on top the
ScintillaViewclass, pretty much based on what you need – I, for example, have create a separate Category just in order to group there someScintillaViewspecific commands (sooner or later, you’ll notice that for some more advanced Scintilla manipulations, although it’s there, it may need some polishing to be a bit more cocoa-friendly, so here you go…)Now, last but not least…
To resolve the
"bunch of errors related to the C++ class keyword and so on", as I’ve shown in my other video-response to your comment, all you have to do is :Add to both Debug and Release :
And that’s it. 🙂
Hint : The above are defined by Scintilla to avoid clashes between C and non-C elements, like above… so, all it takes is to notify the preprocessor and the rest is taken care of….