/*
        Controller.h

	Controller.h : This file is part of SlideShow

	Copyright (C) 2004 Fabien VALLON
	Additional copyrights here

	Authors: Fabien VALLON <fabien.vallon@fr.alcove.com>
	Date:	17 August 2004

	This program 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 2 of
	the License, or (at your option) any later version.

	This program 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 General Public License for more details.

	You should have received a copy of the GNU General Public
	License along with this program; if not, write to:

		Free Software Foundation, Inc.
		59 Temple Place - Suite 330
		Boston, MA  02111-1307, USA
*/

#ifndef _IMAGEAPPS_SLIDESHOW_CONTROLLER_H_
#define _IMAGEAPPS_SLIDESHOW_CONTROLLER_H_

#include "PreferencesController.h"
#include "SlideShowMenu.h"
#include "CacheEngine.h"

#include <Foundation/NSObject.h>
#include <AppKit/NSNibDeclarations.h>


#include <SlideShow/SlideShowWindow.h>

@class NSBrowser;
@class NSButton;
@class NSImageView;
@class NSMutableArray;
@class NSMutableDictionary;
@class NSPanel;
@class NSPopUpButton;
@class NSTextField;
@class NSTimer;

typedef enum _SlideShowShowState {
  ShowAll = 0,
  ShowOnlyMarked,
  ShowOnlyModified,
  ShowMarkedAndModified,
} SlideShowShowState;


@interface Controller: NSObject
{
  //IBOutlets ( Browser Window )
  IBOutlet NSBrowser *browser;

  IBOutlet NSButton *slideShowSwitch;

  IBOutlet NSTextField *slideShowTextField;
  IBOutlet NSTextField *secondLabel;
  IBOutlet NSButton *startButton;
  IBOutlet NSButton *stopButton;
  IBOutlet NSPopUpButton *showPopUp;
  IBOutlet NSPanel *browserWindow;

  //IBOutlet
  IBOutlet NSImageView *imageView;
  IBOutlet NSButton *fullScreenButton;
  IBOutlet NSButton *markSwitch;
  IBOutlet NSPanel *imageWindow;
  




  PreferencesController *preferences;
  id clientConnection;

  SlideShowMenu *slideShowMenu;

@private
  SlideShowWindow *_slideShow;
  NSImageView *_imageView;
  int _current;
  NSMutableArray *_marksArray;
  long _maxSize;
  BOOL _onlyMarked;
  BOOL _mark;
  id markView;
  NSMutableDictionary *_imagesDict;
  NSMutableArray *_backend;
  NSConnection *kitConnection;
  CacheEngine *cacheEngine;
  unsigned int _slideShowShowState;
  NSTimer *_timer;
}


-(void) setShowState:(SlideShowShowState) flag;
-(SlideShowShowState) showState;

-(IBAction) slideShowSwitchAction:(id) sender;
-(IBAction) startSlideShowAction:(id) sender;
-(IBAction) stopSlideShowAction:(id) sender;


//IBActions
-(IBAction) showPreferences:(id) sender;

-(IBAction) addImages:(id) sender;
-(IBAction) removeImages:(id) sender;

//SlideShow
-(void) mark:(id) sender;
-(IBAction) markAction:(id) sender;
-(IBAction) showMarkAction:(id)sender;
-(IBAction) addMarkAction: (id) sender;
-(IBAction) fullscreenAction:(id)sender;
-(IBAction) showPreviousImage: (id) sender;
-(IBAction) showNextImage: (id) sender;
-(IBAction) rotateLeftAction:(id) sender;
-(IBAction) rotateRightAction:(id) sender;
-(IBAction) showAction:(id) sender;



//Files Actions : Should be a services !!!
//-(void) removeFilesFromDisk:(id) sender;
//-(void) copyFilesToDirectory: (id) sender;
@end


@interface Controller (Browser)
- (int)browser:(NSBrowser *)sender numberOfRowsInColumn:(int)column;
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column;
-(IBAction) browserAction: (id) sender;
@end


@interface Controller (Event)
-(void)scrollWheelEvent : (NSEvent*)theEvent;
-(void) keyEvent: (NSEvent*) theEvent;
@end


#endif /* _IMAGEAPPS_SLIDESHOW_CONTROLLER_H_ */
