X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6056257ab676ea10a51ef96e19b1f1092f95b40..7d1f4c3ff01b09105c07d5e176a14428c834975e:/wxPython/src/gdi.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 7ed99fbc21..7544659159 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -16,9 +16,6 @@ %{ #include "helpers.h" #include -#ifndef __WXMSW__ -#include -#endif #include #include #include @@ -34,9 +31,6 @@ %import _defs.i %import misc.i -%{ - static wxString wxPyEmptyStr(""); -%} //--------------------------------------------------------------------------- @@ -57,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__ @@ -205,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__ @@ -303,7 +299,8 @@ enum wxFontFamily wxFONTFAMILY_SWISS = wxSWISS, wxFONTFAMILY_MODERN = wxMODERN, wxFONTFAMILY_TELETYPE = wxTELETYPE, - wxFONTFAMILY_MAX + wxFONTFAMILY_MAX, + wxFONTFAMILY_UNKNOWN }; // font styles @@ -365,6 +362,10 @@ enum wxFontEncoding wxFONTENCODING_CP866, // and another one // and for Windows wxFONTENCODING_CP874, // WinThai + wxFONTENCODING_CP932, // Japanese (shift-JIS) + wxFONTENCODING_CP936, // Chiniese simplified (GB) + wxFONTENCODING_CP949, // Korean (Hangul charset) + wxFONTENCODING_CP950, // Chinese (traditional - Big5) wxFONTENCODING_CP1250, // WinLatin2 wxFONTENCODING_CP1251, // WinCyrillic wxFONTENCODING_CP1252, // WinLatin1 @@ -393,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); @@ -403,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; }; @@ -513,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); @@ -523,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; @@ -542,6 +594,8 @@ public: bool underline = FALSE, const char* facename = NULL, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); void RemoveFont(wxFont *font); + + int GetCount(); }; @@ -589,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)); } } @@ -627,6 +700,11 @@ public: + +// The list of ints for the dashes needs to exist for the life of the pen +// so we make it part of the class to save it. wxPyPen is aliased to wxPen +// in _extras.py + %{ class wxPyPen : public wxPen { public: @@ -635,13 +713,16 @@ public: { m_dash = NULL; } ~wxPyPen() { if (m_dash) - delete m_dash; + delete [] m_dash; } void SetDashes(int nb_dashes, const wxDash *dash) { + if (m_dash) + delete [] m_dash; m_dash = new wxDash[nb_dashes]; - for (int i=0; iDrawLabel(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, @@ -742,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(); @@ -1064,15 +1166,6 @@ public: //--------------------------------------------------------------------------- -#ifndef __WXMSW__ -class wxPostScriptDC : public wxDC { -public: - wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL); -}; -#endif - -//--------------------------------------------------------------------------- - #ifdef __WXMSW__ @@ -1082,7 +1175,7 @@ public: class wxMetaFile : public wxObject { public: - wxMetaFile(const wxString& filename = wxPyEmptyStr); + wxMetaFile(const wxString& filename = wxEmptyString); ~wxMetaFile(); bool Ok(); @@ -1102,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 { @@ -1242,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); @@ -1295,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 +%} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +