/******************************************************************************
*
*
* Notepad2
*
* Dlapi.h
*   Definitions for Directory Listing APIs
*
* See Readme.txt for more information about this source code.
* Please send me your comments to this work.
*
* Distributed under the terms of the GNU General Public License,
* see License.txt for details.
*
*                                              (c) Florian Balmer 1996-2004
*                                                       textview@bluewin.ch
*                                               http://www.flos-freeware.ch
*
*
******************************************************************************/

#ifndef _DLAPI_H_
#define _DLAPI_H_

#ifdef __cplusplus
extern "C" { // C-Declarations
#endif //__cplusplus



//==== DirList ================================================================

//==== LV_ITEMDATA Structure ==================================================
typedef struct tagLV_ITEMDATA // lvid
{
  LPITEMIDLIST  pidl; // Item Id
  LPSHELLFOLDER lpsf; // Parent IShellFolder Interface

} LV_ITEMDATA, *LPLV_ITEMDATA;


//==== DlInit() ===============================================================

BOOL DirList_Init(HWND,LPCSTR);


//==== DlDestroy() ============================================================

BOOL DirList_Destroy(HWND);


//==== DlStartIconThread() ====================================================

BOOL DirList_StartIconThread(HWND);


//==== DlTerminateIconThread() ================================================

BOOL DirList_TerminateIconThread(HWND);


//==== DlFill() ===============================================================

#define DL_FOLDERS      32
#define DL_NONFOLDERS   64
#define DL_INCLHIDDEN  128
#define DL_ALLOBJECTS  (32|64|128)

int DirList_Fill(HWND,LPCSTR,DWORD,LPCSTR,BOOL,BOOL);


//==== DlIconThread() =========================================================

DWORD WINAPI DirList_IconThread(LPVOID);


//==== DlGetDispInfo() ========================================================

BOOL DirList_GetDispInfo(HWND,LPARAM,BOOL);


//==== DlDeleteItem() =========================================================

BOOL DirList_DeleteItem(HWND,LPARAM);


//==== DlSort() ===============================================================

#define DS_NAME     0
#define DS_SIZE     1
#define DS_TYPE     2
#define DS_LASTMOD  3

BOOL DirList_Sort(HWND,int,BOOL);


//==== DlGetItem() ============================================================

#define DLE_NONE 0
#define DLE_DIR  1
#define DLE_FILE 2

#define DLI_FILENAME 1
#define DLI_DISPNAME 2
#define DLI_TYPE     4
#define DLI_ALL (1|2|4)

typedef struct tagDLITEM // dli
{

  UINT mask;
  char szFileName[MAX_PATH];
  char szDisplayName[MAX_PATH];
  int  ntype;

} DLITEM, *LPDLITEM;

DirList_GetItem(HWND,int,LPDLITEM);


//==== DlGetItemEx() ==========================================================

int DirList_GetItemEx(HWND,int,LPWIN32_FIND_DATA);


//==== DlPropertyDlg() ========================================================

BOOL DirList_PropertyDlg(HWND,int);


//==== DlDoDragDrop() =========================================================

void DirList_DoDragDrop(HWND,LPARAM);

//==== DlGetLongPathName() ====================================================

BOOL DirList_GetLongPathName(HWND,LPSTR);

//==== DlSelectItem() =========================================================

BOOL DirList_SelectItem(HWND,LPCSTR,LPCSTR);

//==== DlCreateFilter() and DlMatchFilter() ===================================

#define DL_FILTER_BUFSIZE 128

typedef struct tagDL_FILTER { //dlf
  int   nCount;
  char  tFilterBuf[DL_FILTER_BUFSIZE];
  char  *pFilter  [DL_FILTER_BUFSIZE];
  BOOL  bExcludeFilter;
} DL_FILTER, *PDL_FILTER;

void DirList_CreateFilter(PDL_FILTER,LPCSTR,BOOL);

BOOL DirList_MatchFilter(LPSHELLFOLDER,LPCITEMIDLIST,PDL_FILTER);



//==== DriveBox ===============================================================

BOOL DriveBox_Init(HWND);
int  DriveBox_Fill(HWND);
BOOL DriveBox_GetSelDrive(HWND,LPSTR,int,BOOL);
BOOL DriveBox_SelectDrive(HWND,LPCSTR);
BOOL DriveBox_PropertyDlg(HWND);

LRESULT DriveBox_DeleteItem(HWND,LPARAM);
LRESULT DriveBox_GetDispInfo(HWND,LPARAM);



//==== ItemID =================================================================

//==== IL_Next() ==============================================================
#define _IL_Next(pidl) ((LPITEMIDLIST)(((LPBYTE)(pidl)) + pidl->mkid.cb))

//==== IL_Create() ============================================================
LPITEMIDLIST IL_Create(LPMALLOC,
                       LPCITEMIDLIST,UINT,
                       LPCITEMIDLIST,UINT);

//==== IL_GetSize() ===========================================================
UINT IL_GetSize(LPCITEMIDLIST);

//==== IL_GetDisplayName() ====================================================
BOOL IL_GetDisplayName(LPSHELLFOLDER,
                       LPCITEMIDLIST,
                       DWORD,LPSTR,int);




#ifdef __cplusplus
}
#endif //__cplusplus


#endif // _DLAPI_H_


///   End of Dlapi.h   \\\
