| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Application Framework |
| 4 |
* Copyright (C) 1998 AbiSource, Inc. |
| 5 |
* Copyright (c) 2005 Francis James Franklin |
| 6 |
* Copyright (C) 2001, 2009 Hubert Figuiere |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2 |
| 11 |
* of the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 21 |
* 02110-1301 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef XAP_COCOADIALOG_LANGUAGE_H |
| 25 |
#define XAP_COCOADIALOG_LANGUAGE_H |
| 26 |
|
| 27 |
#import <Cocoa/Cocoa.h> |
| 28 |
|
| 29 |
#include "xap_Dlg_Language.h" |
| 30 |
|
| 31 |
@class XAP_CocoaDialog_Language_Controller; |
| 32 |
|
| 33 |
/*****************************************************************/ |
| 34 |
|
| 35 |
class XAP_CocoaDialog_Language : public XAP_Dialog_Language |
| 36 |
{ |
| 37 |
public: |
| 38 |
static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); |
| 39 |
|
| 40 |
XAP_CocoaDialog_Language(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); |
| 41 |
|
| 42 |
virtual ~XAP_CocoaDialog_Language(void); |
| 43 |
|
| 44 |
virtual void runModal(XAP_Frame * pFrame); |
| 45 |
|
| 46 |
const char * getNthLanguage (UT_uint32 n) const |
| 47 |
{ |
| 48 |
return (n < m_iLangCount) ? ((const char *) m_ppLanguages[n]) : 0; |
| 49 |
} |
| 50 |
UT_uint32 getLanguageCount() const { return m_iLangCount; } |
| 51 |
|
| 52 |
const char * getCurrentLanguage() const { return (const char *) m_pLanguage; } |
| 53 |
|
| 54 |
private: |
| 55 |
XAP_CocoaDialog_Language_Controller * m_dlg; |
| 56 |
}; |
| 57 |
|
| 58 |
@interface XAP_CocoaDialog_Language_Controller : NSWindowController <XAP_CocoaDialogProtocol> |
| 59 |
{ |
| 60 |
IBOutlet NSBox * _selectLanguageBox; |
| 61 |
IBOutlet NSButton * _cancelBtn; |
| 62 |
IBOutlet NSButton * _okBtn; |
| 63 |
IBOutlet NSButton * _documentDefaultBtn; |
| 64 |
|
| 65 |
IBOutlet NSTextField * _documentCurrentLabel; |
| 66 |
|
| 67 |
IBOutlet NSTableView * _languageTable; |
| 68 |
|
| 69 |
NSMutableArray * m_Languages; |
| 70 |
|
| 71 |
NSString * m_Selection; |
| 72 |
int m_SelectionIndex; |
| 73 |
|
| 74 |
BOOL m_bApplyToDocument; |
| 75 |
|
| 76 |
XAP_CocoaDialog_Language * _xap; |
| 77 |
} |
| 78 |
|
| 79 |
- (id)initFromNib; |
| 80 |
- (void)dealloc; |
| 81 |
- (void)setXAPOwner:(XAP_Dialog *)owner; |
| 82 |
- (void)discardXAP; |
| 83 |
- (void)windowDidLoad; |
| 84 |
|
| 85 |
- (NSString *)selectedLanguage; |
| 86 |
- (int)indexOfSelectedLanguage; |
| 87 |
- (BOOL)applyToDocument; |
| 88 |
|
| 89 |
- (IBAction)aCancel:(id)sender; |
| 90 |
- (IBAction)aOK:(id)sender; |
| 91 |
- (IBAction)aLanguageTable:(id)sender; |
| 92 |
|
| 93 |
/* NSTableViewDataSource methods |
| 94 |
*/ |
| 95 |
- (int)numberOfRowsInTableView:(NSTableView *)aTableView; |
| 96 |
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; |
| 97 |
|
| 98 |
@end |
| 99 |
|
| 100 |
#endif /* XAP_COCOADIALOG_LANGUAGE_H */ |