> this case, I think you could create a subclass in C++ (in the .i
> file, like we did with App), and then expose it to Ruby. If that
doesn''t
> make sense, let me know and I''ll rethink and/or clarify.
Tried this with the MessageParameters stuff commented out and I can''t
even get that working, can you take a look at this *.i file and see if
I have something obviously wrong.
Thanks
Sean
-------------- next part --------------
# Copyright 2004-2005 by Kevin Smith
# released under the MIT-style wxruby2 license
%include "../common.i"
%module(directors="1") wxFileType
%{
#include <wx/mimetype.h>
%}
%rename(FileType) wxRubyFileType;
%{
class wxRubyFileType : public wxFileType
{
public:
/*
// An object of this class must be passed to Get{Open|Print}Command. The
// default implementation is trivial and doesn''t know anything at
all about
// parameters, only filename and MIME type are used (so it''s
probably ok for
// Windows where %{param} is not used anyhow)
class MessageParameters
{
public:
// ctors
MessageParameters() { }
MessageParameters(const wxString& filename,
const wxString& mimetype = wxEmptyString)
: m_filename(filename), m_mimetype(mimetype) { }
// accessors (called by GetOpenCommand)
// filename
const wxString& GetFileName() const { return m_filename; }
// mime type
const wxString& GetMimeType() const { return m_mimetype; }
// override this function in derived class
virtual wxString GetParamValue(const wxString& name) const { return
wxEmptyString; }
// virtual dtor as in any base class
virtual ~MessageParameters() { }
protected:
wxString m_filename, m_mimetype;
};
*/
wxRubyFileType(const wxFileTypeInfo& ftInfo) :wxFileType(ftInfo) { }
~wxRubyFileType() { wxFileType::~wxFileType(); }
};
%}
class wxRubyFileType : public wxFileType
{
public:
/*
class MessageParameters
{
public:
MessageParameters();
MessageParameters(const wxString& filename,
const wxString& mimetype = wxEmptyString);
const wxString& GetFileName() const;
const wxString& GetMimeType() const;
virtual wxString GetParamValue(const wxString& name) const;
virtual ~MessageParameters();
protected:
wxString m_filename, m_mimetype;
};
*/
wxRubyFileType(const wxFileTypeInfo& ftInfo);
bool GetMimeType(wxString *mimeType) const;
bool GetMimeTypes(wxArrayString& mimeTypes) const;
bool GetExtensions(wxArrayString& extensions);
bool GetIcon(wxIconLocation *iconloc) const;
// bool GetIcon(wxIconLocation *iconloc,
// const MessageParameters& params) const;
bool GetDescription(wxString *desc) const;
// bool GetOpenCommand(wxString *openCmd,
// const MessageParameters& params) const;
wxString GetOpenCommand(const wxString& filename) const;
// bool GetPrintCommand(wxString *printCmd,
// const MessageParameters& params) const;
// size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands,
// const wxFileType::MessageParameters& params)
const;
bool SetCommand(const wxString& cmd, const wxString& verb,
bool overwriteprompt = true);
bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
bool Unassociate();
// static wxString ExpandCommand(const wxString& command,
// const MessageParameters& params);
~wxRubyFileType();
};