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

#import "Cache.h"

#define TICKER_MINWIDTH   384
#define TICKER_MAXWIDTH  8192

#define TICKER_DEFAULT_CAP 16

#define TICKER_TEMP_FILE    @"TICKER_TEMP_FILE"
#define TICKER_TASK_OBJECT  @"TICKER_TASK_OBJECT"

#define TickerDidUpdateNotification          @"TickerDidUpdateNotification"

#define URL_RESOURCE_CAPACITY 4096

@class GenericArticle;

@interface TickerWindow: NSWindow <NSURLHandleClient>
{
    NSURL *url;
    NSURLHandle *urlHandle;
    NSMutableData *feedData;
    BOOL loadInProgress;

    NSMutableDictionary *attr;
    Cache *cache;

    NSTextView *text;

    BOOL signalChange;
    int current;
    NSMutableArray *articles;

    unsigned long refreshsecs, ticksecs;

    int externalChoice;
}

- (void)dealloc;
- initWithAttributes:(NSDictionary *)attributes;

- (NSDictionary *)attributes;

- swapColors;

- (NSArray *)prepareCommand:(NSString *)what error:(NSString **)errPtr;
- (NSString *)untag:(NSString *)source title:(NSString *)aTitle;
- browse:(GenericArticle *)art text:(BOOL)flag;

- setErrorFormat:(NSString *)fmt arg:(NSString *)arg;
- (NSString *)loadtitle;

- (BOOL)loadInProgress;

- refresh;
- tick;

- (unsigned long)refreshsecs;
- (unsigned long)ticksecs;

- (GenericArticle *)currentArticle;
- (int)currentArticleIndex;
- (NSArray *)articles;

- setExternalChoice:(int)choice;

- articleText:(id)sender;
- articleBrowse:(id)sender;
- articleLink:(id)sender;
- articleShowAll:(id)sender;
- articleUpdate:(id)sender;

- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem;

@end
