X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68320e40cde2ceaac4645db9ae2989e3101fde45..7d1f4c3ff01b09105c07d5e176a14428c834975e:/wxPython/src/gdi.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 079792271a..7544659159 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -31,9 +31,6 @@ %import _defs.i %import misc.i -%{ - static wxString wxPyEmptyStr(""); -%} //--------------------------------------------------------------------------- @@ -54,12 +51,12 @@ public: class wxBitmap : public wxGDIObject { public: - wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP); + wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY); ~wxBitmap(); wxPalette* GetPalette(); wxMask* GetMask(); - bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP); + bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY); bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL); void SetMask(wxMask* mask); #ifdef __WXMSW__ @@ -302,7 +299,8 @@ enum wxFontFamily wxFONTFAMILY_SWISS = wxSWISS, wxFONTFAMILY_MODERN = wxMODERN, wxFONTFAMILY_TELETYPE = wxTELETYPE, - wxFONTFAMILY_MAX + wxFONTFAMILY_MAX, + wxFONTFAMILY_UNKNOWN }; // font styles @@ -400,8 +398,14 @@ struct wxNativeFontInfo // init the elements from an XLFD, return TRUE if ok bool FromXFontName(const wxString& xFontName); + // return false if we were never initialized with a valid XLFD + bool IsDefault() const; + // generate an XLFD using the fontElements wxString GetXFontName() const; + + // set the XFLD + void SetXFontName(const wxString& xFontName); #endif wxNativeFontInfo() { Init(); } @@ -639,6 +643,25 @@ public: %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("GRAY", "GREY") ) + cName2.clear(); + + wxNode *node = self->First(); + while ( node ) { + const wxChar *key = node->GetKeyString(); + if ( cName == key || cName2 == key ) { + wxColour* c = (wxColour *)node->Data(); + c->Set(red, green, blue); + return; + } + node = node->Next(); + } + + // otherwise append the new colour self->Append(name.c_str(), new wxColour(red, green, blue)); } } @@ -790,6 +813,23 @@ public: void DrawEllipse(long x, long y, long width, long height); void DrawEllipticArc(long x, long y, long width, long height, long start, long end); void DrawIcon(const wxIcon& icon, long x, long y); + + void DrawLabel(const wxString& text, const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1); + + %addmethods { + wxRect DrawImageLabel(const wxString& text, + const wxBitmap& image, + const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1) { + wxRect rv; + self->DrawLabel(text, image, rect, alignment, indexAccel, &rv); + return rv; + } + } + void DrawLine(long x1, long y1, long x2, long y2); void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0); void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0, @@ -1135,7 +1175,7 @@ public: class wxMetaFile : public wxObject { public: - wxMetaFile(const wxString& filename = wxPyEmptyStr); + wxMetaFile(const wxString& filename = wxEmptyString); ~wxMetaFile(); bool Ok(); @@ -1155,9 +1195,9 @@ public: class wxMetaFileDC : public wxDC { public: - wxMetaFileDC(const wxString& filename = wxPyEmptyStr, + wxMetaFileDC(const wxString& filename = wxEmptyString, int width = 0, int height = 0, - const wxString& description = wxPyEmptyStr); + const wxString& description = wxEmptyString); wxMetaFile* Close(); }; @@ -1227,6 +1267,10 @@ public: ~wxRegion(); void Clear(); +#ifndef __WXMAC__ + bool Offset(wxCoord x, wxCoord y); +#endif + wxRegionContain Contains(long x, long y); %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);