X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f4e928794167715f19a3021d62b7c4f77611694..8262f9aecb42cefb62a6c574812a2db3dcc33661:/wxPython/src/gdi.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 5d0cdaf57e..29aca1dcac 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -31,9 +31,6 @@ %import _defs.i %import misc.i -%{ - static wxString wxPyEmptyStr(""); -%} //--------------------------------------------------------------------------- @@ -202,7 +199,9 @@ public: int desiredWidth = -1, int desiredHeight = -1); ~wxIcon(); +#ifndef __WXMAC__ bool LoadFile(const wxString& name, long flags); +#endif // wxGDIImage methods #ifdef __WXMSW__ @@ -300,7 +299,8 @@ enum wxFontFamily wxFONTFAMILY_SWISS = wxSWISS, wxFONTFAMILY_MODERN = wxMODERN, wxFONTFAMILY_TELETYPE = wxTELETYPE, - wxFONTFAMILY_MAX + wxFONTFAMILY_MAX, + wxFONTFAMILY_UNKNOWN }; // font styles @@ -394,6 +394,44 @@ enum wxFontEncoding // ToString() and restore them using FromString()) struct wxNativeFontInfo { +#ifdef __WXGTK__ + // 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(); } + + // reset to the default state + void Init(); + +#ifndef __WXGTK__ + // accessors and modifiers for the font elements + int GetPointSize() const; + wxFontStyle GetStyle() const; + wxFontWeight GetWeight() const; + bool GetUnderlined() const; + wxString GetFaceName() const; + wxFontFamily GetFamily() const; + wxFontEncoding GetEncoding() const; + + void SetPointSize(int pointsize); + void SetStyle(wxFontStyle style); + void SetWeight(wxFontWeight weight); + void SetUnderlined(bool underlined); + void SetFaceName(wxString facename); + void SetFamily(wxFontFamily family); + void SetEncoding(wxFontEncoding encoding); +#endif + // it is important to be able to serialize wxNativeFontInfo objects to be // able to store them (in config file, for example) bool FromString(const wxString& s); @@ -404,6 +442,12 @@ struct wxNativeFontInfo return self->ToString(); } } + + // we also want to present the native font descriptions to the user in some + // human-readable form (it is not platform independent neither, but can + // hopefully be understood by the user) + bool FromUserString(const wxString& s); + wxString ToUserString() const; }; @@ -514,7 +558,12 @@ public: bool GetUnderlined() const; wxString GetFaceName() const; wxFontEncoding GetEncoding() const; + + bool IsFixedWidth(); + wxNativeFontInfo* GetNativeFontInfo() const; + wxString GetNativeFontInfoDesc() const; + wxString GetNativeFontInfoUserDesc() const; void SetPointSize(int pointSize); void SetFamily(int family); @@ -524,6 +573,8 @@ public: void SetUnderlined(bool underlined); void SetEncoding(wxFontEncoding encoding); void SetNativeFontInfo(const wxNativeFontInfo& info); + // void SetNativeFontInfo(const wxString& info); + void SetNativeFontInfoUserDesc(const wxString& info); wxString GetFamilyString() const; wxString GetStyleString() const; @@ -592,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)); } } @@ -743,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, @@ -757,18 +844,18 @@ public: void EndDrawing(); void EndPage(); void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); - wxBrush& GetBackground(); - wxBrush& GetBrush(); + wxBrush GetBackground(); + wxBrush GetBrush(); long GetCharHeight(); long GetCharWidth(); void GetClippingBox(long *OUTPUT, long *OUTPUT, long *OUTPUT, long *OUTPUT); - wxFont& GetFont(); + wxFont GetFont(); int GetLogicalFunction(); void GetLogicalScale(double *OUTPUT, double *OUTPUT); int GetMapMode(); bool GetOptimization(); - wxPen& GetPen(); + wxPen GetPen(); %addmethods { %new wxColour* GetPixel(long x, long y) { wxColour* wc = new wxColour(); @@ -1088,7 +1175,7 @@ public: class wxMetaFile : public wxObject { public: - wxMetaFile(const wxString& filename = wxPyEmptyStr); + wxMetaFile(const wxString& filename = wxEmptyString); ~wxMetaFile(); bool Ok(); @@ -1108,82 +1195,14 @@ 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(); }; #endif -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - - -%readonly -%{ -#if 0 -%} -extern wxFont *wxNORMAL_FONT; -extern wxFont *wxSMALL_FONT; -extern wxFont *wxITALIC_FONT; -extern wxFont *wxSWISS_FONT; - -extern wxPen *wxRED_PEN; -extern wxPen *wxCYAN_PEN; -extern wxPen *wxGREEN_PEN; -extern wxPen *wxBLACK_PEN; -extern wxPen *wxWHITE_PEN; -extern wxPen *wxTRANSPARENT_PEN; -extern wxPen *wxBLACK_DASHED_PEN; -extern wxPen *wxGREY_PEN; -extern wxPen *wxMEDIUM_GREY_PEN; -extern wxPen *wxLIGHT_GREY_PEN; - -extern wxBrush *wxBLUE_BRUSH; -extern wxBrush *wxGREEN_BRUSH; -extern wxBrush *wxWHITE_BRUSH; -extern wxBrush *wxBLACK_BRUSH; -extern wxBrush *wxTRANSPARENT_BRUSH; -extern wxBrush *wxCYAN_BRUSH; -extern wxBrush *wxRED_BRUSH; -extern wxBrush *wxGREY_BRUSH; -extern wxBrush *wxMEDIUM_GREY_BRUSH; -extern wxBrush *wxLIGHT_GREY_BRUSH; - -extern wxColour *wxBLACK; -extern wxColour *wxWHITE; -extern wxColour *wxRED; -extern wxColour *wxBLUE; -extern wxColour *wxGREEN; -extern wxColour *wxCYAN; -extern wxColour *wxLIGHT_GREY; - -extern wxCursor *wxSTANDARD_CURSOR; -extern wxCursor *wxHOURGLASS_CURSOR; -extern wxCursor *wxCROSS_CURSOR; - -extern wxBitmap wxNullBitmap; -extern wxIcon wxNullIcon; -extern wxCursor wxNullCursor; -extern wxPen wxNullPen; -extern wxBrush wxNullBrush; -extern wxPalette wxNullPalette; -extern wxFont wxNullFont; -extern wxColour wxNullColour; - - -extern wxFontList* wxTheFontList; -extern wxPenList* wxThePenList; -extern wxBrushList* wxTheBrushList; -extern wxColourDatabase* wxTheColourDatabase; - - -%readwrite -%{ -#endif -%} - //--------------------------------------------------------------------------- class wxPalette : public wxGDIObject { @@ -1248,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); @@ -1301,3 +1324,72 @@ public: //--------------------------------------------------------------------------- +%readonly +%{ +#if 0 +%} + +extern wxFont *wxNORMAL_FONT; +extern wxFont *wxSMALL_FONT; +extern wxFont *wxITALIC_FONT; +extern wxFont *wxSWISS_FONT; + +extern wxPen *wxRED_PEN; +extern wxPen *wxCYAN_PEN; +extern wxPen *wxGREEN_PEN; +extern wxPen *wxBLACK_PEN; +extern wxPen *wxWHITE_PEN; +extern wxPen *wxTRANSPARENT_PEN; +extern wxPen *wxBLACK_DASHED_PEN; +extern wxPen *wxGREY_PEN; +extern wxPen *wxMEDIUM_GREY_PEN; +extern wxPen *wxLIGHT_GREY_PEN; + +extern wxBrush *wxBLUE_BRUSH; +extern wxBrush *wxGREEN_BRUSH; +extern wxBrush *wxWHITE_BRUSH; +extern wxBrush *wxBLACK_BRUSH; +extern wxBrush *wxTRANSPARENT_BRUSH; +extern wxBrush *wxCYAN_BRUSH; +extern wxBrush *wxRED_BRUSH; +extern wxBrush *wxGREY_BRUSH; +extern wxBrush *wxMEDIUM_GREY_BRUSH; +extern wxBrush *wxLIGHT_GREY_BRUSH; + +extern wxColour *wxBLACK; +extern wxColour *wxWHITE; +extern wxColour *wxRED; +extern wxColour *wxBLUE; +extern wxColour *wxGREEN; +extern wxColour *wxCYAN; +extern wxColour *wxLIGHT_GREY; + +extern wxCursor *wxSTANDARD_CURSOR; +extern wxCursor *wxHOURGLASS_CURSOR; +extern wxCursor *wxCROSS_CURSOR; + + +extern wxBitmap wxNullBitmap; +extern wxIcon wxNullIcon; +extern wxCursor wxNullCursor; +extern wxPen wxNullPen; +extern wxBrush wxNullBrush; +extern wxPalette wxNullPalette; +extern wxFont wxNullFont; +extern wxColour wxNullColour; + + +extern wxFontList* wxTheFontList; +extern wxPenList* wxThePenList; +extern wxBrushList* wxTheBrushList; +extern wxColourDatabase* wxTheColourDatabase; + + +%readwrite +%{ +#endif +%} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +