Difference between revisions of "Mac OS X Porting - Proxy Icon implementation"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Added reference to 'Apple Human Interface Guidelines: Window Elements')
Line 76: Line 76:
  
 
[http://search.lists.apple.com/?q=proxy+icon&cmd=Search%21 Proxy Icon search on Apple lists]
 
[http://search.lists.apple.com/?q=proxy+icon&cmd=Search%21 Proxy Icon search on Apple lists]
 +
 +
[http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html Apple Human Interface Guidelines: Window Elements] "A standard document window ''may'' also have … A proxy icon (after a document has been saved)…"
  
  

Revision as of 10:31, 1 September 2008

Started


After, just a quick look, the concerned code could be in vcl/aqua/source/window/salframe.cxx :

First idea: create AquaSalFrame::SetProxyIcon (WindowRef inWindow, FSRef * outRef )

We immediately see what we need is the path ( FSRef ) of the concerned file contained in the window, and the pointer on the Window (not a problem)

Other need: check whether the window is a document or not (help, preferences, dialog box .. and so on).

-> ask dev@ or dev@framework for the info

Maybe check whether void AquaSalFrame::SetIcon( USHORT nIcon ) or maybe void AquaSalFrame::SetTitle(const XubString& rTitle) can help


The probable right function to use is (copied from XCode documentation) :

HIWindowGetProxyFSRef Obtains the FSRef used to determine the proxy icon for a window.

OSStatus HIWindowGetProxyFSRef (
  WindowRef inWindow,
  FSRef * outRef
);

Parameters inWindow The window whose proxy FSRef is to be obtained.

outRef On exit, the FSRef for the window’s proxy icon.

Return Value A result code. See “Window Manager Result Codes”.

Discussion If the specified window’s proxy icon has been specified using HIWindowSetProxyFSRef or SetWindowProxyAlias, HIWindowGetProxyFSRef returns noErr and a valid FSRef for the window’s proxy icon. If the window has no proxy icon, or if the icon was specified by calling SetWindowProxyCreatorAndType or SetWindowProxyIcon, this function returns an error.

Availability Available in Mac OS X v10.4 and later. Declared In MacWindows.h


Sample code from http://developer.apple.com/samplecode/MovieVideoChart/listing3.html :



static OSStatus setWindowTitleAndProxyFromFSRef( WindowRef window, FSRef *fileRef )
{
    OSStatus err = noErr;
  HFSUniStr255 name;
  CFStringRef fileName = NULL;
  
  err = FSGetCatalogInfo( fileRef, 0, NULL, &name, NULL, NULL );
    require_noerr( err, CantGetInfo );
  
  fileName = CFStringCreateWithCharacters( kCFAllocatorDefault, name.unicode, name.length );
  SetWindowTitleWithCFString( window, fileName );
  HIWindowSetProxyFSRef( window, fileRef );
  SetWindowModified( window, false );

CantGetInfo:
  if( fileName )
    CFRelease( fileName );
  return err;
}

Links (to be improved):

Sample code (Carbon, can be obsolete)

Proxy Icon search on Apple lists

Apple Human Interface Guidelines: Window Elements "A standard document window may also have … A proxy icon (after a document has been saved)…"


Ericb 13:03, 30 August 2008 (CEST) 

Personal tools