/////////////////////////////////////////////////////////////////////////////
// Name:        settingsdlg.h
// Purpose:     wxPackageManagerSettingsDlg definition
// Author:      Francesco Montorsi
// Modified by: 
// Created:     25/07/2006 17:15:46
// RCS-ID:      $Id: settingsdlg.h,v 1.3 2007/01/14 12:17:18 frm Exp $
// Copyright:   (c) 2006 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////

#ifndef _SETTINGSDIALOG_H_
#define _SETTINGSDIALOG_H_

/*!
 * Includes
 */

#include "wxp/wxbuild.h"
#include "wx/propdlg.h"


/*!
 * Forward declarations
 */

class wxConfigBase;
class wxPackageViewerPanel;
class wxPackageBrowserPanel;
class wxCompilerSettingsPanel;
class wxOptionEditorCtrl;
class wxPackagePresetsPanel;
class wxDirPickerCtrl;
class wxCheckListBox;

/*!
 * Control identifiers
 */

////@begin control identifiers
#define SYMBOL_WXPACKAGEMANAGERSETTINGSDLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXPACKAGEMANAGERSETTINGSDLG_TITLE _("Package Manager Settings")
#define SYMBOL_WXPACKAGEMANAGERSETTINGSDLG_IDNAME wxID_ANY
#define SYMBOL_WXPACKAGEMANAGERSETTINGSDLG_SIZE wxSize(400, 300)
#define SYMBOL_WXPACKAGEMANAGERSETTINGSDLG_POSITION wxDefaultPosition
#define ID_SETTINGS_VIEWMODE 10034
#define ID_SETTINGS_LOADWXDOC 10033
#define ID_SETTINGS_AUTOLOAD_WXPACKAGES 10074
#define ID_SETTINGS_DOWNLOAD_PICKER 10010
#define ID_SETTINGS_DECOMPRESSION_PICKER 10000
#define ID_SETTINGS_INSTALLATION_PICKER 10001
#define ID_SETTINGS_QUESTIONS_LIST 10065
#define ID_SETTINGS_LOCALREPO_PATHS 10002
#define ID_SETTINGS_LOCALREPO_ADDPATH 10003
#define ID_SETTINGS_LOCALREPO_EDITPATH 10057
#define ID_SETTINGS_LOCALREPO_OPENPATH 10075
#define ID_SETTINGS_LOCALREPO_DELETEPATH 10004
#define ID_SETTINGS_LIST 10048
#define ID_SETTINGS_WX_ADDNEW 10050
#define ID_SETTINGS_WX_EDIT 10051
#define ID_SETTINGS_WX_DELETE 10052
#define ID_SETTINGS_WX_AUTODETECT 10053
////@end control identifiers



// ----------------------------------------------------------------------------
// wxPackageManagerSettingsDlg
// ----------------------------------------------------------------------------

class wxPackageManagerSettingsDlg: public wxPropertySheetDialog
{    
    DECLARE_DYNAMIC_CLASS( wxPackageManagerSettingsDialog )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    wxPackageManagerSettingsDlg( );
    wxPackageManagerSettingsDlg( wxWindow* parent, wxWindowID id,
                                    wxConfigBase *, const wxString &path,
                                    wxPackageViewerPanel *, wxPackageBrowserPanel *);

    /// Creation
    bool Create( wxWindow* parent, wxWindowID id,
                 wxConfigBase *, const wxString &path,
                 wxPackageViewerPanel *, wxPackageBrowserPanel *);

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

public:     // event handlers

    void OnLocalRepoAddPath(wxCommandEvent &);
    void OnLocalRepoEditPath(wxCommandEvent &);
    void OnLocalRepoOpenPath(wxCommandEvent &);
    void OnLocalRepoDeletePath(wxCommandEvent &);

    void OnWxBuildAddNew(wxCommandEvent &);
    void OnWxBuildEdit(wxCommandEvent &);
    void OnWxBuildDelete(wxCommandEvent &);
    void OnWxBuildAutodetect(wxCommandEvent &);

    void OnOK(wxCommandEvent &);
    void OnUpdateUI(wxUpdateUIEvent &);

public:         // load/save

    // NB: unlike all other classes, wxPackageManagerSettingsDlg's
    //     Load() and Save() functions do not take any wxConfig
    //     object nor any path. This is because this class does not
    //     need to load/save anything directly in the registry but
    //     rather to init its GUI from the other classes which
    //     effectively load/save into the registry.
    bool LoadSettings();
    void ApplySettings();

protected:      // controls

    wxChoice* m_pViewMode;
    wxCheckBox* m_pLoadWxDocs;
    wxCheckBox* m_pAutoLoadWxPackages;
    wxDirPickerCtrl* m_pDownloadPicker;
    wxDirPickerCtrl* m_pDecompressionPicker;
    wxDirPickerCtrl* m_pInstallationPicker;
    wxListBox* m_pPathList;
    wxListBox* m_pWxBuildList;
    wxCheckListBox* m_pQuestionList;

    wxPackagePresetsPanel *m_pPresetsPanel;
    wxCompilerSettingsPanel *m_pCompilerOptPanel;

protected:      // objects whose settings are modified through this dialog

    wxConfigBase *m_pCfg;
    wxString m_strPath;
    wxPackageViewerPanel *m_pViewerPanel;
    wxPackageBrowserPanel *m_pBrowserPanel;

    // a temporary array of the wx builds as edited by the user.
    // saved in wxWidgetsBuild::s_arrWxBuilds only in ApplySettings.
    wxWidgetsBuildArray m_arrBuilds;

    // array used to keep traces of the keynames of the questions
    wxArrayString m_questionListKeynames;
};

#endif
    // _SETTINGSDIALOG_H_
