/***************************************************************************
                            KFileTreeView.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KFileTreeView.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KFileTreeView.h>
#include <kdeobjc/KFileTreeBranch.h>
#include <kdeobjc/KFileTreeViewItem.h>
#include <kdeobjc/KURL.h>
#include <qtobjc/QPixmap.h>


@implementation  KFileTreeView


- initWithWidget: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KFileTreeView((qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KFileTreeView((qt_QWidget *) [parent qt], 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parentWidget: YES] == nil) {
			kde_del_KFileTreeView((kde_KFileTreeView *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KFileTreeViewItem*) currentKFileTreeViewItem
{
	return (KFileTreeViewItem*) [QtSupport objectForQtKey: kde_KFileTreeView_currentKFileTreeViewItem((kde_KFileTreeView *)[self qt]) withClass: [KFileTreeViewItem class] allocatedInObjcWorld: YES];
}

- (KURL*) currentURL
{
	return (KURL*) [QtSupport objectForQtKey: kde_KFileTreeView_currentURL((kde_KFileTreeView *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- (KFileTreeBranch*) addBranch: (KURL*)path name: (NSString *)name showHidden: (BOOL)showHidden
{
static qt_QString * _qstring_name = 0L;
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_addBranch((kde_KFileTreeView *)[self qt], (kde_KURL*) [path qt], (qt_QString *) [name toQString: &_qstring_name], (int)showHidden) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

- (KFileTreeBranch*) addBranch: (KURL*)path name: (NSString *)name 
{
static qt_QString * _qstring_name = 0L;
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_addBranch((kde_KFileTreeView *)[self qt], (kde_KURL*) [path qt], (qt_QString *) [name toQString: &_qstring_name], 0) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

- (KFileTreeBranch*) addBranch: (KURL*)path name: (NSString *)name pix: (QPixmap *)pix showHidden: (BOOL)showHidden
{
static qt_QString * _qstring_name = 0L;
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_addBranch1((kde_KFileTreeView *)[self qt], (kde_KURL*) [path qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QPixmap *) [pix qt], (int)showHidden) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

- (KFileTreeBranch*) addBranch: (KURL*)path name: (NSString *)name pix: (QPixmap *)pix 
{
static qt_QString * _qstring_name = 0L;
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_addBranch1((kde_KFileTreeView *)[self qt], (kde_KURL*) [path qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QPixmap *) [pix qt], 0) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

- (KFileTreeBranch*) addBranch: (KFileTreeBranch*)arg1
{
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_addBranch2((kde_KFileTreeView *)[self qt], (kde_KFileTreeBranch*) [arg1 qt]) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

- (BOOL) removeBranch: (KFileTreeBranch*)branch
{
	return (BOOL) kde_KFileTreeView_removeBranch((kde_KFileTreeView *)[self qt], (kde_KFileTreeBranch*) [branch qt]);
}

- (KFileTreeBranch*) branch: (NSString *)searchName
{
static qt_QString * _qstring_searchName = 0L;
	return (KFileTreeBranch*) [QtSupport objectForQtKey: kde_KFileTreeView_branch((kde_KFileTreeView *)[self qt], (qt_QString *) [searchName toQString: &_qstring_searchName]) withClass: [KFileTreeBranch class] allocatedInObjcWorld: YES];
}

//- (KFileTreeBranchList&) branches
//{
//	return (KFileTreeBranchList&) kde_KFileTreeView_branches((kde_KFileTreeView *)[self qt]);
//}

- setDirOnlyMode: (KFileTreeBranch*)brnch bool: (BOOL)arg1
{
	kde_KFileTreeView_setDirOnlyMode((kde_KFileTreeView *)[self qt], (kde_KFileTreeBranch*) [brnch qt], (int)arg1);
	return self;
}

- (KFileTreeViewItem*) findItem: (KFileTreeBranch*)brnch relUrl: (NSString *)relUrl
{
static qt_QString * _qstring_relUrl = 0L;
	return (KFileTreeViewItem*) [QtSupport objectForQtKey: kde_KFileTreeView_findItem((kde_KFileTreeView *)[self qt], (kde_KFileTreeBranch*) [brnch qt], (qt_QString *) [relUrl toQString: &_qstring_relUrl]) withClass: [KFileTreeViewItem class] allocatedInObjcWorld: YES];
}

- (KFileTreeViewItem*) findItemWithName: (NSString *)branchName relUrl: (NSString *)relUrl
{
static qt_QString * _qstring_relUrl = 0L;
static qt_QString * _qstring_branchName = 0L;
	return (KFileTreeViewItem*) [QtSupport objectForQtKey: kde_KFileTreeView_findItem1((kde_KFileTreeView *)[self qt], (qt_QString *) [branchName toQString: &_qstring_branchName], (qt_QString *) [relUrl toQString: &_qstring_relUrl]) withClass: [KFileTreeViewItem class] allocatedInObjcWorld: YES];
}

- (BOOL) showFolderOpenPixmap
{
	return (BOOL) kde_KFileTreeView_showFolderOpenPixmap((kde_KFileTreeView *)[self qt]);
}

- setShowFolderOpenPixmap: (BOOL)showIt
{
	kde_KFileTreeView_setShowFolderOpenPixmap((kde_KFileTreeView *)[self qt], (int)showIt);
	return self;
}

- setShowFolderOpenPixmap
{
	kde_KFileTreeView_setShowFolderOpenPixmap((kde_KFileTreeView *)[self qt], 1);
	return self;
}

- (BOOL) acceptDrag: (QDropEvent*)event
{
	return (BOOL) kde_KFileTreeView_acceptDrag((kde_KFileTreeView *)[self qt], (qt_QDropEvent*) [event qt]);
}

- (QDragObject*) dragObject
{
	return (QDragObject*) [QtSupport objectForQtKey: kde_KFileTreeView_dragObject((kde_KFileTreeView *)[self qt]) withClass: [QDragObject class] allocatedInObjcWorld: YES];
}

- startAnimation: (KFileTreeViewItem*)item iconBaseName: (NSString *)iconBaseName iconCount: (unsigned int)iconCount
{
	kde_KFileTreeView_startAnimation((kde_KFileTreeView *)[self qt], (kde_KFileTreeViewItem*) [item qt], (char*) [iconBaseName cString], (unsigned int)iconCount);
	return self;
}

- startAnimation: (KFileTreeViewItem*)item 
{
	kde_KFileTreeView_startAnimation((kde_KFileTreeView *)[self qt], (kde_KFileTreeViewItem*) [item qt], "kde", 6);
	return self;
}

- stopAnimation: (KFileTreeViewItem*)item
{
	kde_KFileTreeView_stopAnimation((kde_KFileTreeView *)[self qt], (kde_KFileTreeViewItem*) [item qt]);
	return self;
}

- virtual_hook: (int)identifier data: (void*)data
{
	kde_KFileTreeView_virtual_hook((kde_KFileTreeView *)[self qt], (int)identifier, (void*)data);
	return self;
}

//- slotNewTreeViewItems: (KFileTreeBranch*)arg1 filetreeviewitemlist: (KFileTreeViewItemList*)arg2
//{
//	kde_KFileTreeView_slotNewTreeViewItems((kde_KFileTreeView *)[self qt], (kde_KFileTreeBranch*) [arg1 qt], (KFileTreeViewItemList) arg2);
//	return self;
//}

- slotSetNextUrlToSelect: (KURL*)url
{
	kde_KFileTreeView_slotSetNextUrlToSelect((kde_KFileTreeView *)[self qt], (kde_KURL*) [url qt]);
	return self;
}

- (QPixmap*) itemIcon: (KFileTreeViewItem*)arg1 gap: (int)gap
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KFileTreeView_itemIcon((kde_KFileTreeView *)[self qt], (kde_KFileTreeViewItem*) [arg1 qt], (int)gap) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (QPixmap*) itemIcon: (KFileTreeViewItem*)arg1 
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KFileTreeView_itemIcon((kde_KFileTreeView *)[self qt], (kde_KFileTreeViewItem*) [arg1 qt], 0) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

@end
