This is ExecScrollText.h in view mode; [Download] [Up]
// -------------------------------------------------------------------------------------
// ExecScrollText.h
// -------------------------------------------------------------------------------------
// Permission is granted to freely redistribute this source code, and to use fragments
// of this code in your own applications if you find them to be useful. This class,
// along with the source code, come with no warranty of any kind, and the user assumes
// all responsibility for its use.
// -------------------------------------------------------------------------------------
#import <objc/Object.h>
// --------------------------------------------------------------------------------
// formatted text size limit for 'textPrintf'
#define textStringSIZE 2048 // actual size cannot be known
// --------------------------------------------------------------------------------
// method name synonyms
#define setAutoLF setAutoLineFeed
// --------------------------------------------------------------------------------
// errors passed by 'commandDidComplete:withError:' via 'runCommand:...'
// Note: these codes may be shared by the running command which executes an exit(#)
#define RUNCMD_STOPPED -1 // command stopped/aborted
#define RUNCMD_SUCCESS 0 // executed/completed successfully
#define RUNCMD_EXEC 255 // cannot execute execl shell
// -------------------------------------------------------------------------------------
// structures used internal to ScrollText
/* text attributes */
typedef struct textAttr_s {
id fontId;
int colorMode; // 0=none, 1=gray, 2=color
NXColor color; // contains only gray if mode=1
} textAttr_t;
// --------------------------------------------------------------------------------
@interface ExecScrollText : Object
#ifdef RemoteClient_PROTOCOL
<RemoteClient>
#endif
{
id delegate; // delegate for ExecServer support
id scrollView; // scroll view object
id textView; // text view object
textAttr_t runAttr; // newly added text attributes
BOOL wasEditable; // scrollView was editable
BOOL autoLf; // auto linefeed mode
int cmdChild; // command execution
int inputDescriptor; // input pipe
}
// --------------------------------------------------------------------------------
+ newExecScrollText:anObject;
// Creates a new ExecScrollText object to handle text scrolling. anObject must be
// a ScrollView object which has a Text content view. This is compatible
// with the outlet provided by the text scroll view object in Interface Builder.
//
// --------------------------------------------------------------------------------
- setDelegate:aDelegate;
// Currently used for ExecServer support. Returns self.
//
// --------------------------------------------------------------------------------
- setAutoLineFeed:(BOOL)mode;
// Sets the autoLineFeed options. If set to YES, then a newLine will be sent
// after each string written to the scroll text. The default is NO.
//
// --------------------------------------------------------------------------------
- docView;
// Returns the ScrollView docView.
//
// --------------------------------------------------------------------------------
- scrollView;
// Returns the ScrollView id.
//
// --------------------------------------------------------------------------------
- setTextAttributeFont:fontId;
- setTextAttributeGray:(float)aGray;
- setTextAttributeColor:(NXColor)aColor;
// Set RTF font/gray run attributes for newly added text.
//
// --------------------------------------------------------------------------------
- setTabStops:(float*)tabArray count:(int)c;
- setTab:(float)tabSize count:(int)c;
// Set default tabs stops. 'setTabStops:count:' set the default tabs to those
// specified in the array 'tabArray'. 'setTab:count:' sets the default tabs to
// multiples of 'tabSize'. Both return self.
//
// --------------------------------------------------------------------------------
- clearScrollText;
// This clears the contents of the Text ScrollView. Returns self.
//
// --------------------------------------------------------------------------------
- (int)textPrint:(const char*)buffer;
- (int)textPrintf:(const char*)fmt args:(va_list)args;
- (int)textPrintf:(const char*)fmt, ...;
// Appends the specified formated string to the contents of the ScrollView.
//
// --------------------------------------------------------------------------------
- runCommand:(const char*)command;
- terminateCommand;
- killCommand;
// Allows running a command shell and using the scrollable text view to place the
// output. The delegate is sent the message commandDidComplete:withError: when
// the command has completed execution.
//
// --------------------------------------------------------------------------------
- (void)commandOutput:(const char*)buffer len:(int)len;
- (void)commandDidCompleteWithError:(int)errorCode;
// Provides support for ExecServer.
//
// --------------------------------------------------------------------------------
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.