Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Contextual Finder Menus

Contextual Finder Menus
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Dec 13, 2001, 01:04 PM
 
Apparently, Apple does have a framework in place for creating Contextual menu plugins. Has anyone noticed that XRay installs a file here:
~/Library/Contextual Menu Items/XRay Contextual Menu.plugin

It even has a nice icon and everything. I looked and can't find a single shred of documentation on this.
     
Mac Elite
Join Date: Mar 2001
Location: somewhere in ohio
Status: Offline
Reply With Quote
Dec 13, 2001, 09:38 PM
 
It's not so much having the framework, it's the documentation and the ability to provide examples to developers so they know how to make them. Same goes for the Input Devices (gamepads and the like), the framework is there, but they don't have the ability to demonstrate it yet. While its good to see Apple implementing this, it would also be nice to have sample so that we can in turn develop for them.
     
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Dec 14, 2001, 11:33 AM
 
So my question is - where did the guy that wrote XRay get the information? Is it a relic from NeXT? Do premium developers get this info and it has to trickle down to us? Was it just hacking?
     
Senior User
Join Date: Aug 2001
Location: CA
Status: Offline
Reply With Quote
Dec 14, 2001, 10:24 PM
 
Originally posted by absmiths:
<STRONG>So my question is - where did the guy that wrote XRay get the information? Is it a relic from NeXT? Do premium developers get this info and it has to trickle down to us? Was it just hacking?</STRONG>
It's right there in Menus.h.

Great way to search the docs/headers:

Create new carbon project in PB, turn on indexing, and build it.

Then go to "find", search "this project, frameworks only" and search for "contextual". You can also select "Definitions" in the second menu and find only function definitions with your string, and you get a link to the docs right there!

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
<font color = brown>/*————————————————————————————————————————————————— —————————————————————————————————————*/</font>
<font color = brown>/* Contextual Menu Plugin Interface */</font>
<font color = brown>/* */</font>
<font color = brown>/* For Mac OS X, we will support a new type of Contextual Menu Plugin: the CFPlugIn */</font>
<font color = brown>/* based plugin. Each plugin must be in a CFPlugIn in the Contextual Menu Items */</font>
<font color = brown>/* folder in one of these paths: */</font>
<font color = brown>/* /System/Library/Contextual Menu Items/ */</font>
<font color = brown>/* /Library/Contextual Menu Items/ */</font>
<font color = brown>/* ~/Library/Contextual Menu Items/ */</font>
<font color = brown>/* */</font>
<font color = brown>/* It must export the following functions using the following interface or a C++ */</font>
<font color = brown>/* interface inheriting from IUnknown and including similar functions. */</font>
<font color = brown>/*————————————————————————————————————————————————— —————————————————————————————————————*/</font>

<font color = brown>// The Contextual Menu Manager will only load CFPlugIns of type kContextualMenuTypeID</font>
#define kContextualMenuTypeID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
0x2F, 0x65, 0x22, 0xE9, 0x3E, 0x66, 0x11, 0xD5, \
0x80, 0xA7, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
<font color = brown>// 2F6522E9-3E66-11D5-80A7-003065B300BC</font>

<font color = brown>// Contextual Menu Plugins must implement this Contexual Menu Plugin Interface.</font>
#define kContextualMenuInterfaceID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
0x32, 0x99, 0x7B, 0x62, 0x3E, 0x66, 0x11, 0xD5, \
0xBE, 0xAB, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
<font color = brown>// 32997B62-3E66-11D5-BEAB-003065B300BC</font>

#define CM_IUNKNOWN_C_GUTS \
void *_reserved; \
SInt32 (*QueryInterface)(void *thisPointer, CFUUIDBytes iid, void ** ppv); \
UInt32 (*AddRef)(void *thisPointer); \
UInt32 (*Release)(void *thisPointer)

<font color = brown>// The function table for the interface.</font>
struct ContextualMenuInterfaceStruct
{
CM_IUNKNOWN_C_GUTS;
OSStatus ( *ExamineContext )(
void* thisInstance,
const AEDesc* inContext,
AEDescList* outCommandPairs );
OSStatus ( *HandleSelection )(
void* thisInstance,
AEDesc* inContext,
SInt32 inCommandID );
void ( *PostMenuCleanup )(
void* thisInstance );
};
typedef struct ContextualMenuInterfaceStruct ContextualMenuInterfaceStruct;

<font color = brown>/*
* CMPluginExamineContext()
*
* Availability:
* Implemented by client
*/</font>
extern OSStatus
CMPluginExamineContext(
void * thisInstance,
const AEDesc * inContext,
AEDescList * outCommandPairs);


<font color = brown>/*
* CMPluginHandleSelection()
*
* Availability:
* Implemented by client
*/</font>
extern OSStatus
CMPluginHandleSelection(
void * thisInstance,
AEDesc * inContext,
SInt32 inCommandID);


<font color = brown>/*
* CMPluginPostMenuCleanup()
*
* Availability:
* Implemented by client
*/</font>
extern void
CMPluginPostMenuCleanup(void * thisInstance);

</font>[/code]
Dual 800 - GF3 - 1.5GB
     
Senior User
Join Date: Aug 2001
Location: CA
Status: Offline
Reply With Quote
Dec 15, 2001, 02:53 AM
 
Aha! I found OSX sample code for a CM Plugin which implements the above API.

It is on the iDisk "geowar1", public folder.

Unfortunately he has not set up file sharing so you have to use iDisk to get to it. Easiest way is to go to iTools on apple.com, log in and choose open public folder.

-Ben
Dual 800 - GF3 - 1.5GB
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:04 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2