opteditctrl.h

00001 
00002 // Name:        opteditctrl.h
00003 // Purpose:     wxOptionEditorCtrl definition
00004 // Author:      Francesco Montorsi
00005 // Modified by:
00006 // Created:     10/7/2006
00007 // RCS-ID:      $Id: opteditctrl.h,v 1.2 2007/02/01 20:11:26 frm Exp $
00008 // Copyright:   (c) Francesco Montorsi
00009 // Licence:     wxWindows licence
00011 
00012 #ifndef _WX_OPTIONEDITOR_H_
00013 #define _WX_OPTIONEDITOR_H_
00014 
00015 // includes needed by wxPropertyGrid header
00016 #include "wx/window.h"
00017 #include "wx/bitmap.h"
00018 #include "wx/dcclient.h"
00019 #include <wx/scrolwin.h>
00020 
00021 #include "wx/propgrid/propgrid.h"
00022 #include "wxp/package.h"
00023 class wxConfigBase;
00024 
00025 
00026 // ----------------------------------------------------------------------------
00027 // wxOptionEditorCtrl - a control which allows the user to edit package options
00028 // ----------------------------------------------------------------------------
00029 
00030 class wxOptionEditorCtrl : public wxPropertyGrid
00031 {
00032     DECLARE_DYNAMIC_CLASS( wxOptionEditorCtrl )
00033     DECLARE_EVENT_TABLE()
00034 
00035 public:
00036     wxOptionEditorCtrl() {}
00037 
00038     wxOptionEditorCtrl(wxWindow* parent, wxWindowID id,
00039                        const wxPoint& pos = wxDefaultPosition,
00040                        const wxSize& size = wxDefaultSize,
00041                        long style = 0,
00042                        const wxString& name = wxT("wxOptionEditorCtrl"))
00043         { Create(parent, id, pos, size, style, name); }
00044 
00045     bool Create(wxWindow* parent, wxWindowID id,
00046                          const wxPoint& pos = wxDefaultPosition,
00047                          const wxSize& size = wxDefaultSize,
00048                          long style = 0,
00049                          const wxString& name = wxT("wxOptionEditorCtrl"));
00050 
00051 
00052 public:     // wxOptionEditorCtrl-specific API
00053 
00056     bool Load(wxConfigBase *, const wxString &path);
00057 
00060     void Save(wxConfigBase *, const wxString &path) const;
00061 
00067     bool SetOptions(const wxPackageCommandOptionArray &opt)
00068         { m_arr = opt; m_arr.SetDirty(false); return true; }
00069 
00070     // Remember to call TransferDataToWindow() after calling all Set*() functions!
00071 
00072     void SetBuildSystemType(wxPackageBuildSystemType type)
00073         { m_buildsys = type; }
00074     void SetStages(long stages)
00075         { m_stages = stages; }
00076     void SetCompilerFormats(long formats)
00077         { m_formats = formats; }
00078 
00082     wxPackageCommandOptionArray &GetOptions()
00083         { return m_arr; }
00084 
00087     bool IsDirty() const
00088         { return m_arr.IsDirty(); }
00089 
00090     bool TransferDataFromWindow();
00091     bool TransferDataToWindow();
00092 
00093 public:     // event handlers
00094 
00095     void OnOptionChanged(wxPropertyGridEvent &ev);
00096 
00097 protected:
00098     wxPackageCommandOptionArray m_arr;
00099 
00100     // filters of the m_arr options
00101     wxPackageBuildSystemType m_buildsys;
00102     long m_stages;
00103     long m_formats;
00104 };
00105 
00106 
00107 // ----------------------------------------------------------------------------
00108 // wxEVT_COMMAND_OPTIONS_CHANGED
00109 // ----------------------------------------------------------------------------
00110 
00111 BEGIN_DECLARE_EVENT_TYPES()
00112     //DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP, wxEVT_COMMAND_FILTER_PACKAGES, 1000000)
00113     DECLARE_EVENT_TYPE(wxEVT_COMMAND_OPTIONS_CHANGED, 3000000)
00114 END_DECLARE_EVENT_TYPES()
00115 
00116 #define EVT_OPTIONS_CHANGED(id, fn) \
00117     wx__DECLARE_EVT1(wxEVT_COMMAND_OPTIONS_CHANGED, id, wxCommandEventHandler(fn))
00118 
00119 
00120 #endif
00121     // _WX_OPTIONEDITOR_H_
00122 

Generated on Thu Feb 1 22:14:31 2007 for wxWidgets Package Manager by  doxygen 1.5.1-p1