Skip to content

Commit

Permalink
Updated file reference and version checks to fix compilation with wxw…
Browse files Browse the repository at this point in the history
…idgets <3.1.2 (fixes #46).
  • Loading branch information
pkulchenko committed Nov 5, 2019
1 parent 2ac2561 commit 7afa3a7
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 42 deletions.
2 changes: 1 addition & 1 deletion wxLua/bindings/wxwidgets/wx_datatypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ wx_dataTypeTable =
ValueType = "class",
},
wxGraphicsPenInfo = {
Condition = "wxUSE_GRAPHICS_CONTEXT",
Condition = "(wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)",
IsNumber = false,
Name = "wxGraphicsPenInfo",
ValueType = "class",
Expand Down
6 changes: 3 additions & 3 deletions wxLua/bindings/wxwidgets/wxbase_file.i
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,11 @@ class %delete wxTextInputStream
const wxInputStream& GetInputStream();

// base may be between 2 and 36, inclusive, or the special 0 (= C format)
wxUint64 Read64(int base = 10);
%wxchkver_3_1_0 wxUint64 Read64(int base = 10);
wxUint32 Read32(int base = 10);
wxUint16 Read16(int base = 10);
wxUint8 Read8(int base = 10);
wxInt64 Read64S(int base = 10);
%wxchkver_3_1_0 wxInt64 Read64S(int base = 10);
wxInt32 Read32S(int base = 10);
wxInt16 Read16S(int base = 10);
wxInt8 Read8S(int base = 10);
Expand All @@ -1010,7 +1010,7 @@ class %delete wxTextOutputStream
void SetMode( wxEOL mode = wxEOL_NATIVE );
wxEOL GetMode();

void Write64(wxUint64 i);
%wxchkver_3_1_0 void Write64(wxUint64 i);
void Write32(wxUint32 i);
void Write16(wxUint16 i);
void Write8(wxUint8 i);
Expand Down
21 changes: 13 additions & 8 deletions wxLua/bindings/wxwidgets/wxcore_graphics.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "wx/dynarray.h"
#include "wx/font.h"
#include "wx/image.h"
#include "wx/peninfobase.h"
#include "wx/pen.h"
#include "wx/vector.h"

enum wxAntialiasMode
Expand Down Expand Up @@ -78,6 +78,9 @@ class %delete wxGraphicsObject : public wxObject
// wxGraphicsObjectRefData* GetGraphicsData() const;
};


#if %wxchkver_3_1_1

// ----------------------------------------------------------------------------
// wxGraphicsPenInfo describes a wxGraphicsPen
// ----------------------------------------------------------------------------
Expand All @@ -98,6 +101,8 @@ class %delete wxGraphicsPenInfo// : public wxPenInfoBase<wxGraphicsPenInfo>
wxDouble GetWidth() const;
};

#endif // !%wxchkver_3_1_1

class %delete wxGraphicsPen : public wxGraphicsObject
{
wxGraphicsPen();
Expand Down Expand Up @@ -328,7 +333,7 @@ class %delete wxGraphicsContext : public wxGraphicsObject
#endif

// Create a context from a DC of unknown type, if supported, returns NULL otherwise
static %gc wxGraphicsContext* CreateFromUnknownDC(const wxDC& dc);
%wxchkver_3_1_1 static %gc wxGraphicsContext* CreateFromUnknownDC(const wxDC& dc);
static %gc wxGraphicsContext* CreateFromNative( void * context );
static %gc wxGraphicsContext* CreateFromNativeWindow( void * window );
static %gc wxGraphicsContext* Create( wxWindow* window );
Expand Down Expand Up @@ -363,7 +368,7 @@ class %delete wxGraphicsContext : public wxGraphicsObject

wxGraphicsPen CreatePen(const wxPen& pen) const;

wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const;
%wxchkver_3_1_1 wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const;

virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const;

Expand Down Expand Up @@ -427,7 +432,7 @@ class %delete wxGraphicsContext : public wxGraphicsObject
virtual void ResetClip();// = 0;

// returns bounding box of the clipping region
virtual void GetClipBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h);// = 0;
%wxchkver_3_1_1 virtual void GetClipBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h);// = 0;

