Added wxIconBundle and wxTopLevelWindow.SetIcons.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-04-01 20:33:16 +00:00
parent 726fc00ab9
commit 0e9b78ce36
7 changed files with 372 additions and 0 deletions

View File

@ -70,6 +70,9 @@ UNICODE!
Added wxListCtrlAutoWidthMixin from Erik Westra. Added wxListCtrlAutoWidthMixin from Erik Westra.
Added wxIconBundle and wxTopLevelWindow.SetIcons.
2.3.2.1 2.3.2.1

View File

@ -105,6 +105,8 @@ public:
// set the frame icon // set the frame icon
virtual void SetIcon(const wxIcon& icon); virtual void SetIcon(const wxIcon& icon);
// set the frame icons
virtual void SetIcons(const wxIconBundle& icons );
// maximize the window to cover entire screen // maximize the window to cover entire screen
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);

View File

@ -21,6 +21,7 @@
#include <wx/fontmap.h> #include <wx/fontmap.h>
#include <wx/fontutil.h> #include <wx/fontutil.h>
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
#include <wx/iconbndl.h>
%} %}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -268,6 +269,38 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class wxIconBundle
{
public:
// default constructor
wxIconBundle();
// initializes the bundle with the icon(s) found in the file
%name(wxIconBundleFromFile) wxIconBundle( const wxString& file, long type );
// initializes the bundle with a single icon
%name(wxIconBundleFromIcon)wxIconBundle( const wxIcon& icon );
~wxIconBundle();
// adds the icon to the collection, if the collection already
// contains an icon with the same width and height, it is
// replaced
void AddIcon( const wxIcon& icon );
// adds all the icons contained in the file to the collection,
// if the collection already contains icons with the same
// width and height, they are replaced
%name(AddIconFromFile)void AddIcon( const wxString& file, long type );
// returns the icon with the given size; if no such icon exists,
// returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
// returns the first icon in the bundle
const wxIcon& GetIcon( const wxSize& size ) const;
};
//---------------------------------------------------------------------------
class wxCursor : public wxGDIObject class wxCursor : public wxGDIObject
{ {
public: public:

View File

@ -515,6 +515,43 @@ static PyObject *_wrap_wxTopLevelWindow_SetIcon(PyObject *self, PyObject *args,
return _resultobj; return _resultobj;
} }
#define wxTopLevelWindow_SetIcons(_swigobj,_swigarg0) (_swigobj->SetIcons(_swigarg0))
static PyObject *_wrap_wxTopLevelWindow_SetIcons(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxTopLevelWindow * _arg0;
wxIconBundle * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","icons", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTopLevelWindow_SetIcons",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTopLevelWindow_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTopLevelWindow_SetIcons. Expected _wxTopLevelWindow_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxIconBundle_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTopLevelWindow_SetIcons. Expected _wxIconBundle_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxTopLevelWindow_SetIcons(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxTopLevelWindow_ShowFullScreen(_swigobj,_swigarg0,_swigarg1) (_swigobj->ShowFullScreen(_swigarg0,_swigarg1)) #define wxTopLevelWindow_ShowFullScreen(_swigobj,_swigarg0,_swigarg1) (_swigobj->ShowFullScreen(_swigarg0,_swigarg1))
static PyObject *_wrap_wxTopLevelWindow_ShowFullScreen(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxTopLevelWindow_ShowFullScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
@ -2435,6 +2472,7 @@ static PyMethodDef framescMethods[] = {
{ "wxTopLevelWindow_SetTitle", (PyCFunction) _wrap_wxTopLevelWindow_SetTitle, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_SetTitle", (PyCFunction) _wrap_wxTopLevelWindow_SetTitle, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_IsFullScreen", (PyCFunction) _wrap_wxTopLevelWindow_IsFullScreen, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_IsFullScreen", (PyCFunction) _wrap_wxTopLevelWindow_IsFullScreen, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_ShowFullScreen", (PyCFunction) _wrap_wxTopLevelWindow_ShowFullScreen, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_ShowFullScreen", (PyCFunction) _wrap_wxTopLevelWindow_ShowFullScreen, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_SetIcons", (PyCFunction) _wrap_wxTopLevelWindow_SetIcons, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_SetIcon", (PyCFunction) _wrap_wxTopLevelWindow_SetIcon, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_SetIcon", (PyCFunction) _wrap_wxTopLevelWindow_SetIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_GetIcon", (PyCFunction) _wrap_wxTopLevelWindow_GetIcon, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_GetIcon", (PyCFunction) _wrap_wxTopLevelWindow_GetIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxTopLevelWindow_IsIconized", (PyCFunction) _wrap_wxTopLevelWindow_IsIconized, METH_VARARGS | METH_KEYWORDS }, { "wxTopLevelWindow_IsIconized", (PyCFunction) _wrap_wxTopLevelWindow_IsIconized, METH_VARARGS | METH_KEYWORDS },

View File

@ -44,6 +44,9 @@ class wxTopLevelWindowPtr(wxWindowPtr):
def SetIcon(self, *_args, **_kwargs): def SetIcon(self, *_args, **_kwargs):
val = apply(framesc.wxTopLevelWindow_SetIcon,(self,) + _args, _kwargs) val = apply(framesc.wxTopLevelWindow_SetIcon,(self,) + _args, _kwargs)
return val return val
def SetIcons(self, *_args, **_kwargs):
val = apply(framesc.wxTopLevelWindow_SetIcons,(self,) + _args, _kwargs)
return val
def ShowFullScreen(self, *_args, **_kwargs): def ShowFullScreen(self, *_args, **_kwargs):
val = apply(framesc.wxTopLevelWindow_ShowFullScreen,(self,) + _args, _kwargs) val = apply(framesc.wxTopLevelWindow_ShowFullScreen,(self,) + _args, _kwargs)
return val return val

View File

@ -62,6 +62,7 @@ extern PyObject *SWIG_newvarlink(void);
#include <wx/fontmap.h> #include <wx/fontmap.h>
#include <wx/fontutil.h> #include <wx/fontutil.h>
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
#include <wx/iconbndl.h>
static PyObject* t_output_helper(PyObject* target, PyObject* o) { static PyObject* t_output_helper(PyObject* target, PyObject* o) {
@ -2761,6 +2762,254 @@ static PyObject *_wrap_wxIcon_CopyFromBitmap(PyObject *self, PyObject *args, PyO
return _resultobj; return _resultobj;
} }
#define new_wxIconBundle() (new wxIconBundle())
static PyObject *_wrap_new_wxIconBundle(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _result;
char *_kwnames[] = { NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxIconBundle",_kwnames))
return NULL;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxIconBundle *)new_wxIconBundle();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIconBundle_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define new_wxIconBundleFromFile(_swigarg0,_swigarg1) (new wxIconBundle(_swigarg0,_swigarg1))
static PyObject *_wrap_new_wxIconBundleFromFile(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _result;
wxString * _arg0;
long _arg1;
PyObject * _obj0 = 0;
char *_kwnames[] = { "file","type", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:new_wxIconBundleFromFile",_kwnames,&_obj0,&_arg1))
return NULL;
{
_arg0 = wxString_in_helper(_obj0);
if (_arg0 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxIconBundle *)new_wxIconBundleFromFile(*_arg0,_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIconBundle_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
#define new_wxIconBundleFromIcon(_swigarg0) (new wxIconBundle(_swigarg0))
static PyObject *_wrap_new_wxIconBundleFromIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _result;
wxIcon * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "icon", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxIconBundleFromIcon",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIcon_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxIconBundleFromIcon. Expected _wxIcon_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxIconBundle *)new_wxIconBundleFromIcon(*_arg0);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIconBundle_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define delete_wxIconBundle(_swigobj) (delete _swigobj)
static PyObject *_wrap_delete_wxIconBundle(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxIconBundle",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIconBundle_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxIconBundle. Expected _wxIconBundle_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
delete_wxIconBundle(_arg0);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxIconBundle_AddIcon(_swigobj,_swigarg0) (_swigobj->AddIcon(_swigarg0))
static PyObject *_wrap_wxIconBundle_AddIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _arg0;
wxIcon * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","icon", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIconBundle_AddIcon",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIconBundle_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIconBundle_AddIcon. Expected _wxIconBundle_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxIcon_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxIconBundle_AddIcon. Expected _wxIcon_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxIconBundle_AddIcon(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxIconBundle_AddIconFromFile(_swigobj,_swigarg0,_swigarg1) (_swigobj->AddIcon(_swigarg0,_swigarg1))
static PyObject *_wrap_wxIconBundle_AddIconFromFile(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIconBundle * _arg0;
wxString * _arg1;
long _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","file","type", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:wxIconBundle_AddIconFromFile",_kwnames,&_argo0,&_obj1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIconBundle_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIconBundle_AddIconFromFile. Expected _wxIconBundle_p.");
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxIconBundle_AddIconFromFile(_arg0,*_arg1,_arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxIconBundle_GetIcon(_swigobj,_swigarg0) (_swigobj->GetIcon(_swigarg0))
static PyObject *_wrap_wxIconBundle_GetIcon(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxIcon * _result;
wxIconBundle * _arg0;
wxSize * _arg1;
PyObject * _argo0 = 0;
wxSize temp;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","size", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIconBundle_GetIcon",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIconBundle_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIconBundle_GetIcon. Expected _wxIconBundle_p.");
return NULL;
}
}
{
_arg1 = &temp;
if (! wxSize_helper(_obj1, &_arg1))
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
const wxIcon & _result_ref = wxIconBundle_GetIcon(_arg0,*_arg1);
_result = (wxIcon *) &_result_ref;
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIcon_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static void *SwigwxCursorTowxGDIObject(void *ptr) { static void *SwigwxCursorTowxGDIObject(void *ptr) {
wxCursor *src; wxCursor *src;
wxGDIObject *dest; wxGDIObject *dest;
@ -13340,6 +13589,13 @@ static PyMethodDef gdicMethods[] = {
{ "wxCursor_GetHandle", (PyCFunction) _wrap_wxCursor_GetHandle, METH_VARARGS | METH_KEYWORDS }, { "wxCursor_GetHandle", (PyCFunction) _wrap_wxCursor_GetHandle, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxCursor", (PyCFunction) _wrap_delete_wxCursor, METH_VARARGS | METH_KEYWORDS }, { "delete_wxCursor", (PyCFunction) _wrap_delete_wxCursor, METH_VARARGS | METH_KEYWORDS },
{ "new_wxCursor", (PyCFunction) _wrap_new_wxCursor, METH_VARARGS | METH_KEYWORDS }, { "new_wxCursor", (PyCFunction) _wrap_new_wxCursor, METH_VARARGS | METH_KEYWORDS },
{ "wxIconBundle_GetIcon", (PyCFunction) _wrap_wxIconBundle_GetIcon, METH_VARARGS | METH_KEYWORDS },
{ "wxIconBundle_AddIconFromFile", (PyCFunction) _wrap_wxIconBundle_AddIconFromFile, METH_VARARGS | METH_KEYWORDS },
{ "wxIconBundle_AddIcon", (PyCFunction) _wrap_wxIconBundle_AddIcon, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxIconBundle", (PyCFunction) _wrap_delete_wxIconBundle, METH_VARARGS | METH_KEYWORDS },
{ "new_wxIconBundleFromIcon", (PyCFunction) _wrap_new_wxIconBundleFromIcon, METH_VARARGS | METH_KEYWORDS },
{ "new_wxIconBundleFromFile", (PyCFunction) _wrap_new_wxIconBundleFromFile, METH_VARARGS | METH_KEYWORDS },
{ "new_wxIconBundle", (PyCFunction) _wrap_new_wxIconBundle, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_CopyFromBitmap", (PyCFunction) _wrap_wxIcon_CopyFromBitmap, METH_VARARGS | METH_KEYWORDS }, { "wxIcon_CopyFromBitmap", (PyCFunction) _wrap_wxIcon_CopyFromBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_SetSize", (PyCFunction) _wrap_wxIcon_SetSize, METH_VARARGS | METH_KEYWORDS }, { "wxIcon_SetSize", (PyCFunction) _wrap_wxIcon_SetSize, METH_VARARGS | METH_KEYWORDS },
{ "wxIcon_SetDepth", (PyCFunction) _wrap_wxIcon_SetDepth, METH_VARARGS | METH_KEYWORDS }, { "wxIcon_SetDepth", (PyCFunction) _wrap_wxIcon_SetDepth, METH_VARARGS | METH_KEYWORDS },

View File

@ -197,6 +197,43 @@ class wxIcon(wxIconPtr):
class wxIconBundlePtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,gdic=gdic):
if self.thisown == 1 :
gdic.delete_wxIconBundle(self)
def AddIcon(self, *_args, **_kwargs):
val = apply(gdic.wxIconBundle_AddIcon,(self,) + _args, _kwargs)
return val
def AddIconFromFile(self, *_args, **_kwargs):
val = apply(gdic.wxIconBundle_AddIconFromFile,(self,) + _args, _kwargs)
return val
def GetIcon(self, *_args, **_kwargs):
val = apply(gdic.wxIconBundle_GetIcon,(self,) + _args, _kwargs)
if val: val = wxIconPtr(val)
return val
def __repr__(self):
return "<C wxIconBundle instance at %s>" % (self.this,)
class wxIconBundle(wxIconBundlePtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(gdic.new_wxIconBundle,_args,_kwargs)
self.thisown = 1
def wxIconBundleFromFile(*_args,**_kwargs):
val = wxIconBundlePtr(apply(gdic.new_wxIconBundleFromFile,_args,_kwargs))
val.thisown = 1
return val
def wxIconBundleFromIcon(*_args,**_kwargs):
val = wxIconBundlePtr(apply(gdic.new_wxIconBundleFromIcon,_args,_kwargs))
val.thisown = 1
return val
class wxCursorPtr(wxGDIObjectPtr): class wxCursorPtr(wxGDIObjectPtr):
def __init__(self,this): def __init__(self,this):
self.this = this self.this = this