
/*
 * See the files COPYING and README for copyright information and how to reach 
 * the author.
 *
 *  $Id: menuitems.h,v 1.2 2004/12/05 18:50:34 lordjaxom Exp $
 */

#ifndef VDR_BURN_MENUITEMS_H
#define VDR_BURN_MENUITEMS_H

#include "vdr_compat.h"
#include <vdr/menuitems.h>

class cBurnRecording;
class cBurnJob;

enum eBurnItemType
{
    bitText,
    bitJob,
    bitEditable,
    bitEditStr = bitEditable,
    bitEditInt,
    bitEditRecording,
    bitEditStra,
};

// --- cBurnMenuItem ----------------------------------------------------------

class cBurnMenuItem:
    public cOsdItem
{
  private:
    bool mSelectable;
    eBurnItemType mType;

  public:
    cBurnMenuItem(eBurnItemType Type, bool Selectable);
    ~cBurnMenuItem() {}

    bool Selectable(void) const { return mSelectable; }
    eBurnItemType Type(void) const { return mType; }
};

// --- cBurnMenuTextItem ------------------------------------------------------

class cBurnMenuTextItem:
    public cBurnMenuItem
{
  public:
    cBurnMenuTextItem(const char *Text, bool Selectable = false);
    ~cBurnMenuTextItem() {}
};

// --- cBurnMenuJobItem -------------------------------------------------------

class cBurnMenuJobItem:
    public cBurnMenuItem
{
  private:
    cBurnJob * mJob;

  public:
    cBurnMenuJobItem(cBurnJob * Job, int Number, bool Done = false);

    cBurnJob *Job(void) const { return mJob; }
};

// --- cBurnMenuEditItem ------------------------------------------------------

class cBurnMenuEditItem:
    public cBurnMenuItem
{
  private:
    char *mName;
    char *mValue;

  protected:
    bool mReadOnly;

  public:
    cBurnMenuEditItem(eBurnItemType Type, const char *Name);
    virtual ~cBurnMenuEditItem();

    void SetValue(const char *Value);
    void SetReadOnly(bool ReadOnly);
};

// --- cBurnMenuEditIntItem ---------------------------------------------------

class cBurnMenuEditIntItem:
    public cBurnMenuEditItem
{
  private:
    int mMin, mMax;

  protected:
    int *mValue;

    virtual void Set(void);

  public:
    cBurnMenuEditIntItem(const char *Name, int *Value, int Min = 0,
            int Max = INT_MAX);
    cBurnMenuEditIntItem(eBurnItemType Type, const char *Name, int *Value,
            int Min = 0, int Max = INT_MAX);

    virtual eOSState ProcessKey(eKeys Key);
};

// --- cBurnMenuEditStrItem ---------------------------------------------------

class cBurnMenuEditStrItem:
    public cBurnMenuEditItem
{
  private:
    char *value;
    int length;
    char *allowed;
    int pos;
    bool insert, newchar, uppercase;
    void SetHelpKeys(void);
    virtual void Set(void);
    char Inc(char c, bool Up);
    int ieCurChr;
    eKeys lastKey;
    time_t lastActivity;

  public:
    cBurnMenuEditStrItem(const char *Name, char *Value, int Length,
            const char *Allowed);
    cBurnMenuEditStrItem(eBurnItemType Type, const char *Name, char *Value,
            int Length, const char *Allowed);
    ~cBurnMenuEditStrItem();

    virtual const char *GetValue() { return value; };
    virtual eOSState ProcessKey(eKeys Key);
    bool Editing(void) const { return pos != -1; }
};

// --- cBurnMenuEditRecordingItem ---------------------------------------------

class cBurnMenuEditRecordingItem:
    public cBurnMenuEditStrItem
{
  private:
    char *mFileName;

  public:
    cBurnMenuEditRecordingItem(cBurnRecording *Recording);
    virtual ~cBurnMenuEditRecordingItem();

    const char *FileName(void) const { return mFileName; }
};

// --- cBurnMenuEditStraItem --------------------------------------------------

class cBurnMenuEditStraItem:
    public cBurnMenuEditIntItem
{
  private:
    const char **mStrings;

  protected:
    virtual void Set(void);

  public:
    cBurnMenuEditStraItem(const char *Name, int *Value, int NumStrings,
            const char **Strings);
};

#endif // VDR_BURN_MENUITEMS_H