// returns the native context
virtual void * GetNativeContext();// = 0;
Expand Down Expand Up @@ -522,7 +527,7 @@ class %delete wxGraphicsContext : public wxGraphicsObject
virtual void DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );

// paints a transparent rectangle (only useful for bitmaps or windows)
virtual void ClearRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
%wxchkver_3_1_1 virtual void ClearRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);

//
// text
Expand Down Expand Up @@ -657,7 +662,7 @@ class %delete wxGraphicsRenderer : public wxObject

// Paints

virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info);// = 0;
%wxchkver_3_1_1 virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info);// = 0;

virtual wxGraphicsBrush CreateBrush(const wxBrush& brush );// = 0;

Expand Down Expand Up @@ -693,8 +698,8 @@ class %delete wxGraphicsRenderer : public wxObject
// create a subimage from a native image representation
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );// = 0;

virtual wxString GetName() const;// = 0;
virtual void GetVersion(int* major, int* minor = NULL, int* micro = NULL) const;// = 0;
%wxchkver_3_1_0 virtual wxString GetName() const;// = 0;
%wxchkver_3_1_0 virtual void GetVersion(int* major, int* minor = NULL, int* micro = NULL) const;// = 0;
};

class %delete wxGCDC: public wxDC
Expand Down
7 changes: 5 additions & 2 deletions wxLua/modules/wxbind/include/wxcore_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ extern WXDLLIMPEXP_BINDWXCORE wxLuaBinding* wxLuaBinding_wxcore_init();
#include "wx/font.h"
#include "wx/geometry.h"
#include "wx/image.h"
#include "wx/peninfobase.h"
#include "wx/pen.h"
#include "wx/vector.h"
#endif // wxUSE_GRAPHICS_CONTEXT

Expand Down Expand Up @@ -658,6 +658,10 @@ extern WXDLLIMPEXP_BINDWXCORE wxLuaBinding* wxLuaBinding_wxcore_init();
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxPenInfo;
#endif // (wxCHECK_VERSION(3,1,1)) && (wxLUA_USE_wxColourPenBrush)

#if (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsPenInfo;
#endif // (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)

#if (wxLUA_USE_wxBitmapButton && wxUSE_BMPBUTTON) && (wxLUA_USE_wxButton && wxUSE_BUTTON)
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxBitmapButton;
#endif // (wxLUA_USE_wxBitmapButton && wxUSE_BMPBUTTON) && (wxLUA_USE_wxButton && wxUSE_BUTTON)
Expand Down Expand Up @@ -1292,7 +1296,6 @@ extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxWindowUpdateLocker;
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsObject;
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsPath;
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsPen;
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsPenInfo;
extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxluatype_wxGraphicsRenderer;
#endif // wxUSE_GRAPHICS_CONTEXT

Expand Down
22 changes: 19 additions & 3 deletions wxLua/modules/wxbind/src/wxbase_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7611,10 +7611,12 @@ if ((double)(lua_Integer)returns == (double)returns) {
return 1;
}


