/*
    MakeMKV GUI - Graphics user interface application for MakeMKV

    Copyright (C) 2007-2013 GuinpinSoft inc <makemkvgui@makemkv.com>

    You may use this file in accordance with the end user license
    agreement provided with the Software. For licensing terms and
    conditions see License.txt

    This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY
    OF ANY KIND, either express or implied. See the License.txt for
    the specific language governing rights and limitations.

*/
#ifndef APP_DIRSELECTBOX_H
#define APP_DIRSELECTBOX_H

#include <QtGui/QtGui>
#include "qtapp.h"

class CDirSelectBox : public QGroupBox
{
    Q_OBJECT

public:
    typedef enum Style
    {
        DirBoxDir,
        DirBoxOutDir,
        DirBoxFile
    } Style;

private:
    QLineEdit*   lineEditDir;
    QToolButton* toolButtonSelect;
    QAction*     toolButtonAction;
    bool         validState;
    Style        style;

private:

    static const unsigned int MaxRadioButtons = 5;
    QAbstractButton*    radioButtons[MaxRadioButtons];

public:
    CDirSelectBox(CDirSelectBox::Style BoxStyle,const QString &Name, QWidgetList widgets = QWidgetList(), QWidget *parent = 0);
    void setIndexValue(int Index);
    int getIndexValue();
    bool IsDirValid();
    void setText(const QString &Text);
    QString text();
    QAction* selectDialogAction();
    void setDirEnabled(bool Enabled);

private:
    void EmitValidChanged();

private slots:
    void SlotButtonPressed();
    void SlotTextChanged(const QString &str);
    void SlotRadioToggled();

signals:
    void SignalChanged();
    void SignalDirValidChanged();
    void SignalIndexChanged();

};

#endif // APP_DIRSELECTBOX_H

