// This file is a part of the Dynamic Preferences Library.
//
// Copyright (c) 2004 Theodore R. Smith (hopeseekr@xmule.ws / http://www.xmule.ws/)
// DSA-1024 Fingerprint: 10A0 6372 9092 85A2 BB7F 907B CB8B 654B E33B F1ED
//
// This file is dually licensed under the terms of the following licenses:
// * Primary License: OSSAL - Open Source Software Alliance License
//   * See the included License.OSSAL for complete details.
//   * Key points:
//       5.Redistributions of source code in any non-textual form (i.e.
//          binary or object form, etc.) must not be linked to software that is
//          released with a license that requires disclosure of source code
//          (ex: the GPL).
//       6.Redistributions of source code must be licensed under more than one
//          license and must not have the terms of the OSSAL removed.
//
// * Secondary License: Creative Commons Attribution-NoDerivs License v1.0
//   * See the included License.CCANDL for complete details.
//   * Key Points:
//       * You are free:
//           * to copy, distribute, display, and perform the work
//           * to make non-commercial use of the work in its original form
//       * Under the following conditions:
//           * Attribution.You must give the original author credit.
//           * No Derivative Works.You may not alter, transform, or build upon
//             this work.
//
// * Special exceptions:
//   I, Theodore R.Smith, hereby grant, as the sole author of this library,
//   exclusive permission to the xMule Project to distribute and link to this
//   library, specifically voiding clause 5 of the OSSAL for the xMule Project.
//   As a further exclusive permission, when linked to the xMule Project,
//   the terms of the GPL concerning binary distribution must be observed.
//
// For more information on legality, see README.txt.

#ifndef _DYNPREFSCTRL_H
#define _DYNPREFSCTRL_H

#include "wxTreeMultiCtrl.h"                // Needed for wxTreeMultiCtrl

#if wxCHECK_VERSION(2, 5, 1)
    #include <wx/xml/xml.h>                 // Needed for wxXmlNode
#else
    #include <wx/xrc/xml.h>                 // Needed for wxXmlNode
#endif

class DynamicPreferences;

class DynamicPreferencesCtrl: public wxTreeMultiCtrl
{
friend wxWindow* add_item(wxTreeMultiCtrl* parent, wxXmlNode* node, wxPanel* panel);
private:
    DynamicPreferences* dynprefs;

public:
    DynamicPreferencesCtrl(const wxString& filename, wxWindow* parent, DynamicPreferences* dp, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);

private:
    void OnExpandNode(const wxTreeMultiEvent& event);
    void OnCheckBox(wxCommandEvent& event);
    void OnTextChange(wxCommandEvent& event);
    void OnChangedPrefs(const wxEvent& event);
    void OnBrowse1(wxCommandEvent& event);
    void OnCombo(wxCommandEvent& event);
    void OnSlider(wxScrollEvent& event);

    wxXmlDocument* doc;
    DECLARE_EVENT_TABLE()
};

extern const wxEventType wxEVT_PREFS_CHANGED;

#define EVT_PREFS_CHANGED(fn) \
    DECLARE_EVENT_TABLE_ENTRY( \
        wxEVT_PREFS_CHANGED, wxID_ANY, wxID_ANY, \
        (wxObjectEventFunction)(wxEventFunction)(wxNotifyEventFunction)&fn, \
        (wxObject *) NULL \
    ),

#endif
