discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom options during save in a document app


From: Wolfgang Lux
Subject: Re: custom options during save in a document app
Date: Sat, 6 Oct 2012 14:40:30 +0200

Riccardo Mottola wrote:

> Hi,
> 
> Wolfgang Lux wrote:
>> Riccardo Mottola wrote:
>> 
>>> is changeSaveType, undocumented, available on both Mac and GS? or is it 
>>> some kind of extension? That would be the place probably where to add the 
>>> view-swizzling code.
>> It is available on both Cocoa and GNUstep (otherwise, I wouldn't have 
>> suggested using it :-)
>> 
> Indeed, it exists and works. I just get a warning when I call [super 
> changeSaveType:sender] but it works as advertised (well from you, Apple keeps 
> it hidden!).

You might add a declaration
@interface NSDocument(Hidden)
- (void)changeSaveType: (NSString *)fileType;
@end
to get rid of the warning.

> Perhaps the best thing would be to add/remove from the accessoryView the 
> options for each file tye and make it totally dynamic.
> 
> Now  some further questions:
> how do I get the current accessory view to modify it with my stuff? I could 
> call "superview" on the sender which is the popupbutton, but it seems dirty. 
> [savePanel accessoryView] ? I tried getting the accessoryView and making it 
> larger, but it doesn't work, it is a NSBox, which makes sense under Mac. 
> Perhaps the default one is not saved in accessoryView?

If changing the size of the accessory view doesn't work, create your own view 
and make the view returned from -accessoryView a subview of your own view. On 
the other hand, if the accessory view is a NSBox on Cocoa, you may want to 
create your own NSBox for the accessory view and only add the content view of 
the NSBox to your view.

> Second, in the changeSaveType method I need to know which filetype was 
> selected. The document has not yet an updated fileType (hence the need of 
> fileTYpeFromLastRunSavePanel of course).

The new file type is passed as argument to the -changeSaveType: method.

Wolfgang


reply via email to

[Prev in Thread] Current Thread [Next in Thread]