#if (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)
static wxLuaArgType s_wxluatypeArray_wxLua_wxTextInputStream_Read64[] = { &wxluatype_wxTextInputStream, &wxluatype_TNUMBER, NULL };
static int LUACALL wxLua_wxTextInputStream_Read64(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextInputStream_Read64[1] = {{ wxLua_wxTextInputStream_Read64, WXLUAMETHOD_METHOD, 1, 2, s_wxluatypeArray_wxLua_wxTextInputStream_Read64 }};
// wxUint64 Read64(int base = 10);
// %wxchkver_3_1_0 wxUint64 Read64(int base = 10);
static int LUACALL wxLua_wxTextInputStream_Read64(lua_State *L)
{
// get number of arguments
Expand All @@ -7640,7 +7642,7 @@ if ((double)(lua_Integer)returns == (double)returns) {
static wxLuaArgType s_wxluatypeArray_wxLua_wxTextInputStream_Read64S[] = { &wxluatype_wxTextInputStream, &wxluatype_TNUMBER, NULL };
static int LUACALL wxLua_wxTextInputStream_Read64S(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextInputStream_Read64S[1] = {{ wxLua_wxTextInputStream_Read64S, WXLUAMETHOD_METHOD, 1, 2, s_wxluatypeArray_wxLua_wxTextInputStream_Read64S }};
// wxInt64 Read64S(int base = 10);
// %wxchkver_3_1_0 wxInt64 Read64S(int base = 10);
static int LUACALL wxLua_wxTextInputStream_Read64S(lua_State *L)
{
// get number of arguments
Expand All @@ -7663,6 +7665,8 @@ if ((double)(lua_Integer)returns == (double)returns) {
return 1;
}

#endif // (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)

static wxLuaArgType s_wxluatypeArray_wxLua_wxTextInputStream_Read8[] = { &wxluatype_wxTextInputStream, &wxluatype_TNUMBER, NULL };
static int LUACALL wxLua_wxTextInputStream_Read8(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextInputStream_Read8[1] = {{ wxLua_wxTextInputStream_Read8, WXLUAMETHOD_METHOD, 1, 2, s_wxluatypeArray_wxLua_wxTextInputStream_Read8 }};
Expand Down Expand Up @@ -7818,8 +7822,12 @@ wxLuaBindMethod wxTextInputStream_methods[] = {
{ "Read16S", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read16S, 1, NULL },
{ "Read32", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read32, 1, NULL },
{ "Read32S", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read32S, 1, NULL },

#if (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)
{ "Read64", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read64, 1, NULL },
{ "Read64S", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read64S, 1, NULL },
#endif // (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)

{ "Read8", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read8, 1, NULL },
{ "Read8S", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_Read8S, 1, NULL },
{ "ReadDouble", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextInputStream_ReadDouble, 1, NULL },
Expand Down Expand Up @@ -7965,10 +7973,12 @@ static int LUACALL wxLua_wxTextOutputStream_Write32(lua_State *L)
return 0;
}


#if (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)
static wxLuaArgType s_wxluatypeArray_wxLua_wxTextOutputStream_Write64[] = { &wxluatype_wxTextOutputStream, &wxluatype_TINTEGER, NULL };
static int LUACALL wxLua_wxTextOutputStream_Write64(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextOutputStream_Write64[1] = {{ wxLua_wxTextOutputStream_Write64, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxTextOutputStream_Write64 }};
// void Write64(wxUint64 i);
// %wxchkver_3_1_0 void Write64(wxUint64 i);
static int LUACALL wxLua_wxTextOutputStream_Write64(lua_State *L)
{
// wxUint64 i
Expand All @@ -7981,6 +7991,8 @@ static int LUACALL wxLua_wxTextOutputStream_Write64(lua_State *L)
return 0;
}

#endif // (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)

static wxLuaArgType s_wxluatypeArray_wxLua_wxTextOutputStream_Write8[] = { &wxluatype_wxTextOutputStream, &wxluatype_TINTEGER, NULL };
static int LUACALL wxLua_wxTextOutputStream_Write8(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextOutputStream_Write8[1] = {{ wxLua_wxTextOutputStream_Write8, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxTextOutputStream_Write8 }};
Expand Down Expand Up @@ -8068,7 +8080,11 @@ wxLuaBindMethod wxTextOutputStream_methods[] = {
{ "SetMode", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_SetMode, 1, NULL },
{ "Write16", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_Write16, 1, NULL },
{ "Write32", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_Write32, 1, NULL },

#if (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)
{ "Write64", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_Write64, 1, NULL },
#endif // (wxCHECK_VERSION(3,1,0)) && (wxUSE_STREAMS)

{ "Write8", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_Write8, 1, NULL },
{ "WriteDouble", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_WriteDouble, 1, NULL },
{ "WriteString", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTextOutputStream_WriteString, 1, NULL },
Expand Down
15 changes: 12 additions & 3 deletions wxLua/modules/wxbind/src/wxcore_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5808,6 +5808,12 @@ static wxLuaBindClass* wxluabaseclassbinds_wxXPMHandler[] = { NULL };
extern void wxLua_wxPenInfo_delete_function(void** p);
#endif // (wxCHECK_VERSION(3,1,1)) && (wxLUA_USE_wxColourPenBrush)

#if (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)
extern wxLuaBindMethod wxGraphicsPenInfo_methods[];
extern int wxGraphicsPenInfo_methodCount;
extern void wxLua_wxGraphicsPenInfo_delete_function(void** p);
#endif // (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)

#if (wxLUA_USE_wxBitmapButton && wxUSE_BMPBUTTON) && (wxLUA_USE_wxButton && wxUSE_BUTTON)
extern wxLuaBindMethod wxBitmapButton_methods[];
extern int wxBitmapButton_methodCount;
Expand Down Expand Up @@ -7048,9 +7054,6 @@ extern void wxLua_wxWindowUpdateLocker_delete_function(void** p);
extern wxLuaBindMethod wxGraphicsPen_methods[];
extern int wxGraphicsPen_methodCount;
extern void wxLua_wxGraphicsPen_delete_function(void** p);
extern wxLuaBindMethod wxGraphicsPenInfo_methods[];
extern int wxGraphicsPenInfo_methodCount;
extern void wxLua_wxGraphicsPenInfo_delete_function(void** p);
extern wxLuaBindMethod wxGraphicsRenderer_methods[];
extern int wxGraphicsRenderer_methodCount;
extern void wxLua_wxGraphicsRenderer_delete_function(void** p);
Expand Down Expand Up @@ -7449,7 +7452,13 @@ wxLuaBindClass* wxLuaGetClassList_wxcore(size_t &count)
{ wxluaclassname_wxGraphicsObject, wxGraphicsObject_methods, wxGraphicsObject_methodCount, CLASSINFO(wxGraphicsObject), &wxluatype_wxGraphicsObject, wxluabaseclassnames_wxGraphicsObject, wxluabaseclassbinds_wxGraphicsObject, NULL, NULL, NULL, 0, &wxLua_wxGraphicsObject_delete_function, },
{ wxluaclassname_wxGraphicsPath, wxGraphicsPath_methods, wxGraphicsPath_methodCount, CLASSINFO(wxGraphicsPath), &wxluatype_wxGraphicsPath, wxluabaseclassnames_wxGraphicsPath, wxluabaseclassbinds_wxGraphicsPath, NULL, NULL, NULL, 0, &wxLua_wxGraphicsPath_delete_function, },
{ wxluaclassname_wxGraphicsPen, wxGraphicsPen_methods, wxGraphicsPen_methodCount, CLASSINFO(wxGraphicsPen), &wxluatype_wxGraphicsPen, wxluabaseclassnames_wxGraphicsPen, wxluabaseclassbinds_wxGraphicsPen, NULL, NULL, NULL, 0, &wxLua_wxGraphicsPen_delete_function, },
#endif // wxUSE_GRAPHICS_CONTEXT

#if (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)
{ wxluaclassname_wxGraphicsPenInfo, wxGraphicsPenInfo_methods, wxGraphicsPenInfo_methodCount, NULL, &wxluatype_wxGraphicsPenInfo, NULL, NULL, NULL, NULL, NULL, 0, &wxLua_wxGraphicsPenInfo_delete_function, },
#endif // (wxCHECK_VERSION(3,1,1)) && (wxUSE_GRAPHICS_CONTEXT)

#if wxUSE_GRAPHICS_CONTEXT
{ wxluaclassname_wxGraphicsRenderer, wxGraphicsRenderer_methods, wxGraphicsRenderer_methodCount, CLASSINFO(wxGraphicsRenderer), &wxluatype_wxGraphicsRenderer, wxluabaseclassnames_wxGraphicsRenderer, wxluabaseclassbinds_wxGraphicsRenderer, NULL, NULL, NULL, 0, &wxLua_wxGraphicsRenderer_delete_function, },
#endif // wxUSE_GRAPHICS_CONTEXT

Expand Down
Loading

0 comments on commit 7afa3a7

Please sign in to comment.