/*
 * filewnd.h: Main OSD Window
 *
 */

#ifndef _FILEWND__H
#define _FILEWND__H

#include <vdr/plugin.h>

enum eFileItem
{
    itemDir,
    itemFile,
    itemUpDir
};

class cFileItem : public cListObject
{
public:
    char *m_sName;
    int  m_iType;
    cFileItem(const char *sName, int iType);
    virtual ~cFileItem();
};

class cDirList : public cList<cFileItem>
{
public:
};

class cFileWnd
{
private:
    cOsd *pOSD;
    int iX;
    int iY;
    int iWidth;
    int iHeight;
    bool m_bActive;
    int  m_iTopElem;
    int  m_iCurrentElem;
    char m_sFolder[512];
    cDirList m_lDir;
protected:
    void DrawDirItems();
    void DrawTitle();
    void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg);
    bool ReadActiveDir();
public:
    cFileWnd(cOsd *osd, int x, int y, int width, int height, const char *folder);
    ~cFileWnd(void);
    void Draw();
    void SetActive(bool bActive = true);
    void RefreshActiveDir();
    bool isDirectory();
    bool isUpDirectory();
    bool isFile();
    void GetFolder(char **sFolder);
    void GetFileItem(char **sFileItem);
    void GetFileItemShow(char **sFileItem, int iItem = -1);
    void GetCurFullName(char **sFName);
    bool GoUp();
    bool GoDown();
    bool GoIn();
    bool GoLeft();
    bool GoRight();
};

#endif //_FILEWND__H
