#pragma once

#include <tqwidget.h>
#include <tqdatetime.h>
#include <tqptrlist.h>

class PulseModel;
class AudioDevice;
class DeviceWidget;
class TQHBoxLayout;
class TQVBoxLayout;

class TmixPopup : public TQWidget
{
    TQ_OBJECT

public:
    TmixPopup( PulseModel *model,
               bool showOutput, bool showMic, bool showApps,
               bool showRecording = false,
               TQWidget *parent = 0 );

    void toggleAt( const TQPoint &trayGlobalPos, const TQSize &traySize );
    bool justHidden() const;

protected:
    void showEvent( TQShowEvent *e );
    void hideEvent( TQHideEvent *e );
    void wheelEvent( TQWheelEvent *e );

private slots:
    void onDefaultOutputChanged( AudioDevice *dev );
    void onDeviceAdded( AudioDevice *dev );
    void onDeviceRemoved( AudioDevice *dev );

private:
    void rebuild();

    PulseModel  *m_model;
    bool         m_showOutput;
    bool         m_showMic;
    bool         m_showApps;
    bool         m_showRecording;
    TQVBoxLayout *m_outerLayout;
    TQWidget     *m_devContainer;
    TQPtrList<DeviceWidget> m_devWidgets;
    TQTime        m_hideTime;
};
