Fixed SetFonts methods to properly accept a Python list for the sizes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-04-20 07:34:04 +00:00
parent d72d009d64
commit 9b4c5d5a21
4 changed files with 53 additions and 119 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* FILE : html.cpp * FILE : ./html.cpp
* *
* This file was automatically generated by : * This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG) * Simplified Wrapper and Interface Generator (SWIG)
@@ -1316,21 +1316,27 @@ static PyObject *_wrap_wxHtmlWinParser_GetWindow(PyObject *self, PyObject *args,
return _resultobj; return _resultobj;
} }
#define wxHtmlWinParser_SetFonts(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetFonts(_swigarg0,_swigarg1,_swigarg2)) static void wxHtmlWinParser_SetFonts(wxHtmlWinParser *self,wxString normal_face,wxString fixed_face,PyObject * sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
delete [] temp;
}
}
static PyObject *_wrap_wxHtmlWinParser_SetFonts(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxHtmlWinParser_SetFonts(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxHtmlWinParser * _arg0; wxHtmlWinParser * _arg0;
wxString * _arg1; wxString * _arg1;
wxString * _arg2; wxString * _arg2;
int * _arg3; PyObject * _arg3;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0; PyObject * _obj1 = 0;
PyObject * _obj2 = 0; PyObject * _obj2 = 0;
PyObject * _argo3 = 0; PyObject * _obj3 = 0;
char *_kwnames[] = { "self","normal_face","fixed_face","LIST", NULL }; char *_kwnames[] = { "self","normal_face","fixed_face","sizes", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO:wxHtmlWinParser_SetFonts",_kwnames,&_argo0,&_obj1,&_obj2,&_argo3)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO:wxHtmlWinParser_SetFonts",_kwnames,&_argo0,&_obj1,&_obj2,&_obj3))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -1353,13 +1359,9 @@ static PyObject *_wrap_wxHtmlWinParser_SetFonts(PyObject *self, PyObject *args,
} }
_arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2));
} }
if (_argo3) { {
if (_argo3 == Py_None) { _arg3 = NULL; } _arg3 = _obj3;
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) { }
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxHtmlWinParser_SetFonts. Expected _int_p.");
return NULL;
}
}
{ {
wxPy_BEGIN_ALLOW_THREADS; wxPy_BEGIN_ALLOW_THREADS;
wxHtmlWinParser_SetFonts(_arg0,*_arg1,*_arg2,_arg3); wxHtmlWinParser_SetFonts(_arg0,*_arg1,*_arg2,_arg3);
@@ -4117,21 +4119,27 @@ static PyObject *_wrap_wxHtmlWindow_SetRelatedStatusBar(PyObject *self, PyObject
return _resultobj; return _resultobj;
} }
#define wxHtmlWindow_SetFonts(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetFonts(_swigarg0,_swigarg1,_swigarg2)) static void wxPyHtmlWindow_SetFonts(wxPyHtmlWindow *self,wxString normal_face,wxString fixed_face,PyObject * sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
delete [] temp;
}
}
static PyObject *_wrap_wxHtmlWindow_SetFonts(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxHtmlWindow_SetFonts(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxPyHtmlWindow * _arg0; wxPyHtmlWindow * _arg0;
wxString * _arg1; wxString * _arg1;
wxString * _arg2; wxString * _arg2;
int * _arg3; PyObject * _arg3;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0; PyObject * _obj1 = 0;
PyObject * _obj2 = 0; PyObject * _obj2 = 0;
PyObject * _argo3 = 0; PyObject * _obj3 = 0;
char *_kwnames[] = { "self","normal_face","fixed_face","LIST", NULL }; char *_kwnames[] = { "self","normal_face","fixed_face","sizes", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO:wxHtmlWindow_SetFonts",_kwnames,&_argo0,&_obj1,&_obj2,&_argo3)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO:wxHtmlWindow_SetFonts",_kwnames,&_argo0,&_obj1,&_obj2,&_obj3))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -4154,16 +4162,12 @@ static PyObject *_wrap_wxHtmlWindow_SetFonts(PyObject *self, PyObject *args, PyO
} }
_arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2));
} }
if (_argo3) { {
if (_argo3 == Py_None) { _arg3 = NULL; } _arg3 = _obj3;
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) { }
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxHtmlWindow_SetFonts. Expected _int_p.");
return NULL;
}
}
{ {
wxPy_BEGIN_ALLOW_THREADS; wxPy_BEGIN_ALLOW_THREADS;
wxHtmlWindow_SetFonts(_arg0,*_arg1,*_arg2,_arg3); wxPyHtmlWindow_SetFonts(_arg0,*_arg1,*_arg2,_arg3);
wxPy_END_ALLOW_THREADS; wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None); } Py_INCREF(Py_None);

View File

