00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * Copyright (c) 2005 Francis James Franklin 00006 * Copyright (C) 2001, 2009 Hubert Figuiere 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 XAP_COCOADIALOG_LANGUAGE_H 00025 #define XAP_COCOADIALOG_LANGUAGE_H 00026 00027 #import <Cocoa/Cocoa.h> 00028 00029 #include "xap_Dlg_Language.h" 00030 00031 @class XAP_CocoaDialog_Language_Controller; 00032 00033 /*****************************************************************/ 00034 00035 class XAP_CocoaDialog_Language : public XAP_Dialog_Language 00036 { 00037 public: 00038 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); 00039 00040 XAP_CocoaDialog_Language(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); 00041 00042 virtual ~XAP_CocoaDialog_Language(void); 00043 00044 virtual void runModal(XAP_Frame * pFrame); 00045 00046 const char * getNthLanguage (UT_uint32 n) const 00047 { 00048 return (n < m_iLangCount) ? ((const char *) m_ppLanguages[n]) : 0; 00049 } 00050 UT_uint32 getLanguageCount() const { return m_iLangCount; } 00051 00052 const char * getCurrentLanguage() const { return (const char *) m_pLanguage; } 00053 00054 private: 00055 XAP_CocoaDialog_Language_Controller * m_dlg; 00056 }; 00057 00058 @interface XAP_CocoaDialog_Language_Controller : NSWindowController <XAP_CocoaDialogProtocol> 00059 { 00060 IBOutlet NSBox * _selectLanguageBox; 00061 IBOutlet NSButton * _cancelBtn; 00062 IBOutlet NSButton * _okBtn; 00063 IBOutlet NSButton * _documentDefaultBtn; 00064 00065 IBOutlet NSTextField * _documentCurrentLabel; 00066 00067 IBOutlet NSTableView * _languageTable; 00068 00069 NSMutableArray * m_Languages; 00070 00071 NSString * m_Selection; 00072 int m_SelectionIndex; 00073 00074 BOOL m_bApplyToDocument; 00075 00076 XAP_CocoaDialog_Language * _xap; 00077 } 00078 00079 - (id)initFromNib; 00080 - (void)dealloc; 00081 - (void)setXAPOwner:(XAP_Dialog *)owner; 00082 - (void)discardXAP; 00083 - (void)windowDidLoad; 00084 00085 - (NSString *)selectedLanguage; 00086 - (int)indexOfSelectedLanguage; 00087 - (BOOL)applyToDocument; 00088 00089 - (IBAction)aCancel:(id)sender; 00090 - (IBAction)aOK:(id)sender; 00091 - (IBAction)aLanguageTable:(id)sender; 00092 00093 /* NSTableViewDataSource methods 00094 */ 00095 - (int)numberOfRowsInTableView:(NSTableView *)aTableView; 00096 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; 00097 00098 @end 00099 00100 #endif /* XAP_COCOADIALOG_LANGUAGE_H */