/*
 * daap_menu.h: The menu implementations
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: daap_menu.h,v 1.17 2005/10/28 09:51:09 cm Exp $
 */

#ifndef __DAAPMENU_H
#define __DAAPMENU_H

#include <vdr/osdbase.h>
#include <vdr/menu.h>
#include <vdr/menuitems.h>
#include "daap_client.h"

class cDaapMenu : public cOsdMenu {
  private:
    void Set(void);
  public:
    cDaapMenu();
    ~cDaapMenu();
    eOSState ProcessKey(eKeys Key);
};

class cDaapMenuPassword : public cOsdMenu {
  private:
    char m_password[129];
    cDaapHost *mpo_host;
    void Set(void);
  public:
    cDaapMenuPassword(cDaapHost *host);
    ~cDaapMenuPassword();
    eOSState ProcessKey(eKeys Key);
};

class cDaapMenuDatabases : public cOsdMenu {
  private:
    cDaapDatabases *mpo_dbs;
    void Set(void);
    void SetCurrentHelp(void);
  public:
    cDaapMenuDatabases(cDaapDatabases *dbs);
    ~cDaapMenuDatabases();
    eOSState ProcessKey(eKeys Key);
};

class cDaapMenuDatabase : public cOsdMenu {
  private:
    eDatabaseField m_viewField;
    cDaapDatabase *mpo_db;
    void Set(void);
  public:
    cDaapMenuDatabase(cDaapDatabase *db);
    ~cDaapMenuDatabase();
    eOSState ProcessKey(eKeys Key);
};

class cDaapMenuPlaylist : public cOsdMenu {
  private:
    cDaapPlaylist *mpo_pl;
    void Set(void);
    void SetCurrentHelp(void);
  public:
    cDaapMenuPlaylist(cDaapPlaylist *pl);
    ~cDaapMenuPlaylist();
    eOSState ProcessKey(eKeys Key);
};

class cDaapMenuSong : public cOsdMenu {
  private:
    void Set(cDaapDatabaseItem *item);
    void AddSongItemStr(const char *description, const char *data);
    void AddSongItemInt(const char *description, int num);
  public:
    cDaapMenuSong(cDaapDatabaseItem *item);
    ~cDaapMenuSong();
};

class cDaapMenuCommands : public cOsdMenu {
  private:
    cDaapDatabaseItem *mpo_current;
    cDaapDatabase *mpo_db;
    void Set(void);
  public:
    cDaapMenuCommands(cDaapDatabase *db, cDaapDatabaseItem *current);
    eOSState ProcessKey(eKeys Key);
    ~cDaapMenuCommands();
};

class cDaapMenuItem : public cOsdItem {
  private:
    enum {
      miItem,
      miPlaylist,
      miDatabase,
      miNone
    } m_type;

    union {
      void *mpo_object;
      cDaapDatabaseItem *mpo_dbitem;
      cDaapPlaylist *mpo_pl;
      cDaapDatabase *mpo_db;
    };
  public:
    cDaapMenuItem(const char *Text, cDaapDatabaseItem *item, eOSState State = osUnknown);
    cDaapMenuItem(const char *Text, cDaapPlaylist *playlist, eOSState State = osUnknown);
    cDaapMenuItem(const char *Text, cDaapDatabase *database, eOSState State = osUnknown);
    cDaapMenuItem(const char *Text, eOSState State = osUnknown);
    ~cDaapMenuItem();
    cDaapDatabaseItem *GetDatabaseItem(void) const;
    cDaapDatabase *GetDatabase(void) const;
    cDaapPlaylist *GetPlaylist(void) const;
};                                   

class cDaapMenuSetup : public cMenuSetupPage {
  private:
    int m_menuEntry;
    int m_audioOnly;
    int m_skipBackMargin;
    int m_skipLength;
    char m_instantPlaylistName[21];
  protected:
    void Store(void);
  public:
    cDaapMenuSetup();
};

#endif
