00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiWord 00004 * Copyright (C) 2000 AbiSource, Inc. 00005 * Copyright (C) 2001, 2003 Hubert Figuiere 00006 * Copyright (C) 2005 Francis Franklin 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License 00010 * as published by the Free Software Foundation; either version 2 00011 * of the License, or (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00021 * 02110-1301 USA. 00022 */ 00023 00024 #ifndef AP_COCOADIALOG_NEW_H 00025 #define AP_COCOADIALOG_NEW_H 00026 00027 #include <Cocoa/Cocoa.h> 00028 #include "ap_Dialog_New.h" 00029 #import "xap_Cocoa_NSTableUtils.h" 00030 00031 class XAP_CocoaFrame; 00032 class AP_CocoaDialog_New; 00033 00034 @interface AP_CocoaDialog_NewController 00035 : NSWindowController <XAP_CocoaDialogProtocol, NSTableViewDelegate> 00036 { 00037 IBOutlet NSButton * _cancelBtn; 00038 IBOutlet NSButton * _chooseFileBtn; 00039 IBOutlet NSButton * _createNewBtn; 00040 IBOutlet NSButton * _okBtn; 00041 IBOutlet NSButton * _openBtn; 00042 00043 IBOutlet NSTextField * _documentNameData; 00044 00045 IBOutlet NSTableView * _templateList; 00046 00047 AP_CocoaDialog_New * _xap; 00048 00049 XAP_StringListDataSource * _dataSource; 00050 00051 NSMutableArray * m_templates; 00052 } 00053 - (void)tableViewSelectionDidChange:(NSNotification *)aNotification; 00054 - (IBAction)cancelAction:(id)sender; 00055 - (IBAction)radioButtonAction:(id)sender; 00056 - (IBAction)chooseAction:(id)sender; 00057 - (IBAction)okAction:(id)sender; 00058 - (void)synchronizeGUI:(NSControl*)control; 00059 - (BOOL)existingBtnState; 00060 - (void)setExistingBtnState:(BOOL)state; 00061 - (NSString *)newBtnState NS_RETURNS_NOT_RETAINED; // mistaken by clang-analyzer otherwise. 00062 - (void)setFileName:(NSString*)name; 00063 @end 00064 00065 /*****************************************************************/ 00066 00067 class AP_CocoaDialog_New: public AP_Dialog_New 00068 { 00069 public: 00070 AP_CocoaDialog_New(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); 00071 virtual ~AP_CocoaDialog_New(void); 00072 00073 virtual void runModal(XAP_Frame * pFrame); 00074 00075 static XAP_Dialog * static_constructor(XAP_DialogFactory *, 00076 XAP_Dialog_Id dlgid); 00077 00078 void event_Ok (); 00079 void event_Cancel (); 00080 void event_ToggleUseTemplate (const char * name); 00081 void event_ToggleOpenExisting (); 00082 void event_ToggleStartNew (); 00083 00084 private: 00085 XAP_Frame * m_pFrame; 00086 AP_CocoaDialog_NewController* m_dlg; 00087 }; 00088 00089 #endif /* AP_COCOADIALOG_NEW_H */