Patch #1731 2006-12-18 19:08
stahta01
scripting patch for wxWidgets 2.8- Download
- 1731-scripting_patc.patch (1.5 KB)
Index: src/sdk/scripting/bindings/sc_globals.cpp
===================================================================
--- src/sdk/scripting/bindings/sc_globals.cpp (revision 3393)
+++ src/sdk/scripting/bindings/sc_globals.cpp (working copy)
@@ -81,7 +81,11 @@
SQInteger wx_GetColourFromUser(HSQUIRRELVM v)
{
StackHandler sa(v);
+#if wxCHECK_VERSION(2, 8, 0)
+ wxColour c = sa.GetParamCount() == 2 ? *SqPlus::GetInstance<wxColour>(v, 2) : *wxBLACK;
+#else
wxColour& c = sa.GetParamCount() == 2 ? *SqPlus::GetInstance<wxColour>(v, 2) : *wxBLACK;
+#endif
return SqPlus::ReturnCopy(v, wxGetColourFromUser(Manager::Get()->GetAppWindow(), c));
}
long wx_GetNumberFromUser(const wxString& message, const wxString& prompt, const wxString& caption, long value)
Index: src/sdk/scripting/bindings/sc_wxtypes.cpp
===================================================================
--- src/sdk/scripting/bindings/sc_wxtypes.cpp (revision 3393)
+++ src/sdk/scripting/bindings/sc_wxtypes.cpp (working copy)
@@ -229,7 +229,11 @@
func(&wxArrayString::GetCount, "GetCount").
func(&wxArrayString::Item, "Item");
+#if wxCHECK_VERSION(2, 8, 0)
+ typedef void(wxColour::*WXC_SET)(const unsigned char, const unsigned char, const unsigned char, const unsigned char);
+#else
typedef void(wxColour::*WXC_SET)(const unsigned char, const unsigned char, const unsigned char);
+#endif
SqPlus::SQClassDef<wxColour>("wxColour").
emptyCtor().
staticFuncVarArgs(&wxColour_OpToString, "_tostring", "").
History
Patches to src/sdk/scripting/bindings sc_wxtypes.cpp and sc_globals.cpp for mainly wxColour minor changes. Tim S
Problem 1: This statement did NOT work with wxW2.8.0
wxColour& c = sa.GetParamCount() == 2 ? *SqPlus::GetInstance<wxColour>(v, 2) : *wxBLACK;
Error 1: invalid initialization of reference of type 'wxColour&' from expression of type 'const wxColour'
Solution 1: Changed "wxColour& c =" to "wxColour c =", note I am NOT sure if this is a valid fix, but it compiles now.
Change 2: The constructor of wxColour has a added parameter of alpha.
wxColour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=wxALPHA_OPAQUE)
Problem 2: Caused func<WXC_SET>(&wxColour::Set, "Set"); to fail.
Solution 2: Added 4th parameter to typedef void(wxColour::*WXC_SET).
Tim S
Yiannis could you have a look at this patch for the scripting, I am not so confident in that area.
Regarding problem1, seems like they changed wxBLACK from "wxColour*" to "const wxColour*".
The way to fix it (w/out using #ifdef) is to just change "wxColour& c = ..." to "const wxColour& c = ...".
applied with the suggestion from Yiannis