1 /*
2 **  PlopWindowController.m
3 **
4 **  Copyright (c) 2002
5 **
6 **  Author: Ludovic Marcotte <ludovic@Sophos.ca>
7 **
8 **  This program is free software; you can redistribute it and/or modify
9 **  it under the terms of the GNU General Public License as published by
10 **  the Free Software Foundation; either version 2 of the License, or
11 **  (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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22 
23 #import <AppKit/AppKit.h>
24 
25 // Because of bug #2751274, on Mac OS X 10.1.x, we set up a #define here
26 // for the AppKit version that is fixed so that the code can automatically switch
27 // over to doing things the right way when the time comes.
28 #define kFixedDockMenuAppKitVersion 632
29 
30 @class Channel;
31 @class PlopView;
32 
33 @interface PlopWindowController : NSWindowController
34 {
35   // Outlets
36   IBOutlet NSTextView *textView;
37 
38   // Other ivar
39   Channel *channel;
40   NSMenu *dockMenu;
41   NSMenu *dockSubMenu;
42 }
43 
44 - (id) initWithWindowNibName: (NSString *) theNibName;
45 - (void) dealloc;
46 
47 
48 //
49 // delegate methods
50 //
51 - (void) windowDidBecomeKey: (NSNotification *) aNotification;
52 - (void) windowDidLoad;
53 - (void) windowDidMove: (NSNotification *) aNotification;
54 - (void) windowDidResize: (NSNotification *) aNotification;
55 - (void) windowWillClose: (NSNotification *) theNotification;
56 
57 //
58 // action methods
59 //
60 #ifdef MACOSX
61 - (IBAction) dockItemSelected: (id) sender;
62 - (IBAction) dockItemUpdate: (id) sender;
63 #endif
64 
65 //
66 // access / mutation
67 //
68 + (id) lastPlopWindowOnTop;
69 - (NSTextView *) textView;
70 - (PlopView *) plopView;
71 
72 - (Channel *) channel;
73 - (void) setChannel: (Channel *) theChannel;
74 
75 
76 //
77 // Other methods
78 //
79 - (BOOL) openURL: (NSURL *) theURL;
80 - (void) update;
81 
82 @end
83 
84 //
85 // private methods
86 //
87 @interface PlopWindowController (Private)
88 
89 - (void) _updateWindowFrame;
90 #ifdef MACOSX
91 - (NSMenuItem *) _constructMenuItem: (NSString *) theTitle action: (SEL) theSelector url: (NSURL *) theURL;
92 #endif
93 
94 @end
95