refeditdlg.h

00001 
00002 // Name:        refeditdlg.h
00003 // Purpose:     wxPackageReferenceEditDlg definition
00004 // Author:      Francesco Montorsi
00005 // Modified by:
00006 // Created:     Thu 10 Aug 2006 18:49:40 CEST
00007 // RCS-ID:      $Id: refeditdlg.h,v 1.2 2007/01/01 20:06:20 frm Exp $
00008 // Copyright:   (c) 2006 Francesco Montorsi
00009 // Licence:     wxWidgets license
00011 
00012 #ifndef _REFEDITDLG_H_
00013 #define _REFEDITDLG_H_
00014 
00015 
00020 #include <wx/textctrl.h>
00021 #include "wxp/packageutils.h"
00022 
00023 
00028 
00029 #define SYMBOL_WXPACKAGEREFERENCEEDITDLG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
00030 #define SYMBOL_WXPACKAGEREFERENCEEDITDLG_TITLE _("Reference")
00031 #define SYMBOL_WXPACKAGEREFERENCEEDITDLG_IDNAME wxID_ANY
00032 #define SYMBOL_WXPACKAGEREFERENCEEDITDLG_SIZE wxSize(400, 300)
00033 #define SYMBOL_WXPACKAGEREFERENCEEDITDLG_POSITION wxDefaultPosition
00034 #define ID_REFEDIT_LOCAL 10000
00035 #define ID_REFEDIT_LOCALBROWSE 10017
00036 #define ID_REFEDIT_REMOTE 10001
00038 
00039 #define wxPACKAGEREF_DEFAULT_HREF       wxT("http://")
00040 #define wxPACKAGEREF_DEFAULT_LOCALREF   wxT("file:
00041 
00042 
00043 // ----------------------------------------------------------------------------
00044 // wxPackageReferenceEditDlg
00045 // ----------------------------------------------------------------------------
00046 
00047 class wxPackageReferenceEditDlg: public wxDialog
00048 {
00049     DECLARE_DYNAMIC_CLASS( wxPackageReferenceEditDlg )
00050     DECLARE_EVENT_TABLE()
00051 
00052 public:
00054     wxPackageReferenceEditDlg( );
00055     wxPackageReferenceEditDlg( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEREFERENCEEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEREFERENCEEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEREFERENCEEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEREFERENCEEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEREFERENCEEDITDLG_STYLE );
00056 
00058     bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEREFERENCEEDITDLG_IDNAME, const wxString& caption = SYMBOL_WXPACKAGEREFERENCEEDITDLG_TITLE, const wxPoint& pos = SYMBOL_WXPACKAGEREFERENCEEDITDLG_POSITION, const wxSize& size = SYMBOL_WXPACKAGEREFERENCEEDITDLG_SIZE, long style = SYMBOL_WXPACKAGEREFERENCEEDITDLG_STYLE );
00059 
00061     void CreateControls();
00062 
00064     static bool ShowToolTips();
00065 
00066 public:     // event handlers
00067 
00068     void OnOK(wxCommandEvent &ev);
00069     void OnLocalBrowse(wxCommandEvent &ev);
00070 
00071 public:     // public API
00072 
00076     void SetLocalRoot(const wxString &root)
00077         { m_strRoot=root; }
00078 
00081     void SetWildcard(const wxString &wild)
00082         { m_strWildcard=wild; }
00083 
00084     void SetRef(const wxPackageDataWithRef &ref)
00085     {
00086         m_pLocal->SetValue(ref.GetLocalRef().IsEmpty() ? wxPACKAGEREF_DEFAULT_LOCALREF : ref.GetLocalRef());
00087         m_pRemote->SetValue(ref.GetHref().IsEmpty() ? wxPACKAGEREF_DEFAULT_HREF : ref.GetHref());
00088 
00089         // save this so that we can restore a wxPackageDataWithRef later
00090         m_strData = ref.GetData();
00091     }
00092 
00093     wxPackageDataWithRef GetRef() const
00094     {
00095         wxString r(m_pRemote->GetValue()), l(m_pLocal->GetValue());
00096 
00097         return wxPackageDataWithRef(m_strData,
00098                                     r == wxPACKAGEREF_DEFAULT_HREF ? wxT("") : r,
00099                                     l == wxPACKAGEREF_DEFAULT_LOCALREF ? wxT("") : l);
00100     }
00101 
00102 protected:      // controls
00103 
00105     wxTextCtrl* m_pLocal;
00106     wxTextCtrl* m_pRemote;
00108 
00109 protected:
00110 
00111     wxString m_strData;
00112 
00113     wxString m_strRoot;
00114     wxString m_strWildcard;
00115 };
00116 
00117 #endif
00118     // _REFEDITDLG_H_

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