@@ -152,7 +152,16 @@ public:
int GetCharHeight(); int GetCharHeight();
int GetCharWidth(); int GetCharWidth();
wxWindow* GetWindow(); wxWindow* GetWindow();
void SetFonts(wxString normal_face, wxString fixed_face, int *LIST); //void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
delete [] temp;
}
}
}
wxHtmlContainerCell* GetContainer(); wxHtmlContainerCell* GetContainer();
wxHtmlContainerCell* OpenContainer(); wxHtmlContainerCell* OpenContainer();
@@ -457,7 +466,18 @@ public:
void SetRelatedFrame(wxFrame* frame, const char* format); void SetRelatedFrame(wxFrame* frame, const char* format);
wxFrame* GetRelatedFrame(); wxFrame* GetRelatedFrame();
void SetRelatedStatusBar(int bar); void SetRelatedStatusBar(int bar);
void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
//void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
delete [] temp;
}
}
}
void SetTitle(const char* title); void SetTitle(const char* title);
void SetBorders(int b); void SetBorders(int b);
void ReadCustomization(wxConfigBase *cfg, char* path = ""); void ReadCustomization(wxConfigBase *cfg, char* path = "");

View File

@@ -1,5 +1,5 @@
/* /*
* FILE : htmlhelp.cpp * FILE : ./htmlhelp.cpp
* *
* This file was automatically generated by : * This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG) * Simplified Wrapper and Interface Generator (SWIG)

View File

@@ -183,94 +183,4 @@ public:
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#ifdef DO_WE_NEED_TO_KEEP_THIS
class wxHtmlHelpSystem : public wxHtmlHelpController {
public:
wxHtmlHelpSystem() {};
~wxHtmlHelpSystem() {};
bool AddBookParam(const wxString& title, const wxString& contfile,
const wxString& indexfile=wxEmptyString, const wxString& deftopic=wxEmptyString,
const wxString& path=wxEmptyString, bool show_wait_msg=FALSE);
// Alternative to AddBook(wxString& hhpfile)
wxToolBar* CreateToolBar(wxFrame* frame);
// creates a dockable toolbar for the frame, containing hide/show, back and forward buttons
wxTreeCtrl* CreateContentsTree(wxWindow* parent);
// creates a treecontrol with imagelist for books, folders etc and id wxID_HTML_TREECTRL
wxListBox* CreateIndexList(wxWindow* parent);
// creates a listbox with the right id
virtual void CreateHelpWindow();
// Slightly different version than in wxHtmlHelpController; uses helpers above
// Do nothing if the window already exists
void SetControls(wxFrame* frame, wxHtmlWindow* htmlwin,
wxTreeCtrl* contents=NULL, wxListBox* index=NULL,
wxListBox* searchlist=NULL);
// alternative for CreateHelpWindow(), sets frame, htmlwindow, contents tree, index
// listbox and searchlist listbox. If null, their functionality won't be used
// Some extra accessor functions
wxFrame* GetFrame() { return m_Frame; }
wxHtmlWindow* GetHtmlWindow() { return m_HtmlWin; }
wxTreeCtrl* GetContentsTree() { return m_ContentsBox; }
wxListBox* GetIndexList() { return m_IndexBox; }
wxListBox* GetSearchList() { return m_SearchList; }
wxImageList* GetContentsImageList() { return m_ContentsImageList; }
// public interface for wxHtmlHelpControllers handlers, so wxPython can call them
void OnToolbar(wxCommandEvent& event);
void OnContentsSel(wxTreeEvent& event) {wxHtmlHelpController::OnContentsSel(event);}
void OnIndexSel(wxCommandEvent& event) {wxHtmlHelpController::OnIndexSel(event);}
void OnSearchSel(wxCommandEvent& event) {wxHtmlHelpController::OnSearchSel(event);}
void OnSearch(wxCommandEvent& event) {wxHtmlHelpController::OnSearch(event);}
void OnCloseWindow(wxCloseEvent& event);
// some more protected functions that should be accessible from wxPython
void RefreshLists();
void CreateContents() { if (!m_IndexBox) return; wxHtmlHelpController::CreateContents(); }
// Adds items to m_Contents tree control
void CreateIndex() { if (! m_ContentsBox) return; wxHtmlHelpController::CreateIndex(); }
// Adds items to m_IndexList
};
// just for fun, an Altavista-like search engine (the gems that Vaclav has hidden in wxHtml...)
// but not for wxMSW because it's not DLL exported
//#ifndef __WXMSW__
#ifdef THIS_IS_NOT_DEFINED_OKAY
class wxSearchEngine
{
public:
wxSearchEngine() : wxObject() {m_Keyword = NULL;}
~wxSearchEngine() {if (m_Keyword) free(m_Keyword);}
void LookFor(const wxString& keyword);
// Sets the keyword we will be searching for
bool Scan(wxInputStream *stream);
// Scans the stream for the keyword.
// Returns TRUE if the stream contains keyword, fALSE otherwise
%addmethods {
bool ScanFile(const wxString& filename) {
if (filename.IsEmpty())
return false;
wxFileInputStream istr(filename);
return self->Scan(&istr);
}
}
};
#endif
#endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------