File: Components.h

package info (click to toggle)
grr.app 1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 3,948 kB
  • ctags: 118
  • sloc: objc: 4,019; sh: 72; makefile: 18
file content (116 lines) | stat: -rw-r--r-- 3,787 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
   Grr RSS Reader
   
   Copyright (C) 2006, 2007 Guenther Noack <guenther@unix-ag.uni-kl.de>
   Copyright (C) 2009  GNUstep Application Team
                       Riccardo Mottola

   This application is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.
 
   This application is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
 
   You should have received a copy of the GNU General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. 
*/

#ifndef _PLUGINCONTROLLER_H_
#define _PLUGINCONTROLLER_H_

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

#import "PipeType.h"

extern NSString* ComponentDidUpdateNotification;

/**
 * Components conforming to this protocol send a ComponentDidUpdateNotification
 * with themselves as notification object whenever their output changes. Listeners can
 * then retrieve the output using the output providing component's -objectsForPipeType method.
 */
@protocol OutputProvidingComponent
/**
 * Returns the set of objects handled by this component that is
 * given out through the "pipe" with the given pipe type.
 */
-(NSSet*) objectsForPipeType: (id<PipeType>)aPipeType;
@end

/**
 * Components conforming to this protocol can be sent notifications to the
 * componentDidUpdateSet: method with an OutputProvidingComponent being the
 * notification object. They can then retrieve their input using the
 * OutputProvidingComponent's -objectsForPipeType method.
 *
 * @see OutputProvidingComponent
 */
@protocol InputAcceptingComponent
/**
 * Notifications sent to this method with an OutputPlugin being the notification object
 * tell the InputPlugin that an updated set of objects can be retrieved from the OutputPlugin.
 */
-(void)componentDidUpdateSet: (NSNotification*) aNotification;
@end


/**
 * This convenience protocol serves the sole purpose to release programmers
 * from writing OutputProvidingComponent,InputAcceptingComponent.
 */
@protocol FilterComponent <OutputProvidingComponent,InputAcceptingComponent>
@end


/**
 * Components conforming to this interface can return an NSView instance using their
 * -view method. The returned NSView reference must always refer to the same instance for
 * each instance of the ViewProvidingComponent.
 */
@protocol ViewProvidingComponent
/**
 * Returns the view belonging to this component.
 */
-(NSView*) view;
@end


/**
 * A class with a _view field that implements ViewProvidingComponent. Inherit from this class
 * for easy view providing component creation. The steps to do are:
 *
 * <ul>
 * <li>Create a subclass of this class</li>
 * <li>Create a Gorm file named like your subclass
 *    <ul>
 *    <li>Model this class and your subclass into the Gorm file. Don't forget the fields
 *        for your class and this classes' _view field.</li>
 *    <li>Connect this classes' _view outlet with the view you wish to use as component view.</li>
 *    </ul>
 * <li>Done. When your class is instantiated, the Gorm file will automatically be loaded and
 *     it will automatically return that view.</li>
 * </li>
 * </ul>
 */
@interface ViewProvidingComponent : NSObject <ViewProvidingComponent>
{
    IBOutlet NSView* _view;
}

-(NSView*) view;

/**
 * Small convenience method that can be used in almost every output providing component.
 */
-(void) notifyChanges;

@end

#endif // _PLUGINCONTROLLER_H_