1 /* -*- mode:objc; coding:utf-8; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- */
2 /*
3   Copyright (c) 2003-2005 MacUIM contributors, All rights reserved.
4 
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8 
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11   2. Redistributions in binary form must reproduce the above copyright
12      notice, this list of conditions and the following disclaimer in the
13      documentation and/or other materials provided with the distribution.
14   3. Neither the name of authors nor the names of its contributors
15      may be used to endorse or promote products derived from this software
16      without specific prior written permission.
17 
18   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
22   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28   SUCH DAMAGE.
29 */
30 
31 #import <Cocoa/Cocoa.h>
32 #import <PreferencePanes/PreferencePanes.h>
33 #import <SystemConfiguration/SystemConfiguration.h>
34 
35 
36 int
37 CoreMenuExtraGetMenuExtra(CFStringRef identifier, void *menuExtra);
38 
39 int
40 CoreMenuExtraAddMenuExtra(CFURLRef path, int position, int whoCares,
41                           int whoCares2, int whoCares3, int whoCares4);
42 
43 int
44 CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
45 
46 
47 typedef struct _IMModule {
48   int index;
49   char *name;
50   char *lang;
51   bool on;
52 
53 } IMModule;
54 
55 @interface MacUIMPrefPane : NSPreferencePane
56 {
57   SCDynamicStoreRef scSession;
58   SCDynamicStoreContext scContext;
59 
60   IBOutlet NSTabView *tab;
61   IBOutlet NSPopUpButton *imButton;
62   IBOutlet NSMatrix *listDirection;
63   IBOutlet NSButton *modeTipsButton;
64   IBOutlet NSButton *appletButton;
65   IBOutlet NSTableView *imTable;
66   IBOutlet NSSlider *opacitySlider;
67   IBOutlet NSTextField *fontSample;
68   IBOutlet NSButton *annotationButton;
69 
70   CFStringRef appID;
71 
72   int numModules;
73   IMModule **imModules;
74 
75   NSMutableArray *imOnArray;
76   NSMutableArray *imNameArray;
77   NSMutableArray *imScriptArray;
78 
79   NSFont *font;
80 }
81 
82 - (IBAction)imChange:(id)sender;
83 
84 - (IBAction)appletChange:(id)sender;
85 
86 - (IBAction)imSwitchChange:(id)sender;
87 
88 - (IBAction)imSwitchApply:(id)sender;
89 
90 - (IBAction)listDirectionChange:(id)sender;
91 
92 - (IBAction)modeTipsChange:(id)sender;
93 
94 - (IBAction)opacityChange:(id)sender;
95 
96 - (IBAction)chooseFont:(id)sender;
97 
98 - (IBAction)annotationChange:(id)sender;
99 
100 - (void)changeFont:(id)sender;
101 
102 - (void)setFont:(id)sender;
103 
104 - (void)prefSync;
105 
106 - (void)loadExtra;
107 
108 - (void)removeExtra:(NSString *)extraID;
109 
110 - (BOOL)isExtraLoaded:(NSString *)extraID;
111 
112 - (int)charArrayToUni:(char *)charArray
113                uniStr:(UniCharPtr *)strUni
114              encoding:(CFStringEncoding)enc;
115 
116 - (void)loadPrefs:(NSString *)im;
117 
118 - (void)updateFontSample;
119 
120 + (id)sharedPane;
121 
122 @end
123