/////////////////////////////////////////////////////////////////////////////
// Name:        filterpanel.h
// Purpose:     wxPackageFilterPanel definition
// Author:      Julian Smart, Francesco Montorsi
// Modified by:
// Created:     04/06/2006 11:57:34
// RCS-ID:      $Id: filterpanel.h,v 1.2 2007/01/01 20:06:20 frm Exp $
// Copyright:   (c) 2004 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////

#ifndef _PMFILTERPANEL_H_
#define _PMFILTERPANEL_H_


/*!
 * Includes
 */

#include "wxp/package.h"


/*!
 * Control identifiers
 */

#define SYMBOL_WXPACKAGEFILTERPANEL_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXPACKAGEFILTERPANEL_TITLE _("Dialog")
#define SYMBOL_WXPACKAGEFILTERPANEL_IDNAME wxID_ANY
#define SYMBOL_WXPACKAGEFILTERPANEL_SIZE wxSize(400, 300)
#define SYMBOL_WXPACKAGEFILTERPANEL_POSITION wxDefaultPosition
#define ID_FILTER_SUPPORTED_WXPORT 10000
#define ID_FILTER_CATEGORY 10001
#define ID_FILTER_KEYWORDS 10002


// ----------------------------------------------------------------------------
// wxPackageFilterPanel
// ----------------------------------------------------------------------------

class wxPackageFilterPanel: public wxPanel
{
    DECLARE_DYNAMIC_CLASS( wxPackageFilterPanel )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    wxPackageFilterPanel( );
    wxPackageFilterPanel( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEFILTERPANEL_IDNAME,
                          const wxPoint& pos = SYMBOL_WXPACKAGEFILTERPANEL_POSITION,
                          const wxSize& size = SYMBOL_WXPACKAGEFILTERPANEL_SIZE,
                          long style = SYMBOL_WXPACKAGEFILTERPANEL_STYLE );

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEFILTERPANEL_IDNAME,
                 const wxPoint& pos = SYMBOL_WXPACKAGEFILTERPANEL_POSITION,
                 const wxSize& size = SYMBOL_WXPACKAGEFILTERPANEL_SIZE,
                 long style = SYMBOL_WXPACKAGEFILTERPANEL_STYLE );

    /// Creates the controls and sizers
    void CreateControls();


public:     // event handlers

    void OnFilterUpdate(wxCommandEvent &ev);

public:

    void Reset()
    {
        m_pSupportedPort->Select(0);
        m_pCategory->Select(0);
        m_pKeywords->SetValue(wxEmptyString);
    }

    //! Returns true if the given package passed through this filter.
    bool IsToPreserve(const wxPackage &pkg) const;

protected:
    wxChoice *m_pSupportedPort, *m_pCategory;
    wxTextCtrl* m_pKeywords;
};


// ----------------------------------------------------------------------------
// wxEVT_COMMAND_FILTER_PACKAGES
// ----------------------------------------------------------------------------

BEGIN_DECLARE_EVENT_TYPES()
    //DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP, wxEVT_COMMAND_FILTER_PACKAGES, 1000000)
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FILTER_PACKAGES, 12300568)
END_DECLARE_EVENT_TYPES()

#define EVT_FILTER_PACKAGES(id, fn) \
    wx__DECLARE_EVT1(wxEVT_COMMAND_FILTER_PACKAGES, id, wxCommandEventHandler(fn))


#endif
    // _PMFILTERPANEL_H_
