/////////////////////////////////////////////////////////////////////////////
// Name:        opteditdlg.h
// Purpose:     wxPackageOptionEditDlg definition
// Author:      Francesco Montorsi
// Modified by:
// Created:     Thu 10 Aug 2006 19:08:43 CEST
// RCS-ID:      $Id: opteditdlg.h,v 1.2 2007/01/01 20:06:20 frm Exp $
// Copyright:   (c) 2006 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////

#ifndef _OPTEDITDLG_H_
#define _OPTEDITDLG_H_


/*!
 * Includes
 */

#include "wx/notebook.h"
#include "wxp/packageopt.h"
#include "guicmn/condeditpanel.h"

/*!
 * Forward declarations
 */

class wxNotebook;

/*!
 * Control identifiers
 */

////@begin control identifiers
#define SYMBOL_WXPACKAGEOPTIONEDITDLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXPACKAGEOPTIONEDITDLG_TITLE _("Build system option")
#define SYMBOL_WXPACKAGEOPTIONEDITDLG_IDNAME wxID_ANY
#define SYMBOL_WXPACKAGEOPTIONEDITDLG_SIZE wxSize(400, 300)
#define SYMBOL_WXPACKAGEOPTIONEDITDLG_POSITION wxDefaultPosition
#define ID_OPTEDIT_NAME 10002
#define ID_OPTEDIT_CATEGORY 10003
#define ID_OPTEDIT_VALUES 10004
#define ID_OPTEDIT_DEFVALUE 10005
#define ID_OPTEDIT_GROUP 10006
#define ID_OPTEDIT_DESCRIPTION 10016
////@end control identifiers


// ----------------------------------------------------------------------------
// wxPackageOptionEditDlg
// ----------------------------------------------------------------------------

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

public:
    /// Constructors
    wxPackageOptionEditDlg( );
    wxPackageOptionEditDlg( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEOPTIONEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEOPTIONEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEOPTIONEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEOPTIONEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEOPTIONEDITDLG_STYLE );

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEOPTIONEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEOPTIONEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEOPTIONEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEOPTIONEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEOPTIONEDITDLG_STYLE );

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

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

public:     // event handlers

    void OnOK(wxCommandEvent &);
    void OnCategory(wxCommandEvent &ev);

public:     // public API

    void SetOption(const wxPackageCommandOption &opt)
    {
        m_pName->SetValue(opt.GetName());
        m_pCategory->Select(opt.GetCategory());
        m_pAllowedValues->SetValue(opt.GetAllowedValues());
        m_pDefValue->SetValue(opt.GetDefaultValue());
        m_pGroup->SetValue(opt.GetGroup());
        m_pDescription->SetValue(opt.GetDescription());

        m_pConditionPanel->SetCondition(opt.GetCondition());
    }

    wxPackageCommandOption GetOption() const
    {
        wxPackageCommandOption ret(m_pName->GetValue(),
                                   m_pAllowedValues->GetValue(),
                                   m_pDefValue->GetValue(),
                                   m_pDefValue->GetValue(),
                                   wxEmptyString,
                                   m_pDescription->GetValue(),
                                   m_pGroup->GetValue(),
                                   (wxPackageCommandOptionCategory)m_pCategory->GetSelection(),
                                   m_pConditionPanel->GetCondition());
        wxASSERT(ret.IsOk());
        return ret;
    }

protected:      // controls

////@begin wxPackageOptionEditDlg member variables
    wxNotebook* m_pNotebook;
    wxTextCtrl* m_pName;
    wxChoice* m_pCategory;
    wxTextCtrl* m_pAllowedValues;
    wxTextCtrl* m_pDefValue;
    wxComboBox* m_pGroup;
    wxTextCtrl* m_pDescription;
////@end wxPackageOptionEditDlg member variables

    wxPackageConditionPanel *m_pConditionPanel;
};

#endif
    // _OPTEDITDLG_H_
