00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * Copyright (C) 2001-2003, 2009 Hubert Figuiere 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #ifndef XAP_COCOADIALOG_FILEOPENSAVEAS_H 00024 #define XAP_COCOADIALOG_FILEOPENSAVEAS_H 00025 00026 #import <Cocoa/Cocoa.h> 00027 00028 #include "xap_Dlg_FileOpenSaveAs.h" 00029 00030 class XAP_CocoaFrame; 00031 class XAP_CocoaDialog_FileOpenSaveAs; 00032 00033 00034 @interface XAP_OpenSavePanel_AccessoryController 00035 : NSObject<NSOpenSavePanelDelegate> 00036 { 00037 IBOutlet NSTextField * oFTLabel; 00038 IBOutlet NSPopUpButton * oFTPopUp; 00039 IBOutlet NSView * oFTAccessoryView; 00040 00041 XAP_CocoaDialog_FileOpenSaveAs * _xap; 00042 } 00043 00044 - (id)initWithXAP:(XAP_CocoaDialog_FileOpenSaveAs*)xap; 00045 00046 - (NSView *)fileTypeAccessoryView; 00047 - (void)setFileTypeLabel:(const std::string &)label; 00048 - (void)setSelectedFileType:(int)type; 00049 00050 - (void)removeItemsOfFileTypesMenu; 00051 - (void)addItemWithTitle:(NSString *)title fileType:(int)type; 00052 00053 - (IBAction)selectFileType:(id)sender; 00054 @end 00055 00056 /*****************************************************************/ 00057 00058 class XAP_CocoaDialog_FileOpenSaveAs : public XAP_Dialog_FileOpenSaveAs 00059 { 00060 public: 00061 XAP_CocoaDialog_FileOpenSaveAs(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); 00062 virtual ~XAP_CocoaDialog_FileOpenSaveAs(void); 00063 00064 virtual void runModal(XAP_Frame * pFrame); 00065 00066 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); 00067 00068 void _setSelectedFileType (UT_sint32 type); 00069 00070 private: 00071 NSSavePanel * _makeOpenPanel(); 00072 NSSavePanel * _makeSavePanel(const std::string & label); 00073 00074 XAP_OpenSavePanel_AccessoryController * m_accessoryViewsController; 00075 00076 NSSavePanel * m_panel; 00077 NSMutableArray * m_fileTypes; 00078 00079 const char * m_szFileTypeDescription; 00080 UT_uint32 m_szFileTypeCount; 00081 00082 bool m_bPanelActive; 00083 bool m_bOpenPanel; 00084 bool m_bIgnoreCancel; 00085 }; 00086 00087 #endif /* XAP_COCOADIALOG_FILEOPENSAVEAS_H */