1
0
forked from 0ad/0ad

Updated wxJavaScript to 0.9.71 (plus minor customisations)

This was SVN commit r5313.
This commit is contained in:
Ykkrosh 2007-09-02 17:17:58 +00:00
parent 08d3ff2952
commit 5d26f84910
97 changed files with 855 additions and 987 deletions

View File

@ -1,15 +1,8 @@
Based on wxJavaScript r741, with some modifications:
Based on wxJavaScript 0.9.71, with some modifications:
# Fix line endings
for i in `find . -name '*.cpp' -or -name '*.h'`; do dos2unix $i; done
for i in `find . -name '*.cpp' -or -name '*.h'`; do svn propset svn:eol-style native $i; done
# Add '#include "precompiled.h"' to every .cpp file
for i in `find common ext gui io -name '*.cpp'`; do mv $i $i~; ( echo -e "#include \"precompiled.h\"\n" ; cat $i~ ) >$i; rm $i~; done
# Fix JS include paths
for i in `grep -lr '<jsapi.h>' .`; do sed -i 's/<jsapi.h>/<js\/jsapi.h>/' $i; done
for i in `grep -lr '<jsdate.h>' .`; do sed -i 's/<jsdate.h>/<js\/jsdate.h>/' $i; done
svn co -r818 https://wxjs.svn.sourceforge.net/svnroot/wxjs/trunk/wxJS2/src/ temp_src_dir
# Copy {common,ext,gui,io} source files into tools/atlas/wxJS
# Keep non-standard files gui/{control/{notebook,bookctrl},event/notebookevt,misc/timer}.{cpp,h}
# Rename common filenames to prevent naming conflicts when we compile everything together
for i in io ext gui; do
@ -18,10 +11,22 @@ for i in io ext gui; do
done;
done
# Make sure new files are added to our SVN
# Fix line endings
for i in `find . -name '*.cpp' -or -name '*.h'`; do dos2unix $i; done
for i in `find . -name '*.cpp' -or -name '*.h'`; do svn propset svn:eol-style native $i; done
gui/misc/app.cpp: delete
"IMPLEMENT_APP_NO_MAIN(App)"
# Add '#include "precompiled.h"' to every .cpp file
for i in `find common ext gui io -name '*.cpp'`; do
if [[ ! ( `grep precompiled.h $i` ) ]]; then
mv $i $i~; ( echo -e "#include \"precompiled.h\"\n" ; cat $i~ ) >$i; rm $i~;
fi
done
# Fix JS include paths
for i in `grep -lr '<jsapi.h>' .`; do sed -i 's/<jsapi.h>/<js\/jsapi.h>/' $i; done
for i in `grep -lr '<jsdate.h>' .`; do sed -i 's/<jsdate.h>/<js\/jsdate.h>/' $i; done
io/io_constant.cpp: replace
"JSConstDoubleSpec wxGlobalMap[] =
@ -31,6 +36,24 @@ io/io_constant.cpp: replace
};"
with
"extern JSConstDoubleSpec wxGlobalMap[];"
(since it conflicts with wxGlobalMap in gui/misc/constant.cpp)
gui/gui_init.cpp: add
#include "control/bookctrl.h"
#include "control/notebook.h"
#include "misc/timer.h"
...and some other minor things
obj = BookCtrlBase::JSInit(cx, global, Control::GetClassPrototype());
wxASSERT_MSG(obj != NULL, wxT("wxBookCtrlBase prototype creation failed"));
if (! obj )
return false;
obj = Notebook::JSInit(cx, global, BookCtrlBase::GetClassPrototype());
wxASSERT_MSG(obj != NULL, wxT("wxNotebook prototype creation failed"));
if (! obj )
return false;
obj = Timer::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxTimer prototype creation failed"));
if (! obj )
return false;

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: apiwrap.h 676 2007-04-18 20:27:39Z fbraem $
* $Id: apiwrap.h 810 2007-07-13 20:07:05Z fbraem $
*/
// ApiWrapper uses the Barton and Nackman trick (also known as
@ -50,6 +50,9 @@ namespace wxjs
JSObject *parent = NULL)
{
JSObject *obj = JS_NewObject(cx, &wxjs_class, m_classProto, parent);
if ( obj == NULL )
return JSVAL_NULL;
JS_SetPrivate(cx, obj, p);
return OBJECT_TO_JSVAL(obj);
}
@ -73,7 +76,10 @@ namespace wxjs
JSObject *propObj = JS_DefineObject(cx, obj, name,
&wxjs_class, m_classProto,
JSPROP_READONLY | JSPROP_PERMANENT);
JS_SetPrivate(cx, propObj, p);
if ( propObj )
{
JS_SetPrivate(cx, propObj, p);
}
return propObj;
}
@ -102,12 +108,17 @@ namespace wxjs
}
JSClass *clazz = JS_GetClass(cx, obj);
if ( clazz == NULL )
return NULL;
while((clazz->flags & JSCLASS_HAS_PRIVATE) != JSCLASS_HAS_PRIVATE)
{
obj = JS_GetPrototype(cx, obj);
if ( obj == NULL )
return NULL;
clazz = JS_GetClass(cx, obj);
if ( clazz == NULL )
return NULL;
}
p = (T_Priv*) JS_GetPrivate(cx, obj);
@ -646,7 +657,7 @@ namespace wxjs
}
}
};
};
}; // namespace wxjs
// The initialisation of wxjs_class
template<class T_Port, class T_Priv>
@ -733,15 +744,15 @@ JSClass wxjs::ApiWrapper<T_Port, T_Priv>::wxjs_class =
// Ends a constant map
#define WXJS_END_CONSTANT_MAP() \
{ 0, 0, 0, 0 } \
{ 0, 0, 0, { 0 } } \
}; \
JS_DefineConstDoubles(cx, obj, consts); \
}
// Defines a constant with a prefix
#define WXJS_CONSTANT(prefix, name) { prefix##name, #name, WXJS_READONLY, 0, 0 },
#define WXJS_CONSTANT(prefix, name) { prefix##name, #name, WXJS_READONLY, { 0 } },
// Defines a constant
#define WXJS_SIMPLE_CONSTANT(name) { name, #name, WXJS_READONLY, 0, 0 },
#define WXJS_SIMPLE_CONSTANT(name) { name, #name, WXJS_READONLY, { 0 } },
// METHOD MACROS
#define WXJS_DECLARE_METHOD_MAP() \

View File

@ -43,7 +43,7 @@ namespace wxjs
Protect(protect);
}
JavaScriptClientData(const JavaScriptClientData &copy)
JavaScriptClientData(const JavaScriptClientData &copy) : wxClientData(copy)
{
m_cx = copy.m_cx;
m_obj = copy.m_obj;

View File

@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: defs.h 714 2007-05-16 20:24:49Z fbraem $
* $Id: defs.h 812 2007-07-16 19:38:58Z fbraem $
*/
#ifndef _wxjs_defs_h
#define _wxjs_defs_h
#define wxJS_MAJOR_VERSION 0
#define wxJS_MINOR_VERSION 9
#define wxJS_RELEASE_NUMBER 7
#define wxJS_STR_VERSION wxT("0.9.7")
#define wxJS_RELEASE_NUMBER 71
#define wxJS_STR_VERSION wxT("0.9.71")
// Encoding used internally. SpiderMonkey uses UTF-16
#define wxJS_INTERNAL_ENCODING wxT("UTF-16")

View File

@ -22,15 +22,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: jsutil.cpp 603 2007-03-08 20:36:17Z fbraem $
* $Id: jsutil.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#include <js/jsapi.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "jsutil.h"
#include "defs.h"
JSBool wxjs::GetFunctionProperty(JSContext *cx, JSObject *obj, const char *propertyName, jsval *property)
{
@ -103,20 +102,61 @@ bool wxjs::HasPrototype(JSContext *cx, jsval v, const char *className)
bool wxjs::GetScriptRoot(JSContext *cx, jsval *v)
{
return JS_GetProperty(cx, JS_GetGlobalObject(cx), "scriptRoot", v) == JS_TRUE;
if ( JS_GetProperty(cx, JS_GetGlobalObject(cx), "script", v) == JS_TRUE )
{
if ( JSVAL_IS_OBJECT(*v) )
{
JSObject *obj = JSVAL_TO_OBJECT(*v);
return JS_GetProperty(cx, obj, "root", v) == JS_TRUE;
}
}
return false;
}
JSBool wxjs::DefineUnicodeProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue)
JSBool wxjs::wxDefineProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue)
{
wxMBConvUTF16 utf16;
wxCSConv conv(wxJS_INTERNAL_ENCODING);
int length = propertyName.length();
wxCharBuffer s = propertyName.mb_str(conv);
/*
int jsLength = utf16.WC2MB(NULL, propertyName, 0);
char *jsValue = new char[jsLength + utf16.GetMBNulLen()];
jsLength = utf16.WC2MB(jsValue, propertyName, jsLength + utf16.GetMBNulLen());
JSBool ret = JS_DefineUCProperty(cx, obj, (jschar *) jsValue, jsLength / utf16.GetMBNulLen(),
char *jsValue = new char[jsLength + conv.GetMBNulLen()];
jsLength = conv.WC2MB(jsValue, propertyName, jsLength + conv.GetMBNulLen());
JSBool ret = JS_DefineUCProperty(cx, obj, (jschar *) jsValue, jsLength / conv.GetMBNulLen(),
*propertyValue, NULL, NULL, JSPROP_ENUMERATE);
delete[] jsValue;
return ret;
*/
return JS_DefineUCProperty(cx, obj, (const jschar *) s.data(), length,
*propertyValue, NULL, NULL, JSPROP_ENUMERATE);
}
JSBool wxjs::wxGetProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue)
{
wxCSConv conv(wxJS_INTERNAL_ENCODING);
int length = propertyName.length();
wxCharBuffer s = propertyName.mb_str(conv);
return JS_GetUCProperty(cx, obj,
(const jschar *) s.data(), length, propertyValue);
}
JSBool wxjs::wxSetProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue)
{
wxCSConv conv(wxJS_INTERNAL_ENCODING);
int length = propertyName.length();
wxCharBuffer s = propertyName.mb_str(conv);
return JS_SetUCProperty(cx, obj,
(const jschar *) s.data(), length, propertyValue);
}

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: jsutil.h 603 2007-03-08 20:36:17Z fbraem $
* $Id: jsutil.h 801 2007-07-02 20:54:19Z fbraem $
*/
#ifndef _wxjs_util_h
#define _wxjs_util_h
@ -40,7 +40,18 @@ namespace wxjs
bool GetScriptRoot(JSContext *cx, jsval *v);
// Define a UNICODE property
JSBool DefineUnicodeProperty(JSContext *cx, JSObject *obj, const wxString &propertyName, jsval *propertyValue);
// Property functions using wxString / UTF-16
JSBool wxDefineProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue);
JSBool wxGetProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue);
JSBool wxSetProperty(JSContext *cx,
JSObject *obj,
const wxString &propertyName,
jsval *propertyValue);
};
#endif //wxjs_util_h

