X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fded56b375bf7a4687af1cdb182899614c1b2a8..5dacf03c57128529219145bafe9cee07d4348e85:/wxPython/src/gdi.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 6905b8133e..d3fe92e1ae 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -21,6 +21,7 @@ #include #include #include +#include #include %} @@ -242,6 +243,7 @@ public: %new wxIcon* wxEmptyIcon(); %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings); %new wxIcon* wxIconFromBitmap(const wxBitmap& bmp); +%new wxIcon* wxIconFromLocation(const wxIconLocation& loc); %{ // Implementations of some alternate "constructors" wxIcon* wxEmptyIcon() { @@ -265,8 +267,61 @@ public: icon->CopyFromBitmap(bmp); return icon; } + + wxIcon* wxIconFromLocation(const wxIconLocation& loc) { + wxIcon* icon = new wxIcon(loc); + return icon; + } %} + +//--------------------------------------------------------------------------- + +class wxIconLocation +{ +public: + // ctor takes the name of the file where the icon is + %addmethods { + wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) { +#ifdef __WXMSW__ + return new wxIconLocation(*filename, num); +#else + return new wxIconLocation(*filename); +#endif + } + } + + ~wxIconLocation(); + + + // returns true if this object is valid/initialized + bool IsOk() const; + + // set/get the icon file name + void SetFileName(const wxString& filename); + const wxString& GetFileName() const; + + %addmethods { + void SetIndex(int num) { +#ifdef __WXMSW__ + self->SetIndex(num); +#else + // do nothing +#endif + } + + int GetIndex() { +#ifdef __WXMSW__ + return self->GetIndex(); +#else + return -1; +#endif + } + } +}; + + + //--------------------------------------------------------------------------- class wxIconBundle @@ -432,31 +487,20 @@ public: class wxColourDatabase : public wxObject { public: - wxColour *FindColour(const wxString& colour); + wxColour *FindColour(const wxString& colour) ; + wxColour *FindColourNoAdd(const wxString& colour) const; wxString FindName(const wxColour& colour) const; %addmethods { - void Append(const wxString& name, int red, int green, int blue) { - // first see if the name is already there - wxString cName = name; - cName.MakeUpper(); - wxString cName2 = cName; - if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) ) - cName2.clear(); - - wxNode *node = self->GetFirst(); - while ( node ) { - const wxChar *key = node->GetKeyString(); - if ( cName == key || cName2 == key ) { - wxColour* c = (wxColour *)node->GetData(); - c->Set(red, green, blue); - return; - } - node = node->GetNext(); - } + void AddColour(const wxString& name, wxColour* colour) { + // make a copy since the python one will be GC'd + wxColour* c = new wxColour(*colour); + self->AddColour(name, c); + } - // otherwise append the new colour - self->Append(name.c_str(), new wxColour(red, green, blue)); + void Append(const wxString& name, int red, int green, int blue) { + wxColour* c = new wxColour(red, green, blue); + self->AddColour(name, c); } } }; @@ -978,6 +1022,20 @@ public: //--------------------------------------------------------------------------- +class wxMirrorDC : public wxDC +{ +public: + // constructs a mirror DC associated with the given real DC + // + // if mirror parameter is true, all vertical and horizontal coordinates are + // exchanged, otherwise this class behaves in exactly the same way as a + // plain DC + // + wxMirrorDC(wxDC& dc, bool mirror); +}; + +//--------------------------------------------------------------------------- + #ifdef __WXMSW__ @@ -1164,6 +1222,8 @@ public: #if 0 %} +// See also wxPy_ReinitStockObjects in helpers.cpp + extern wxFont *wxNORMAL_FONT; extern wxFont *wxSMALL_FONT; extern wxFont *wxITALIC_FONT;