| 1 | /* X11Controller.h -- connect the IB ui |
| 2 | * |
| 3 | * Copyright (c) 2002-2012 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person |
| 6 | * obtaining a copy of this software and associated documentation files |
| 7 | * (the "Software"), to deal in the Software without restriction, |
| 8 | * including without limitation the rights to use, copy, modify, merge, |
| 9 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 10 | * and to permit persons to whom the Software is furnished to do so, |
| 11 | * subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be |
| 14 | * included in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT |
| 20 | * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | * DEALINGS IN THE SOFTWARE. |
| 24 | * |
| 25 | * Except as contained in this notice, the name(s) of the above |
| 26 | * copyright holders shall not be used in advertising or otherwise to |
| 27 | * promote the sale, use or other dealings in this Software without |
| 28 | * prior written authorization. |
| 29 | */ |
| 30 | |
| 31 | #ifndef X11CONTROLLER_H |
| 32 | #define X11CONTROLLER_H 1 |
| 33 | |
| 34 | #ifdef HAVE_DIX_CONFIG_H |
| 35 | #include <dix-config.h> |
| 36 | #endif |
| 37 | |
| 38 | #if __OBJC__ |
| 39 | |
| 40 | #include "sanitizedCocoa.h" |
| 41 | #include "xpr/x-list.h" |
| 42 | |
| 43 | #ifdef XQUARTZ_SPARKLE |
| 44 | #define BOOL OSX_BOOL |
| 45 | #include <Sparkle/SUUpdater.h> |
| 46 | #undef BOOL |
| 47 | #endif |
| 48 | |
| 49 | #ifndef NSINTEGER_DEFINED |
| 50 | #if __LP64__ || NS_BUILD_32_LIKE_64 |
| 51 | typedef long NSInteger; |
| 52 | typedef unsigned long NSUInteger; |
| 53 | #else |
| 54 | typedef int NSInteger; |
| 55 | typedef unsigned int NSUInteger; |
| 56 | #endif |
| 57 | #endif |
| 58 | |
| 59 | @interface X11Controller : NSObject |
| 60 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 |
| 61 | <NSTableViewDataSource> |
| 62 | #endif |
| 63 | { |
| 64 | IBOutlet NSPanel *prefs_panel; |
| 65 | |
| 66 | IBOutlet NSButton *fake_buttons; |
| 67 | IBOutlet NSButton *enable_fullscreen; |
| 68 | IBOutlet NSButton *enable_fullscreen_menu; |
| 69 | IBOutlet NSTextField *enable_fullscreen_menu_text; |
| 70 | IBOutlet NSButton *enable_keyequivs; |
| 71 | IBOutlet NSButton *sync_keymap; |
| 72 | IBOutlet NSButton *option_sends_alt; |
| 73 | IBOutlet NSButton *scroll_in_device_direction; |
| 74 | IBOutlet NSButton *click_through; |
| 75 | IBOutlet NSButton *focus_follows_mouse; |
| 76 | IBOutlet NSButton *focus_on_new_window; |
| 77 | IBOutlet NSButton *enable_auth; |
| 78 | IBOutlet NSButton *enable_tcp; |
| 79 | IBOutlet NSButton *sync_pasteboard; |
| 80 | IBOutlet NSButton *sync_pasteboard_to_clipboard; |
| 81 | IBOutlet NSButton *sync_pasteboard_to_primary; |
| 82 | IBOutlet NSButton *sync_clipboard_to_pasteboard; |
| 83 | IBOutlet NSButton *sync_primary_immediately; |
| 84 | IBOutlet NSTextField *sync_text1; |
| 85 | IBOutlet NSTextField *sync_text2; |
| 86 | IBOutlet NSPopUpButton *depth; |
| 87 | |
| 88 | IBOutlet NSMenuItem *window_separator; |
| 89 | // window_separator is DEPRECATED due to this radar: |
| 90 | // <rdar://problem/7088335> NSApplication releases the separator in the Windows menu even though it's an IBOutlet |
| 91 | // It is kept around for localization compatability and is subject to removal "eventually" |
| 92 | // If it is !NULL (meaning it is in the nib), it is removed from the menu and released |
| 93 | |
| 94 | IBOutlet NSMenuItem *x11_about_item; |
| 95 | IBOutlet NSMenuItem *dock_window_separator; |
| 96 | IBOutlet NSMenuItem *apps_separator; |
| 97 | IBOutlet NSMenuItem *toggle_fullscreen_item; |
| 98 | #ifdef XQUARTZ_SPARKLE |
| 99 | NSMenuItem *check_for_updates_item; // Programatically enabled |
| 100 | #endif |
| 101 | IBOutlet NSMenuItem *copy_menu_item; |
| 102 | IBOutlet NSMenu *dock_apps_menu; |
| 103 | IBOutlet NSTableView *apps_table; |
| 104 | |
| 105 | NSArray *apps; |
| 106 | NSMutableArray *table_apps; |
| 107 | |
| 108 | IBOutlet NSMenu *dock_menu; |
| 109 | |
| 110 | // This is where in the Windows menu we'll start (this will be the index of the separator) |
| 111 | NSInteger windows_menu_start; |
| 112 | |
| 113 | int checked_window_item; |
| 114 | x_list *pending_apps; |
| 115 | |
| 116 | OSX_BOOL finished_launching; |
| 117 | OSX_BOOL can_quit; |
| 118 | } |
| 119 | |
| 120 | - (void)set_window_menu:(NSArray *)list; |
| 121 | - (void)set_window_menu_check:(NSNumber *)n; |
| 122 | - (void)set_apps_menu:(NSArray *)list; |
| 123 | #ifdef XQUARTZ_SPARKLE |
| 124 | - (void)setup_sparkle; |
| 125 | - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *) |
| 126 | update; |
| 127 | #endif |
| 128 | - (void)set_can_quit:(OSX_BOOL)state; |
| 129 | - (void)server_ready; |
| 130 | - (OSX_BOOL)application:(NSApplication *)app openFile:(NSString *)filename; |
| 131 | |
| 132 | - (IBAction)apps_table_show:(id)sender; |
| 133 | - (IBAction)apps_table_done:(id)sender; |
| 134 | - (IBAction)apps_table_new:(id)sender; |
| 135 | - (IBAction)apps_table_duplicate:(id)sender; |
| 136 | - (IBAction)apps_table_delete:(id)sender; |
| 137 | - (IBAction)bring_to_front:(id)sender; |
| 138 | - (IBAction)close_window:(id)sender; |
| 139 | - (IBAction)minimize_window:(id)sender; |
| 140 | - (IBAction)zoom_window:(id)sender; |
| 141 | - (IBAction)next_window:(id)sender; |
| 142 | - (IBAction)previous_window:(id)sender; |
| 143 | - (IBAction)enable_fullscreen_changed:(id)sender; |
| 144 | - (IBAction)toggle_fullscreen:(id)sender; |
| 145 | - (IBAction)prefs_changed:(id)sender; |
| 146 | - (IBAction)prefs_show:(id)sender; |
| 147 | - (IBAction)quit:(id)sender; |
| 148 | - (IBAction)x11_help:(id)sender; |
| 149 | |
| 150 | @end |
| 151 | |
| 152 | #endif /* __OBJC__ */ |
| 153 | |
| 154 | void |
| 155 | X11ControllerMain(int argc, char **argv, char **envp); |
| 156 | |
| 157 | #endif /* X11CONTROLLER_H */ |