View File

@ -22,10 +22,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: script.cpp 631 2007-03-23 20:14:28Z fbraem $
* $Id: script.cpp 806 2007-07-05 20:17:47Z fbraem $
*/
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
#include <wx/filename.h>
#include <wx/textfile.h>
#include "script.h"
@ -36,10 +37,12 @@ wxString ScriptSource::GetSource() const
return m_source;
}
void ScriptSource::SetFile(const wxString &file, wxMBConv &conv)
void ScriptSource::SetFile(const wxFileName &file, wxMBConv &conv)
{
m_file = file;
wxFileInputStream fis(file);
m_file = file.GetFullPath();
m_path = file.GetPath();
wxFileInputStream fis(m_file);
if ( fis.IsOk() )
{
wxTextInputStream tis(fis, wxT("\t"), conv);
@ -62,7 +65,6 @@ void ScriptSource::SetFile(const wxString &file, wxMBConv &conv)
ScriptSource::ScriptSource(const ScriptSource &copy) : m_file(copy.m_file)
, m_source(copy.m_source)
, m_name(copy.m_name)
{
}

View File

@ -20,57 +20,61 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: script.h 598 2007-03-07 20:13:28Z fbraem $
* $Id: script.h 806 2007-07-05 20:17:47Z fbraem $
*/
#ifndef _wxjs_script_h
#define _wxjs_script_h
#include <wx/string.h>
class wxFileName;
namespace wxjs
{
class ScriptSource
{
public:
ScriptSource()
{
}
ScriptSource(const ScriptSource &copy);
virtual ~ScriptSource()
{
}
virtual void SetSource(const wxString &source);
wxString GetName() const
{
return m_name;
}
void SetName(const wxString &name)
{
m_name = name;
}
virtual wxString GetSource() const;
wxString GetFile() const
{
return m_file;
}
ScriptSource()
{
}
ScriptSource(const ScriptSource &copy);
virtual ~ScriptSource()
{
}
virtual void SetSource(const wxString &source);
bool HasSource() const
{
return m_source.length() > 0;
}
virtual wxString GetSource() const;
wxString GetFileName() const
{
return m_file;
}
wxString GetPath() const
{
return m_path;
}
void SetPath(const wxString &path)
{
m_path = path;
}
// Sets the filename and reads the source from it
virtual void SetFile(const wxString &file, wxMBConv &conv = wxConvUTF8);
void SetFile(const wxFileName &file, wxMBConv &conv = wxConvUTF8);
// Sets the filename
virtual void SetFilename(const wxString &name) { m_file = name; }
private:
wxString m_file;
wxString m_path;
wxString m_source;
wxString m_name;
};
}; // namespace wxjs
#endif // _wxjs_script_h

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: type.cpp 600 2007-03-07 22:08:44Z fbraem $
* $Id: type.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -290,22 +290,16 @@ jsval wxjs::ToJS<bool>(JSContext* WXUNUSED(cx), const bool &from)
template<>
jsval wxjs::ToJS<wxString>(JSContext* cx, const wxString &from)
{
if ( from.Length() == 0 )
int length = from.length();
if ( length == 0 )
{
return STRING_TO_JSVAL(JS_NewUCStringCopyN(cx, (jschar *) "", 0));
}
jsval val = JSVAL_VOID;
wxMBConvUTF16 utf16;
int jsLength = utf16.WC2MB(NULL, from, 0);
if ( jsLength > 0 )
{
char *jsValue = new char[jsLength + utf16.GetMBNulLen()];
jsLength = utf16.WC2MB(jsValue, from, jsLength + utf16.GetMBNulLen());
val = STRING_TO_JSVAL(JS_NewUCStringCopyN(cx, (jschar *) jsValue, jsLength / utf16.GetMBNulLen()));
delete[] jsValue;
}
wxCharBuffer buffer = from.mb_str(utf16);
val = STRING_TO_JSVAL(JS_NewUCStringCopyN(cx, (jschar *) buffer.data(), length));
return val;
}

View File

@ -22,20 +22,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: main.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: main.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#include <wx/wx.h>
#ifdef __WXMSW__
#include <windows.h>
#endif
#include "../common/main.h"
#include "jsmembuf.h"
#include "point.h"
#include "wxjs_ext.h"
using namespace wxjs;
using namespace wxjs::ext;
/*
#ifdef __WXMSW__
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
@ -54,39 +56,84 @@ using namespace wxjs::ext;
}
#endif
WXJSAPI bool wxJS_EXTInit(JSContext *cx, JSObject *global)
WXJSAPI bool wxjs::ext::InitClass(JSContext *cx, JSObject *global)
{
MemoryBuffer::JSInit(cx, global);
Point::JSInit(cx, global);
return true;
}
WXJSAPI bool wxJS_EXTInitClass(JSContext *cx, JSObject *obj)
/***
* <file>globfun</file>
* <module>ext</module>
* <class name="Global Functions">
* On this page you can find all the functions/properties that are defined on the global object.
* </class>
* <properties>
* <property name="wxDefaultPosition" type="@wxPoint">
* The default position
* </property>
* </properties>
*/
WXJSAPI bool wxjs::ext::InitObject(JSContext *cx, JSObject *obj)
{
Point::DefineObject(cx, obj, "wxDefaultPosition", new wxPoint(wxDefaultPosition));
return true;
}
WXJSAPI void wxJS_EXTDestroy()
WXJSAPI void wxjs::ext::Destroy()
{
}
*/
JSObject *wxjs::ext::CreateMemoryBuffer(JSContext *cx, void *buffer, int size)
WXJSAPI jsval wxjs::ext::CreateMemoryBuffer(JSContext *cx, void *buffer, int size)
{
wxMemoryBuffer *membuf = new wxMemoryBuffer(size);
membuf->AppendData(buffer, size);
JSObject *obj = JS_NewObject(cx, MemoryBuffer::GetClass(), NULL, NULL);
JS_SetPrivate(cx, obj, membuf);
return obj;
wxMemoryBuffer *membuf = new wxMemoryBuffer(size);
membuf->AppendData(buffer, size);
JSObject *obj = JS_NewObject(cx, MemoryBuffer::GetClass(), NULL, NULL);
if ( obj == NULL )
return JSVAL_NULL;
JS_SetPrivate(cx, obj, membuf);
return OBJECT_TO_JSVAL(obj);
}
wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, JSObject *obj)
WXJSAPI wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, JSObject *obj)
{
return MemoryBuffer::GetPrivate(cx, obj);
}
wxMemoryBuffer* wxjs::ext::NewMemoryBuffer(void *buffer, int size)
WXJSAPI wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, jsval v)
{
if ( JSVAL_IS_OBJECT(v) )
{
return GetMemoryBuffer(cx, JSVAL_TO_OBJECT(v));
}
return NULL;
}
WXJSAPI wxMemoryBuffer* wxjs::ext::NewMemoryBuffer(void *buffer, int size)
{
wxMemoryBuffer *membuf = new wxMemoryBuffer(size);
membuf->AppendData(buffer, size);
return membuf;
}
WXJSAPI wxPoint* wxjs::ext::GetPoint(JSContext *cx, JSObject *obj)
{
return Point::GetPrivate(cx, obj);
}
WXJSAPI wxPoint* wxjs::ext::GetPoint(JSContext *cx, jsval v)
{
if ( JSVAL_IS_OBJECT(v) )
{
return GetPoint(cx, JSVAL_TO_OBJECT(v));
}
return NULL;
}
WXJSAPI jsval wxjs::ext::CreatePoint(JSContext *cx, const wxPoint &p)
{
return Point::CreateObject(cx, new wxPoint(p));
}

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: jsmembuf.cpp 737 2007-06-08 18:12:16Z fbraem $
* $Id: jsmembuf.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// jsmembuf.cpp
#include "../common/main.h"
@ -199,7 +199,7 @@ wxMemoryBuffer *MemoryBuffer::Construct(JSContext *cx, JSObject *obj, uintN argc
}
wxMemoryBuffer *buffer = new wxMemoryBuffer();
buffer->AppendData(content, strlen(content));
buffer->AppendData(content, data.length());
return buffer;
}
@ -284,7 +284,7 @@ JSBool MemoryBuffer::append(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
content = data.mb_str(conv);
}
p->AppendData(content, strlen(content));
p->AppendData(content, data.length());
return JS_TRUE;
}

View File

@ -22,23 +22,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: point.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id$
*/
// point.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../common/main.h"
#include "point.h"
using namespace wxjs;
using namespace wxjs::gui;
using namespace wxjs::ext;
/***
* <file>misc/point</file>
* <module>gui</module>
* <file>point</file>
* <module>ext</module>
* <class name="wxPoint">
* A wxPoint is a useful data structure for graphics operations.
* It simply contains integer x and y members.

View File

@ -22,22 +22,13 @@
*
* $Id: point.h 598 2007-03-07 20:13:28Z fbraem $
*/
/////////////////////////////////////////////////////////////////////////////
// Name: point.h
// Purpose: Ports wxPoint to JavaScript
// Author: Franky Braem
// Modified by:
// Created: 16.12.01
// Copyright: (c) 2001-2002 Franky Braem
// Licence: LGPL
/////////////////////////////////////////////////////////////////////////////
#ifndef _WXJSPoint_H
#define _WXJSPoint_H
namespace wxjs
{
namespace gui
namespace ext
{
class Point : public ApiWrapper<Point, wxPoint>
{

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: wxjs_ext.h 598 2007-03-07 20:13:28Z fbraem $
* $Id: wxjs_ext.h 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef _wxjs_ext_h
#define _wxjs_ext_h
@ -35,17 +35,23 @@
#define WXJSAPI WXIMPORT
#endif
WXJSAPI bool wxJS_EXTInit(JSContext *cx, JSObject *global);
WXJSAPI bool wxJS_EXTInitClass(JSContext *cx, JSObject *obj);
WXJSAPI void wxJS_EXTDestroy();
class wxPoint;
namespace wxjs
{
namespace ext
{
wxMemoryBuffer* NewMemoryBuffer(void *buffer, int size);
JSObject *CreateMemoryBuffer(JSContext *cx, void *buffer, int size);
wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, JSObject *obj);
WXJSAPI bool InitClass(JSContext *cx, JSObject *obj);
WXJSAPI bool InitObject(JSContext *cx, JSObject *global);
WXJSAPI void Destroy();
WXJSAPI wxMemoryBuffer* NewMemoryBuffer(void *buffer, int size);
WXJSAPI jsval CreateMemoryBuffer(JSContext *cx, void *buffer, int size);
WXJSAPI wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, JSObject *obj);
WXJSAPI wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, jsval v);
WXJSAPI wxPoint* GetPoint(JSContext* cx, JSObject *obj);
WXJSAPI wxPoint* GetPoint(JSContext* cx, jsval v);
WXJSAPI jsval CreatePoint(JSContext *cx, const wxPoint &p);
};
};

View File

