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 <Foundation/Foundation.h> 32 #import <uim.h> 33 #import <uim-helper.h> 34 #import "SystemUIPlugin.h" 35 #import "MacUIMHelperView.h" 36 37 38 #define kMenuBarWidth 19 39 #define kMenuBarWidth2 38 40 #define kMenuBarWidth3 57 41 #define kMenuBarHeight 22 42 43 44 @interface MacUIMHelperExtra : NSMenuExtra 45 { 46 NSMenu *menu; 47 MacUIMHelperView *view; 48 49 #ifdef NEW_HELPER 50 int is_helper_connect; 51 #else 52 int uimFD; 53 #endif 54 NSFileHandle *uimHandle; 55 56 NSString *imName; 57 58 NSMutableArray *branchPoints; 59 NSMutableArray *modes; 60 NSMutableArray *propNames; 61 NSMutableArray *menuItems; 62 63 NSMutableArray *labels; 64 65 NSMutableArray *imNames; 66 NSMutableArray *imItems; 67 68 BOOL clicked; 69 } 70 71 - (NSImage *)createImage:(BOOL)alter; 72 - (void)renderFrame:(NSImage *)image; 73 - (void)renderText:(NSImage *)image; 74 - (void)updateMenu; 75 - (void)modeSelect:(id)sender; 76 - (void)imSelect:(id)sender; 77 - (void)openSystemPrefs:(id)sender; 78 - (int)helperConnect; 79 - (void)helperRead:(NSNotification *)notification; 80 - (void)helperParse:(char *)str; 81 - (void)helperClose; 82 - (void)helperDisconnect; 83 - (void)propListUpdate:(NSArray *)lines; 84 - (void)propLabelUpdate:(NSArray *)lines; 85 - (void)loadPrefs; 86 87 + (id)sharedExtra; 88 89 @end 90