/////////////////////////////////////////////////////////////////////////////
// Name:        presetspanel.h
// Purpose:     wxPackagePresetsPanel definition
// Author:      Francesco Montorsi
// Modified by:
// Created:     10/07/2006 19:02:39
// RCS-ID:      $Id: presetspanel.h,v 1.2 2007/01/01 20:06:20 frm Exp $
// Copyright:   (c) 2006 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////

#ifndef _PMPRESETSPANEL_H_
#define _PMPRESETSPANEL_H_


/*!
 * Includes
 */

#include "wxp/wxp.h"


/*!
 * Forward declarations
 */

class wxOptionEditorCtrl;


/*!
 * Control identifiers
 */

////@begin control identifiers
#define SYMBOL_WXPACKAGEPRESETSPANEL_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXPACKAGEPRESETSPANEL_TITLE _("Dialog")
#define SYMBOL_WXPACKAGEPRESETSPANEL_IDNAME wxID_ANY
#define SYMBOL_WXPACKAGEPRESETSPANEL_SIZE wxSize(400, 300)
#define SYMBOL_WXPACKAGEPRESETSPANEL_POSITION wxDefaultPosition
#define ID_PRESETS_PRESETCHOICE 10002
#define ID_PRESETS_RESET 10003
#define ID_PRESETS_OPTIONS 10004
////@end control identifiers



// ----------------------------------------------------------------------------
// wxPackagePresetsPanel
// ----------------------------------------------------------------------------

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

public:
    /// Constructors
    wxPackagePresetsPanel( );
    wxPackagePresetsPanel( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEPRESETSPANEL_IDNAME, const wxPoint& pos = SYMBOL_WXPACKAGEPRESETSPANEL_POSITION, const wxSize& size = SYMBOL_WXPACKAGEPRESETSPANEL_SIZE, long style = SYMBOL_WXPACKAGEPRESETSPANEL_STYLE );

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEPRESETSPANEL_IDNAME, const wxPoint& pos = SYMBOL_WXPACKAGEPRESETSPANEL_POSITION, const wxSize& size = SYMBOL_WXPACKAGEPRESETSPANEL_SIZE, long style = SYMBOL_WXPACKAGEPRESETSPANEL_STYLE );

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

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

public:         // event handlers

    void OnResetToDefaults(wxCommandEvent &);
    void OnPresetChanged(wxCommandEvent &);
    void OnOptionChanged(wxCommandEvent &);

public:         // misc

    //! Returns true if there were changes to be saved.
    bool TransferDataFromWindow();

    //! Returns the name of the currently selected preset.
    wxString GetPresetName(unsigned int n) const;

    //! Updates the strings in the preset choice control.
    void UpdatePresetChoiceStrings();

    //! Applies user changes to global presets.
    void ApplySettings();

protected:

    wxOptionEditorCtrl *m_pOptionsList;
    wxChoice *m_pPresetChoice;

    //! The name of the currently selected preset.
    wxString m_strCurPresetSelection;

    //! The options with user edits.
    //! This hashmap is initialized with global presets at creation-time.
    //! It's saved back in global presets only in ApplySettings()
    wxPackageCommandOptionArrayHashMap m_optHashmap;
};

#endif
    // _PMPRESETSPANEL_H_