@ -22,10 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: bmpbtn.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: bmpbtn.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// bmpbtn.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
@ -39,9 +37,9 @@
*/
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "bmpbtn.h"
#include "../misc/bitmap.h"
#include "button.h"
@ -250,7 +248,7 @@ JSBool BitmapButton::create(JSContext *cx,
}
// Walk through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: button.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: button.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
/***
@ -47,11 +47,11 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
@ -310,7 +310,7 @@ JSBool Button::create(JSContext *cx,
return JS_FALSE;
}
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");
@ -397,13 +397,12 @@ void ButtonEventHandler::ConnectClicked(wxButton *p, bool connect)
{
if ( connect )
{
p->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(ButtonEventHandler::OnClicked));
p->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ButtonEventHandler::OnClicked));
}
else
{
p->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(ButtonEventHandler::OnClicked));
wxCommandEventHandler(ButtonEventHandler::OnClicked));
}
}

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: calendar.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: calendar.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// calendar.cpp
@ -34,11 +34,11 @@
#include "../../common/main.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/cal.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/colour.h"
@ -487,7 +487,7 @@ JSBool CalendarCtrl::create(JSContext *cx,
return JS_FALSE;
}
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: checkbox.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: checkbox.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,6 +30,7 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -37,7 +38,6 @@
#include "checkbox.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -243,7 +243,7 @@ JSBool CheckBox::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: chklstbx.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: chklstbx.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -32,6 +32,7 @@
#include "../../common/main.h"
#include "../../common/strsptr.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -41,7 +42,6 @@
#include "window.h"
#include "listbox.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -247,7 +247,7 @@ JSBool CheckListBox::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -22,15 +22,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: choice.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: choice.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -39,7 +38,6 @@
#include "choice.h"
#include "item.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -277,7 +275,7 @@ JSBool Choice::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: coldlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: coldlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -31,12 +31,11 @@
#include "../../common/main.h"
#include "../../common/index.h"
#include "coldlg.h"
#include "coldata.h"
#include "window.h"
#include "../misc/point.h"
#include "../errors.h"
using namespace wxjs;
@ -62,11 +61,9 @@ using namespace wxjs::gui;
* dlg = new wxColourDialog(null, clrData);
* dlg.title = "Select a colour";
* dlg.showModal();
*
* // Return false to exit the mainloop
* return false;
*
* return false;
* }
* wxTheApp.mainLoop();
* </code></pre>
* </class>
*/

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: combobox.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: combobox.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -31,6 +31,7 @@
#include "../../common/main.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -38,7 +39,6 @@
#include "combobox.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -357,7 +357,7 @@ JSBool ComboBox::create(JSContext *cx,
return JS_FALSE;
}
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: dialog.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: dialog.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,6 +30,7 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/jsevent.h"
@ -38,7 +39,6 @@
#include "dialog.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../errors.h"
@ -71,8 +71,7 @@ using namespace wxjs::gui;
* // Return false, will end the main loop
* return false;
* }
*
* wxTheApp.mainLoop();</code></pre>
* </code></pre>
* </class>
*/
WXJS_INIT_CLASS(Dialog, "wxDialog", 3)
@ -283,7 +282,7 @@ JSBool Dialog::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: dirdlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: dirdlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,10 +30,10 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "dirdlg.h"
#include "window.h"
#include "../misc/point.h"
#include "../errors.h"
@ -149,7 +149,7 @@ wxDirDialog* DirDialog::Construct(JSContext *cx,
switch(argc)
{
case 5:
pt = Point::GetPrivate(cx, argv[4]);
pt = wxjs::ext::GetPoint(cx, argv[4]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 5, "wxPoint");

View File

@ -22,20 +22,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: filedlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: filedlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "filedlg.h"
#include "window.h"
#include "../misc/point.h"
#include "../errors.h"
using namespace wxjs;
@ -260,7 +257,7 @@ wxFileDialog* FileDialog::Construct(JSContext *cx,
switch(argc)
{
case 7:
pt = Point::GetPrivate(cx, argv[6]);
pt = wxjs::ext::GetPoint(cx, argv[6]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 7, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: findrdlg.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: findrdlg.cpp 762 2007-06-16 13:33:43Z fbraem $
*/
// findrdlg.cpp

View File

@ -22,12 +22,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: fontdlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: fontdlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
@ -35,8 +33,6 @@
#include "fontdata.h"
#include "window.h"
#include "../misc/point.h"
#include "../errors.h"
using namespace wxjs;

View File

@ -22,23 +22,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: frame.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: frame.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../event/close.h"
#include "../event/iconize.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/icon.h"
#include "../misc/app.h"
#include "../misc/constant.h"
#include "../errors.h"
@ -425,7 +423,7 @@ JSBool Frame::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");
@ -490,13 +488,11 @@ JSBool Frame::processCommand(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
#ifdef __WXMSW__
if ( p->GetHWND() == NULL )
if ( p->GetHandle() == NULL )
{
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
return JS_FALSE;
}
#endif
int id;
if ( ! FromJS(cx, argv[0], id) )
@ -535,14 +531,12 @@ JSBool Frame::createStatusBar(JSContext *cx, JSObject *obj, uintN argc, jsval *a
if ( p == NULL )
return JS_FALSE;
#ifdef __WXMSW__
if ( p->GetHWND() == NULL )
if ( p->GetHandle() == NULL )
{
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
return JS_FALSE;
}
#endif
int fields = 1;
long style = 0;
int id = -1;
@ -599,13 +593,11 @@ JSBool Frame::createToolBar(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
if ( p == NULL )
return JS_FALSE;
#ifdef __WXMSW__
if ( p->GetHWND() == NULL )
if ( p->GetHandle() == NULL )
{
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
return JS_FALSE;
}
#endif
long style = wxNO_BORDER | wxTB_HORIZONTAL;
int id = -1;
@ -664,13 +656,11 @@ JSBool Frame::setStatusText(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
#ifdef __WXMSW__
if ( p->GetHWND() == NULL )
if ( p->GetHandle() == NULL )
{
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
return JS_FALSE;
}
#endif
wxStatusBar *statusBar = p->GetStatusBar();
if ( statusBar != (wxStatusBar*) NULL )
@ -719,13 +709,11 @@ JSBool Frame::setStatusWidths(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
#ifdef __WXMSW__
if ( p->GetHWND() == NULL )
if ( p->GetHandle() == NULL )
{
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
return JS_FALSE;
}
#endif
wxStatusBar *statusBar = p->GetStatusBar();
if ( statusBar == (wxStatusBar*) NULL )

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: gauge.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: gauge.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// gauge.cpp
@ -31,10 +31,8 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
@ -293,7 +291,7 @@ JSBool Gauge::create(JSContext *cx,
return JS_FALSE;
}
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,11 +22,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: helpbtn.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: helpbtn.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
@ -34,8 +32,6 @@
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "helpbtn.h"
#include "button.h"
#include "window.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: htmlwin.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: htmlwin.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
@ -40,13 +40,12 @@
*/
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/htmllink.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "htmlwin.h"
#include "frame.h"
#include "window.h"
@ -306,7 +305,7 @@ JSBool HtmlWindow::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
// Walk through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");
@ -563,7 +562,7 @@ JSBool HtmlWindow::selectLine(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
wxPoint *pos = Point::GetPrivate(cx, argv[0]);
wxPoint *pos = wxjs::ext::GetPoint(cx, argv[0]);
if ( pos != NULL )
{
p->SelectLine(*pos);
@ -594,7 +593,7 @@ JSBool HtmlWindow::selectWord(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
wxPoint *pos = Point::GetPrivate(cx, argv[0]);
wxPoint *pos = wxjs::ext::GetPoint(cx, argv[0]);
if ( pos != NULL )
{
p->SelectWord(*pos);

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: listbox.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: listbox.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -31,12 +31,11 @@
#include "../../common/main.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
@ -273,7 +272,7 @@ JSBool ListBox::create(JSContext *cx,
break;
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
break;
// Fall through

View File

@ -22,27 +22,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: listctrl.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: listctrl.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// ListCtrl.cpp
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#ifdef __WXMSW__
#include "commctrl.h"
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/listevt.h"
#include "../misc/app.h"
#include "../misc/validate.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/rect.h"
#include "../misc/colour.h"
@ -273,7 +268,6 @@ int wxCALLBACK ListCtrl::SortFn(long item1, long item2, long data)
* }
*
* wxTheApp.onInit = init;
* wxTheApp.mainLoop();
* </code></pre>
* </class>
*/
@ -934,7 +928,7 @@ JSBool ListCtrl::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");
@ -1650,15 +1644,10 @@ JSBool ListCtrl::getItemPosition(JSContext *cx,
if ( FromJS(cx, argv[0], item) )
{
wxPoint *pt = new wxPoint();
if ( p->GetItemPosition(item, *pt) )
wxPoint pt;
if ( p->GetItemPosition(item, pt) )
{
*rval = Point::CreateObject(cx, pt);
}
else
{
delete pt;
*rval = JSVAL_VOID;
*rval = wxjs::ext::CreatePoint(cx, pt);
}
return JS_TRUE;
}
@ -1694,7 +1683,7 @@ JSBool ListCtrl::setItemPosition(JSContext *cx,
long item;
if ( FromJS(cx, argv[0], item) )
{
wxPoint *pt = Point::GetPrivate(cx, argv[1]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[1]);
if ( pt != NULL )
{
*rval = ToJS(cx, p->SetItemPosition(item, *pt));
@ -2452,12 +2441,12 @@ JSBool ListCtrl::findItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
if ( FromJS(cx, argv[0], item) )
{
if ( Point::HasPrototype(cx, argv[1]) )
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[1]);
if ( pt != NULL )
{
if ( argc < 3 )
return JS_FALSE;
wxPoint *pt = Point::GetPrivate(cx, argv[1], false);
int direction;
if ( FromJS(cx, argv[2], direction) )
{
@ -2511,7 +2500,7 @@ JSBool ListCtrl::hitTest(JSContext *cx,
if ( p == NULL )
return JS_FALSE;
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
int flags;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: listitattr.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: listitattr.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// listitem.cpp
#include <wx/wxprec.h>
@ -33,7 +33,6 @@
#include "../../common/main.h"
#include "../misc/app.h"
#include "../misc/font.h"
#include "../misc/colour.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: listitem.cpp 688 2007-04-27 20:45:09Z fbraem $
* $Id: listitem.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// listitem.cpp
#include <wx/wxprec.h>
@ -33,7 +33,6 @@
#include "../../common/main.h"
#include "../misc/app.h"
#include "../misc/font.h"
#include "../misc/colour.h"

View File

@ -1,14 +1,39 @@
#include "precompiled.h"
/*
* wxJavaScript - mdi.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id$
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "../../common/main.h"
#include "../errors.h"
#include "../../ext/wxjs_ext.h"
#include "../errors.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "window.h"
#include "mdi.h"
#include "frame.h"
@ -192,7 +217,7 @@ JSBool MDIParentFrame::create(JSContext* cx,
return JS_FALSE;
}
case 4:
pos = Point::GetPrivate(cx, argv[3]);
pos = wxjs::ext::GetPoint(cx, argv[3]);
if ( pos == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -1,14 +1,40 @@
#include "precompiled.h"
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
/*
* wxJavaScript - mdichild.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id$
*/
// 3rd party includes
#include <wx/wx.h>
// wxJS includes
#include "../../common/main.h"
#include "../errors.h"
#include "../../ext/wxjs_ext.h"
// wxJS_gui includes
#include "../errors.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "mdi.h"
#include "mdichild.h"
#include "frame.h"
@ -158,7 +184,7 @@ JSBool MDIChildFrame::create(JSContext* cx,
return JS_FALSE;
}
case 4:
pos = Point::GetPrivate(cx, argv[3]);
pos = wxjs::ext::GetPoint(cx, argv[3]);
if ( pos == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");
@ -180,10 +206,7 @@ JSBool MDIChildFrame::create(JSContext* cx,
parent = MDIParentFrame::GetPrivate(cx, argv[0]);
if ( parent == NULL
#ifdef __WXMSW__
|| parent->GetHWND() == NULL
#endif
)
|| parent->GetHandle() == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 1, "wxMDIParentFrame");
return JS_FALSE;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: menu.cpp 696 2007-05-07 21:16:23Z fbraem $
* $Id: menu.cpp 783 2007-06-24 20:36:30Z fbraem $
*/
// menu.cpp
#ifndef WX_PRECOMP
@ -35,8 +35,6 @@
#include "menu.h"
#include "menuitem.h"
#include "../misc/app.h"
#include "../event/jsevent.h"
#include "../event/command.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: menubar.cpp 715 2007-05-18 20:38:04Z fbraem $
* $Id: menubar.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// menubar.cpp
#ifndef WX_PRECOMP
@ -34,8 +34,6 @@
#include "menubar.h"
#include "menu.h"
#include "../misc/app.h"
using namespace wxjs;
using namespace wxjs::gui;

View File

@ -13,7 +13,7 @@
#include "bookctrl.h"
#include "window.h"
#include "../misc/point.h"
#include "../../ext/point.h"
#include "../misc/size.h"
#include "../errors.h"
@ -168,7 +168,7 @@ JSBool Notebook::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::Point::GetPrivate(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: panel.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: panel.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// panel.cpp
@ -31,12 +31,11 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "button.h"
#include "panel.h"
@ -262,7 +261,7 @@ JSBool Panel::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");
@ -334,5 +333,5 @@ void PanelEventHandler::ConnectSysColourChanged(wxPanel *p, bool connect)
void PanelEventHandler::InitConnectEventMap()
{
AddConnector(WXJS_SYS_COLOUR_CHANGED_EVENT, ConnectSysColourChanged);
AddConnector(WXJS_SYS_COLOUR_CHANGED_EVENT, PanelEventHandler::ConnectSysColourChanged);
}

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: pwdlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: pwdlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
@ -30,12 +30,10 @@
#include <wx/textdlg.h>
#include "../../common/main.h"
#include "../misc/point.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../errors.h"
#include "pwdlg.h"
#include "dialog.h"
@ -121,7 +119,7 @@ wxPasswordEntryDialog* PasswordEntryDialog::Construct(JSContext *cx,
switch(argc)
{
case 6:
pt = Point::GetPrivate(cx, argv[5]);
pt = wxjs::ext::GetPoint(cx, argv[5]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 6, "wxPoint");

View File

@ -22,9 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: radiobox.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: radiobox.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// radiobox.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
@ -32,13 +31,13 @@
#include "../../common/main.h"
#include "../../common/index.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "../misc/validate.h"
#include "radiobox.h"
@ -275,7 +274,7 @@ JSBool RadioBox::create(JSContext *cx,
if ( argc > 9 )
argc = 9;
int style = wxRA_SPECIFY_COLS;
int style = 0;
int max = 0;
StringsPtr items;
const wxSize *size = &wxDefaultSize;
@ -321,7 +320,7 @@ JSBool RadioBox::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: radiobtn.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: radiobtn.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,13 +30,12 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "../misc/validate.h"
#include "radiobtn.h"
@ -235,7 +234,7 @@ JSBool RadioButton::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,11 +22,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: scrollwnd.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: scrollwnd.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
/***
* <file>control/scrolwin</file>
@ -39,9 +37,9 @@
*/
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "scrollwnd.h"
#include "panel.h"
#include "window.h"
@ -267,7 +265,7 @@ JSBool ScrolledWindow::create(JSContext *cx,
}
// Walk through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: slider.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: slider.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// slider.cpp
@ -31,14 +31,13 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "../event/scroll.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "../misc/validate.h"
#include "slider.h"
@ -424,7 +423,7 @@ JSBool Slider::create(JSContext *cx,
}
// Fall through
case 6:
pt = Point::GetPrivate(cx, argv[5]);
pt = wxjs::ext::GetPoint(cx, argv[5]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 6, "wxPoint");

View File

@ -1,10 +1,36 @@
#include "precompiled.h"
/*
* wxJavaScript - spinbtn.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id$
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -13,7 +39,6 @@
#include "spinbtn.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -23,8 +48,8 @@ using namespace wxjs::gui;
/***
* <module>gui</module>
* <file>spinbtn</file>
* <class name="wxSplitButton" prototype="@wxControl">
* <file>control/spinbtn</file>
* <class name="wxSpinButton" prototype="@wxControl">
* A wxSpinButton has two small up and down (or left and right) arrow buttons.
* It is often used next to a text control for increment and decrementing a
* value. Portable programs should try to use @wxSpinButton instead as
@ -241,7 +266,7 @@ JSBool SpinButton::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -1,6 +1,31 @@
#ifndef _WXJSSPINBTN_H
#define _WXJSSPINBTN_H
/*
* wxJavaScript - spinbtn.h
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id$
*/
#include "../../common/evtconn.h"
#include <wx/spinbutt.h>

View File

@ -1,10 +1,37 @@
#include "precompiled.h"
/*
* wxJavaScript - spinctrl.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* Remark: This class was donated by Philip Taylor.
*
* $Id$
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -13,7 +40,6 @@
#include "spinctrl.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -23,7 +49,7 @@ using namespace wxjs::gui;
/***
* <module>gui</module>
* <file>spinctrl</file>
* <file>control/spinctrl</file>
* <class name="wxSplitCtrl" prototype="@wxControl">
* wxSpinCtrl combines @wxTextCtrl and @wxSpinButton in one control.
* </class>
@ -154,7 +180,7 @@ bool SpinCtrl::DeleteProperty(wxSpinCtrl *p,
* <arg name="max" type="Integer" default="100">
* Maximal value.
* </arg>
* <arg name="initial" type="Integer default="0">
* <arg name="initial" type="Integer" default="0">
* Initial value.
* </arg>
* </function>
@ -214,7 +240,7 @@ WXJS_END_METHOD_MAP()
* <arg name="max" type="Integer" default="100">
* Maximal value.
* </arg>
* <arg name="initial" type="Integer default="0">
* <arg name="initial" type="Integer" default="0">
* Initial value.
* </arg>
* </function>
@ -283,7 +309,7 @@ JSBool SpinCtrl::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");
@ -409,7 +435,6 @@ JSBool SpinCtrl::setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
* Generated when right/down arrow is pressed. A @wxSpinEvent is passed
* as argument.
* </event>
* </event>
* </events>
*/
WXJS_INIT_EVENT_MAP(wxSpinCtrl)

View File

@ -1,6 +1,33 @@
#ifndef _WXJSSPINCTRL_H
#define _WXJSSPINCTRL_H
/*
* wxJavaScript - spinctrl.h
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* Remark: This class was donated by Philip Taylor
*
* $Id$
*/
#include "../../common/evtconn.h"
#include <wx/spinctrl.h>

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: splitwin.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: splitwin.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,10 +30,9 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../misc/size.h"
#include "../misc/point.h"
#include "../event/jsevent.h"
#include "../event/split.h"
@ -70,8 +69,6 @@ using namespace wxjs::gui;
*
* return true;
* };
*
* wxTheApp.mainLoop();
* </code></pre>
* </class>
*/
@ -373,7 +370,7 @@ JSBool SplitterWindow::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: statbar.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: statbar.cpp 782 2007-06-24 20:23:23Z fbraem $
*/
// wxJSStatusBar.cpp
@ -54,7 +54,6 @@ using namespace wxjs::gui;
* When you click the button the bitmap is changed.
* <pre><code class="whjs">
* wxTheApp.onInit = init;
* wxTheApp.mainLoop();
*
* function init()
* {

View File

@ -22,21 +22,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: staticbx.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: staticbx.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "staticbx.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../errors.h"
@ -183,7 +179,7 @@ JSBool StaticBox::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: sttext.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: sttext.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -30,13 +30,11 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "sttext.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../errors.h"
@ -236,7 +234,7 @@ JSBool StaticText::create(JSContext *cx,
return JS_FALSE;
} // Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: textctrl.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: textctrl.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#ifndef WX_PRECOMP
@ -31,7 +31,7 @@
#include <wx/file.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
@ -39,7 +39,6 @@
#include "textctrl.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/validate.h"
#include "../errors.h"
@ -367,7 +366,7 @@ JSBool TextCtrl::create(JSContext *cx,
}
// Fall through
case 4:
pt = Point::GetPrivate(cx, argv[3]);
pt = wxjs::ext::GetPoint(cx, argv[3]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: toolbar.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: toolbar.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#include <wx/wxprec.h>
@ -33,11 +33,9 @@
#include <wx/toolbar.h>
#include "../../common/main.h"
#include "../misc/app.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/command.h"
#include "window.h"
@ -45,7 +43,6 @@
#include "toolbar.h"
#include "tbartool.h"
#include "../misc/point.h"
#include "../misc/bitmap.h"
#include "../misc/size.h"
#include "../errors.h"
@ -365,7 +362,7 @@ JSBool ToolBar::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "wxPoint");

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: treectrl.cpp 746 2007-06-11 20:58:21Z fbraem $
* $Id: treectrl.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// wxJSTreeCtrl.cpp
@ -31,14 +31,12 @@
#endif
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../event/jsevent.h"
#include "../event/treeevt.h"
#include "../misc/app.h"
#include "../misc/validate.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/rect.h"
#include "../misc/colour.h"
@ -505,7 +503,7 @@ JSBool TreeCtrl::create(JSContext *cx,
}
// Fall through
case 3:
pt = Point::GetPrivate(cx, argv[2]);
pt = wxjs::ext::GetPoint(cx, argv[2]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");
@ -2196,7 +2194,7 @@ JSBool TreeCtrl::hitTest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
if ( p == NULL )
return JS_FALSE;
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
int flags;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: treeitem.cpp 735 2007-06-06 20:22:54Z fbraem $
* $Id: treeitem.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// wxJSTreeItem.cpp
@ -34,8 +34,6 @@
#include "../../common/main.h"
#include "../misc/app.h"
#include "treectrl.h"
#include "treeid.h"
#include "treeitem.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: txtdlg.cpp 708 2007-05-14 15:30:45Z fbraem $
* $Id: txtdlg.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// txtdlg.cpp
@ -32,8 +32,8 @@
#include <wx/textdlg.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "../misc/point.h"
#include "../event/jsevent.h"
#include "../errors.h"
@ -144,7 +144,7 @@ wxTextEntryDialog* TextEntryDialog::Construct(JSContext *cx, JSObject *obj, uint
switch(argc)
{
case 6:
pt = Point::GetPrivate(cx, argv[5]);
pt = wxjs::ext::GetPoint(cx, argv[5]);
if ( pt == NULL )
{
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 6, "wxPoint");

View File

@ -22,20 +22,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: window.cpp 745 2007-06-11 20:16:54Z fbraem $
* $Id: window.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// window.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include <wx/tooltip.h>
#include "../../ext/wxjs_ext.h"
#include "window.h"
#include "../misc/point.h"
#include "../misc/size.h"
#include "../misc/rect.h"
#include "../misc/colour.h"
@ -200,7 +196,6 @@ WXJS_BEGIN_PROPERTY_MAP(Window)
WXJS_PROPERTY(P_BACKGROUND_COLOUR, "backgroundColour")
WXJS_PROPERTY(P_FOREGROUND_COLOUR, "foregroundColour")
WXJS_PROPERTY(P_FONT, "font")
WXJS_PROPERTY(P_TOOL_TIP, "toolTip")
WXJS_END_PROPERTY_MAP()
bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
@ -233,14 +228,11 @@ bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
*vp = ToJS(cx, p->GetClientSize().GetHeight());
break;
case P_POSITION:
*vp = Point::CreateObject(cx, new wxPoint(p->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, p->GetPosition());
break;
case P_CLIENT_ORIGIN:
{
const wxPoint &pt = p->GetClientAreaOrigin();
*vp = Point::CreateObject(cx, new wxPoint(pt));
break;
}
*vp = wxjs::ext::CreatePoint(cx, p->GetClientAreaOrigin());
break;
case P_SIZER:
{
wxSizer *sizer = p->GetSizer();
@ -350,15 +342,6 @@ bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
case P_FONT:
*vp = Font::CreateObject(cx, new wxFont(p->GetFont()), obj);
break;
case P_TOOL_TIP:
if ( p->GetToolTip() == NULL )
*vp = JSVAL_VOID;
else
{
wxString tip = p->GetToolTip()->GetTip();
*vp = ToJS(cx, tip);
}
break;
}
return true;
}
@ -466,9 +449,9 @@ bool Window::SetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
}
case P_POSITION:
{
wxPoint *pt = Point::GetPrivate(cx, *vp);
if ( pt != NULL )
p->Move(*pt);
wxPoint *pt = wxjs::ext::GetPoint(cx, *vp);
if ( pt != NULL )
p->Move(*pt);
}
break;
case P_AUTO_LAYOUT:
@ -540,17 +523,6 @@ bool Window::SetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
p->SetFont(*font);
break;
}
case P_TOOL_TIP:
if ( JSVAL_IS_VOID(*vp) )
{
p->SetToolTip(NULL);
}
else
{
wxString tip;
FromJS(cx, *vp, tip);
p->SetToolTip(tip);
}
}
return true;
}
@ -800,11 +772,11 @@ JSBool Window::clientToScreen(JSContext *cx, JSObject *obj, uintN argc, jsval *a
if ( p == NULL )
return JS_FALSE;
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
*rval = Point::CreateObject(cx, new wxPoint(p->ClientToScreen(*pt)));
*rval = wxjs::ext::CreatePoint(cx, p->ClientToScreen(*pt));
else
return JS_FALSE;
return JS_FALSE;
return JS_TRUE;
}
@ -880,11 +852,11 @@ JSBool Window::convertDialogToPixels(JSContext *cx, JSObject *obj, uintN argc, j
}
else
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
*rval = Point::CreateObject(cx, new wxPoint(p->ConvertDialogToPixels(*pt)));
result = JS_TRUE;
*rval = wxjs::ext::CreatePoint(cx, p->ConvertDialogToPixels(*pt));
result = JS_TRUE;
}
}
@ -922,10 +894,10 @@ JSBool Window::convertPixelsToDialog(JSContext *cx, JSObject *obj, uintN argc, j
}
else
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
*rval = Point::CreateObject(cx, new wxPoint(p->ConvertPixelsToDialog(*pt)));
*rval = wxjs::ext::CreatePoint(cx, p->ConvertPixelsToDialog(*pt));
result = JS_TRUE;
}
}
@ -1013,7 +985,7 @@ JSBool Window::warpPointer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
if ( argc == 1 )
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
p->WarpPointer(pt->x, pt->y);
@ -1095,7 +1067,7 @@ JSBool Window::move(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
case 1:
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt == NULL )
{
p->Move(*pt);

View File

@ -129,7 +129,6 @@ namespace wxjs
, P_BACKGROUND_COLOUR
, P_FOREGROUND_COLOUR
, P_FONT
, P_TOOL_TIP
};
};

View File

@ -29,4 +29,4 @@
extern const char* WXJS_NO_PARENT_ERROR;
extern const char* WXJS_INVALID_ARG_TYPE;
#endif // _wxjs_gui_errors_h
#endif // _wxjs_gui_errors_h

View File

@ -22,21 +22,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: help.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: help.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// move.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "jsevent.h"
#include "help.h"
#include "../misc/point.h"
using namespace wxjs;
using namespace wxjs::gui;
@ -82,7 +78,7 @@ bool HelpEvent::GetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int
if ( id == P_POSITION )
{
*vp = Point::CreateObject(cx, new wxPoint(event->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, event->GetPosition());
}
return true;
}
@ -93,7 +89,7 @@ bool HelpEvent::SetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int
if ( id == P_POSITION )
{
wxPoint *pt = Point::GetPrivate(cx, *vp);
wxPoint *pt = wxjs::ext::GetPoint(cx, *vp);
if ( pt != NULL )
event->SetPosition(*pt);
}

View File

@ -48,7 +48,6 @@
#include "htmllink.h"
#include "split.h"
#include "spinevt.h"
#include "notebookevt.h"
#include "notify.h"
#include "listevt.h"
@ -179,10 +178,5 @@ bool wxjs::gui::InitEventClasses(JSContext *cx, JSObject *global)
if (! obj )
return false;
obj = NotebookEvent::JSInit(cx, global, NotifyEvent::GetClassPrototype());
wxASSERT_MSG(obj != NULL, wxT("wxNotebookEvent prototype creation failed"));
if (! obj )
return false;
return true;
return true;
}

View File

@ -20,13 +20,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: jsevent.h 702 2007-05-10 22:01:44Z fbraem $
* $Id: jsevent.h 783 2007-06-24 20:36:30Z fbraem $
*/
#ifndef wxJS_Event_H
#define wxJS_Event_H
#include "../misc/app.h"
#include "../../common/jsutil.h"
namespace wxjs

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: listevt.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: listevt.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// listevt.cpp
@ -33,8 +33,7 @@
#include <wx/listctrl.h>
#include "../../common/main.h"
#include "../misc/point.h"
#include "../../ext/wxjs_ext.h"
#include "../control/listitem.h"
@ -126,7 +125,7 @@ bool ListEvent::GetProperty(PrivListEvent *p, JSContext *cx, JSObject *obj, int
*vp = ToJS(cx, event->GetColumn());
break;
case P_POINT:
*vp = Point::CreateObject(cx, new wxPoint(event->GetPoint()));
*vp = wxjs::ext::CreatePoint(cx, event->GetPoint());
break;
case P_LABEL:
*vp = ToJS(cx, event->GetLabel());

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: mouse.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: mouse.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// mouse.cpp
@ -33,10 +33,10 @@
#include "../../common/main.h"
#include "../../common/type.h"
#include "../../common/apiwrap.h"
#include "../../ext/wxjs_ext.h"
#include "jsevent.h"
#include "mouse.h"
#include "../misc/point.h"
using namespace wxjs;
using namespace wxjs::gui;
@ -206,7 +206,7 @@ bool MouseEvent::GetProperty(PrivMouseEvent *p, JSContext *cx, JSObject *obj, in
*vp = ToJS(cx, event->Entering());
break;
case P_POSITION:
*vp = Point::CreateObject(cx, new wxPoint(event->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, event->GetPosition());
break;
case P_LINES_PER_ACTION:
*vp = ToJS(cx, event->GetLinesPerAction());

View File

@ -22,19 +22,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: move.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: move.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// move.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../common/apiwrap.h"
#include "../../ext/wxjs_ext.h"
#include "jsevent.h"
#include "../misc/point.h"
#include "move.h"
using namespace wxjs;
@ -68,7 +66,7 @@ bool MoveEvent::GetProperty(PrivMoveEvent *p, JSContext *cx, JSObject *obj, int
if ( id == P_POSITION )
{
*vp = Point::CreateObject(cx, new wxPoint(event->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, event->GetPosition());
}
return true;
}

View File

@ -7,6 +7,8 @@
#include "../../common/main.h"
#include "../../common/apiwrap.h"
#include <wx/spinctrl.h>
#include "jsevent.h"
#include "../misc/size.h"
#include "spinevt.h"

View File

@ -33,7 +33,6 @@
#include "../../common/apiwrap.h"
#include "jsevent.h"
#include "../misc/point.h"
#include "split.h"
using namespace wxjs;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: treeevt.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: treeevt.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// treeevt.cpp
@ -40,8 +40,7 @@
#include <wx/treectrl.h>
#include "../../common/main.h"
#include "../misc/point.h"
#include "../../ext/wxjs_ext.h"
#include "../control/treeid.h"
@ -113,7 +112,7 @@ bool TreeEvent::GetProperty(PrivTreeEvent *p, JSContext *cx, JSObject *obj, int
break;
}
case P_POINT:
*vp = Point::CreateObject(cx, new wxPoint(event->GetPoint()));
*vp = wxjs::ext::CreatePoint(cx, event->GetPoint());
break;
case P_LABEL:
*vp = ToJS(cx, event->GetLabel());

View File

@ -48,7 +48,6 @@
#include "../common/index.h"
// All wxJS objects
#include "misc/app.h"
#include "control/window.h"
#include "control/toplevel.h"
#include "control/frame.h"
@ -117,9 +116,6 @@
#include "control/finddata.h"
// Miscellaneous wxWindow classes
#include "misc/settings.h"
#include "misc/timer.h"
#include "misc/point.h"
#include "misc/size.h"
#include "misc/rect.h"
#include "misc/accentry.h"
@ -138,6 +134,8 @@
#if defined(__WXMSW__)
#include "misc/autoobj.h"
#endif
#include "misc/settings.h"
#include "misc/timer.h"
// Events
#include "event/jsevent.h"
@ -166,17 +164,6 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
JSObject *obj;
// Only create the wxApp prototype when no mainloop is running
// which would mean that there is already a wxApp Instance which is the
// case when embedding wxJS into a wxWidgets application
if ( ! wxApp::IsMainLoopRunning() )
{
obj = App::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxApp prototype creation failed"));
if (! obj )
return false;
}
// Initialize wxJS JavaScript objects
obj = Window::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxWindow prototype creation failed"));
@ -328,21 +315,6 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
if (! obj )
return false;
obj = SystemSettings::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxSystemSettings prototype creation failed"));
if (! obj )
return false;
obj = Timer::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxTimer prototype creation failed"));
if (! obj )
return false;
obj = Point::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxPoint prototype creation failed"));
if (! obj )
return false;
obj = Size::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxSize prototype creation failed"));
if (! obj )
@ -640,17 +612,27 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
if (! obj )
return false;
obj = BookCtrlBase::JSInit(cx, global, Control::GetClassPrototype());
obj = SystemSettings::JSInit(cx, global, NULL);
wxASSERT_MSG(obj != NULL, wxT("wxSystemSettings prototype creation failed"));
if (! obj )
return false;
obj = BookCtrlBase::JSInit(cx, global, Control::GetClassPrototype());
wxASSERT_MSG(obj != NULL, wxT("wxBookCtrlBase prototype creation failed"));
if (! obj )
return false;
obj = Notebook::JSInit(cx, global, BookCtrlBase::GetClassPrototype());
obj = Notebook::JSInit(cx, global, BookCtrlBase::GetClassPrototype());
wxASSERT_MSG(obj != NULL, wxT("wxNotebook prototype creation failed"));
if (! obj )
return false;
// Define the global functions
obj = Timer::JSInit(cx, global);
wxASSERT_MSG(obj != NULL, wxT("wxTimer prototype creation failed"));
if (! obj )
return false;
// Define the global functions
InitFunctions(cx, global);
DefineGlobals(cx, global);
@ -659,35 +641,9 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
bool wxjs::gui::InitObject(JSContext *cx, JSObject *obj)
{
// Only create wxTheApp, if there is no running mainloop, becuase in this
// case there exists already an instance of wxApp, which is the case when embedding
// wxJS into a wxWidgets application
if ( ! wxApp::IsMainLoopRunning() )
{
JSObject *jsApp = JS_NewObject(cx, App::GetClass(), NULL, NULL);
JS_SetPrivate(cx, jsApp, wxTheApp);
wxTheApp->SetClientObject(new JavaScriptClientData(cx, jsApp, true, false));
//JSObject *jsApp = JS_ConstructObject(cx, App::GetClass(), App::GetClassPrototype(), NULL);
JS_DefineProperty(cx, obj, "wxTheApp", OBJECT_TO_JSVAL(jsApp), NULL, NULL, 0);
}
return true;
return true;
}
void wxjs::gui::Destroy()
{
if ( ! wxApp::IsMainLoopRunning() )
{
wxClassInfo *cInfo = wxTheApp->GetClassInfo();
wxString t_strClassName( cInfo->GetClassName() );
// Make sure the object is unrooted by cleaning up the client object
JavaScriptClientData *data
= dynamic_cast<JavaScriptClientData*>(wxTheApp->GetClientObject());
if ( data != NULL )
{
wxTheApp->SetClientObject(NULL);
}
}
}

View File

@ -42,7 +42,6 @@
#include "init.h"
/*
#if defined( __WXMSW__)
void WXDLLEXPORT wxEntryCleanup();
extern "C"
@ -60,15 +59,11 @@
{
case DLL_PROCESS_ATTACH:
{
wxSetInstance(hinstDLL);
DisableThreadLibraryCalls(hinstDLL);
int app_argc = 0;
char **app_argv = NULL;
wxEntryStart(app_argc, app_argv);
break;
}
case DLL_PROCESS_DETACH:
wxEntryCleanup();
// Register the classes again, because otherwise we have debug messages
break;
}
@ -90,4 +85,3 @@ WXJSAPI void wxJS_Destroy()
{
wxjs::gui::Destroy();
}
*/

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: acctable.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: acctable.cpp 782 2007-06-24 20:23:23Z fbraem $
*/
// acctable.cpp
@ -51,7 +51,6 @@ using namespace wxjs::gui;
* the menu action associated with id 1 is executed.
* <pre><code class="whjs">
* wxTheApp.onInit = init;
* wxTheApp.mainLoop();
*
* function init()
* {

View File

@ -1,303 +0,0 @@
#include "precompiled.h"
/*
* wxJavaScript - app.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: app.cpp 716 2007-05-20 17:57:22Z fbraem $
*/
// app.cpp
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#ifdef __WXMSW__
#include <wx/msw/private.h>
#endif
#include <wx/cmdline.h>
#include "../../common/main.h"
#include "../../common/jsutil.h"
#include "../control/window.h"
#include "app.h"
using namespace wxjs;
using namespace wxjs::gui;
// IMPLEMENT_APP_NO_MAIN(App)
/***
* <file>misc/app</file>
* <module>gui</module>
* <class name="wxApp">
* wxApp represents the GUI application. wxJS instantiates
* an object of this type and stores it in the global
* variable wxTheApp. The script is responsible for calling
* @wxApp#mainLoop. Before the main loop is entered,
* the function that is put in @wxApp#onInit is called. This
* function must create a top-level window, make it visible
* and return true. Otherwise the main loop is immediately
* ended.<br /><br />
* <b>Remark:</b>When the application is dialog based
* and the dialog is a modal dialog, the onInit function
* must return false.
* </class>
*/
WXJS_INIT_CLASS(App, "wxApp", 0)
App::~App()
{
}
/***
* <properties>
* <property name="appName" type="String">Get/Set the application name</property>
* <property name="className" type="String">Get/Set the classname</property>
* <property name="topWindow" type="@wxWindow">Get/Set the top window of your application.</property>
* <property name="vendorName" type="String">Get/Set the vendor name</property>
* </properties>
*/
WXJS_BEGIN_PROPERTY_MAP(App)
WXJS_PROPERTY(P_APPLICATION_NAME, "appName")
WXJS_PROPERTY(P_CLASS_NAME, "className")
WXJS_PROPERTY(P_VENDOR_NAME, "vendorName")
WXJS_PROPERTY(P_TOP_WINDOW, "topWindow")
WXJS_END_PROPERTY_MAP()
void App::DestroyTopWindows()
{
while ( !wxTopLevelWindows.empty() )
{
// do not use Destroy() here as it only puts the TLW in pending list
// but we want to delete them now
delete wxTopLevelWindows.GetFirst()->GetData();
}
}
bool App::GetProperty(wxApp *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
{
switch (id)
{
case P_APPLICATION_NAME:
*vp = ToJS(cx, p->GetAppName());
break;
case P_CLASS_NAME:
*vp = ToJS(cx, p->GetClassName());
break;
case P_VENDOR_NAME:
*vp = ToJS(cx, p->GetVendorName());
break;
case P_TOP_WINDOW:
{
wxWindow *win = p->GetTopWindow();
if ( win != NULL )
{
JavaScriptClientData *data
= dynamic_cast<JavaScriptClientData*>(win->GetClientObject());
if ( data != NULL )
*vp = OBJECT_TO_JSVAL(data->GetObject());
}
break;
}
/* case P_USE_BEST_VISUAL:
*vp = BOOLEAN_TO_JSVAL(p->GetUseBestVisual());
break;
*/ }
return true;
}
bool App::SetProperty(wxApp *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
{
switch (id)
{
case P_APPLICATION_NAME:
{
wxString name;
FromJS(cx, *vp, name);
p->SetAppName(name);
break;
}
case P_CLASS_NAME:
{
wxString name;
FromJS(cx, *vp, name);
p->SetClassName(name);
break;
}
case P_VENDOR_NAME:
{
wxString name;
FromJS(cx, *vp, name);
p->SetVendorName(name);
break;
}
case P_TOP_WINDOW:
{
wxWindow *win = Window::GetPrivate(cx, *vp);
if ( win != NULL )
p->SetTopWindow(win);
break;
}
}
return true;
}
WXJS_BEGIN_METHOD_MAP(App)
WXJS_METHOD("mainLoop", mainLoop, 0)
WXJS_END_METHOD_MAP()
/***
* <method name="mainLoop">
* <function />
* <desc>
* Enters the main loop (meaning it starts your application). Before the application
* is started it will call the function you've set in the @wxApp#onInit event.
* You don't have to use mainLoop for executing a script. You only need this function
* when you want to block the execution of the script (i.e. when not using
* modal dialogs).
* </desc>
* </method>
*/
JSBool App::mainLoop(JSContext *cx,
JSObject *obj,
uintN argc,
jsval *argv,
jsval *rval)
{
wxApp *p = GetPrivate(cx, obj);
p->OnRun();
return JS_TRUE;
}
int App::MainLoop()
{
int retval = 0;
SetExitOnFrameDelete(TRUE);
if ( CallOnInit() )
{
bool initialized = (wxTopLevelWindows.GetCount() != 0);
if ( initialized )
{
if ( GetTopWindow()->IsShown() )
{
retval = wxApp::MainLoop();
}
}
}
DestroyTopWindows();
return retval;
}
bool App::OnInit()
{
JavaScriptClientData *data
= dynamic_cast<JavaScriptClientData*>(GetClientObject());
if ( data == NULL )
return false;
jsval fval;
if ( GetFunctionProperty(data->GetContext(), data->GetObject(),
"onInit", &fval) == JS_TRUE )
{
jsval rval;
if ( JS_CallFunctionValue(data->GetContext(), data->GetObject(),
fval, 0, NULL, &rval) == JS_TRUE )
{
if ( JSVAL_IS_BOOLEAN(rval) )
{
if ( JSVAL_TO_BOOLEAN(rval) == JS_TRUE )
{
return true;
}
return false;
}
}
else
{
JS_ReportPendingException(data->GetContext());
return false;
}
}
return true;
}
int App::OnExit()
{
JavaScriptClientData *data
= dynamic_cast<JavaScriptClientData*>(GetClientObject());
if ( data == NULL )
return false;
jsval fval;
if ( GetFunctionProperty(data->GetContext(), data->GetObject(),
"onExit", &fval) == JS_TRUE )
{
jsval rval;
JSBool result = JS_CallFunctionValue(data->GetContext(), data->GetObject(),
fval, 0, NULL, &rval);
if ( result == JS_TRUE )
{
if ( rval == JSVAL_VOID )
return 0;
int rc;
if ( FromJS(data->GetContext(), rval, rc) )
{
return rc;
}
else
{
if ( JS_IsExceptionPending(data->GetContext()) )
{
JS_ReportPendingException(data->GetContext());
}
}
}
}
return 0;
}
/***
* <events>
* <event name="onInit">
* Called when the application needs to be initialized. Set a function
* that returns a boolean. When it returns false the application will stop (onExit
* isn't called!).
* <b>Remark:</b>When your application is dialog based and the dialog is modal,
* you must return false, otherwise the application keeps running.
* </event>
* <event name="onExit">
* This function is executed when the application exits.
* The function doesn't get any parameters and must return an Integer.
* </event>
* </events>
*/

View File

@ -1,95 +0,0 @@
/*
* wxJavaScript - app.h
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: app.h 716 2007-05-20 17:57:22Z fbraem $
*/
#ifndef _WXJSApp_H
#define _WXJSApp_H
namespace wxjs
{
namespace gui
{
class App : public wxApp
, public ApiWrapper<App, wxApp>
{
public:
/**
* Constructor
*/
App() : wxApp()
{
}
/**
* Destructor
*/
virtual ~App();
static bool GetProperty(wxApp *p,
JSContext *cx,
JSObject *obj,
int id,
jsval *vp);
static bool SetProperty(wxApp *p,
JSContext *cx,
JSObject *obj,
int id,
jsval *vp);
/**
* MainLoop is overridden to make sure, we only enter the mainloop
* when a window is created
*/
int MainLoop();
/**
* Runs the mainloop
*/
static JSBool mainLoop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
WXJS_DECLARE_PROPERTY_MAP()
WXJS_DECLARE_METHOD_MAP()
/**
* Property Ids.
*/
enum
{
P_APPLICATION_NAME
, P_TOP_WINDOW
, P_INITIALIZED
, P_CLASS_NAME
, P_VENDOR_NAME
};
virtual int OnExit();
bool OnInit();
private:
void DestroyTopWindows();
};
}; // namespace gui
}; // namespace wxjs
#endif //_WXJSApp_H

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: fontenum.cpp 715 2007-05-18 20:38:04Z fbraem $
* $Id: fontenum.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// fontenum.cpp
@ -34,7 +34,6 @@
#include "../../common/jsutil.h"
#include "fontenum.h"
#include "app.h"
using namespace wxjs;
using namespace wxjs::gui;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: genval.cpp 723 2007-05-31 19:59:50Z fbraem $
* $Id: genval.cpp 783 2007-06-24 20:36:30Z fbraem $
*/
// validator.cpp
@ -36,7 +36,6 @@
#include "../control/window.h"
#include "genval.h"
#include "app.h"
using namespace wxjs;
using namespace wxjs::gui;
@ -106,7 +105,6 @@ IMPLEMENT_CLASS(GenericValidator, wxGenericValidator)
* }
*
* wxTheApp.onInit = Application;
* wxTheApp.mainLoop();
* </code></pre>
* </class>
*/

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: globfun.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: globfun.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// globfun.cpp
#ifndef WX_PRECOMP
@ -31,8 +31,9 @@
#include <wx/image.h>
#include "../../common/main.h"
#include "../../ext/wxjs_ext.h"
#include "globfun.h"
#include "point.h"
#include "colour.h"
#include "size.h"
#include "fontlist.h"
@ -118,7 +119,6 @@ bool wxjs::gui::InitFunctions(JSContext *cx, JSObject *global)
*/
void wxjs::gui::DefineGlobals(JSContext *cx, JSObject *global)
{
wxjs::gui::Point::DefineObject(cx, global, "wxDefaultPosition", new wxPoint(wxDefaultPosition));
wxjs::gui::Size::DefineObject(cx, global, "wxDefaultSize", new wxSize(wxDefaultSize));
wxjs::gui::FontList::DefineObject(cx, global, "wxTheFontList", wxTheFontList);
wxjs::gui::ColourDatabase::DefineObject(cx, global, "wxTheColourDatabase", wxTheColourDatabase);

View File

@ -22,21 +22,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: image.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: image.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// image.cpp
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/wx.h>
#include "../../common/main.h"
#include "../../common/jsutil.h"
#include "../../ext/wxjs_ext.h"
#include "image.h"
#include "size.h"
#include "rect.h"
#include "point.h"
#include "colour.h"
#include "imghand.h"
@ -614,7 +611,7 @@ JSBool Image::rotate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
switch(argc)
{
case 4:
offset = Point::GetPrivate(cx, argv[3]);
offset = wxjs::ext::GetPoint(cx, argv[3]);
if ( offset == NULL )
break;
// Fall through
@ -622,7 +619,7 @@ JSBool Image::rotate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
if ( ! FromJS(cx, argv[2], interpol) )
break;
default:
wxPoint *center = Point::GetPrivate(cx, argv[1]);
wxPoint *center = wxjs::ext::GetPoint(cx, argv[1]);
if ( center == NULL )
break;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: rect.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: rect.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// rect.cpp
@ -32,9 +32,9 @@
#include "../../common/main.h"
#include "../../common/apiwrap.h"
#include "../../ext/wxjs_ext.h"
#include "rect.h"
#include "point.h"
#include "size.h"
using namespace wxjs;
@ -99,7 +99,7 @@ bool Rect::GetProperty(wxRect *p, JSContext *cx, JSObject *obj, int id, jsval *v
*vp = ToJS(cx, p->GetLeft());
break;
case P_POSITION:
*vp = Point::CreateObject(cx, new wxPoint(p->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, p->GetPosition());
break;
case P_RIGHT:
*vp = ToJS(cx, p->GetRight());
@ -239,10 +239,10 @@ wxRect* Rect::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, b
}
else if ( argc == 2 )
{
wxPoint *pt1 = Point::GetPrivate(cx, argv[0]);
wxPoint *pt1 = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt1 != NULL )
{
wxPoint *pt2 = Point::GetPrivate(cx, argv[1]);
wxPoint *pt2 = wxjs::ext::GetPoint(cx, argv[1]);
if ( pt2 != NULL )
{
return new wxRect(*pt1, *pt2);
@ -395,7 +395,7 @@ JSBool Rect::offset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
case 1:
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
p->Offset(*pt);
@ -471,7 +471,7 @@ JSBool Rect::inside(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
case 1:
{
wxPoint *pt = Point::GetPrivate(cx, argv[0]);
wxPoint *pt = wxjs::ext::GetPoint(cx, argv[0]);
if ( pt != NULL )
{
*rval = ToJS(cx, p->Inside(*pt));

View File

@ -1,5 +1,31 @@
#include "precompiled.h"
/*
* wxJavaScript - settings.cpp
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* Remark: This class was donated by Philip Taylor
*
* $Id$
*/
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
@ -16,12 +42,28 @@
using namespace wxjs;
using namespace wxjs::gui;
/***
* <module>gui</module>
* <file>misc/settings</file>
* <class name="wxSystemSettings">
* wxSystemSettings allows the application to ask for details about the system.
* This can include settings such as standard colours, fonts, and user
* interface element sizes.
* </class>
*/
WXJS_INIT_CLASS(SystemSettings, "wxSystemSettings", 0)
WXJS_BEGIN_STATIC_PROPERTY_MAP(SystemSettings)
WXJS_STATIC_PROPERTY(P_SCREEN_TYPE, "screenType")
WXJS_END_PROPERTY_MAP()
/***
* <class_properties>
* <property name="screenType" type="Integer">
* Get/Set the screen type.
* </property>
* </class_properties>
*/
bool SystemSettings::GetStaticProperty(JSContext *cx, int id, jsval *vp)
{
switch ( id )
@ -54,6 +96,16 @@ WXJS_BEGIN_STATIC_METHOD_MAP(SystemSettings)
WXJS_METHOD("hasFeature", hasFeature, 1)
WXJS_END_METHOD_MAP()
/***
* <class_method name="getColour">
* <function returns="@wxColour">
* <arg name="Index" type="Integer" />
* </function>
* <desc>
* Returns a system colour.
* </desc>
* </class_method>
*/
JSBool SystemSettings::getColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
int index;
@ -64,6 +116,16 @@ JSBool SystemSettings::getColour(JSContext *cx, JSObject *obj, uintN argc, jsval
return JS_TRUE;
}
/***
* <class_method name="getFont">
* <function returns="@wxFont">
* <arg name="Index" type="Integer" />
* </function>
* <desc>
* Returns a system font.
* </desc>
* </class_method>
*/
JSBool SystemSettings::getFont(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
int index;
@ -74,6 +136,23 @@ JSBool SystemSettings::getFont(JSContext *cx, JSObject *obj, uintN argc, jsval *
return JS_TRUE;
}
/***
* <class_method name="getColour">
* <function returns="Integer">
* <arg name="Index" type="Integer" />
* <arg name="Win" type="@wxWindow" default="null" />
* </function>
* <desc>
* Returns the value of a system metric, or -1 if the metric is not
* supported on the current system. Specifying the win parameter is
* encouraged, because some metrics on some ports are not supported without
* one, or they might be capable of reporting better values if given one.
* If a window does not make sense for a metric, one should still be given,
* as for example it might determine which displays cursor width is requested
* with wxSystemSettings.CURSOR_X
* </desc>
* </class_method>
*/
JSBool SystemSettings::getMetric(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
int index;
@ -101,6 +180,90 @@ JSBool SystemSettings::hasFeature(JSContext *cx, JSObject *obj, uintN argc, jsva
return JS_TRUE;
}
/***
* <constants>
* <type name="System Colours">
* <constant name="COLOUR_SCROLLBAR">The scrollbar grey area.</constant>
* <constant name="COLOUR_BACKGROUND">The desktop colour.</constant>
* <constant name="COLOUR_ACTIVECAPTION">Active window caption.</constant>
* <constant name="COLOUR_INACTIVECAPTION">Inactive window caption.</constant>
* <constant name="COLOUR_MENU">Menu background.</constant>
* <constant name="COLOUR_WINDOW">Window background.</constant>
* <constant name="COLOUR_WINDOWFRAME">Window frame.</constant>
* <constant name="COLOUR_MENUTEXT">Menu text.</constant>
* <constant name="COLOUR_WINDOWTEXT">Text in windows.</constant>
* <constant name="COLOUR_CAPTIONTEXT">Text in caption, size box and scrollbar arrow box.</constant>
* <constant name="COLOUR_ACTIVEBORDER">Active window border.</constant>
* <constant name="COLOUR_INACTIVEBORDER">Inactive window border.</constant>
* <constant name="COLOUR_APPWORKSPACE">Background colour MDI applications.</constant>
* <constant name="COLOUR_HIGHLIGHT">Item(s) selected in a control.</constant>
* <constant name="COLOUR_HIGHLIGHTTEXT">Text of item(s) selected in a control.</constant>
* <constant name="COLOUR_BTNFACE">Face shading on push buttons.</constant>
* <constant name="COLOUR_BTNSHADOW">Edge shading on push buttons.</constant>
* <constant name="COLOUR_GRAYTEXT">Greyed (disabled) text.</constant>
* <constant name="COLOUR_BTNTEXT">Text on push buttons.</constant>
* <constant name="COLOUR_INACTIVECAPTIONTEXT">Colour of text in active captions.</constant>
* <constant name="COLOUR_BTNHIGHLIGHT">Highlight colour for buttons (same as constant name="COLOUR_3DHILIGHT).</constant>
* <constant name="COLOUR_3DDKSHADOW">Dark shadow for three-dimensional display elements.</constant>
* <constant name="COLOUR_3DLIGHT">Light colour for three-dimensional display elements.</constant>
* <constant name="COLOUR_INFOTEXT">Text colour for tooltip controls.</constant>
* <constant name="COLOUR_INFOBK">Background colour for tooltip controls.</constant>
* <constant name="COLOUR_DESKTOP">Same as COLOUR_BACKGROUND.</constant>
* <constant name="COLOUR_3DFACE">Same as COLOUR_BTNFACE.</constant>
* <constant name="COLOUR_3DSHADOW">Same as COLOUR_BTNSHADOW.</constant>
* <constant name="COLOUR_3DHIGHLIGHT">Same as COLOUR_BTNHIGHLIGHT.</constant>
* <constant name="COLOUR_3DHILIGHT">Same as COLOUR_BTNHIGHLIGHT.</constant>
* <constant name="COLOUR_BTNHILIGHT">Same as COLOUR_BTNHIGHLIGHT.</constant>
* </type>
* <type name="System Fonts">
* <constant name="OEM_FIXED_FONT">Original equipment manufacturer dependent fixed-pitch font.</constant>
* <constant name="ANSI_FIXED_FONT">Windows fixed-pitch font.</constant>
* <constant name="ANSI_VAR_FONT">Windows variable-pitch (proportional) font.</constant>
* <constant name="SYSTEM_FONT">System font.</constant>
* <constant name="DEVICE_DEFAULT_FONT">Device-dependent font (Windows NT only).</constant>
* <constant name="DEFAULT_GUI_FONT">Default font for user interface objects such as menus and dialog boxes. Note that with modern GUIs nothing guarantees that the same font is used for all GUI elements, so some controls might use a different font by default.</constant>
* </type>
* <type name="System Metrics">
* <constant name="MOUSE_BUTTONS">Number of buttons on mouse, or zero if no mouse was installed.</constant>
* <constant name="BORDER_X">Width of single border.</constant>
* <constant name="BORDER_Y">Height of single border.</constant>
* <constant name="CURSOR_X">Width of cursor.</constant>
* <constant name="CURSOR_Y">Height of cursor.</constant>
* <constant name="DCLICK_X">Width in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.</constant>
* <constant name="DCLICK_Y">Height in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.</constant>
* <constant name="DRAG_X">Width in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.</constant>
* <constant name="DRAG_Y">Height in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.</constant>
* <constant name="EDGE_X">Width of a 3D border, in pixels.</constant>
* <constant name="EDGE_Y">Height of a 3D border, in pixels.</constant>
* <constant name="HSCROLL_ARROW_X">Width of arrow bitmap on horizontal scrollbar.</constant>
* <constant name="HSCROLL_ARROW_Y">Height of arrow bitmap on horizontal scrollbar.</constant>
* <constant name="HTHUMB_X">Width of horizontal scrollbar thumb.</constant>
* <constant name="ICON_X">The default width of an icon.</constant>
* <constant name="ICON_Y">The default height of an icon.</constant>
* <constant name="ICONSPACING_X">Width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.</constant>
* <constant name="ICONSPACING_Y">Height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.</constant>
* <constant name="WINDOWMIN_X">Minimum width of a window.</constant>
* <constant name="WINDOWMIN_Y">Minimum height of a window.</constant>
* <constant name="SCREEN_X">Width of the screen in pixels.</constant>
* <constant name="SCREEN_Y">Height of the screen in pixels.</constant>
* <constant name="FRAMESIZE_X">Width of the window frame for a wxTHICK_FRAME window.</constant>
* <constant name="FRAMESIZE_Y">Height of the window frame for a wxTHICK_FRAME window.</constant>
* <constant name="SMALLICON_X">Recommended width of a small icon (in window captions, and small icon view).</constant>
* <constant name="SMALLICON_Y">Recommended height of a small icon (in window captions, and small icon view).</constant>
* <constant name="HSCROLL_Y">Height of horizontal scrollbar in pixels.</constant>
* <constant name="VSCROLL_X">Width of vertical scrollbar in pixels.</constant>
* <constant name="VSCROLL_ARROW_X">Width of arrow bitmap on a vertical scrollbar.</constant>
* <constant name="VSCROLL_ARROW_Y">Height of arrow bitmap on a vertical scrollbar.</constant>
* <constant name="VTHUMB_Y">Height of vertical scrollbar thumb.</constant>
* <constant name="CAPTION_Y">Height of normal caption area.</constant>
* <constant name="MENU_Y">Height of single-line menu bar.</constant>
* <constant name="NETWORK_PRESENT">1 if there is a network present, 0 otherwise.</constant>
* <constant name="PENWINDOWS_PRESENT">1 if PenWindows is installed, 0 otherwise.</constant>
* <constant name="SHOW_SOUNDS">Non-zero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; zero otherwise.</constant>
* <constant name="SWAP_BUTTONS">Non-zero if the meanings of the left and right mouse buttons are swapped; zero otherwise.</constant>
* </type>
* </constants>
*/
WXJS_BEGIN_CONSTANT_MAP(SystemSettings)
// wxSystemFont
WXJS_CONSTANT(wxSYS_, OEM_FIXED_FONT)

View File

@ -1,6 +1,32 @@
#ifndef _WXJSSettings_H
#define _WXJSSettings_H
/*
* wxJavaScript - settings.h
*
* Copyright (c) 2002-2007 Franky Braem and the wxJavaScript project
*
* Project Info: http://www.wxjavascript.net or http://wxjs.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* Remark: This class was donated by Philip Taylor
*
* $Id$
*/
namespace wxjs
{
namespace gui

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: sizer.cpp 733 2007-06-05 21:17:25Z fbraem $
* $Id: sizer.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// sizer.cpp
@ -32,12 +32,12 @@
#include "../../common/main.h"
#include "../../common/apiwrap.h"
#include "../../ext/wxjs_ext.h"
#include "../control/window.h"
#include "sizer.h"
#include "size.h"
#include "point.h"
using namespace wxjs;
using namespace wxjs::gui;
@ -55,7 +55,6 @@ using namespace wxjs::gui;
* <pre><code class="whjs">
* // The wxSizer example
* wxTheApp.onInit = init;
* wxTheApp.mainLoop();
*
* function init()
* {
@ -164,7 +163,7 @@ bool Sizer::GetProperty(wxSizer *p, JSContext *cx, JSObject *obj, int id, jsval
*vp = Size::CreateObject(cx, new wxSize(p->GetSize()));
break;
case P_POSITION:
*vp = Point::CreateObject(cx, new wxPoint(p->GetPosition()));
*vp = wxjs::ext::CreatePoint(cx, p->GetPosition());
break;
}
return true;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: textval.cpp 738 2007-06-08 18:47:56Z fbraem $
* $Id: textval.cpp 782 2007-06-24 20:23:23Z fbraem $
*/
#ifndef WX_PRECOMP
@ -85,7 +85,6 @@ wxObject* TextValidator::Clone() const
* }
*
* wxTheApp.onInit = init;
* wxTheApp.mainLoop();
* </code></pre>
* </class>
*/

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: validator.cpp 739 2007-06-08 20:51:47Z fbraem $
* $Id: validator.cpp 784 2007-06-25 18:34:22Z fbraem $
*/
// validator.cpp
@ -36,7 +36,6 @@
#include "../control/window.h"
#include "validate.h"
#include "app.h"
using namespace wxjs;
using namespace wxjs::gui;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: ffile.cpp 671 2007-04-11 21:03:11Z fbraem $
* $Id: ffile.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// file.cpp
#include <wx/strconv.h>
@ -31,7 +31,7 @@
#include "../common/apiwrap.h"
#include "../common/type.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "ffile.h"
using namespace wxjs;
@ -281,7 +281,7 @@ JSBool FFile::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
else
{
*rval = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, count));
*rval = wxjs::ext::CreateMemoryBuffer(cx, buffer, count);
}
delete[] buffer;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: file.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: file.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
// file.cpp
#include <wx/wxprec.h>
@ -32,7 +32,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "file.h"
using namespace wxjs;
@ -454,7 +454,7 @@ JSBool File::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
}
else
{
*rval = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, count));
*rval = wxjs::ext::CreateMemoryBuffer(cx, buffer, count);
}
delete[] buffer;

View File

@ -49,11 +49,6 @@ using namespace wxjs;
* </class>
*/
extern JSConstDoubleSpec wxGlobalMap[];
/*JSConstDoubleSpec wxGlobalMap[] =
{
WXJS_SIMPLE_CONSTANT(wxNOT_FOUND)
{ 0 }
};*/
/***
* <constants>

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: main.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: main.cpp 777 2007-06-24 19:42:27Z fbraem $
*/
// main.cpp
#ifdef __WXMSW__
@ -38,15 +38,6 @@
using namespace wxjs;
using namespace wxjs::io;
// A wxApp is needed by wxSocketBase
class wxJSIOApp : public wxAppConsole
{
virtual int OnRun() { return 0; }
};
/*
IMPLEMENT_APP_NO_MAIN(wxJSIOApp)
#ifdef __WXMSW__
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
@ -56,16 +47,10 @@ IMPLEMENT_APP_NO_MAIN(wxJSIOApp)
{
case DLL_PROCESS_ATTACH:
{
wxSetInstance(hinstDLL);
wxAppConsole *app = new wxJSIOApp();
int app_argc = 0;
char **app_argv = NULL;
wxEntryStart(app_argc, app_argv);
DisableThreadLibraryCalls(hinstDLL);
break;
}
case DLL_PROCESS_DETACH:
wxEntryCleanup();
break;
}
@ -87,4 +72,3 @@ WXJSAPI void wxJS_Destroy()
{
Destroy();
}
*/

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: mistream.cpp 716 2007-05-20 17:57:22Z fbraem $
* $Id: mistream.cpp 759 2007-06-12 21:13:52Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -35,6 +35,7 @@
#include "mistream.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
using namespace wxjs;
using namespace wxjs::io;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: mostream.cpp 715 2007-05-18 20:38:04Z fbraem $
* $Id: mostream.cpp 810 2007-07-13 20:07:05Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -35,7 +35,7 @@
#include "mostream.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
using namespace wxjs;
using namespace wxjs::io;
@ -125,7 +125,7 @@ bool MemoryOutputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, in
char* buffer = new char[size];
mstream->CopyTo(buffer, size);
*vp = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, size));
*vp = wxjs::ext::CreateMemoryBuffer(cx, buffer, size);
delete[] buffer;
break;
}

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: ostream.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: ostream.cpp 759 2007-06-12 21:13:52Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -31,7 +31,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "stream.h"
#include "istream.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: sockbase.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: sockbase.cpp 759 2007-06-12 21:13:52Z fbraem $
*/
// file.cpp
#include <wx/wxprec.h>
@ -32,7 +32,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "sockbase.h"
using namespace wxjs;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: tempfile.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: tempfile.cpp 758 2007-06-12 20:43:31Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -31,6 +31,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "tempfile.h"
using namespace wxjs;

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: zistream.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: zistream.cpp 759 2007-06-12 21:13:52Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -31,6 +31,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "stream.h"
#include "istream.h"

View File

@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* $Id: zostream.cpp 598 2007-03-07 20:13:28Z fbraem $
* $Id: zostream.cpp 759 2007-06-12 21:13:52Z fbraem $
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@ -31,7 +31,7 @@
#include "../common/main.h"
#include "../ext/wxjs_ext.h"
#include "../ext/jsmembuf.h"
#include "stream.h"
#include "ostream.h"