/////////////////////////////////////////////////////////////////////////////
// Name:        depeditdlg.h
// Purpose:     wxPackageDependencyEditDlg definition
// Author:      Francesco Montorsi
// Modified by:
// Created:     Thu 10 Aug 2006 18:22:30 CEST
// RCS-ID:      $Id: depeditdlg.h,v 1.2 2007/01/01 20:06:20 frm Exp $
// Copyright:   (c) 2006 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////

#ifndef _DEPEDITDLG_H_
#define _DEPEDITDLG_H_


/*!
 * Includes
 */

#include "wxp/packagedep.h"


/*!
 * Forward declarations
 */


/*!
 * Control identifiers
 */

////@begin control identifiers
#define SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_TITLE _("Dependency")
#define SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_IDNAME wxID_ANY
#define SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_SIZE wxSize(400, 300)
#define SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_POSITION wxDefaultPosition
#define ID_DEPEDIT_TYPE 10003
#define ID_DEPEDIT_NAME 10004
#define ID_DEPEDIT_VERSION 10005
////@end control identifiers


// ----------------------------------------------------------------------------
// wxPackageDependencyEditDlg
// ----------------------------------------------------------------------------

class wxPackageDependencyEditDlg: public wxDialog
{
    DECLARE_DYNAMIC_CLASS( wxPackageDependencyEditDlg )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    wxPackageDependencyEditDlg( );
    wxPackageDependencyEditDlg( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_STYLE );

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEDEPENDENCYEDITDLG_STYLE );

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

    /// Should we show tooltips?
    static bool ShowToolTips();

public:     // event handlers

    void OnOK(wxCommandEvent &);

public:     // public API

    void SetDependency(const wxPackageDependency &dep)
    {
        m_pName->SetValue(dep.GetName());
        if (dep.GetType() != wxPDT_INVALID)
            m_pDepType->Select(dep.GetType());
        if (dep.GetVersion().IsOk())
            m_pVersion->SetValue(dep.GetVersion().GetAsString());
    }

    wxPackageDependency GetDependency() const
    {
        wxPackageDependency ret(m_pName->GetValue(),
                                wxVersionRange(m_pVersion->GetValue()),
                                wxEmptyString,
                                (wxPackageDependencyType)m_pDepType->GetSelection());
        wxASSERT(ret.IsOk());
        return ret;
    }

protected:      // controls

////@begin wxPackageDependencyEditDlg member variables
    wxChoice* m_pDepType;
    wxTextCtrl* m_pName;
    wxTextCtrl* m_pVersion;
////@end wxPackageDependencyEditDlg member variables
};

#endif
    // _DEPEDITDLG_H_
