1 | /* |
---|
2 | * Adium is the legal property of its developers, whose names are listed in the copyright file included |
---|
3 | * with this source distribution. |
---|
4 | * |
---|
5 | * This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
6 | * General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
7 | * or (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
10 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | * Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License along with this program; if not, |
---|
14 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | #import <Adium/AIWindowController.h> |
---|
18 | |
---|
19 | typedef enum { |
---|
20 | AITextAndButtonsDefaultReturn = 1, |
---|
21 | AITextAndButtonsAlternateReturn = 0, |
---|
22 | AITextAndButtonsOtherReturn = -1, |
---|
23 | AITextAndButtonsClosedWithoutResponse = -2 |
---|
24 | } AITextAndButtonsReturnCode; |
---|
25 | |
---|
26 | typedef enum { |
---|
27 | AITextAndButtonsWindowButtonDefault = 0, |
---|
28 | AITextAndButtonsWindowButtonAlternate, |
---|
29 | AITextAndButtonsWindowButtonOther |
---|
30 | } AITextAndButtonsWindowButton; |
---|
31 | |
---|
32 | @interface ESTextAndButtonsWindowController : AIWindowController { |
---|
33 | IBOutlet NSTextView *textView_messageHeader; |
---|
34 | IBOutlet NSScrollView *scrollView_messageHeader; |
---|
35 | |
---|
36 | IBOutlet NSTextView *textView_message; |
---|
37 | IBOutlet NSScrollView *scrollView_message; |
---|
38 | IBOutlet NSButton *button_default; |
---|
39 | IBOutlet NSButton *button_alternate; |
---|
40 | IBOutlet NSButton *button_other; |
---|
41 | |
---|
42 | IBOutlet NSImageView *imageView; |
---|
43 | |
---|
44 | NSString *title; |
---|
45 | NSString *defaultButton; |
---|
46 | NSString *alternateButton; |
---|
47 | NSString *otherButton; |
---|
48 | NSString *messageHeader; |
---|
49 | NSAttributedString *message; |
---|
50 | NSImage *image; |
---|
51 | id target; |
---|
52 | id userInfo; |
---|
53 | |
---|
54 | BOOL userClickedButton; //Did the user click a button to begin closing the window? |
---|
55 | BOOL allowsCloseWithoutResponse; //Is it okay to close without clicking a button? |
---|
56 | } |
---|
57 | |
---|
58 | + (id)showTextAndButtonsWindowWithTitle:(NSString *)inTitle |
---|
59 | defaultButton:(NSString *)inDefaultButton |
---|
60 | alternateButton:(NSString *)inAlternateButton |
---|
61 | otherButton:(NSString *)inOtherButton |
---|
62 | onWindow:(NSWindow *)parentWindow |
---|
63 | withMessageHeader:(NSString *)inMessageHeader |
---|
64 | andMessage:(NSAttributedString *)inMessage |
---|
65 | image:(NSImage *)inImage |
---|
66 | target:(id)inTarget |
---|
67 | userInfo:(id)inUserInfo; |
---|
68 | |
---|
69 | + (id)showTextAndButtonsWindowWithTitle:(NSString *)inTitle |
---|
70 | defaultButton:(NSString *)inDefaultButton |
---|
71 | alternateButton:(NSString *)inAlternateButton |
---|
72 | otherButton:(NSString *)inOtherButton |
---|
73 | onWindow:(NSWindow *)parentWindow |
---|
74 | withMessageHeader:(NSString *)inMessageHeader |
---|
75 | andMessage:(NSAttributedString *)inMessage |
---|
76 | target:(id)inTarget |
---|
77 | userInfo:(id)inUserInfo; |
---|
78 | + (id)controller; |
---|
79 | |
---|
80 | - (void)changeWindowToTitle:(NSString *)inTitle |
---|
81 | defaultButton:(NSString *)inDefaultButton |
---|
82 | alternateButton:(NSString *)inAlternateButton |
---|
83 | otherButton:(NSString *)inOtherButton |
---|
84 | withMessageHeader:(NSString *)inMessageHeader |
---|
85 | andMessage:(NSAttributedString *)inMessage |
---|
86 | image:(NSImage *)inImage |
---|
87 | target:(id)inTarget |
---|
88 | userInfo:(id)inUserInfo; |
---|
89 | |
---|
90 | - (IBAction)pressedButton:(id)sender; |
---|
91 | |
---|
92 | - (void)show; |
---|
93 | - (void)setAllowsCloseWithoutResponse:(BOOL)inAllowsCloseWithoutResponse; |
---|
94 | - (void)setImage:(NSImage *)image; |
---|
95 | - (void)setKeyEquivalent:(NSString *)keyEquivalent modifierMask:(unsigned int)mask forButton:(AITextAndButtonsWindowButton)windowButton; |
---|
96 | |
---|
97 | @end |
---|
98 | |
---|
99 | @interface NSObject (ESTextAndButtonsTarget) |
---|
100 | //Return YES to let the window close; NO not to let it close |
---|
101 | - (BOOL)textAndButtonsWindowDidEnd:(NSWindow *)window returnCode:(AITextAndButtonsReturnCode)returnCode userInfo:(id)userInfo; |
---|
102 | @end |
---|
103 | |
---|