Index: ps/trunk/source/tools/atlas/wxJS/io/protocol.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/protocol.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/protocol.cpp (nonexistent) @@ -1,255 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - protocol.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: protocol.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "jsstream.h" -#include "sistream.h" -#include "sockbase.h" -#include "protocol.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * protocol - * io - * - * Prototype for all protocol classes. - * - */ -WXJS_INIT_CLASS(Protocol, "wxProtocol", 0) - -/*** - * - * - * No error - * A generic network error occurred. - * An error occurred during negotiation. - * The client failed to connect the server. - * Invalid value. - * - * The remote file doesn't exist. - * Last action aborted. - * An error occurred during reconnection. - * Someone tried to send a command during a transfer. - * - * wxProtocolError is ported to JavaScript as a separate class. Note that this - * class doesn't exist in wxWidgets. - * - * - * - */ -void Protocol::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxProtocolErrorMap[] = - { - WXJS_CONSTANT(wxPROTO_, NOERR) - WXJS_CONSTANT(wxPROTO_, NETERR) - WXJS_CONSTANT(wxPROTO_, PROTERR) - WXJS_CONSTANT(wxPROTO_, CONNERR) - WXJS_CONSTANT(wxPROTO_, INVVAL) - WXJS_CONSTANT(wxPROTO_, NOHNDLR) - WXJS_CONSTANT(wxPROTO_, NOFILE) - WXJS_CONSTANT(wxPROTO_, ABRT) - WXJS_CONSTANT(wxPROTO_, RCNCT) - WXJS_CONSTANT(wxPROTO_, STREAMING) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxProtocolError", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxProtocolErrorMap); -} - -/*** - * - * - * Returns the type of the content of the last opened stream. It is a mime-type - * - * - * Returns the last occurred error. See @wxProtocol#wxProtocolError. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Protocol) - WXJS_READONLY_PROPERTY(P_CONTENT_TYPE, "contentType") - WXJS_READONLY_PROPERTY(P_ERROR, "error") -WXJS_END_PROPERTY_MAP() - -bool Protocol::GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxProtocol *protocol = dynamic_cast(p->GetBase()); - - switch(id) - { - case P_CONTENT_TYPE: - *vp = ToJS(cx, protocol->GetContentType()); - break; - case P_ERROR: - *vp = ToJS(cx, protocol->GetError()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(Protocol) - WXJS_METHOD("abort", abort, 0) - WXJS_METHOD("getInputStream", getInputStream, 1) - WXJS_METHOD("reconnect", reconnect, 0) - WXJS_METHOD("setPassword", setPassword, 1) - WXJS_METHOD("setUser", setUser, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Abort the current stream. - * - * - */ -JSBool Protocol::abort(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxProtocol *protocol = dynamic_cast(p->GetBase()); - *rval = ToJS(cx, protocol->Abort()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Creates a new input stream on the specified path. - * You can use all but seek functionality of wxStream. - * @wxInputStream#seekI isn't available on all stream. For example, http or - * ftp streams doesn't deal with it. Other functions like - * @wxStreamBase#size aren't available for the moment for - * this sort of stream. You will be notified when the EOF - * is reached by an error. - * - * - */ -JSBool Protocol::getInputStream(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxProtocol *protocol = dynamic_cast(p->GetBase()); - - wxString path; - FromJS(cx, argv[0], path); - - wxInputStream *stream = protocol->GetInputStream(path); - if ( stream != NULL ) - { - Stream *js_stream = new Stream(stream, false); - p->AddStream(js_stream); - *rval = SocketInputStream::CreateObject(cx, js_stream, NULL); - js_stream->SetObject(JSVAL_TO_OBJECT(*rval)); - } - return JS_TRUE; -} - -/*** - * - * - * - * Tries to reestablish a previous opened connection (close and renegotiate connection). - * - * - */ -JSBool Protocol::reconnect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxProtocol *protocol = dynamic_cast(p->GetBase()); - - *rval = ToJS(cx, protocol->Reconnect()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Sets the authentication password. It is mainly useful when FTP is used. - * - * - */ -JSBool Protocol::setPassword(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxProtocol *protocol = dynamic_cast(p->GetBase()); - - wxString pwd; - FromJS(cx, argv[0], pwd); - protocol->SetPassword(pwd); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Sets the authentication user. It is mainly useful when FTP is used. - * - * - */ -JSBool Protocol::setUser(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxProtocol *protocol = dynamic_cast(p->GetBase()); - - wxString user; - FromJS(cx, argv[0], user); - protocol->SetUser(user); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/protocol.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/textline.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/textline.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/textline.h (nonexistent) @@ -1,57 +0,0 @@ -/* - * wxJavaScript - textline.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: textline.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_textline_h -#define _wxjs_io_textline_h - -// Helper class for text lines -namespace wxjs -{ - namespace io - { - class TextLine : public ApiWrapper - { - public: - - static bool GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static bool Enumerate(Index *p, JSContext *cx, JSObject *obj, JSIterateOp enum_op, jsval *statep, jsid *idp); - static bool Resolve(JSContext *cx, JSObject *obj, jsval id); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_LINE_TYPE = WXJS_START_PROPERTY_ID - , P_CONTENT - }; - - static JSBool removeLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_textline_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/textline.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tostream.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - tostream.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: tostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTextOutputStream_H -#define _WXJSTextOutputStream_H - -#include - -namespace wxjs -{ - namespace io - { - class TextOutputStream : public ApiWrapper - { - public: - - /** - * Callback for when a wxTextOutputStream object is created - */ - static wxTextOutputStream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static bool GetProperty(wxTextOutputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxTextOutputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_MODE - }; - WXJS_DECLARE_METHOD_MAP() - static JSBool write32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool writeDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool writeString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSTextOutputStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/istream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/istream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/istream.cpp (nonexistent) @@ -1,302 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - istream.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: istream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" - -#include "stream.h" -#include "ostream.h" -#include "istream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * istream - * io - * - * wxInputStream is a prototype for input streams. You can't construct it directly. - * See @wxMemoryInputStream, @wxFileInputStream and @wxFFileInputStream. - * - */ -WXJS_INIT_CLASS(InputStream, "wxInputStream", 0) - -/*** - * - * - * Returns the first character in the input queue and removes it. - * When set it puts back the character or full String in the input queue. - * - * - * Returns true when end-of-file occurred. - * - * - * Returns the last number of bytes read. - * - * - * Returns the first character in the input queue without removing it. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(InputStream) - WXJS_PROPERTY(P_C, "c") - WXJS_READONLY_PROPERTY(P_EOF, "eof") - WXJS_READONLY_PROPERTY(P_LAST_READ, "lastRead") - WXJS_READONLY_PROPERTY(P_PEEK, "peek") - WXJS_READONLY_PROPERTY(P_TELL_I, "tellI") -WXJS_END_PROPERTY_MAP() - -bool InputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxInputStream *stream = (wxInputStream*) p->GetStream(); - switch (id) - { - case P_C: - *vp = ToJS(cx, wxString::FromAscii(stream->GetC())); - break; - case P_EOF: - *vp = ToJS(cx, stream->Eof()); - break; - case P_LAST_READ: - *vp = ToJS(cx, (int) stream->LastRead()); - break; - case P_PEEK: - *vp = ToJS(cx, wxString::FromAscii(stream->Peek())); - break; - } - return true; -} - -bool InputStream::SetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_C ) - { - wxInputStream *stream = (wxInputStream*) p->GetStream(); - wxString s; - FromJS(cx, *vp, s); - if ( s.length() > 0 ) - { - stream->Ungetch(s, s.length()); - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(InputStream) - WXJS_METHOD("getC", getC, 0) - WXJS_METHOD("peek", peek, 0) - WXJS_METHOD("read", read, 1) - WXJS_METHOD("seekI", seekI, 1) - WXJS_METHOD("ungetch", ungetch, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Returns the next character from the input queue and removes it. - * - * - */ -JSBool InputStream::getC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxInputStream *in = (wxInputStream *) p->GetStream(); - *rval = ToJS(cx, wxString::FromAscii(in->GetC())); - return JS_TRUE; -} - -/*** - * - * - * - * Returns the next character from the input queue without removing it. - * - * - */ -JSBool InputStream::peek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxInputStream *in = (wxInputStream *) p->GetStream(); - - *rval = ToJS(cx, wxString::FromAscii(in->Peek())); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * The outputstream that gets the data from the input queue. - * - * - * - * Reads the specified number of bytes (the size of the buffer) and stores them in the buffer. - *

- * Reads data from the input queue and stores it in the specified output stream. - * The data is read until an error is raised by one of the two streams. - *
- *
- */ -JSBool InputStream::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxInputStream *in = (wxInputStream *) p->GetStream(); - - if ( OutputStream::HasPrototype(cx, argv[0]) ) - { - Stream *p_out = OutputStream::GetPrivate(cx, argv[0], false); - wxOutputStream *out = (wxOutputStream *) p_out->GetStream(); - in->Read(*out); - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - else - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - in->Read(buffer->GetData(), buffer->GetBufSize()); - buffer->SetDataLen(in->LastRead()); - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * Offset to seek to - * - * - * - * - * Seeks the offset. Returns the actual position or -1 on error. - * - * - */ -JSBool InputStream::seekI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxInputStream *in = (wxInputStream *) p->GetStream(); - - int offset; - if ( ! FromJS(cx, argv[0], offset) ) - return JS_FALSE; - - int pos; - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - pos = in->SeekI(offset, (wxSeekMode) mode); - } - else - return JS_FALSE; - } - else - pos = in->SeekI(offset); - - *rval = ToJS(cx, pos); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * This function is only useful in read mode. It is the manager of the "Write-Back" buffer. - * This buffer acts like a temporary buffer where datas which has to be read during the next - * read IO call are put. This is useful when you get a big block of data which you didn't want - * to read: you can replace them at the top of the input queue by this way. - *

- * Be very careful about this call in connection with calling @wxInputStream#seekI on the - * same stream. Any call to @wxInputStream#seekI will invalidate any previous call to this - * method (otherwise you could @wxInputStream#seekI to one position, "unread" a few bytes - * there, @wxInputStream#seekI to another position and data would be either lost or corrupted). - *
- *
- */ -JSBool InputStream::ungetch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxInputStream *in = (wxInputStream *) p->GetStream(); - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - *rval = ToJS(cx, (int) in->Ungetch(buffer->GetData(), buffer->GetDataLen())); - return JS_TRUE; - } - } - - wxString s; - FromJS(cx, argv[0], s); - if ( s.length() > 0 ) - { - *rval = ToJS(cx, (int) in->Ungetch(s, s.length())); - } - else - *rval = ToJS(cx, 0); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/istream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/archentry.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/archentry.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/archentry.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - archentry.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: archentry.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_archentry_h -#define wxjs_io_archentry_h - -#include - -namespace wxjs -{ - namespace io - { - class ArchiveEntry : public ApiWrapper - { - public: - - /** - * Callback for retrieving properties - */ - static bool GetProperty(wxArchiveEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxArchiveEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_DATE_TIME, - P_INTERNAL_FMT, - P_INTERNAL_NAME, - P_NAME, - P_OFFSET, - P_SIZE, - P_DIR, - P_READ_ONLY, - }; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_archentry_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/archentry.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/url.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/url.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/url.h (nonexistent) @@ -1,58 +0,0 @@ -/* - * wxJavaScript - url.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: url.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_url_h -#define _wxjs_io_url_h - -#include - -namespace wxjs -{ - namespace io - { - class URL : public ApiWrapper - { - public: - - static wxURL *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static bool GetProperty(wxURL *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_INPUT_STREAM = WXJS_START_PROPERTY_ID - , P_ERROR - }; - - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - static JSBool setDefaultProxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setProxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_url_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/url.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/distream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/distream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/distream.cpp (nonexistent) @@ -1,256 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - distream.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: distream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "istream.h" -#include "distream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * distream - * io - * - * This class provides functions that read binary data types in a portable way. - * Data can be read in either big-endian or little-endian format, little-endian being - * the default on all architectures. - *

- * If you want to read data from text files (or streams) use @wxTextInputStream instead. - *

- * Remark :This class is not thoroughly tested. If you find problems let - * it know on the project forum. - *
- */ - -WXJS_INIT_CLASS(DataInputStream, "wxDataInputStream", 1) -/*** - * - * - * An input stream - * - * - * Constructs a new wxDataInputStream object. - * - * - */ -wxDataInputStream* DataInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - Stream *in = InputStream::GetPrivate(cx, argv[0]); - if ( in == NULL ) - return NULL; - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - return new wxDataInputStream(*dynamic_cast(in->GetStream())); -} - -WXJS_BEGIN_METHOD_MAP(DataInputStream) - WXJS_METHOD("bigEndianOrdered", bigEndianOrdered, 1) - WXJS_METHOD("read64", read64, 0) - WXJS_METHOD("read32", read32, 0) - WXJS_METHOD("read16", read16, 0) - WXJS_METHOD("read8", read8, 0) - WXJS_METHOD("readString", readString, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * If Ordered is true, all data will be read in big-endian order, - * such as written by programs on a big endian architecture (e.g. Sparc) - * or written by Java-Streams (which always use big-endian order). - * - * - */ - JSBool DataInputStream::bigEndianOrdered(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool ordered; - if ( FromJS(cx, argv[0], ordered) ) - { - p->BigEndianOrdered(ordered); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * Reads a 64 bit integer from the stream. - * - * - */ -JSBool DataInputStream::read64(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint64 value = p->Read64(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (long) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a 32 bit integer from the stream. - * - * - */ -JSBool DataInputStream::read32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint32 value = p->Read32(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a 16 bit integer from the stream. - * - * - */ -JSBool DataInputStream::read16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint16 value = p->Read16(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a 8 bit integer from the stream. - * - * - */ -JSBool DataInputStream::read8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint8 value = p->Read8(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a double (IEEE encoded) from a stream. - * - * - */ -JSBool DataInputStream::readDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReadDouble()); - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a string from a stream. Actually, this function first reads a long integer - * specifying the length of the string (without the last null character) and then reads the string. - * - * - */ -JSBool DataInputStream::readString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataInputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReadString()); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/distream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ostream.cpp (nonexistent) @@ -1,267 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ostream.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: ostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" - -#include "stream.h" -#include "istream.h" -#include "ostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ostream - * io - * - * wxOutputStream is a prototype for output streams. You can't construct it directly. - * See @wxMemoryOutputStream, @wxFileOutputStream, @wxFFileOutputStream. - * - */ -WXJS_INIT_CLASS(OutputStream, "wxOutputStream", 0) - -/*** - * - * - * Gets the last number of bytes written. - * - * - * Returns the current position. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(OutputStream) - WXJS_READONLY_PROPERTY(P_LAST_WRITE, "lastWrite") - WXJS_READONLY_PROPERTY(P_TELL_O, "tellO") -WXJS_END_PROPERTY_MAP() - -bool OutputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxOutputStream *stream = (wxOutputStream *) p->GetStream(); - switch (id) - { - case P_LAST_WRITE: - *vp = ToJS(cx, (long) stream->LastWrite()); - break; - case P_TELL_O: - *vp = ToJS(cx, (long) stream->TellO()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(OutputStream) - WXJS_METHOD("close", close, 0) - WXJS_METHOD("putC", putC, 1) - WXJS_METHOD("write", write, 1) - WXJS_METHOD("seekO", seekO, 1) - WXJS_METHOD("sync", sync, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Closes the stream - * - * - */ -JSBool OutputStream::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p != NULL ) - { - wxOutputStream *out = (wxOutputStream *) p->GetStream(); - *rval = ToJS(cx, out->Close()); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * The first character of the String is written to the output stream. - * - * - */ -JSBool OutputStream::putC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxOutputStream *out = (wxOutputStream *) p->GetStream(); - - wxString Buffer; - FromJS(cx, argv[0], Buffer); - if ( Buffer.length() > 0 ) - { - out->PutC(Buffer.at(0)); - } - return JS_TRUE; -} - -/*** - * - * - * - * The number of characters to write. Default is the length of buffer. - * - * - * - * - * - * - * - * - * 1. Writes the buffer to the outputstream. Unlike wxWindows, the size of the buffer must not - * be specified. If ommitted then the full buffer is written. - *

- * 2. Reads data from the specified input stream and stores them in the current stream. - * The data is read until an error is raised by one of the two streams. - *

- * Unlike wxWidgets, this method returns the number of bytes written. - *
- *
- */ -JSBool OutputStream::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxOutputStream *out = (wxOutputStream *) p->GetStream(); - - if ( InputStream::HasPrototype(cx, argv[0]) ) - { - Stream *p_in = InputStream::GetPrivate(cx, argv[0], false); - wxInputStream *in = (wxInputStream *) p_in->GetStream(); - out->Write(*in); - } - else - { - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - *rval = ToJS(cx, out->Write(buffer->GetData(), buffer->GetDataLen()).LastWrite()); - return JS_TRUE; - } - } - - wxString buffer; - FromJS(cx, argv[0], buffer); - - int count = buffer.length(); - if ( argc > 1 ) - { - if ( FromJS(cx, argv[1], count) ) - { - if ( count > (int) buffer.length() ) - count = buffer.length(); - } - else - return JS_FALSE; - } - - *rval = ToJS(cx, out->Write(buffer, count).LastWrite()); - } - return JS_TRUE; -} - -/*** - * - * - * Offset to seek to - * - * - * - * Seeks the offset. Returns the actual position or -1 on error. - * - * - */ -JSBool OutputStream::seekO(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxOutputStream *out = (wxOutputStream *) p->GetStream(); - - int offset; - if ( ! FromJS(cx, argv[0], offset) ) - return JS_FALSE; - - int pos; - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - pos = out->SeekO(offset, (wxSeekMode) mode); - } - else - return JS_FALSE; - } - else - pos = out->SeekO(offset); - - *rval = ToJS(cx, pos); - return JS_TRUE; -} - -/*** - * - * - * - * Flushes the buffer. - * - * - */ -JSBool OutputStream::sync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxOutputStream *out = (wxOutputStream *) p->GetStream(); - - out->Sync(); - return JS_TRUE; -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/aistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/aistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/aistream.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * wxJavaScript - aistream.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: aistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_aistream_h -#define wxjs_io_aistream_h - -namespace wxjs -{ - namespace io - { - class ArchiveInputStream : public ApiWrapper - { - public: - - WXJS_DECLARE_METHOD_MAP() - static JSBool closeentry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool openEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_aistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/aistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dirtrav.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dirtrav.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dirtrav.cpp (nonexistent) @@ -1,183 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - dirtrav.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: dirtrav.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSDirTraverser.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/jsutil.h" - -#include "dirtrav.h" - -using namespace wxjs; -using namespace wxjs::io; - -DirTraverser::DirTraverser(JSContext *cx, JSObject *obj) - : wxDirTraverser() - , Object(obj, cx) -{ -} - -wxDirTraverseResult DirTraverser::OnFile(const wxString& filename) -{ - JSContext *cx = GetContext(); - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onFile", &fval) == JS_TRUE ) - { - jsval rval; - jsval argv[] = { ToJS(cx, filename) }; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval) == JS_TRUE ) - { - int result; - if ( FromJS(cx, rval, result ) ) - { - return (wxDirTraverseResult) result; - } - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - return wxDIR_STOP; - } - - // No function set, we return continue - return wxDIR_CONTINUE; -} - -wxDirTraverseResult DirTraverser::OnDir(const wxString& filename) -{ - JSContext *cx = GetContext(); - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onDir", &fval) == JS_TRUE ) - { - jsval rval; - jsval argv[] = { ToJS(cx, filename) }; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval) == JS_TRUE ) - { - int result; - if ( FromJS(cx, rval, result) ) - { - return (wxDirTraverseResult) result; - } - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - return wxDIR_STOP; - } - - // No function set, we return continue - return wxDIR_CONTINUE; -} - -/*** - * dirtrav - * io - * - * wxDirTraverser can be used to traverse into directories to retrieve filenames and subdirectories. - *

- * See also @wxDir - *

- * The following example counts all subdirectories of the temporary directory. - * Counting the direct subdirectories of temp is possible by returning - * IGNORE in @wxDirTraverser#onDir. - *

- *  var dir = new wxDir("c:\\temp");
- *  var trav = new wxDirTraverser();
- *  subdir = 0; // Don't use var, it doesn't seem to work with closures
- *  
- *  trav.onDir = function(filename)
- *  {
- *    subdir = subdir + 1;
- *    return wxDirTraverser.CONTINUE;
- *  }
- * 
- *  dir.traverse(trav);
- *
- *  wxMessageBox("Number of subdirectories: " + subdir);
- *  
- *
- */ -WXJS_INIT_CLASS(DirTraverser, "wxDirTraverser", 0) - -/*** - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(DirTraverser) - WXJS_CONSTANT(wxDIR_, IGNORE) - WXJS_CONSTANT(wxDIR_, STOP) - WXJS_CONSTANT(wxDIR_, CONTINUE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * Function which will be called for each file. The function - * gets a filename and should return a constant @wxDirTraverser#wxDirTraverseResult except - * for IGNORE. When no function is set, it will return - * CONTINUE. This makes it possible to enumerate the subdirectories. - * - * - * Function which will be called for each directory. The function - * gets a directoryname and should return a constant @wxDirTraverser#wxDirTraverseResult. - * It may return STOP to abort traversing completely, IGNORE to skip this directory but continue with - * others or CONTINUE to enumerate all files and subdirectories - * in this directory. When no function is set, it will return CONTINUE. - * This makes it possible to enumerate all files. - * - * - */ - -/*** - * - * - * - * Constructs a new wxDirTraverser object. - * - * - */ -DirTraverser* DirTraverser::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new DirTraverser(cx, obj); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dirtrav.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.cpp (nonexistent) @@ -1,50 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ipv4addr.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: ipv4addr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "ipv4addr.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ipv4addr - * io - * - * Implements the IPV4 of the internet protocal. - * - */ -WXJS_INIT_CLASS(IPV4address, "wxIPV4address", 0) - -wxIPV4address* IPV4address::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new wxIPV4address(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dostream.cpp (nonexistent) @@ -1,277 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - dostream.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: dostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "constant.h" -#include "stream.h" -#include "ostream.h" -#include "dostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * dostream - * io - * - * This class provides functions that write binary data types in a portable way. - * Data can be written in either big-endian or little-endian format, little-endian - * being the default on all architectures. - * If you want to write data to text files (or streams) use @wxTextOutputStream instead. - *

- * Remark :This class is not thoroughly tested. If you find problems let - * it know on the project forum. - *
- */ -WXJS_INIT_CLASS(DataOutputStream, "wxDataOutputStream", 1) - -/*** - * - * - * An output stream - * - * - * Constructs a new wxDataOutputStream object. - * - * - */ -wxDataOutputStream* DataOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - Stream *out = OutputStream::GetPrivate(cx, argv[0]); - if ( out == NULL ) - return NULL; - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - return new wxDataOutputStream(*dynamic_cast(out->GetStream())); -} - -WXJS_BEGIN_METHOD_MAP(DataOutputStream) - WXJS_METHOD("bigEndianOrdered", bigEndianOrdered, 1) - WXJS_METHOD("write64", write64, 1) - WXJS_METHOD("write32", write32, 1) - WXJS_METHOD("write16", write16, 1) - WXJS_METHOD("write8", write8, 1) - WXJS_METHOD("writeString", writeString, 1) - WXJS_METHOD("writeDouble", writeDouble, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * If Ordered is true, all data will be read in big-endian order, - * such as written by programs on a big endian architecture (e.g. Sparc) - * or written by Java-Streams (which always use big-endian order). - * - * - */ - JSBool DataOutputStream::bigEndianOrdered(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool ordered; - if ( FromJS(cx, argv[0], ordered) ) - { - p->BigEndianOrdered(ordered); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 64 bit integer to the stream. - * - * - */ -JSBool DataOutputStream::write64(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// Check for other platforms !!! -#ifdef __WXMSW__ - long value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write64((wxUint64) value); - return JS_TRUE; - } -#endif - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 32 bit integer to the stream. - * - * - */ -JSBool DataOutputStream::write32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write32(value); - return JS_TRUE; - } -#endif - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 16 bit integer to the stream. - * - * - */ -JSBool DataOutputStream::write16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// TODO: Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write16(value); - return JS_TRUE; - } -#endif - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 8 bit integer to the stream. - * - * - */ -JSBool DataOutputStream::write8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// TODO: Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write8(value); - return JS_TRUE; - } -#endif - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a double (IEEE encoded) to a stream. - * - * - */ -JSBool DataOutputStream::writeDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - double value; - if ( FromJS(cx, argv[0], value) ) - { - p->WriteDouble(value); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes string as a line. Depending on the end-of-line mode the end of line - * ('\n') characters in the string are converted to the correct line - * ending terminator. - * - * - */ -JSBool DataOutputStream::writeString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDataOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString value; - FromJS(cx, argv[0], value); - p->WriteString(value); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/file.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/file.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/file.cpp (nonexistent) @@ -1,647 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - file.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: file.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// file.cpp -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" -#include "file.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * file - * io - * - * A wxFile performs raw file I/O. - * This is a very small class designed to minimize the overhead of using it - - * in fact, there is hardly any overhead at all, but using it brings you - * automatic error checking and hides differences between platforms. - * wxFile is a wrapper around a file descriptor, while @wxFFile is a wrapper - * around the FILE structure. - * - */ -WXJS_INIT_CLASS(File, "wxFile", 0) - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * wxSeekMode is ported as a separate JavaScript object. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(File) - WXJS_CONSTANT(wxFILE_, KIND_UNKNOWN) - WXJS_CONSTANT(wxFILE_, KIND_DISK) - WXJS_CONSTANT(wxFILE_, KIND_TERMINAL) - WXJS_CONSTANT(wxFILE_, KIND_PIPE) - { wxFile::read, "read", WXJS_READONLY }, - { wxFile::write, "write", WXJS_READONLY }, - { wxFile::read_write, "read_write", WXJS_READONLY }, - { wxFile::write_append, "write_append", WXJS_READONLY }, - { wxFile::write_excl, "write_excl", WXJS_READONLY }, - { wxFile::fd_stdin, "fd_stdin", WXJS_READONLY }, - { wxFile::fd_stdout, "fd_stdout", WXJS_READONLY }, - { wxFile::fd_stderr, "fd_stderr", WXJS_READONLY }, - WXJS_CONSTANT(wxS_, IRUSR) - WXJS_CONSTANT(wxS_, IWUSR) - WXJS_CONSTANT(wxS_, IXUSR) - WXJS_CONSTANT(wxS_, IRGRP) - WXJS_CONSTANT(wxS_, IWGRP) - WXJS_CONSTANT(wxS_, IXGRP) - WXJS_CONSTANT(wxS_, IROTH) - WXJS_CONSTANT(wxS_, IWOTH) - WXJS_CONSTANT(wxS_, IXOTH) - WXJS_CONSTANT(wxS_, DEFAULT) -WXJS_END_CONSTANT_MAP() - -void File::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxPathFormatMap[] = - { - WXJS_CONSTANT(wx, FromCurrent) - WXJS_CONSTANT(wx, FromStart) - WXJS_CONSTANT(wx, FromEnd) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxSeekMode", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxPathFormatMap); -} - -/*** - * - * - * Returns true when end of file is reached. - * When the file is not open, undefined is returned. - * - * - * Returns true when the file is open. - * - * - * Returns the length of the file. - * When the file is not open, undefined is returned. - * - * - * Returns the current position or -1. - * When the file is not open, undefined is returned. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(File) - WXJS_READONLY_PROPERTY(P_EOF, "eof") - WXJS_READONLY_PROPERTY(P_OPENED, "opened") - WXJS_READONLY_PROPERTY(P_LENGTH, "length") - WXJS_READONLY_PROPERTY(P_TELL, "tell") - WXJS_READONLY_PROPERTY(P_KIND, "kind") -WXJS_END_PROPERTY_MAP() - -bool File::GetProperty(wxFile *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_EOF: - *vp = p->IsOpened() ? ToJS(cx, p->Eof()) : JSVAL_VOID; - break; - case P_OPENED: - *vp = ToJS(cx, p->IsOpened()); - break; - case P_LENGTH: - *vp = p->IsOpened() ? ToJS(cx, (long) p->Length()) : JSVAL_VOID; - break; - case P_TELL: - *vp = p->IsOpened() ? ToJS(cx, (long) p->Tell()) : JSVAL_VOID; - break; - case P_KIND: - *vp = p->IsOpened() ? ToJS(cx, (int) p->GetKind()) : JSVAL_VOID; - break; - } - return true; -} - -/*** - * - * - * - * The filename - * - * The mode in which to open the file. See @wxFile#Mode. - * - * - * - * Constructs a new wxFile object. When a filename is passed, - * The file is opened, and you can check whether the operation -* was successful or not by checking @wxFile#opened. - * - * - */ -wxFile *File::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - wxString fileName; - - int mode = wxFile::read; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], mode) ) - break; - // Walk through - case 1: - FromJS(cx, argv[0], fileName); - return new wxFile(fileName, (wxFile::OpenMode) mode); - break; - case 0: - return new wxFile(); - break; - } - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(File) - WXJS_METHOD("attach", attach, 1) - WXJS_METHOD("detach", detach, 0) - WXJS_METHOD("close", close, 0) - WXJS_METHOD("create", create, 3) - WXJS_METHOD("flush", flush, 0) - WXJS_METHOD("open", open, 2) - WXJS_METHOD("read", read, 1) - WXJS_METHOD("seek", seek, 2) - WXJS_METHOD("seekEnd", seekEnd, 1) - WXJS_METHOD("write", write, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * A file descriptor - * - * - * - * Attaches an existing file descriptor to the wxFile object. - * Example of predefined file descriptors are 0, 1 and 2 which correspond to - * stdin, stdout and stderr (and have symbolic names of wxFile.fd_stdin, wxFile.fd_stdout - * and wxFile.fd_stderr). - * - * - */ -JSBool File::attach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int fd; - if ( FromJS(cx, argv[0], fd) ) - { - p->Attach(fd); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Closes the file. - * - * - */ -JSBool File::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( p->IsOpened() ) - p->Close(); - - return JS_TRUE; -} - -/*** - * - * - * - * Get back a file descriptor from wxFile object - the caller is responsible for closing - * the file if this descriptor is opened. @wxFile#opened will return false - * after call to detach. - * - * - */ -JSBool File::detach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - p->Detach(); - - return JS_TRUE; -} - -/*** - * - * - * The name of the file to create. - * - * Overwrite the file when it already exist? The default is false. - * - * - * - * - * Creates a file for writing. - * - * - */ -JSBool File::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - wxString fileName; - bool overwrite = false; - int access = wxS_DEFAULT; - - FromJS(cx, argv[0], fileName); - if ( argc > 1 - && ! FromJS(cx, argv[1], overwrite) ) - { - return JS_FALSE; - } - - if ( argc > 2 - && ! FromJS(cx, argv[2], access) ) - { - return JS_FALSE; - } - - *rval = p->Create(fileName, overwrite, access); - - return JS_TRUE; -} - -/*** - * - * - * - * Flushes the file. - * - * - */ -JSBool File::flush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - p->Flush(); - - return JS_TRUE; -} - -/*** - * - * - * The name of the file to open - * - * - * - * Opens a file. - * - * - */ -JSBool File::open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - wxString fileName; - bool result = false; - FromJS(cx, argv[0], fileName); - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - result = p->Open(fileName, (wxFile::OpenMode) mode); - } - else - { - return JS_FALSE; - } - } - else - result = p->Open(fileName); - - *rval = result ? JSVAL_TRUE : JSVAL_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * The number of bytes to read. - * - * - * Reads the specified number of bytes and returns a buffer. - * - * - */ -JSBool File::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - int count; - if ( FromJS(cx, argv[0], count) - && count > 0 ) - { - unsigned char *buffer = new unsigned char[count]; - int readCount = p->Read(buffer, count); - if ( readCount == wxInvalidOffset ) - { - *rval = JSVAL_VOID; - } - else - { - *rval = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, count)); - } - delete[] buffer; - - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * Offset to seek to. - * - * - * - * Seeks the offset. Returns the actual position or -1. - * See also @wxFile#seekEnd. - * - * - */ -JSBool File::seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int offset; - if ( ! FromJS(cx, argv[0], offset) ) - { - return JS_FALSE; - } - - int pos; - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - pos = p->Seek(offset, (wxSeekMode) mode); - } - else - { - return JS_FALSE; - } - } - else - pos = p->Seek(offset); - - *rval = ToJS(cx, pos); - return JS_TRUE; -} - -/*** - * - * - * Offset to seek to. - * - * - * Moves the file pointer to the specified number of bytes before the end of the file. - * Returns the actual position or -1 on error. - *

Remark: Is the same as calling seek(Offset, wxFile.FromEnd) - *
- *
- */ -JSBool File::seekEnd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int offset; - if ( FromJS(cx, argv[0], offset) ) - { - *rval = ToJS(cx, (int) p->SeekEnd(offset)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Writes the string or buffer to the file. A String - * is written in the specified encoding. The default is - * UTF-8 because most files are still written as UTF-8 - * or ASCII. Returns the actual number of bytes written to the file. - * - * - */ -JSBool File::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - *rval = ToJS(cx, p->Write(buffer->GetData(), buffer->GetDataLen())); - return JS_TRUE; - } - } - - wxString encoding(wxJS_EXTERNAL_ENCODING); - if ( argc > 1 ) - { - FromJS(cx, argv[1], encoding); - } - wxCSConv conv(encoding); - - wxString content; - FromJS(cx, argv[0], content); - *rval = ToJS(cx, (int) p->Write(content, conv)); - - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(File) - WXJS_METHOD("access", access, 2) - WXJS_METHOD("exists", exists, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * Filename to check - * File mode - * - * - * This function verifies if we may access the given file in specified mode. - * Only values of @wxFile#read or @wxFile#write really make sense here. - * - * - */ -JSBool File::access(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString filename; - FromJS(cx, argv[0], filename); - - int mode; - - if ( FromJS(cx, argv[1], mode) ) - { - *rval = ToJS(cx, wxFile::Access(filename, (wxFile::OpenMode) mode)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Returns true when the file exists. - * - * - */ -JSBool File::exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString filename; - FromJS(cx, argv[0], filename); - *rval = ToJS(cx, wxFile::Exists(filename)); - return JS_TRUE; -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/file.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/aostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/aostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/aostream.h (nonexistent) @@ -1,45 +0,0 @@ -/* - * wxJavaScript - aostream.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: aostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_aostream_h -#define wxjs_io_aostream_h - -namespace wxjs -{ - namespace io - { - class ArchiveOutputStream : public ApiWrapper - { - public: - - WXJS_DECLARE_METHOD_MAP() - static JSBool closeentry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool putNextDirEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool copyArchiveMetaData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool putNextEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool copyEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_aostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/aostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dir.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dir.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dir.h (nonexistent) @@ -1,84 +0,0 @@ -/* - * wxJavaScript - dir.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: dir.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDir_H -#define _WXJSDir_H - -///////////////////////////////////////////////////////////////////////////// -// Name: dir.h -// Purpose: wxJSDir ports wxDir to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 27.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - - class Dir : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxDir - */ - static bool GetProperty(wxDir *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxDir object is created - */ - static wxDir* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getFirst(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool hasFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool hasSubDirs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool traverse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getAllFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_OPENED, - P_NAME - }; - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSDir_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dir.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/textfile.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/textfile.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/textfile.cpp (nonexistent) @@ -1,615 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - textfile.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: textfile.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/index.h" -#include "../ext/wxjs_ext.h" -#include "textfile.h" -#include "textline.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * textfile - * io - * - * The wxTextFile is a simple class which allows to work with text files on line by line basis. - * It also understands the differences in line termination characters under different platforms - * and will not do anything bad to files with "non native" line termination sequences - in fact, - * it can be also used to modify the text files and change the line termination characters from - * one type (say DOS) to another (say Unix). - *

- * One word of warning: the class is not at all optimized for big files and thus it will load the - * file entirely into memory when opened. Of course, you should not work in this way with large files - * (as an estimation, anything over 1 Megabyte is surely too big for this class). On the other hand, - * it is not a serious limitation for small files like configuration files or program sources which - * are well handled by wxTextFile. - *

- * The typical things you may do with wxTextFile in order are: - *
    - *
  • - * Create and open it: this is done with either @wxTextFile#create or @wxTextFile#open function - * which opens the file (name may be specified either as the argument to these functions or in - * the constructor), reads its contents in memory (in the case of open) and closes it. - *
  • - *
  • - * Work with the lines in the file: this may be done either with "direct access" properties - * like @wxTextFile#lines or with "sequential access" properties which include - * @wxTextFile#firstLine/@wxTextFile#nextLine and also @wxTextFile#lastLine/@wxTextFile#prevLine. - * For the sequential access properties the current line number is maintained: @wxTextFile#currentLine - * and may be changed with @wxTextFile#goToLine. - *
  • - *
  • - * Add/remove lines to the file: @wxTextFile#addLine and @wxTextFile#insertLine add new lines while - * @wxTextFile#removeLine deletes the existing ones. @wxTextFile#clear resets the file to empty. - *
  • - *
  • - * Save your changes: notice that the changes you make to the file will not be saved automatically; - * calling @wxTextFile#close or doing nothing discards them! To save the changes you must explicitly - * call @wxTextFile#write - here, you may also change the line termination type if you wish - *
  • - *
- * Remark :wxJS adds the @wxTextLine class. In wxWidgets, lines can be changed because - * most methods return a reference. This is not possible in JavaScript, but this can be solved by - * returning an object: @wxTextLine. This class can be used to access the lines like they were - * an array and you can change them directly: - *

- *   var file = new wxTextFile("text.txt");
- *   file.line[0] = "This is the first line";
- *  
- *
- */ -WXJS_INIT_CLASS(TextFile, "wxTextFile", 0) - -/*** - * - * - * - * - * - * - * - * - */ - -void TextFile::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxTextFileType[] = - { - WXJS_CONSTANT(wxTextFileType_, None) - WXJS_CONSTANT(wxTextFileType_, Unix) - WXJS_CONSTANT(wxTextFileType_, Dos) - WXJS_CONSTANT(wxTextFileType_, Mac) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxTextFileType", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxTextFileType); -} - -/*** - * - * - * - * The filename - * - * - * Constructs a new wxTextFile object. The file is not loaded - * into memory. Use @wxTextFile#open to do it. - * - * - */ -wxTextFile *TextFile::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - wxString fileName; - - switch(argc) - { - case 1: - { - FromJS(cx, argv[0], fileName); - wxTextFile *file = new wxTextFile(fileName); - return file; - } - case 0: - return new wxTextFile(); - } - return NULL; -} - -/*** - * - * - * Returns the current line: it has meaning only when you're using - * @wxTextFile#firstLine/@wxTextFile#nextLine properties, it doesn't get updated when you're - * using "direct access" property @wxTextFile#lines. @wxTextFile#firstLine and @wxTextFile#lastLine - * also change the value of the current line, as well as @wxTextFile#goToLine. - * - * - * Returns true when end of file is reached. - * When the file is not open, undefined is returned. - * - * - * Get the first line. - * - * - * Guess the type of file (which is supposed to be opened). If sufficiently many lines of the file - * are in DOS/Unix/Mac format, the corresponding value will be returned. If the detection mechanism fails wxTextFileType_None is returned - * - * - * Is the file open? - * - * - * Get the last line - * - * - * Number of lines in the file. - * - * - * Get an array of lines - * - * - * Get the nextline - * - * - * Get the previous line - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextFile) - WXJS_READONLY_PROPERTY(P_CURRENT_LINE, "currentLine") - WXJS_READONLY_PROPERTY(P_EOF, "eof") - WXJS_READONLY_PROPERTY(P_FIRST_LINE, "firstLine") - WXJS_READONLY_PROPERTY(P_LAST_LINE, "lastLine") - WXJS_READONLY_PROPERTY(P_NEXT_LINE, "nextLine") - WXJS_READONLY_PROPERTY(P_PREV_LINE, "prevLine") - WXJS_READONLY_PROPERTY(P_OPENED, "opened") - WXJS_READONLY_PROPERTY(P_LINE_COUNT, "lineCount") - WXJS_READONLY_PROPERTY(P_NAME, "name") - WXJS_READONLY_PROPERTY(P_GUESS_TYPE, "guessType") - WXJS_READONLY_PROPERTY(P_LINES, "lines") -WXJS_END_PROPERTY_MAP() - -bool TextFile::GetProperty(wxTextFile *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_EOF: - *vp = p->IsOpened() ? ToJS(cx, p->Eof()) : JSVAL_VOID; - break; - case P_OPENED: - *vp = ToJS(cx, p->IsOpened()); - break; - case P_LINE_COUNT: - *vp = ToJS(cx, p->GetLineCount()); - break; - case P_CURRENT_LINE: - *vp = ToJS(cx, p->GetCurrentLine()); - break; - case P_FIRST_LINE: - p->GetFirstLine(); - *vp = TextLine::CreateObject(cx, new Index(0), obj); - break; - case P_NEXT_LINE: - if ( ! p->Eof() ) - { - p->GetNextLine(); - *vp = TextLine::CreateObject(cx, new Index(p->GetCurrentLine()), obj); - } - else - { - *vp = JSVAL_VOID; - } - break; - case P_PREV_LINE: - if ( p->GetCurrentLine() == 0 ) - { - *vp = JSVAL_VOID; - } - else - { - p->GetPrevLine(); - *vp = TextLine::CreateObject(cx, new Index(p->GetCurrentLine()), obj); - } - break; - case P_LAST_LINE: - p->GetLastLine(); - *vp = TextLine::CreateObject(cx, new Index(p->GetCurrentLine()), obj); - break; - case P_GUESS_TYPE: - *vp = ToJS(cx, (int) p->GuessType()); - break; - case P_LINES: - *vp = TextLine::CreateObject(cx, new Index(0), obj); - break; - case P_NAME: - *vp = ToJS(cx, wxString(p->GetName())); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(TextFile) - WXJS_METHOD("addLine", addLine, 1) - WXJS_METHOD("close", close, 0) - WXJS_METHOD("clear", clear, 0) - WXJS_METHOD("create", create, 1) - WXJS_METHOD("exists", exists, 0) - WXJS_METHOD("gotoLine", gotoLine, 1) - WXJS_METHOD("open", open, 2) - WXJS_METHOD("insertLine", insertLine, 2) - WXJS_METHOD("removeLine", removeLine, 1) - WXJS_METHOD("write", write, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The line to add - * - * - * - * - * Adds a line to the end of file. When Type is omitted - * the native default is used. - * - * - */ -JSBool TextFile::addLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - wxString line; - FromJS(cx, argv[0], line); - - if ( argc == 1 ) - { - p->AddLine(line); - return JS_TRUE; - } - else - { - int type; - if ( FromJS(cx, argv[1], type) ) - { - p->AddLine(line, (wxTextFileType) type); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * Removes all lines - * - * - */ -JSBool TextFile::clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - p->Clear(); - - return JS_TRUE; -} - -/*** - * - * - * - * Closes the file and frees memory, losing all changes. Use @wxTextFile#write if you want to save them. - * - * - */ -JSBool TextFile::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - *rval = ToJS(cx, p->Close()); - - return JS_TRUE; -} - -/*** - * - * - * - * The name of the file to create. - * - * - * Creates the file with the given name or the name which was given in the constructor. - * The array of file lines is initially empty. - * It will fail if the file already exists, @wxTextFile#open should be used in this case. - * - * - */ -JSBool TextFile::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - if ( argc != 0 ) - { - wxString fileName; - FromJS(cx, argv[0], fileName); - *rval = ToJS(cx, p->Create(fileName)); - return JS_TRUE; - } - - *rval = ToJS(cx, p->Create()); - return JS_TRUE; -} - -/*** - * - * - * - * Return true if file exists - the name of the file should have been specified in the - * constructor before calling exists(). - * - * - */ -JSBool TextFile::exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - *rval = ToJS(cx, p->Exists()); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Changes the value returned by @wxTextFile#currentLine. - * - * - */ -JSBool TextFile::gotoLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - int line; - if ( FromJS(cx, argv[0], line) ) - { - p->GoToLine(line); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * The line to insert (without the end-of-line character(s)). - * The line position - * - * - * - * Insert a line before the line number Pos. - * - * - */ -JSBool TextFile::insertLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - wxString line; - int pos; - - FromJS(cx, argv[0], line); - if ( ! FromJS(cx, argv[1], pos) ) - return JS_FALSE; - - if ( argc > 2 ) - { - int type; - if ( ! FromJS(cx, argv[2], type) ) - return JS_FALSE; - p->InsertLine(line, pos, (wxTextFileType) type); - } - else - { - p->InsertLine(line, pos); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * The name of the file to open - * - * - * Opens the file with the given name or the name which was given in the constructor - * and also loads file in memory on success. It will fail if the file does not exist, - * @wxTextFile#create should be used in this case. When no encoding is specified - * the file is opened in UTF-8. - * - * - */ -JSBool TextFile::open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - if ( p->IsOpened() ) - return JS_TRUE; - - if ( argc == 0 ) - { - *rval = ToJS(cx, p->Open()); - return JS_TRUE; - } - - wxString encoding(wxJS_EXTERNAL_ENCODING); - FromJS(cx, argv[0], encoding); - wxCSConv conv(encoding); - - bool ok = false; - if ( argc > 1 ) - { - wxString fileName; - FromJS(cx, argv[1], fileName); - ok = p->Open(fileName, conv); - } - else - { - ok = p->Open(conv); - } - - if ( ok ) - { - // Convert all lines, because internally we want another encoding - if ( ! encoding.IsSameAs(wxJS_INTERNAL_ENCODING, false) ) - { - wxCSConv internalConv(wxJS_INTERNAL_ENCODING); - for (wxString str = p->GetFirstLine(); !p->Eof(); str = p->GetNextLine() ) - { - str = wxString(str.mb_str(conv), internalConv); - } - p->GoToLine(0); - } - } - - *rval = ToJS(cx, ok); - - return JS_TRUE; -} - -/*** - * - * - * The line to remove. - * - * - * Removes the line from the file - * - * - */ -JSBool TextFile::removeLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFile")); - - int line; - if ( ! FromJS(cx, argv[0], line) ) - { - return JS_FALSE; - } - - p->RemoveLine(line); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Change the file on disk. The Type parameter allows you to change the file format - * (default argument means "don't change type") and may be used to convert, for example, - * DOS files to Unix. - * - * - */ -JSBool TextFile::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextFile")); - - int type = wxTextFileType_None; - if ( argc > 0 ) - { - if ( ! FromJS(cx, argv[0], type) ) - return JS_FALSE; - } - wxString encoding(wxJS_EXTERNAL_ENCODING); - if ( argc > 1 ) - { - FromJS(cx, argv[1], encoding); - } - wxCSConv conv(encoding); - *rval = ToJS(cx, p->Write((wxTextFileType) type, conv)); - - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(TextFile) - WXJS_METHOD("getEOL", getEOL, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Get the line termination string corresponding to given constant. - * typeDefault is the value defined during the compilation and corresponds to the - * native format of the platform, i.e. it will be wxTextFileType.Dos under Windows, - * wxTextFileType.Unix under Unix (including Mac OS X when compiling with the Apple - * Developer Tools) and wxTextFileType.Mac under Mac OS - * (including Mac OS X when compiling with CodeWarrior). - * - * - */ -JSBool TextFile::getEOL(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int type; - if ( ! FromJS(cx, argv[0], type) ) - return JS_FALSE; - - *rval = ToJS(cx, wxString(wxTextFile::GetEOL((wxTextFileType) type))); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/textfile.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffile.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffile.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffile.cpp (nonexistent) @@ -1,468 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ffile.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: ffile.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// file.cpp -#include - -#include "../common/main.h" -#include "../common/apiwrap.h" -#include "../common/type.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" -#include "ffile.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ffile - * io - * - * A wxFFile performs raw file I/O. - * This is a very small class designed to minimize the overhead of using it - - * in fact, there is hardly any overhead at all, but using it brings you - * automatic error checking and hides differences between platforms. - * It wraps inside it a FILE * handle used by standard C IO library (also known as stdio). - *

Remark : - * A FILE* structure can't be used directly in JavaScript. That's why some methods are not - * ported. - *
- */ -WXJS_INIT_CLASS(FFile, "wxFFile", 0) - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(FFile) - WXJS_CONSTANT(wxFILE_, KIND_UNKNOWN) - WXJS_CONSTANT(wxFILE_, KIND_DISK) - WXJS_CONSTANT(wxFILE_, KIND_TERMINAL) - WXJS_CONSTANT(wxFILE_, KIND_PIPE) - WXJS_CONSTANT(wx, FromCurrent) - WXJS_CONSTANT(wx, FromStart) - WXJS_CONSTANT(wx, FromEnd) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * True when end of file is reached. When the file is not open, undefined is returned. - * - * - * Returns the type of the file - * - * - * True when the file is open. - * - * - * Returns the length of the file. When the file is not open, undefined is returned. - * - * - * Returns the current position or -1 (invalid offset). - * When the file is not open, undefined is returned. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FFile) - WXJS_READONLY_PROPERTY(P_EOF, "eof") - WXJS_READONLY_PROPERTY(P_KIND, "kind") - WXJS_READONLY_PROPERTY(P_OPENED, "opened") - WXJS_READONLY_PROPERTY(P_LENGTH, "length") - WXJS_READONLY_PROPERTY(P_TELL, "tell") -WXJS_END_PROPERTY_MAP() - -bool FFile::GetProperty(wxFFile *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_EOF: - if ( p->IsOpened() ) - *vp = ToJS(cx, p->Eof()); - else - *vp = JSVAL_VOID; - break; - case P_KIND: - *vp = ToJS(cx, (int) p->GetKind()); - break; - case P_OPENED: - *vp = ToJS(cx, p->IsOpened()); - break; - case P_LENGTH: - if ( p->IsOpened() ) - *vp = ToJS(cx, (int) p->Length()); - else - *vp = JSVAL_VOID; - break; - case P_TELL: - if ( p->IsOpened() ) - *vp = ToJS(cx, (int) p->Tell()); - else - *vp = JSVAL_VOID; - break; - } - return true; -} - -/*** - * - * - * Filename - * - * The mode in which to open the file - * - * - * - * Creates a new wxFFile object - * - * - */ -wxFFile *FFile::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - if ( argc == 0 ) - return new wxFFile(); - - wxString fileName; - wxString mode = wxT("r"); - if ( argc == 2 ) - FromJS(cx, argv[1], mode); - - FromJS(cx, argv[0], fileName); - - return new wxFFile(fileName, mode); -} - -WXJS_BEGIN_METHOD_MAP(FFile) - WXJS_METHOD("close", close, 0) - WXJS_METHOD("flush", flush, 0) - WXJS_METHOD("open", open, 2) - WXJS_METHOD("read", read, 1) - WXJS_METHOD("readAll", readAll, 0) - WXJS_METHOD("seek", seek, 2) - WXJS_METHOD("seekEnd", seekEnd, 1) - WXJS_METHOD("write", write, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Closes the file. - * - * - */ -JSBool FFile::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( p->IsOpened() ) - *rval = ToJS(cx, p->Close()); - else - *rval = JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * Flushes the file. - * - * - */ -JSBool FFile::flush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( p->IsOpened() ) - *rval = ToJS(cx, p->Flush()); - else - *rval = JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * Name of the file - * The mode in which to open the file - * - * - * Opens a file. - * - * - */ -JSBool FFile::open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString fileName; - wxString mode = wxT("r"); - if ( argc == 2 ) - FromJS(cx, argv[1], mode); - - FromJS(cx, argv[0], fileName); - - *rval = ToJS(cx, p->Open(fileName, mode)); - return JS_TRUE; -} - -/*** - * - * - * The number of bytes to read. - * - * - * Reads the specified number of bytes. - * - * - */ -JSBool FFile::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - int count; - if ( FromJS(cx, argv[0], count) - && count > 0 ) - { - unsigned char *buffer = new unsigned char[count]; - int readCount = p->Read(buffer, count); - if ( readCount == wxInvalidOffset ) - { - *rval = JSVAL_VOID; - } - else - { - *rval = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, count)); - } - delete[] buffer; - - - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The encoding of the file. - * - * - * - * Reads all the data and return it in a String. Internally JavaScript - * stores the Strings as UTF-16. But because most files are stored - * in UTF-8 or ASCII, the default of the encoding is UTF-8. - * - * - */ -JSBool FFile::readAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - wxString encoding(wxJS_EXTERNAL_ENCODING); - if ( argc > 0 ) - { - FromJS(cx, argv[0], encoding); - } - wxCSConv conv(encoding); - - wxString data; - if ( p->ReadAll(&data, conv) ) - { - *rval = ToJS(cx, data); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * Offset to seek to - * - * - * - * Seeks the offset. Returns the actual position or -1 on error. - * - * - */ -JSBool FFile::seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int offset; - if ( ! FromJS(cx, argv[0], offset) ) - { - return JS_FALSE; - } - - int pos; - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - pos = p->Seek((wxFileOffset) offset, (wxSeekMode) mode); - } - else - { - return JS_FALSE; - } - } - else - { - pos = p->Seek((wxFileOffset) offset); - } - *rval = ToJS(cx, pos); - return JS_TRUE; -} - -/*** - * - * - * Offset to seek to. - * - * - * Moves the file pointer to the specified number of bytes before the end of the file. - * Returns true on success. - * - * - */ -JSBool FFile::seekEnd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int offset; - if ( FromJS(cx, argv[0], offset) ) - { - *rval = ToJS(cx, p->SeekEnd((wxFileOffset) offset)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Writes the string or buffer to the file. When you write - * a String you can specify an encoding. Because most files - * are still written as UTF-8 or ASCII, UTF-8 is the default - * (wxJS uses UTF-16 internally). - * Returns the actual number of bytes written to the file when - * a buffer is used. Otherwise a boolean indicating - * success or failure is returned. - * - * - */ -JSBool FFile::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxFFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - *rval = ToJS(cx, p->Write(buffer->GetData(), buffer->GetDataLen())); - } - } - else - { - wxString encoding(wxJS_EXTERNAL_ENCODING); - if ( argc > 1 ) - { - FromJS(cx, argv[1], encoding); - } - wxCSConv conv(encoding); - wxString content; - FromJS(cx, argv[0], content); - *rval = ToJS(cx, (int) p->Write(content, conv)); - } - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffile.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/mistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/mistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/mistream.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - mistream.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: mistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMemoryInputStream_H -#define _WXJSMemoryInputStream_H - -///////////////////////////////////////////////////////////////////////////// -// Name: .h -// Purpose: Ports the memory streams -// wxJSMemoryInputStream ports wxMemoryInputStream to JavaScript -// wxJSMemoryOutputStream ports wxMemoryOutputStream to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 22-10-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class MemoryInputStream : public wxMemoryInputStream - , public ApiWrapper - , public Object - { - public: - MemoryInputStream(JSContext *cx, JSObject *obj, char *data, size_t len); - virtual ~MemoryInputStream(); - - /** - * Callback for when a wxMemoryInputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - private: - char *m_data; - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSMemoryInputStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/mistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tistream.cpp (nonexistent) @@ -1,288 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - tistream.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: tistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "istream.h" -#include "tistream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * tistream - * io - * - * This class provides functions that read text datas using an input stream. - * So, you can read text, floats and integers. wxTextInputStream correctly reads - * text files (or streams) in DOS, Macintosh and Unix formats and reports a - * single newline char as a line ending. - *

The following example uses a @wxMemoryInputStream and makes an array which - * contains all words of the given string. - * - *

- *  var m = new wxMemoryInputStream("This is a test");
- *  var t = new wxTextInputStream(m);
- *  var words = new Array();
- *  for(var i = 0; ! m.eof; i++)
- *  {
- *    words[i] = t.readWord();
- *  }
- *  
- *
- */ -WXJS_INIT_CLASS(TextInputStream, "wxTextInputStream", 1) - -TextInputStream::TextInputStream(wxInputStream &stream, - const wxString &sep, - wxMBConv& conv) : wxTextInputStream(stream, sep, conv) -{ -} - -/*** - * - * - * An input stream - * The initial string separator - * The encoding used to convert bytes - * - * - * Constructs a new wxTextInputStream object. - * - * - */ -TextInputStream* TextInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 3 ) - argc = 3; - - wxString encoding(wxJS_EXTERNAL_ENCODING); - wxString sep = wxT("\t"); - switch(argc) - { - case 3: - FromJS(cx, argv[2], encoding); - // Fall through - case 2: - FromJS(cx, argv[1], sep); - // Fall through - default: - { - wxCSConv conv(encoding); - Stream *in = InputStream::GetPrivate(cx, argv[0]); - if ( in == NULL ) - return NULL; - - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, 0); - - return new TextInputStream(*(wxInputStream *) in->GetStream(), sep, conv); - } - } - - return NULL; -} - -/*** - * - * - * Gets/Sets the characters which are used to define the word boundaries in - * See @wxTextInputStream#readWord. The default separators are the space and TAB characters. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextInputStream) - WXJS_PROPERTY(P_STRING_SEPARATORS, "stringSeparators") -WXJS_END_PROPERTY_MAP() - -bool TextInputStream::GetProperty(TextInputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_STRING_SEPARATORS ) - { - *vp = ToJS(cx, p->GetStringSeparators()); - } - return true; -} - -bool TextInputStream::SetProperty(TextInputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_STRING_SEPARATORS ) - { - wxString sep; - FromJS(cx, *vp, sep); - p->SetStringSeparators(sep); - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(TextInputStream) - WXJS_METHOD("read32", read32, 0) - WXJS_METHOD("read16", read16, 0) - WXJS_METHOD("read8", read8, 0) - WXJS_METHOD("readLine", readLine, 0) - WXJS_METHOD("readDouble", readDouble, 0) - WXJS_METHOD("readWord", readWord, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Reads a 32 bit integer from the stream. - * - * - */ -JSBool TextInputStream::read32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint32 value = p->Read32(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a 16 bit integer from the stream. - * - * - */ -JSBool TextInputStream::read16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint16 value = p->Read16(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a 8 bit integer from the stream. - * - * - */ -JSBool TextInputStream::read8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxUint8 value = p->Read8(); - -// Check this for other platforms! -#ifdef __WXMSW__ - *rval = ToJS(cx, (int) value); -#else - *rval = ToJS(cx, (int) value); -#endif - - return JS_TRUE; -} - -/*** - * - * - * - * Reads a double (IEEE encoded) from a stream. - * - * - */ -JSBool TextInputStream::readDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReadDouble()); - - return JS_TRUE; -} - -/*** - * - * - * - * Reads from the input stream until an end-of-line character is read. - * The end-of-line character is not returned. - * - * - */ -JSBool TextInputStream::readLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - TextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReadLine()); - return JS_TRUE; -} - -/*** - * - * - * - * Reads a word (a sequence of characters until the next separator) from the input stream. - * See @wxTextInputStream#stringSeparators. - * - * - */ -JSBool TextInputStream::readWord(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextInputStream *p = TextInputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReadWord()); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/socksrv.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/socksrv.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/socksrv.cpp (nonexistent) @@ -1,223 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - socksrv.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: socksrv.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/jsutil.h" -#include "sockbase.h" -#include "sockaddr.h" -#include "socksrv.h" -#include "sockevth.h" - -using namespace wxjs; -using namespace wxjs::io; - -SocketServer::SocketServer(JSContext *cx - , JSObject *obj - , wxSockAddress &address - , wxSocketFlags flags) : wxSocketServer(address, flags) -{ - m_evtHandler = new SocketEventHandler(cx, obj); - SetEventHandler(*m_evtHandler, -1); -} - -SocketServer::~SocketServer() -{ - delete m_evtHandler; -} - -/*** - * socksrv - * io - * - * This class implements server sockets. A server socket waits for requests - * to come in over the network. - * - */ -WXJS_INIT_CLASS(SocketServer, "wxSocketServer", 1) - -/*** - * - * - * - * - * - * - * Constructs a new wxSocketServer. - * - * - */ -wxSocketServer *SocketServer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int flags = wxSOCKET_NONE; - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[0], flags) ) - { - return NULL; - } - } - - wxSockAddress *address = SockAddress::GetPrivate(cx, argv[0]); - if ( address != NULL ) - { - return new SocketServer(cx, obj, *address, flags); - } - return NULL; -} - -void SocketServer::Destruct(JSContext *cx, wxSocketServer *p) -{ - p->Destroy(); -} - -WXJS_BEGIN_METHOD_MAP(SocketServer) - WXJS_METHOD("accept", accept, 0) - WXJS_METHOD("acceptWith", acceptWith, 1) - WXJS_METHOD("waitForAccept", waitForAccept, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * If wait is true and there are no pending connections to be accepted, - * it will wait for the next incoming connection to arrive. - * - * - * Accepts an incoming connection request, and creates a new @wxSocketBase object - * which represents the server-side of the connection. - * Returns an opened socket connection, or NULL if an error occurred or if the - * wait parameter was false and there were no pending connections. - * - * - */ -JSBool SocketServer::accept(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSocketServer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool wait = true; - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], wait) ) - return JS_FALSE; - } - - wxSocketBase *client = p->Accept(wait); - if ( client == NULL ) - { - *rval = JSVAL_VOID; - } - else - { - *rval = SocketBase::CreateObject(cx, new SocketBasePrivate(client)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * If wait is true and there are no pending connections to be accepted, - * it will wait for the next incoming connection to arrive. - * - * - * Accept an incoming connection using the specified socket object. - * - * - */ -JSBool SocketServer::acceptWith(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSocketServer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - SocketBasePrivate *base = SocketBase::GetPrivate(cx, argv[0]); - if ( ! base ) - { - return JS_FALSE; - } - - bool wait = true; - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], wait) ) - return JS_FALSE; - } - - *rval = ToJS(cx, p->AcceptWith(*base->GetBase(), wait)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * This function waits for an incoming connection. Use it if you want to call - * accept or acceptWith with wait set to false, to detect when an incoming connection - * is waiting to be accepted. - * Returns true if an incoming connection arrived, false if the timeout elapsed. - * - * - */ -JSBool SocketServer::waitForAccept(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSocketServer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - *rval = ToJS(cx, p->WaitForAccept(secs, ms)); - } - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/socksrv.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/textline.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/textline.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/textline.cpp (nonexistent) @@ -1,268 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - textline.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: textline.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/index.h" -#include "textline.h" -#include "textfile.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * textline - * io - * - * wxTextLine is a helper class. It doesn't exist in wxWidgets, - * but wxJS needs it, so you can access lines in @wxTextFile as - * an array: - *

- *   var i;
- *   for(i = 0; i < file.lineCount; i++)
- *   {
- *     file.lines[i].content = ...
- *   }
- *   
- * or as: - *

- *   for each(line in textfile.lines)
- *   {
- *      line.content = ...
- *   }
- *
- */ -WXJS_INIT_CLASS(TextLine, "wxTextLine", 0) - -bool TextLine::Resolve(JSContext *cx, JSObject *obj, jsval id) -{ - if ( JSVAL_IS_INT(id) - && JSVAL_TO_INT(id) >= 0 ) - { - return JS_DefineElement(cx, obj, JSVAL_TO_INT(id), INT_TO_JSVAL(0), NULL, NULL, 0) == JS_TRUE; - } - return true; -} - -/*** - * - * - * Get/Set the content of the line.

- * Remark: When you access this object as an array of @wxTextFile - * you don't need this property. You can write: - * - * textfile.lines[1] = 'Text'; - *
- * - * Get the type of the line - * - *
- */ -WXJS_BEGIN_PROPERTY_MAP(TextLine) - WXJS_READONLY_PROPERTY(P_LINE_TYPE, "lineType") - WXJS_PROPERTY(P_CONTENT, "content") -WXJS_END_PROPERTY_MAP() - -bool TextLine::GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for TextLine")); - - wxTextFile *file = TextFile::GetPrivate(cx, parent); - if ( file == NULL ) - return false; - - if ( id >= 0 && id < file->GetLineCount() ) - { - p->SetIndex(id); - *vp = OBJECT_TO_JSVAL(obj); //ToJS(cx, file->GetLine(id)); - } - else - { - switch(id) - { - case P_LINE_TYPE: - *vp = ToJS(cx, (int) file->GetLineType(p->GetIndex())); - break; - case P_CONTENT: - *vp = ToJS(cx, file->GetLine(p->GetIndex())); - break; - default: - *vp = JSVAL_VOID; - } - } - - return true; -} - -bool TextLine::SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for TextLine")); - - wxTextFile *file = TextFile::GetPrivate(cx, parent); - if ( file == NULL ) - return false; - - if ( id >= 0 && id < file->GetLineCount() ) - { - p->SetIndex(id); - wxString content; - FromJS(cx, *vp, content); - file->GetLine(id) = content; - } - else - { - if ( id == P_CONTENT ) - { - wxString content; - FromJS(cx, *vp, content); - file->GetLine(p->GetIndex()) = content; - } - } - return true; -} - -bool TextLine::Enumerate(Index *p, JSContext *cx, JSObject *obj, JSIterateOp enum_op, jsval *statep, jsid *idp) -{ - JSObject *parent = JS_GetParent(cx, obj); - if ( parent == NULL ) - { - *statep = JSVAL_NULL; - if (idp) - *idp = INT_TO_JSVAL(0); - return true; - } - - wxTextFile *file = TextFile::GetPrivate(cx, parent); - if ( file == NULL ) - { - *statep = JSVAL_NULL; - if (idp) - *idp = INT_TO_JSVAL(0); - return true; - } - - bool ok = true; - - switch(enum_op) - { - case JSENUMERATE_INIT: - *statep = ToJS(cx, 0); - if ( idp ) - *idp = INT_TO_JSVAL(file->GetLineCount()); - break; - case JSENUMERATE_NEXT: - { - int pos; - FromJS(cx, *statep, pos); - if ( pos < file->GetLineCount() ) - { - JS_ValueToId(cx, ToJS(cx, pos), idp); - *statep = ToJS(cx, ++pos); - break; - } - // Fall through - } - case JSENUMERATE_DESTROY: - *statep = JSVAL_NULL; - break; - default: - ok = false; - } - return ok; -} - -WXJS_BEGIN_METHOD_MAP(TextLine) - WXJS_METHOD("insert", insertLine, 1) - WXJS_METHOD("remove", removeLine, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The line to insert (without the end-of-line character(s)). - * - * - * - * Insert a line before this line. - * - * - */ -JSBool TextLine::insertLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Index *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextLine")); - - JSObject *objParent = JS_GetParent(cx, obj); - if ( objParent == NULL ) - return JS_FALSE; - - wxTextFile *file = TextFile::GetPrivate(cx, objParent); - - wxString line; - FromJS(cx, argv[0], line); - - if ( argc > 1 ) - { - int type; - if ( ! FromJS(cx, argv[1], type) ) - return JS_FALSE; - file->InsertLine(line, p->GetIndex(), (wxTextFileType) type); - } - else - { - file->InsertLine(line, p->GetIndex()); - } - return JS_TRUE; -} - -/*** - * - * - * - * Removes this line from the file - * - * - */ -JSBool TextLine::removeLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Index *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTextLine")); - - JSObject *objParent = JS_GetParent(cx, obj); - if ( objParent == NULL ) - return JS_FALSE; - - wxTextFile *file = TextFile::GetPrivate(cx, objParent); - - file->RemoveLine(p->GetIndex()); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/textline.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/mostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/mostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/mostream.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - mostream.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: mostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMemoryOutputStream_H -#define _WXJSMemoryOutputStream_H - -#include - -namespace wxjs -{ - namespace io - { - class MemoryOutputStream : public wxMemoryOutputStream - , public ApiWrapper - , public Object - { - public: - - MemoryOutputStream(JSContext *cx, JSObject *obj, char *data, size_t len); - virtual ~MemoryOutputStream(); - /** - * Callback for when a wxMemoryOutputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_DATA - }; - - private: - char *m_data; - }; - }; // namespace io -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/io/mostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tostream.cpp (nonexistent) @@ -1,303 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - tostream.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: tostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "stream.h" -#include "ostream.h" -#include "tostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * tostream - * io - * - * This class provides functions that write text datas using an output stream. - * So, you can write text, floats and integers. - * - * An example: - *

- *   textout.writeString("The value of x:");
- *   textout.write32(x);
- *  
- * This example can also be written as follows: - * - * textout.writeString("The value of x:" + x); - *
- */ -WXJS_INIT_CLASS(TextOutputStream, "wxTextOutputStream", 1) - -/*** - * - * - * - * - * - * - * - * - * wxEol is ported as a separate JavaScript object. - * - * - */ -void TextOutputStream::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxEolMap[] = - { - WXJS_CONSTANT(wxEOL_, NATIVE) - WXJS_CONSTANT(wxEOL_, UNIX) - WXJS_CONSTANT(wxEOL_, MAC) - WXJS_CONSTANT(wxEOL_, DOS) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxEol", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxEolMap); -} - -/*** - * - * - * An output stream - * The end-of-line mode - * The encoding to use - * - * - * Constructs a new wxTextOutputStream object. - * - * - */ -wxTextOutputStream* TextOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 3 ) - argc = 3; - - wxString encoding(wxJS_EXTERNAL_ENCODING); - int mode = wxEOL_NATIVE; - switch(argc) - { - case 3: - FromJS(cx, argv[2], encoding); - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], mode) ) - return NULL; - // Fall through - default: - Stream *out = OutputStream::GetPrivate(cx, argv[0]); - if ( out == NULL ) - return NULL; - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - wxCSConv conv(encoding); - return new wxTextOutputStream(*(wxOutputStream *) out->GetStream(), (wxEOL) mode, conv); - } -} - -/*** - * - * - * Gets/Sets the end-of-line mode. See @wxTextOutputStream#wxEol. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextOutputStream) - WXJS_PROPERTY(P_MODE, "mode") -WXJS_END_PROPERTY_MAP() - -bool TextOutputStream::GetProperty(wxTextOutputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_MODE ) - { - *vp = ToJS(cx, (int) p->GetMode()); - } - return true; -} - -bool TextOutputStream::SetProperty(wxTextOutputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_MODE ) - { - int mode; - if ( FromJS(cx, *vp, mode) ) - { - p->SetMode((wxEOL) mode); - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(TextOutputStream) - WXJS_METHOD("write32", write32, 1) - WXJS_METHOD("write16", write16, 1) - WXJS_METHOD("write8", write8, 1) - WXJS_METHOD("writeString", writeString, 1) - WXJS_METHOD("writeDouble", writeDouble, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Writes a 32 bit integer to the stream. - * - * - */ -JSBool TextOutputStream::write32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write32(value); - return JS_TRUE; - } -#endif - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 16 bit integer to the stream. - * - * - */ -JSBool TextOutputStream::write16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// TODO: Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write16(value); - return JS_TRUE; - } -#endif - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a 8 bit integer to the stream. - * - * - */ -JSBool TextOutputStream::write8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -// TODO: Check for other platforms !!! -#ifdef __WXMSW__ - int value; - if ( FromJS(cx, argv[0], value) ) - { - p->Write8(value); - return JS_TRUE; - } -#endif - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes a double (IEEE encoded) to a stream. - * - * - */ -JSBool TextOutputStream::writeDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - double value; - if ( FromJS(cx, argv[0], value) ) - { - p->WriteDouble(value); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Writes string as a line. Depending on the end-of-line mode the end of line - * ('\n') characters in the string are converted to the correct line - * ending terminator. - * - * - */ -JSBool TextOutputStream::writeString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextOutputStream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString value; - FromJS(cx, argv[0], value); - p->WriteString(value); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/constant.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/constant.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/constant.h (nonexistent) @@ -1,31 +0,0 @@ -/* - * wxJavaScript - constant.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: constant.h 598 2007-03-07 20:13:28Z fbraem $ - */ -namespace wxjs -{ - namespace io - { - void InitConstants(JSContext *cx, JSObject *obj); - }; // namespace io -}; // namespace wxjs Property changes on: ps/trunk/source/tools/atlas/wxJS/io/constant.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/uri.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/uri.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/uri.cpp (nonexistent) @@ -1,339 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - uri.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: uri.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "uri.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * uri - * io - * - * wxURI is used to extract information from a URI (Uniform Resource Identifier). - * - */ -WXJS_INIT_CLASS(URI, "wxURI", 1) - -/*** - * - * - * Server is a host name, or the Server component itself is undefined. - * Server is a IP version 4 address (XXX.XXX.XXX.XXX) - * Server is a IP version 6 address ((XXX:)XXX::(XXX)XXX:XXX - * Server is an IP address, but not versions 4 or 6 - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(URI) - WXJS_CONSTANT(wxURI_, REGNAME) - WXJS_CONSTANT(wxURI_, IPV4ADDRESS) - WXJS_CONSTANT(wxURI_, IPV6ADDRESS) - WXJS_CONSTANT(wxURI_, IPVFUTURE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * - * - * Creates a new wxURI object - * - * - */ -wxURI *URI::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - wxString uri; - FromJS(cx, argv[0], uri); - return new wxURI(uri); -} - -/*** - * - * - * The fragment of a URI is the last value of the URI. - * - * - * Obtains the host type of this URI, which is of type @wxURI#HostType. - * - * - * Returns the password part of the userinfo component of this URI. - * Note that this is explicitly depreciated by RFC 1396 and should generally be avoided if possible. - * - * - * Returns the (normalized) path of the URI. - * - * - * Returns a string representation of the URI's port. - * - * - * Returns the Query component of the URI. - * - * - * Returns the Scheme component of the URI. - * - * - * Returns the Server component of the URI. - * - * - * Returns the username component of the URI. - * - * - * Returns the userinfo component of the URI. - * - * - * Returns true if the path component of the URI exists. - * - * - * Returns true if the port component of the URI exists. - * - * - * Returns true if the query component of the URI exists. - * - * - * Returns true if the scheme component of the URI exists. - * - * - * Returns true if the server component of the URI exists. - * - * - * Returns true if the user component of the URI exists. - * - * - * Returns true if a valid [absolute] URI, otherwise this URI - * is a URI reference and not a full URI, and IsReference returns false. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(URI) - WXJS_READONLY_PROPERTY(P_FRAGMENT, "fragment") - WXJS_READONLY_PROPERTY(P_HOST_TYPE, "hostType") - WXJS_READONLY_PROPERTY(P_PASSWORD, "password") - WXJS_READONLY_PROPERTY(P_PATH, "path") - WXJS_READONLY_PROPERTY(P_PORT, "port") - WXJS_READONLY_PROPERTY(P_QUERY, "query") - WXJS_READONLY_PROPERTY(P_SCHEME, "scheme") - WXJS_READONLY_PROPERTY(P_SERVER, "server") - WXJS_READONLY_PROPERTY(P_USER, "user") - WXJS_READONLY_PROPERTY(P_USERINFO, "userInfo") - WXJS_READONLY_PROPERTY(P_HAS_PATH, "hasPath") - WXJS_READONLY_PROPERTY(P_HAS_PORT, "hasPort") - WXJS_READONLY_PROPERTY(P_HAS_QUERY, "hasQuery") - WXJS_READONLY_PROPERTY(P_HAS_SCHEME, "hasScheme") - WXJS_READONLY_PROPERTY(P_HAS_SERVER, "hasServer") - WXJS_READONLY_PROPERTY(P_HAS_USER, "hasUser") - WXJS_READONLY_PROPERTY(P_IS_REFERENCE, "isReference") -WXJS_END_PROPERTY_MAP() - -bool URI::GetProperty(wxURI *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_FRAGMENT: - *vp = ToJS(cx, p->GetFragment()); - break; - case P_HOST_TYPE: - *vp = ToJS(cx, p->GetHostType()); - break; - case P_PASSWORD: - *vp = ToJS(cx, p->GetPassword()); - break; - case P_PATH: - *vp = ToJS(cx, p->GetPath()); - break; - case P_PORT: - *vp = ToJS(cx, p->GetPort()); - break; - case P_QUERY: - *vp = ToJS(cx, p->GetQuery()); - break; - case P_SCHEME: - *vp = ToJS(cx, p->GetScheme()); - break; - case P_USER: - *vp = ToJS(cx, p->GetUser()); - break; - case P_USERINFO: - *vp = ToJS(cx, p->GetUserInfo()); - break; - case P_HAS_PATH: - *vp = ToJS(cx, p->HasPath()); - break; - case P_HAS_PORT: - *vp = ToJS(cx, p->HasPort()); - break; - case P_HAS_QUERY: - *vp = ToJS(cx, p->HasQuery()); - break; - case P_HAS_SCHEME: - *vp = ToJS(cx, p->HasScheme()); - break; - case P_HAS_USER: - *vp = ToJS(cx, p->HasUserInfo()); - break; - case P_IS_REFERENCE: - *vp = ToJS(cx, p->IsReference()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(URI) - WXJS_METHOD("buildURI", buildURI, 0) - WXJS_METHOD("buildUnescapedURI", buildUnescapedURI, 0) - WXJS_METHOD("create", create, 1) - WXJS_METHOD("resolve", resolve, 2) - WXJS_METHOD("unescape", unescape, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Builds the URI from its individual components and adds proper separators. - * - * - */ -JSBool URI::buildURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURI *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->BuildURI()); - return JS_TRUE; -} - -/*** - * - * - * - * Builds the URI from its individual components, - * adds proper separators, and returns escape sequences to normal characters. - * - * - */ -JSBool URI::buildUnescapedURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURI *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->BuildUnescapedURI()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Creates this URI from the string uri - * - * - */ -JSBool URI::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURI *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString uri; - FromJS(cx, argv[0], uri); - p->Create(uri); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Inherits this URI from a base URI - components that do not exist in this URI are - * copied from the base, and if this URI's path is not an absolute path (prefixed by a '/'), - * then this URI's path is merged with the base's path. - *

- * For instance, resolving "../mydir" from "http://mysite.com/john/doe" results in the scheme - * (http) and server (mysite.com) being copied into this URI, since they do not exist. - * In addition, since the path of this URI is not absolute (does not begin with '/'), - * the path of the base's is merged with this URI's path, resulting in the - * URI "http://mysite.com/john/mydir". - *
- *
- */ -JSBool URI::resolve(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURI *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxURI *uri = GetPrivate(cx, argv[0]); - if ( uri == NULL ) - return JS_FALSE; - - bool strict = true; - if ( argc > 1 - && !FromJS(cx, argv[1], strict) ) - { - return JS_FALSE; - } - - p->Resolve(*uri, strict ? wxURI_STRICT : 0); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Translates all escape sequences (normal characters and returns the result - * - * - */ -JSBool URI::unescape(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURI *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString uri; - FromJS(cx, argv[0], uri); - *rval = ToJS(cx, p->Unescape(uri)); - return JS_TRUE; -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/uri.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/url.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/url.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/url.cpp (nonexistent) @@ -1,187 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - url.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: url.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "jsstream.h" -#include "istream.h" -#include "url.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * url - * io - * - * Parses URLs. - * - */ -WXJS_INIT_CLASS(URL, "wxURL", 1) - -/*** - * - * - * No error. - * Syntax error in the URL string. - * Found no protocol which can get this URL. - * An host name is required for this protocol. - * A path is required for this protocol. - * Connection error. - * An error occurred during negotiation. - * - * wxURLError is ported to JavaScript as a separate class. Note that this - * class doesn't exist in wxWidgets. - * - * - * - */ -void URL::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxURLErrorMap[] = - { - WXJS_CONSTANT(wxURL_, NOERR) - WXJS_CONSTANT(wxURL_, SNTXERR) - WXJS_CONSTANT(wxURL_, NOPROTO) - WXJS_CONSTANT(wxURL_, NOHOST) - WXJS_CONSTANT(wxURL_, NOPATH) - WXJS_CONSTANT(wxURL_, CONNERR) - WXJS_CONSTANT(wxURL_, PROTOERR) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxURLError", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxURLErrorMap); -} - -/*** - * - * - * - * - * - * Constructs a URL object from the string. The URL must be valid according to RFC 1738. - * In particular, file URLs must be of the format 'file://hostname/path/to/file'. It is valid - * to leave out the hostname but slashes must remain in place-- i.e. a file URL without a - * hostname must contain three consecutive slashes. - * - * - */ -wxURL *URL::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - wxString url; - FromJS(cx, argv[0], url); - return new wxURL(url); -} - -/*** - * - * - * Returns the last occurred error. See @wxURL#wxURLError. - * - * - * Creates a new input stream on the specified URL. You can use all but - * seek functionality of a stream. Seek isn't available on all streams. - * For example, http or ftp streams doesn't deal with it. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(URL) - WXJS_READONLY_PROPERTY(P_ERROR, "error") - WXJS_READONLY_PROPERTY(P_INPUT_STREAM, "inputStream") -WXJS_END_PROPERTY_MAP() - -bool URL::GetProperty(wxURL *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ERROR: - *vp = ToJS(cx, p->GetError()); - break; - case P_INPUT_STREAM: - { - wxInputStream *stream = p->GetInputStream(); - *vp = InputStream::CreateObject(cx, new Stream(stream), NULL); - break; - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(URL) - WXJS_METHOD("setProxy", setProxy, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Sets the proxy to use for this URL. - * - * - */ -JSBool URL::setProxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxURL *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString proxy; - FromJS(cx, argv[0], proxy); - p->SetProxy(proxy); - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(URL) - WXJS_METHOD("setDefaultProxy", setDefaultProxy, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Sets the default proxy server to use to get the URL. - * The string specifies the proxy like this: <hostname>:<port number>. - * - * - */ -JSBool URL::setDefaultProxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString proxy; - FromJS(cx, argv[0], proxy); - wxURL::SetDefaultProxy(proxy); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/url.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ipaddr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ipaddr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ipaddr.cpp (nonexistent) @@ -1,156 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ipaddr.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: ipaddr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "ipaddr.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ipaddr - * io - * - * wxIPaddress is an prototype class for all internet protocol address objects. - * Currently, only @wxIPV4address is implemented. - * - */ -WXJS_INIT_CLASS(IPaddress, "wxIPaddress", 0) - -/*** - * - * - * Get/Set the hostname. - * - * - * Returns a string containing the IP address. - * - * - * Returns true when the hostname is localhost. - * - * - * Get/Set the current service. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(IPaddress) - WXJS_PROPERTY(P_HOSTNAME, "hostname") - WXJS_READONLY_PROPERTY(P_IPADDRESS, "IPAddress") - WXJS_READONLY_PROPERTY(P_LOCALHOST, "localhost") - WXJS_PROPERTY(P_SERVICE, "service") -WXJS_END_PROPERTY_MAP() - -bool IPaddress::GetProperty(wxIPaddress *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_HOSTNAME: - *vp = ToJS(cx, p->Hostname()); - break; - case P_IPADDRESS: - *vp = ToJS(cx, p->IPAddress()); - break; - case P_LOCALHOST: - *vp = ToJS(cx, p->IsLocalHost()); - break; - case P_SERVICE: - *vp = ToJS(cx, p->Service()); - break; - default: - *vp = JSVAL_VOID; - } - return true; -} - -bool IPaddress::SetProperty(wxIPaddress *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_HOSTNAME: - { - wxString hostname; - FromJS(cx, *vp, hostname); - p->Hostname(hostname); - break; - } - case P_SERVICE: - { - int service; - if ( FromJS(cx, *vp, service) ) - p->Service(service); - break; - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(IPaddress) - WXJS_METHOD("anyAddress", anyAddress, 0) - WXJS_METHOD("localhost", localhost, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Internally, this is the same as setting the IP address to INADDR_ANY. - * Returns true on success, false if something went wrong. - * - * - */ -JSBool IPaddress::anyAddress(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxIPaddress *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxIPaddress")); - - *rval = ToJS(cx, p->AnyAddress()); - - return JS_TRUE; -} - -/*** - * - * - * - * Set the address to localhost. - * Returns true on success, false if something went wrong. - * - * - */ -JSBool IPaddress::localhost(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxIPaddress *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxIPaddress")); - - *rval = ToJS(cx, p->LocalHost()); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ipaddr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tempfile.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tempfile.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tempfile.cpp (nonexistent) @@ -1,303 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - tempfile.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: tempfile.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" -#include "tempfile.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * tempfile - * io - * - * wxTempFile provides a relatively safe way to replace the contents of the existing file. - * The name is explained by the fact that it may be also used as just a temporary file if - * you don't replace the old file contents. - *

- * Usually, when a program replaces the contents of some file it first opens it for writing, - * thus losing all of the old data and then starts recreating it. This approach is not very safe - * because during the regeneration of the file bad things may happen: the program may find that - * there is an internal error preventing it from completing file generation, the user may interrupt - * it (especially if file generation takes long time) and, finally, any other external interrupts - * (power supply failure or a disk error) will leave you without either the original file or the new one. - *

- * wxTempFile addresses this problem by creating a temporary file which is meant to replace the original file - * - but only after it is fully written. So, if the user interrupts the program during the file generation, - * the old file won't be lost. Also, if the program discovers itself that it doesn't want to replace the - * old file there is no problem - in fact, wxTempFile will not replace the old file by default, you should - * explicitly call @wxTempFile#commit to do it. Calling @wxTempFile#discard explicitly discards any modifications: - * it closes and deletes the temporary file and leaves the original file unchanged. If you don't call - * neither of @wxTempFile#commit and @wxTempFile#discard, the destructor will call @wxTempFile#discard - * automatically. - *

- * To summarize: if you want to replace another file, create an instance of wxTempFile passing - * the name of the file to be replaced to the constructor (you may also use default constructor - * and pass the file name to @wxTempFile#open). Then you can write to wxTempFile using wxFile-like - * functions and later call @wxTempFile#commit to replace the old file (and close this one) - * or call @wxTempFile#discard to cancel the modifications. - *
- */ -WXJS_INIT_CLASS(TempFile, "wxTempFile", 0) - -/*** - * - * - * Returns true when the file is open. - * - * - * Returns the length of the file. - * When the file is not open, undefined is returned. - * - * - * Returns the current position or -1. - * When the file is not open, undefined is returned. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TempFile) - WXJS_READONLY_PROPERTY(P_OPENED, "opened") - WXJS_READONLY_PROPERTY(P_LENGTH, "length") - WXJS_READONLY_PROPERTY(P_TELL, "tell") -WXJS_END_PROPERTY_MAP() - -bool TempFile::GetProperty(wxTempFile *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_OPENED: - *vp = ToJS(cx, p->IsOpened()); - break; - case P_LENGTH: - *vp = p->IsOpened() ? ToJS(cx, (long) p->Length()) : JSVAL_VOID; - break; - case P_TELL: - *vp = p->IsOpened() ? ToJS(cx, (long) p->Tell()) : JSVAL_VOID; - break; - } - return true; -} - -/*** - * - * - * - * The filename - * - * - * Constructs a new wxTempFile object. When a filename is passed, - * The file is opened, and you can check whether the operation -* was successful or not by checking @wxTempFile#opened. - * - * - */ -wxTempFile *TempFile::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - wxString fileName; - - switch(argc) - { - case 1: - FromJS(cx, argv[0], fileName); - return new wxTempFile(fileName); - break; - case 0: - return new wxTempFile(); - break; - } - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(TempFile) - WXJS_METHOD("open", open, 2) - WXJS_METHOD("seek", seek, 2) - WXJS_METHOD("write", write, 1) - WXJS_METHOD("commit", commit, 0) - WXJS_METHOD("discard", discard, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Validate changes: deletes the old file and renames the new file to the old name. - * Returns true if both actions succeeded. If false is returned it may unfortunately - * mean two quite different things: either that either the old file couldn't be deleted or - * that the new file couldn't be renamed to the old name. - * - * - */ -JSBool TempFile::commit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTempFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTempFile")); - - *rval = ToJS(cx, p->Commit()); - return JS_TRUE; -} - -/*** - * - * - * - * Discard changes: the old file contents is not changed, temporary file is deleted. - * - * - */ -JSBool TempFile::discard(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTempFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTempFile")); - - p->Discard(); - - return JS_TRUE; -} - -/*** - * - * - * The name of the file - * - * - * Open the temporary file, returns true on success, false if an error occurred. - * FileName is the name of file to be replaced. The temporary file is always created - * in the directory where FileName is. In particular, if FileName doesn't include - * the path, it is created in the current directory and the program should have write access - * to it for the function to succeed. - * - * - */ -JSBool TempFile::open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTempFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTempFile")); - - wxString fileName; - FromJS(cx, argv[0], fileName); - - *rval = ToJS(cx, p->Open(fileName)); - - return JS_TRUE; -} - -/*** - * - * - * Offset to seek to. - * - * - * - * Seeks the offset. Returns the actual position or -1. - * See also @wxFile#seekEnd. - * - * - */ -JSBool TempFile::seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTempFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTempFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - int offset; - if ( ! FromJS(cx, argv[0], offset) ) - { - return JS_FALSE; - } - - int pos; - - if ( argc > 1 ) - { - int mode; - if ( FromJS(cx, argv[1], mode) ) - { - pos = p->Seek(offset, (wxSeekMode) mode); - } - else - { - return JS_FALSE; - } - } - else - pos = p->Seek(offset); - - *rval = ToJS(cx, pos); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * Writes the string or buffer to the file. - * Returns the actual number of bytes written to the file. - * - * - */ -JSBool TempFile::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTempFile *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxTempFile")); - - if ( ! p->IsOpened() ) - { - return JS_FALSE; - } - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - *rval = ToJS(cx, p->Write(buffer->GetData(), buffer->GetDataLen())); - return JS_TRUE; - } - } - - wxString content; - FromJS(cx, argv[0], content); - int count = content.length(); - *rval = ToJS(cx, (int) p->Write(content.c_str(), count)); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tempfile.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/protocol.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/protocol.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/protocol.h (nonexistent) @@ -1,56 +0,0 @@ -/* - * wxJavaScript - protocol.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: protocol.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_protocol_h -#define _wxjs_io_protocol_h - -#include -namespace wxjs -{ - namespace io - { - class Protocol : public ApiWrapper - { - public: - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static bool GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_CONTENT_TYPE = WXJS_START_PROPERTY_ID - , P_ERROR - }; - WXJS_DECLARE_METHOD_MAP() - - static JSBool abort(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getInputStream(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool reconnect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setUser(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setPassword(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_protocol_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/protocol.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/bistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/bistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/bistream.h (nonexistent) @@ -1,48 +0,0 @@ -/* - * wxJavaScript - bistream.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: bistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_bistream_h -#define wxjs_io_bistream_h - -namespace wxjs -{ - namespace io - { - class BufferedInputStream : public wxBufferedInputStream - , public ApiWrapper - , public Object - { - public: - BufferedInputStream(JSContext *cx, JSObject *obj, wxInputStream &s, wxStreamBuffer *buffer = NULL); - virtual ~BufferedInputStream() - { - } - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Stream *p); - - Stream m_refStream; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_bistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/bistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/costream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/costream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/costream.cpp (nonexistent) @@ -1,70 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - costream.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: costream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// stream.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "costream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * costream - * io - * - * wxCountingOutputStream is a specialized output stream which does not write any data anyway, - * instead it counts how many bytes would get written if this were a normal stream. - * This can sometimes be useful or required if some data gets serialized to a stream or - * compressed by using stream compression and thus the final size of the stream cannot be - * known other than pretending to write the stream. One case where the resulting size would - * have to be known is if the data has to be written to a piece of memory and the memory has - * to be allocated before writing to it (which is probably always the case when writing to a - * memory stream). - * - */ - -WXJS_INIT_CLASS(CountingOutputStream, "wxCountingOutputStream", 0) - -/*** - * - * - * - * Creates a new wxCountingOutputStream object. - * - * - */ -Stream* CountingOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new Stream(new wxCountingOutputStream()); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/costream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dir.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dir.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dir.cpp (nonexistent) @@ -1,407 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - dir.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: dir.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSDir.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "dir.h" -#include "dirtrav.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * dir - * io - * - * wxDir is a portable equivalent of Unix open/read/closedir functions which allow - * enumerating of the files in a directory. wxDir can enumerate files as well as directories. - *

- * The following example checks if the temp-directory exists, - * and when it does, it retrieves all files with ".tmp" as extension. - *

- *   if ( wxDir.exists("c:\\temp") )
- *   {
- *     files = wxDir.getAllFiles("c:\\temp", "*.tmp");
- *     for(e in files)
- *       wxMessageBox(files[e]);
- *   }
- *  
- * See also @wxDirTraverser - *
- */ -WXJS_INIT_CLASS(Dir, "wxDir", 0) - -/*** - * - * - * - * - * - * - * - * Constants used for filtering files. The default: FILES | DIRS | HIDDEN. - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Dir) - WXJS_CONSTANT(wxDIR_, FILES) - WXJS_CONSTANT(wxDIR_, DIRS) - WXJS_CONSTANT(wxDIR_, HIDDEN) - WXJS_CONSTANT(wxDIR_, DOTDOT) - WXJS_CONSTANT(wxDIR_, DEFAULT) -WXJS_END_CONSTANT_MAP() - -WXJS_BEGIN_STATIC_METHOD_MAP(Dir) - WXJS_METHOD("getAllFiles", getAllFiles, 1) - WXJS_METHOD("exists", exists, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Returns true when the directory exists. - * - * - */ -JSBool Dir::exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - FromJS(cx, argv[0], dir); - - *rval = ToJS(cx, wxDir::Exists(dir)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * This function returns an array of all filenames under directory DirName - * Only files matching FileSpec are taken. When an empty spec is given, - * all files are given. - *

- * Remark: when wxDir.DIRS is specified in Flags then - * getAllFiles recurses into subdirectories. So be carefull when using this method - * on a root directory. - *
- *
- */ -JSBool Dir::getAllFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc > 3 ) - argc = 3; - - wxString filespec = wxEmptyString; - int flags = wxDIR_DEFAULT; - wxArrayString files; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], flags) ) - return JS_FALSE; - // Fall through - case 2: - FromJS(cx, argv[1], filespec); - // Fall through - default: - wxString dir; - FromJS(cx, argv[0], dir); - - wxArrayString files; - wxDir::GetAllFiles(dir, &files, filespec, flags); - - *rval = ToJS(cx, files); - } - - return JS_TRUE; -} - -/*** - * - * - * The name of the directory. - * - * - * Constructs a new wxDir object. When no argument is specified, use @wxDir#open - * afterwards. When a directory is passed, use @wxDir#isOpened to test for errors. - * - * - */ -wxDir* Dir::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxDir(); - - if ( argc == 1 ) - { - wxString dir; - FromJS(cx, argv[0], dir); - return new wxDir(dir); - } - - return NULL; -} - -/*** - * - * - * Returns true when the directory was opened by calling @wxDir#open. - * - * - * Returns the name of the directory itself. The returned string - * does not have the trailing path separator (slash or backslash). - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Dir) - WXJS_READONLY_PROPERTY(P_OPENED, "opened") - WXJS_READONLY_PROPERTY(P_NAME, "name") -WXJS_END_PROPERTY_MAP() - -bool Dir::GetProperty(wxDir *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_OPENED ) - *vp = ToJS(cx, p->IsOpened()); - else if ( id == P_NAME ) - *vp = ToJS(cx, p->GetName()); - return true; -} - -WXJS_BEGIN_METHOD_MAP(Dir) - WXJS_METHOD("getFirst", getFirst, 0) - WXJS_METHOD("getNext", getNext, 0) - WXJS_METHOD("hasFiles", hasFiles, 0) - WXJS_METHOD("hasSubDirs", hasSubDirs, 0) - WXJS_METHOD("open", open, 1) - WXJS_METHOD("traverse", traverse, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * Starts the enumerating. All files matching FileSpec - * (or all files when not specified or empty) and Flags will be - * enumerated. Use @wxDir#getNext for the next file. - *

- * An empty String is returned when there's no file found. - *
- *
- */ -JSBool Dir::getFirst(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 2 ) - { - return JS_FALSE; - } - - wxString filespec = wxEmptyString; - int flags = wxDIR_DEFAULT; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], flags) ) - return JS_FALSE; - // Fall through - case 1: - FromJS(cx, argv[0], filespec); - // Fall through - default: - wxString fileName = wxEmptyString; - p->GetFirst(&fileName, filespec, flags); - *rval = ToJS(cx, fileName); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Continues to enumerate files and/or directories which satisfy - * the criteria specified in @wxDir#getFirst. An empty String - * is returned when there are no more files. - * - * - */ -JSBool Dir::getNext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString next = wxEmptyString; - p->GetNext(&next); - *rval = ToJS(cx, next); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the directory contains any files matching the given FileSpec. - * When no argument is given, it will look if there are files in the directory. - * - * - */ -JSBool Dir::hasFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString filespec = wxEmptyString; - if ( argc == 1 ) - FromJS(cx, argv[0], filespec); - - *rval = ToJS(cx, p->HasFiles(filespec)); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the directory contains any subdirectories matching the given DirSpec. - * When no argument is given, it will look if there are any subdirectories in the directory. - * - * - */ -JSBool Dir::hasSubDirs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString dirspec = wxEmptyString; - if ( argc == 1 ) - FromJS(cx, argv[0], dirspec); - - *rval = ToJS(cx, p->HasSubDirs(dirspec)); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Open directory for enumerating files and subdirectories. Returns true - * on success, or false on failure. - * - * - */ -JSBool Dir::open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString dir; - FromJS(cx, argv[0], dir); - - *rval = ToJS(cx, p->Open(dir)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Open directory for enumerating files and subdirectories. Returns true - * on success, or false on failure. For an example see @wxDirTraverser. - * - * - */ -JSBool Dir::traverse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDir *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 3 ) - argc = 3; - - int flags = wxDIR_DEFAULT; - wxString filespec = wxEmptyString; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], flags) ) - return JS_FALSE; - // Fall through - case 2: - FromJS(cx, argv[1], filespec); - default: - DirTraverser *traverser = DirTraverser::GetPrivate(cx, argv[0]); - if ( traverser == NULL ) - { - return JS_FALSE; - } - - *rval = ToJS(cx, p->Traverse(*traverser, filespec, flags)); - } - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dir.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/http.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/http.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/http.cpp (nonexistent) @@ -1,99 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - http.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: http.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "constant.h" -#include "jsstream.h" -#include "sockbase.h" -#include "http.h" -#include "httphdr.h" -#include "sockaddr.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * http - * io - * - * Implements the HTTP protocol. - * - */ -WXJS_INIT_CLASS(HTTP, "wxHTTP", 0) - -/*** - * - * - * - * Creates a new wxHTTP object - * - * - */ -SocketBasePrivate *HTTP::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new SocketBasePrivate(new wxHTTP()); -} - -void HTTP::Destruct(JSContext *cx, SocketBasePrivate *p) -{ - p->DestroyStreams(cx); - delete p; -} - -/*** - * - * - * Contains the headers. Access the elements of the array with String keys. - * - * - * Returns the HTTP response code returned by the server. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(HTTP) - WXJS_READONLY_PROPERTY(P_RESPONSE, "response") - WXJS_READONLY_PROPERTY(P_HEADERS, "headers") -WXJS_END_PROPERTY_MAP() - -bool HTTP::GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxHTTP *http = dynamic_cast(p->GetBase()); - switch(id) - { - case P_RESPONSE: - *vp = ToJS(cx, http->GetResponse()); - break; - case P_HEADERS: - *vp = HTTPHeader::CreateObject(cx, new HTTPHeader(), obj); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/http.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fistream.h (nonexistent) @@ -1,43 +0,0 @@ -/* - * wxJavaScript - fistream.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: fistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_fistream_h -#define _wxjs_io_fistream_h - -#include -namespace wxjs -{ - namespace io - { - class FileInputStream : public ApiWrapper - { - public: - /** - * Callback for when a wxFileInputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif //_wxjs_io_fistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dirtrav.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dirtrav.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dirtrav.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - dirtrav.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: dirtrav.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDirTraverser_H -#define _WXJSDirTraverser_H - -///////////////////////////////////////////////////////////////////////////// -// Name: dirtrav.h -// Purpose: wxJSDirTraverser ports wxDirTraverser to JavaScript -// Author: Franky Braem -// Modified by: -// Created: -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class DirTraverser : public wxDirTraverser - , public ApiWrapper - , public Object - { - public: - - DirTraverser(JSContext *cx, JSObject *obj); - - virtual ~DirTraverser() - { - } - - wxDirTraverseResult OnFile(const wxString& name); - wxDirTraverseResult OnDir(const wxString& name); - - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Callback for when a wxDirTraverser object is created - */ - static DirTraverser* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSDirTraverser_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dirtrav.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/io_constant.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/io_constant.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/io_constant.cpp (nonexistent) @@ -1,147 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - constant.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: constant.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// constant.cpp - -#ifndef WX_PRECOMP - #include -#endif -#include -#include -#include - -#include "../common/main.h" - -#include "constant.h" - -using namespace wxjs; - -/*** - * constant - * io - * - * The following list shows all the constants that are defined on the Global object. - *
  • wxNOT_FOUND
- * Used by several find methods to indicate that nothing is found. - *
- */ -/*JSConstDoubleSpec wxGlobalMap[] = -{ - WXJS_SIMPLE_CONSTANT(wxNOT_FOUND) - { 0 } -};*/ - -/*** - * - * - * - * No error occurred. - * - * - * An End-OF-File occurred. - * - * - * An error occurred in the last write operation. - * - * - * An error occurred in the last read operation. - * - * See @wxStreamBase - * - */ -JSConstDoubleSpec wxStreamErrorMap[] = -{ - WXJS_CONSTANT(wxSTREAM_, NO_ERROR) - WXJS_CONSTANT(wxSTREAM_, EOF) - WXJS_CONSTANT(wxSTREAM_, WRITE_ERROR) - WXJS_CONSTANT(wxSTREAM_, READ_ERROR) - { 0 } -}; - -/*** - * - * - * - * - * See @wxInputStream#seekI and @wxFile#seek - * - */ -JSConstDoubleSpec wxSeekModeMap[] = -{ - WXJS_CONSTANT(wx, FromCurrent) - WXJS_CONSTANT(wx, FromStart) - WXJS_CONSTANT(wx, FromEnd) - { 0 } -}; - -/*** - * - * - * execute the process asynchronously - * execute it synchronously, i.e. wait until it finishes - * under Windows, don't hide the child even if it's IO is redirected (this - * is done by default) - * - * under Unix, if the process is the group leader then passing true to @wxProcess#kill - * kills all children as well as pid - * - * by default synchronous execution disables all program windows to avoid - * that the user interacts with the program while the child process is - * running, you can use this flag to prevent this from happening - * See @wxExecute and @wxProcess - * - * - */ -JSConstDoubleSpec wxExecFlagsMap[] = -{ - WXJS_CONSTANT(wxEXEC_, ASYNC) - WXJS_CONSTANT(wxEXEC_, SYNC) - WXJS_CONSTANT(wxEXEC_, NOHIDE) - WXJS_CONSTANT(wxEXEC_, MAKE_GROUP_LEADER) - WXJS_CONSTANT(wxEXEC_, NODISABLE) - { 0 } -}; - -void io::InitConstants(JSContext *cx, JSObject *obj) -{ - // Define the global constants -// JS_DefineConstDoubles(cx, obj, wxGlobalMap); - - JSObject *constObj = JS_DefineObject(cx, obj, "wxStreamError", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxStreamErrorMap); - - constObj = JS_DefineObject(cx, obj, "wxSeekMode", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSeekModeMap); - - constObj = JS_DefineObject(cx, obj, "wxExecFlag", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxExecFlagsMap); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/io_constant.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/bostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/bostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/bostream.h (nonexistent) @@ -1,51 +0,0 @@ -/* - * wxJavaScript - bostream.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: bostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_bostream_h -#define wxjs_io_bostream_h - -namespace wxjs -{ - namespace io - { - - class BufferedOutputStream : public wxBufferedOutputStream - , public ApiWrapper - , public Object - { - public: - BufferedOutputStream(JSContext *cx, JSObject *obj, wxOutputStream &s, wxStreamBuffer *buffer = NULL); - virtual ~BufferedOutputStream() - { - } - - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Stream *p); - - // Keep a reference to the stream to avoid deletion. - Stream m_refStream; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_bostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/bostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * wxJavaScript - ipv4addr.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: ipv4addr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_ipv4addr_h -#define _wxjs_io_ipv4addr_h - -#include - -namespace wxjs -{ - namespace io - { - class IPV4address : public ApiWrapper - { - public: - static wxIPV4address* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_ipv4addr_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ipv4addr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/process.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/process.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/process.h (nonexistent) @@ -1,77 +0,0 @@ -/* - * wxJavaScript - process.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: process.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxJS_io_process_h -#define _wxJS_io_process_h - -#include - -namespace wxjs -{ - namespace io - { - class Process : public ApiWrapper - , public wxProcess - { - public: - Process(JSContext *cx, JSObject *obj, int flags); - virtual ~Process(); - - static Process *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Process *p); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static bool GetProperty(Process *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - //static bool SetProperty(Process *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_ERROR_STREAM = WXJS_START_PROPERTY_ID - , P_INPUT_STREAM - , P_OUTPUT_STREAM - , P_ERROR_AVAILABLE - , P_INPUT_AVAILABLE - , P_INPUT_OPENED - , P_PID - }; - - static JSBool closeOutput(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool detach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool redirect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_STATIC_METHOD_MAP() - static JSBool kill(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - }; - - }; // namespace io -}; // namespace wxjs - -#endif //_wxJS_io_process_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/process.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/file.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/file.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/file.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * wxJavaScript - file.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: file.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJS_FILE_H -#define _WXJS_FILE_H - -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: Ports wxFile to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 30.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class File : public ApiWrapper - { - public: - - static bool GetProperty(wxFile *f, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_EOF - , P_OPENED - , P_LENGTH - , P_TELL - , P_KIND - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static wxFile *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool attach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool detach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool flush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seekEnd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool access(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/io/file.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffistream.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * wxJavaScript - ffistream.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: ffistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_ffistream_h -#define _wxjs_io_ffistream_h - -namespace wxjs -{ - namespace io - { - class FFileInputStream : public ApiWrapper - { - public: - /** - * Callback for when a wxFFileInputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_ffistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/filename.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/filename.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/filename.h (nonexistent) @@ -1,148 +0,0 @@ -/* - * wxJavaScript - filename.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: filename.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFileName_H -#define _WXJSFileName_H - -///////////////////////////////////////////////////////////////////////////// -// Name: filename.h -// Purpose: wxJSFileName ports wxFileName to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 14-01-2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class FileName : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxFileName - */ - static bool GetProperty(wxFileName *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxFileName *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - static bool SetStaticProperty(JSContext *cx, int id, jsval *vp); - - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - /** - * Callback for when a wxFileName object is created - */ - static wxFileName* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool appendDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool assign(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool assignCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool assignDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool assignHomeDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool assignTempFileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getFullPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getPathSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getPathSeparators(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getTimes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setTimes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getVolumeSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isAbsolute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isCaseSensitive(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isPathSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isRelative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool makeRelativeTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool mkdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool normalize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool prependDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool removeDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool removeLastDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool rmdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool sameAs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool touch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_PROPERTY_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - static JSBool createTempFileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool dirExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool dirName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool fileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool fileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getFormat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool smkdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool srmdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool splitPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - /** - * Property Ids. - */ - enum - { - P_CWD = -128 - , P_DIRS - , P_DIR_COUNT - , P_DIR_EXISTS - , P_EXT - , P_HAS_EXT - , P_HAS_NAME - , P_HAS_VOLUME - , P_FILE_EXISTS - , P_FULL_NAME - , P_FULL_PATH - , P_HOME_DIR - , P_LONG_PATH - , P_MODIFICATION_TIME - , P_NAME - , P_PATH_SEPARATOR - , P_PATH_SEPARATORS - , P_SHORT_PATH - , P_ACCESS_TIME - , P_CREATE_TIME - , P_VOLUME - , P_VOLUME_SEPARATOR - , P_OK - , P_IS_DIR - }; - - static bool SetDate(JSContext *cx, jsval v, const wxDateTime &date); - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSFileName_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/filename.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fostream.h (nonexistent) @@ -1,43 +0,0 @@ -/* - * wxJavaScript - fostream.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: fostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_fostream_h -#define _wxjs_io_fostream_h - -namespace wxjs -{ - namespace io - { - class FileOutputStream : public ApiWrapper - { - public: - - /** - * Callback for when a wxFileOutputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_fostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sistream.cpp (nonexistent) @@ -1,85 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sistream.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: sistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "stream.h" -#include "sockbase.h" -#include "sistream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * sistream - * io - * - * This class implements an input stream which reads data from a connected socket. - * Note that this stream is purely sequential and it does not support seeking. - * - */ -WXJS_INIT_CLASS(SocketInputStream, "wxSocketInputStream", 1) - -/*** - * - * - * A socket - * - * - * Constructs a new wxSocketInputStream object. - * - * - */ -Stream* SocketInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( SocketBase::HasPrototype(cx, argv[0]) ) - { - SocketBasePrivate *p = SocketBase::GetPrivate(cx, argv[0], false); - wxSocketBase *base = p->GetBase(); - // This is needed, because otherwise the socket can be garbage collected. - // Another method could be to root socket, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__socket__", argv[0], NULL, NULL, JSPROP_READONLY); - - return new Stream(new wxSocketInputStream(*base)); - } - return NULL; -} - -void SocketInputStream::Destruct(JSContext *cx, Stream *p) -{ - if ( p->IsOwner() ) - { - delete p; - } - else - { - p->SetObject(NULL); - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffile.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffile.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffile.h (nonexistent) @@ -1,75 +0,0 @@ -/* - * wxJavaScript - ffile.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: ffile.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJS_FFILE_H -#define _WXJS_FFILE_H - -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: Ports wxFFile to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 18.10.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include -namespace wxjs -{ - namespace io - { - class FFile : public ApiWrapper - { - public: - - static bool GetProperty(wxFFile *f, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_EOF - , P_KIND - , P_OPENED - , P_LENGTH - , P_TELL - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - static wxFFile *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool flush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seekEnd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffile.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/stream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/stream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/stream.cpp (nonexistent) @@ -1,88 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - stream.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: stream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// stream.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * streambase - * io - * - * wxStreamBase is a prototype class. It's the prototype of the Stream classes. - * See @wxInputStream, @wxOutputStream. - * - */ -WXJS_INIT_CLASS(StreamBase, "wxStreamBase", 0) - -/*** - * - * - * Returns the last error. - * - * - * Returns true if no error occurred. - * - * - * Returns the size of the stream. For example, for a file it is the size of the file. - * There are streams which do not have size by definition, such as socket streams. - * In these cases, size returns 0. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(StreamBase) - WXJS_READONLY_PROPERTY(P_OK, "ok") - WXJS_READONLY_PROPERTY(P_SIZE, "size") - WXJS_READONLY_PROPERTY(P_LAST_ERROR, "lastError") -WXJS_END_PROPERTY_MAP() - -bool StreamBase::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxStreamBase *stream = p->GetStream(); - switch (id) - { - case P_OK: - *vp = ToJS(cx, stream->IsOk()); - break; - case P_SIZE: - *vp = ToJS(cx, (long) stream->GetSize()); - break; - case P_LAST_ERROR: - *vp = ToJS(cx, (int) stream->GetLastError()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/stream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffostream.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * wxJavaScript - ffostream.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: ffostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_ffostream_h -#define _wxjs_io_ffostream_h - -namespace wxjs -{ - namespace io - { - class FFileOutputStream : public ApiWrapper - { - public: - /** - * Callback for when a wxFFileOutputStream object is created - */ - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_ffostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sostream.cpp (nonexistent) @@ -1,72 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sostream.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: sostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "stream.h" -#include "sockbase.h" -#include "sostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * sostream - * io - * - * This class implements an output stream which writes data from a connected socket. - * Note that this stream is purely sequential and it does not support seeking. - * - */ -WXJS_INIT_CLASS(SocketOutputStream, "wxSocketOutputStream", 1) - -/*** - * - * - * A socket - * - * - * Constructs a new wxSocketOutputStream object. - * - * - */ -Stream* SocketOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( SocketBase::HasPrototype(cx, argv[0]) ) - { - SocketBasePrivate *base = SocketBase::GetPrivate(cx, argv[0], false); - // This is needed, because otherwise the socket can be garbage collected. - // Another method could be to root socket, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__socket__", argv[0], NULL, NULL, JSPROP_READONLY); - - return new Stream(new wxSocketOutputStream(*base->GetBase())); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sound.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sound.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sound.h (nonexistent) @@ -1,67 +0,0 @@ -/* - * wxJavaScript - sound.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: sound.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSSound_H -#define _WXJSSound_H - -#include - -namespace wxjs -{ - namespace io - { - class Sound : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxDir - */ - static bool GetProperty(wxSound *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxDir object is created - */ - static wxSound* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool play(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool stop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_OK - }; - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSSound_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sound.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/jsstream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/jsstream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/jsstream.h (nonexistent) @@ -1,129 +0,0 @@ -/* - * wxJavaScript - jsstream.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: jsstream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_jsstream_h -#define _wxjs_io_jsstream_h - -#include - -namespace wxjs -{ - namespace io - { - - // Reference counting for stream classes. - // Why? because some streams are members of other streams. When - // these streams are gc'ed by SpiderMonkey before the stream that owns a stream, - // access violations can be the result. This is the case in wxBufferedOutputStream - // where the stream is flushed in the destructor. - class StreamRef : public wxObjectRefData - { - public: - StreamRef(wxStreamBase *stream) : wxObjectRefData(), m_stream(stream) - { - } - virtual ~StreamRef() - { - delete m_stream; - } - - wxStreamBase *GetStream() - { - return m_stream; - } - private: - wxStreamBase *m_stream; - }; - - // This class will be the private data for each stream JavaScript object. - class Stream : public wxObject - { - public: - inline Stream(bool owner = true) : m_owner(owner), m_obj(NULL) - { - } - - inline Stream(wxStreamBase *stream, bool owner = true) : m_owner(owner), m_obj(NULL) - { - m_refData = new StreamRef(stream); - } - - inline Stream(const Stream& stream) : wxObject(stream) - { - Ref(stream); - m_owner = stream.m_owner; - m_obj = stream.m_obj; - } - - inline bool operator == (const Stream& stream) const - { - return m_refData == stream.m_refData; - } - inline bool operator != (const Stream& stream) const - { - return m_refData != stream.m_refData; - } - - inline Stream& operator = (const Stream& stream) - { - if ( *this == stream ) - return (*this); - else - { - Ref(stream); - return *this; - } - } - - inline void SetObject(JSObject *obj) - { - m_obj = obj; - } - - inline JSObject *GetObject() - { - return m_obj; - } - - virtual ~Stream() - { - } - - wxStreamBase* GetStream() - { - return ((StreamRef *) m_refData)->GetStream(); - } - - // Do we own the stream (=default)? Or is another class - // responsible for destroying me? (like wxHTTP for example) - bool IsOwner() const { return m_owner; } - - private: - bool m_owner; - - JSObject *m_obj; - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_jsstream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/jsstream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockaddr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockaddr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockaddr.h (nonexistent) @@ -1,43 +0,0 @@ -/* - * wxJavaScript - sockaddr.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: sockaddr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sockaddr_h -#define _wxjs_io_sockaddr_h - -#include - -namespace wxjs -{ - namespace io - { - class SockAddress : public ApiWrapper - { - public: - WXJS_DECLARE_METHOD_MAP() - - static JSBool clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sockaddr_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockaddr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockbase.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockbase.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockbase.h (nonexistent) @@ -1,113 +0,0 @@ -/* - * wxJavaScript - sockbase.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: sockbase.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sockbase_h -#define _wxjs_io_sockbase_h - -#include - -#include - -#include "jsstream.h" - -namespace wxjs -{ - namespace io - { - class SocketBasePrivate - { - public: - SocketBasePrivate(wxSocketBase *base) : m_base(base) - { - } - - virtual ~SocketBasePrivate() - { - } - - void DestroyStreams(JSContext *cx) - { - for(std::vector::iterator it = m_streams.begin(); it != m_streams.end(); it++) - { - JSObject *obj = (*it)->GetObject(); - if ( obj != NULL ) - JS_SetPrivate(cx, obj, NULL); // To avoid deletion - delete *it; - } - } - - wxSocketBase* GetBase() { return m_base; } - - void AddStream(Stream *stream) - { - m_streams.push_back(stream); - } - - private: - wxSocketBase *m_base; - std::vector m_streams; - }; - - class SocketBase : public ApiWrapper - { - public: - static bool GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_ERROR = WXJS_START_PROPERTY_ID - , P_CONNECTED - , P_DATA - , P_DISCONNECTED - , P_LASTCOUNT - , P_LASTERROR - , P_OK - }; - - WXJS_DECLARE_METHOD_MAP() - - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool discard(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool interruptWait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool notify(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool peek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readMsg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool restoreState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool saveState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setTimeout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool unread(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool wait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool waitForLost(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool waitForRead(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool waitForWrite(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool writeMsg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sockbase_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockbase.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockclient.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockclient.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockclient.h (nonexistent) @@ -1,59 +0,0 @@ -/* - * wxJavaScript - sockclient.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: sockclient.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sockclient_h -#define _wxjs_io_sockclient_h - -#include -#include - -#include "sockbase.h" - -namespace wxjs -{ - namespace io - { - class SocketEventHandler; - - class SocketClient : public ApiWrapper - , public wxSocketClient - { - public: - SocketClient(JSContext *cx, JSObject *obj, wxSocketFlags flags = wxSOCKET_NONE); - virtual ~SocketClient(); - - static SocketBasePrivate *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, SocketBasePrivate *p); - - WXJS_DECLARE_METHOD_MAP() - - static JSBool connect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool waitOnConnect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - private: - SocketEventHandler *m_evtHandler; - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sockclient_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockclient.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fn.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fn.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fn.cpp (nonexistent) @@ -1,575 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fn.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: fn.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "fn.h" -#include "process.h" - -using namespace wxjs; - -/*** - * fn - * io - * - * A list of global IO functions - * - */ - -/*** - * - * - * - * - * - * - * - * Concatenates file1 and file2 to file3, returning true if successful. - * - * - */ -JSBool io::concatFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file1; - wxString file2; - wxString file3; - - FromJS(cx, argv[2], file3); - FromJS(cx, argv[1], file2); - FromJS(cx, argv[0], file1); - - *rval = ToJS(cx, wxConcatFiles(file1, file2, file3)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Copies SourceFile to TargetFile, returning true if successful. - * If overwrite parameter is true (default), the destination file - * is overwritten if it exists, but if overwrite is false, the - * functions fails in this case. - * - * - */ -JSBool io::copyFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file1; - wxString file2; - bool overwrite = true; - - if ( argc == 3 ) - { - if ( ! FromJS(cx, argv[2], overwrite) ) - { - return JS_FALSE; - } - } - - FromJS(cx, argv[1], file2); - FromJS(cx, argv[0], file1); - - *rval = ToJS(cx, wxCopyFile(file1, file2, overwrite)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the directory exists - * - * - */ -JSBool io::dirExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file; - FromJS(cx, argv[0], file); - *rval = ToJS(cx, wxDirExists(file)); - return JS_TRUE; -} - -/*** - * - * - * - * Returns a string containing the current (or working) directory. - * - * - */ -JSBool io::getCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - *rval = ToJS(cx, wxGetCwd()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the free diskspace. Returns -1 if the path doesn't exist. - * Unlike wxWidgets, which implements this function as wxGetDiskSpace, - * wxJS has to separate this into two functions. - * - * - */ -JSBool io::getFreeDiskSpace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString path; - FromJS(cx, argv[0], path); - - wxLongLong free; - if ( wxGetDiskSpace(path, NULL, &free) ) - { - *rval = ToJS(cx, free.ToDouble()); - } - else - { - *rval = ToJS(cx, (double) -1); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the free diskspace. Returns -1 if the path doesn't exist. - * Unlike wxWidgets, which implements this function as wxGetDiskSpace, - * wxJS has to separate this into two functions. - * - * - */ -JSBool io::getTotalDiskSpace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString path; - FromJS(cx, argv[0], path); - - wxLongLong total; - if ( wxGetDiskSpace(path, &total) ) - { - *rval = ToJS(cx, total.ToDouble()); - } - else - { - *rval = ToJS(cx, (double) -1); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the file exists. - * - * - */ -JSBool io::fileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file1; - FromJS(cx, argv[0], file1); - - *rval = ToJS(cx, wxFileExists(file1)); - return JS_TRUE; -} - -/*** - * - * - * - * Returns the Windows directory under Windows; on other platforms returns the empty string. - * - * - */ -JSBool io::getOSDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - *rval = ToJS(cx, wxGetOSDirectory()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the argument is an absolute filename, i.e. with a slash or drive name at the beginning. - * - * - */ -JSBool io::isAbsolutePath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file; - FromJS(cx, argv[0], file); - *rval = ToJS(cx, wxIsAbsolutePath(file)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if the pattern contains wildcards. - * - * - */ -JSBool io::isWild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString pattern; - FromJS(cx, argv[0], pattern); - - *rval = ToJS(cx, wxIsWild(pattern)); - return JS_TRUE; -} - - -/*** - * - * - * - * - * - * - * - * Returns true if the pattern matches the text; if DotSpecial is true, filenames beginning with - * a dot are not matched with wildcard characters. - * - * - */ -JSBool io::matchWild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString pattern; - wxString text; - bool dotSpecial; - - FromJS(cx, argv[2], dotSpecial); - FromJS(cx, argv[1], text); - FromJS(cx, argv[0], pattern); - - *rval = ToJS(cx, wxMatchWild(pattern, text, dotSpecial)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Makes the directory dir, returning true if successful. - * perm is the access mask for the directory for the systems on which it is - * supported (Unix) and doesn't have effect for the other ones. - * - * - */ -JSBool io::mkDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - int perm = 777; - - if ( argc > 0 ) - { - if ( ! FromJS(cx, argv[1], perm) ) - return JS_FALSE; - } - - *rval = ToJS(cx, wxMkdir(dir, perm)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Renames the file From to To, returning true if successful. - * - * - */ -JSBool io::renameFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file1; - wxString file2; - - FromJS(cx, argv[1], file2); - FromJS(cx, argv[0], file1); - - *rval = ToJS(cx, wxRenameFile(file1, file2)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Removes the file, return true on success. - * - * - */ -JSBool io::removeFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file; - - FromJS(cx, argv[0], file); - - *rval = ToJS(cx, wxRemoveFile(file)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Removes the directory. Returns true on success. - * - * - */ -JSBool io::rmDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - FromJS(cx, argv[0], dir); - #if defined( __WXMAC__) || defined(__WXGTK__) - *rval = ToJS(cx, wxRmDir(dir.mb_str())); - #else - *rval = ToJS(cx, wxRmDir(dir)); - #endif - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Sets the current working directory, returning true if the operation succeeded. - * Under MS Windows, the current drive is also changed if dir contains a drive specification. - * - * - */ -JSBool io::setWorkingDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - - FromJS(cx, argv[0], dir); - - *rval = ToJS(cx, wxSetWorkingDirectory(dir)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -JSBool io::execute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int flags = wxEXEC_ASYNC; - wxString cmd; - - if ( JSVAL_IS_STRING(argv[0]) ) - { - FromJS(cx, argv[0], cmd); - if ( argc == 1 ) - { - *rval = ToJS(cx, wxExecute(cmd)); - return JS_TRUE; - } - - if ( JSVAL_IS_INT(argv[1]) ) - { - wxProcess *p = NULL; - if ( argc > 2 ) - { - p = Process::GetPrivate(cx, argv[2]); - } - if ( FromJS(cx, argv[1], flags) ) - { - *rval = ToJS(cx, wxExecute(cmd, flags, p)); - } - return JS_TRUE; - } - else if ( JSVAL_IS_OBJECT(argv[1]) ) - { - wxArrayString output; - wxArrayString error; - - if ( argc > 3 ) - { - if ( ! FromJS(cx, argv[3], flags) ) - return JS_FALSE; - } - if ( argc > 2 - && JSVAL_IS_INT(argv[2]) ) - { - if ( ! FromJS(cx, argv[2], flags) ) - return JS_FALSE; - } - *rval = ToJS(cx, wxExecute(cmd, output, error, flags)); - - if ( argc > 2 && JSVAL_IS_OBJECT(argv[2]) ) - { - JSObject *objArr = JSVAL_TO_OBJECT(argv[2]); - if ( JS_IsArrayObject(cx, objArr) ) - { - for(wxArrayString::size_type i = 0; i < error.size(); i++) - { - jsval element = ToJS(cx, error[i]); - JS_SetElement(cx, objArr, i, &element); - } - } - } - - if ( argc > 1 && JSVAL_IS_OBJECT(argv[1]) ) - { - JSObject *objArr = JSVAL_TO_OBJECT(argv[1]); - if ( JS_IsArrayObject(cx, objArr) ) - { - for(wxArrayString::size_type i = 0; i < output.size(); i++) - { - jsval element = ToJS(cx, output[i]); - JS_SetElement(cx, objArr, i, &element); - } - } - } - return JS_TRUE; - } - } - else if ( JSVAL_IS_OBJECT(argv[0]) ) - { - JSObject *objArr = JSVAL_TO_OBJECT(argv[0]); - if ( JS_IsArrayObject(cx, objArr) ) - { - wxProcess *p = NULL; - switch(argc) - { - case 3: - p = (wxProcess *) Process::GetPrivate(cx, argv[2]); - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], flags) ) - break; - // Fall through - default: - { - jsuint length; - JS_GetArrayLength(cx, objArr, &length); - if ( length > 0 ) - { - wxChar **cmdArgv = new wxChar*[length + 1](); - for(jsuint i = 0; i < length; i++) - { - jsval element; - if ( JS_GetElement(cx, objArr, i, &element) == JS_TRUE ) - { - wxString arg; - FromJS(cx, element, arg); - - cmdArgv[i] = new wxChar[arg.Length() + 1]; - wxStrncpy(cmdArgv[i], arg.c_str(), arg.Length()); - cmdArgv[i][arg.Length()] = '\0'; - } - } - *rval = ToJS(cx, wxExecute(cmdArgv, flags, p)); - delete[] cmdArgv; - } - return JS_TRUE; - } - } - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Executes a command in an interactive shell window. If no command is specified, - * then just the shell is spawned. - * - * - */ -JSBool io::shell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString cmd; - - FromJS(cx, argv[0], cmd); - - *rval = ToJS(cx, wxShell(cmd)); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fn.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zistream.h (nonexistent) @@ -1,65 +0,0 @@ -/* - * wxJavaScript - zistream.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: zistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_zistream_h -#define wxjs_io_zistream_h - -#include - -namespace wxjs -{ - namespace io - { - class ZipInputStream : public wxZipInputStream, - public ApiWrapper - { - public: - - ZipInputStream(wxInputStream &str); - - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Stream *p); - /** - * Callback for retrieving properties of wxInputStream - */ - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_COMMENT - , P_TOTAL_ENTRIES - , P_NEXT_ENTRY - }; - - // Keep a reference to the stream to avoid deletion. - Stream m_refStream; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_zistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/uri.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/uri.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/uri.h (nonexistent) @@ -1,73 +0,0 @@ -/* - * wxJavaScript - uri.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: uri.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_uri_h -#define _wxjs_io_uri_h - -#include - -namespace wxjs -{ - namespace io - { - class URI : public ApiWrapper - { - public: - - static wxURI *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static bool GetProperty(wxURI *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_FRAGMENT = WXJS_START_PROPERTY_ID - , P_HOST_TYPE - , P_PASSWORD - , P_PATH - , P_PORT - , P_QUERY - , P_SCHEME - , P_SERVER - , P_USER - , P_USERINFO - , P_HAS_PATH - , P_HAS_PORT - , P_HAS_QUERY - , P_HAS_SCHEME - , P_HAS_SERVER - , P_HAS_USER - , P_IS_REFERENCE - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool buildURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool buildUnescapedURI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool resolve(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool unescape(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_uri_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/uri.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/bistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/bistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/bistream.cpp (nonexistent) @@ -1,104 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - bistream.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: bistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "istream.h" -#include "bistream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * bistream - * io - * - * An inputstream that caches the input. - * - */ -BufferedInputStream::BufferedInputStream(JSContext *cx - , JSObject *obj - , wxInputStream &s - , wxStreamBuffer *buffer) - : wxBufferedInputStream(s, buffer) - , Object(obj, cx) -{ -} - -WXJS_INIT_CLASS(BufferedInputStream, "wxBufferedInputStream", 1) - -/*** - * - * - * - * - * - * Creates a new wxBufferedInputStream object. - * - * - */ -Stream* BufferedInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 - || argc > 2 ) - return NULL; - - Stream *in = InputStream::GetPrivate(cx, argv[0]); - if ( in == NULL ) - return NULL; - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - wxStreamBuffer *buffer = NULL; - - BufferedInputStream *stream = new BufferedInputStream(cx, obj, *((wxInputStream*) in->GetStream()), buffer); - stream->m_refStream = *in; - - return new Stream(stream); -} - -void BufferedInputStream::Destruct(JSContext *cx, Stream *p) -{ - if ( p != NULL ) - { - BufferedInputStream *stream = (BufferedInputStream*) p->GetStream(); - - // Keep stream alive for a moment, so that the base class wxBufferedOutputStream - // doesn't crash when it flushes the stream. - Stream tempRefStream(stream->m_refStream); - - delete p; - p = NULL; - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/bistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/init.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/init.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/init.h (nonexistent) @@ -1,39 +0,0 @@ -/* - * wxJavaScript - init.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: init.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxJS_IO_init_h -#define _wxJS_IO_init_h - -// Use this to initialize the IO module - -namespace wxjs -{ - namespace io - { - bool InitClass(JSContext *cx, JSObject *global); - bool InitObject(JSContext *cx, JSObject *obj); - void Destroy(); - }; // namespace io -}; // namespace wxjs -#endif // _wxJS_IO_init_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/init.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ipaddr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ipaddr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ipaddr.h (nonexistent) @@ -1,56 +0,0 @@ -/* - * wxJavaScript - ipaddr.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: ipaddr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_ipaddr_h -#define _wxjs_io_ipaddr_h - -#include - -namespace wxjs -{ - namespace io - { - class IPaddress : public ApiWrapper - { - public: - static bool GetProperty(wxIPaddress *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxIPaddress *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static JSBool anyAddress(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool localhost(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - enum - { - P_HOSTNAME = WXJS_START_PROPERTY_ID - , P_LOCALHOST - , P_IPADDRESS - , P_SERVICE - }; - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_ipaddr_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ipaddr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zostream.h (nonexistent) @@ -1,67 +0,0 @@ -/* - * wxJavaScript - zostream.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: zostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_zostream_h -#define wxjs_io_zostream_h - -#include - -namespace wxjs -{ - namespace io - { - class ZipOutputStream : public wxZipOutputStream, - public ApiWrapper - { - public: - - ZipOutputStream(wxOutputStream &str, int level); - - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Stream *p); - - /** - * Callback for retrieving properties of wxInputStream - */ - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_LEVEL - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool setComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - // Keep a reference to the stream to avoid deletion. - Stream m_refStream; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_zostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fistream.cpp (nonexistent) @@ -1,105 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fistream.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: fistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "file.h" -#include "stream.h" -#include "fistream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * fistream - * io - * - * This class represents data read in from a file. There are actually two such groups of classes: - * this one is based on @wxFile whereas @wxFFileInputStream is based on the @wxFFile class. - * An example: - *

- *   var fis = new wxFileInputStream("c:\\temp\\test.txt");
- *   if ( fis.ok )
- *   {
- *     var bis = new wxBufferedInputStream(fis);
- *     while(! bis.eof )
- *     {
- *       var buffer = new wxMemoryBuffer(100);
- *       bis.read(buffer);
- *       buffer.dataLength = bis.lastRead;
- *       ...
- *     }
- *   }
- *
- */ -WXJS_INIT_CLASS(FileInputStream, "wxFileInputStream", 1) - -/*** - * - * - * The name of a file - * - * - * - * - * - * A file descriptor - * - * - * Constructs a new wxFileInputStream object. A wxFileInputStream is - * always opened in read-only mode. - * - * - */ -Stream* FileInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( File::HasPrototype(cx, argv[0]) ) - { - wxFile *file = File::GetPrivate(cx, argv[0], false); - // This is needed, because otherwise the file can be garbage collected. - // Another method could be to root file, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__file__", argv[0], NULL, NULL, JSPROP_READONLY); - return new Stream(new wxFileInputStream(*file)); - } - else if ( JSVAL_IS_STRING(argv[0]) ) - { - wxString name; - FromJS(cx, argv[0], name); - return new Stream(new wxFileInputStream(name)); - } - else if ( JSVAL_IS_INT(argv[0]) ) - { - int fd; - if ( FromJS(cx, argv[0], fd) ) - return new Stream(new wxFileInputStream(fd)); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tempfile.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tempfile.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tempfile.h (nonexistent) @@ -1,70 +0,0 @@ -/* - * wxJavaScript - tempfile.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: tempfile.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJS_TEMPFILE_H -#define _WXJS_TEMPFILE_H - -///////////////////////////////////////////////////////////////////////////// -// Name: tempfile.h -// Purpose: Ports wxFile to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 25.12.05 -// Copyright: (c) 2001-2005 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class TempFile : public ApiWrapper - { - public: - - static bool GetProperty(wxTempFile *f, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_OPENED - , P_LENGTH - , P_TELL - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static wxTempFile *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool commit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool discard(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tempfile.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/bostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/bostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/bostream.cpp (nonexistent) @@ -1,105 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - bostream.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: bostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "stream.h" -#include "ostream.h" -#include "bostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * bostream - * io - * - * This stream acts as a cache. It caches the bytes to be written - * to the specified output stream. - * - */ -BufferedOutputStream::BufferedOutputStream(JSContext *cx - , JSObject *obj - , wxOutputStream &s - , wxStreamBuffer *buffer) - : wxBufferedOutputStream(s, buffer) - , Object(obj, cx) -{ -} - -WXJS_INIT_CLASS(BufferedOutputStream, "wxBufferedOutputStream", 1) - -/*** - * - * - * - * - * - * Creates a new wxBufferedOutputStream object. - * - * - */ -Stream* BufferedOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 - || argc > 2 ) - return NULL; - - Stream *out = OutputStream::GetPrivate(cx, argv[0]); - if ( out == NULL ) - return NULL; - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - wxStreamBuffer *buffer = NULL; - - BufferedOutputStream *stream = new BufferedOutputStream(cx, obj, *((wxOutputStream*)(out->GetStream())), buffer); - stream->m_refStream = *out; - - return new Stream(stream); -} - -void BufferedOutputStream::Destruct(JSContext *cx, Stream *p) -{ - if ( p != NULL ) - { - BufferedOutputStream *stream = (BufferedOutputStream*) p->GetStream(); - - // Keep stream alive for a moment, so that the base class wxBufferedOutputStream - // doesn't crash when it flushes the stream. - Stream tempRefStream(stream->m_refStream); - - delete p; - p = NULL; - } -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/io/bostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/httphdr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/httphdr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/httphdr.cpp (nonexistent) @@ -1,70 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - httphdr.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: httphdr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "http.h" -#include "sockbase.h" -#include "httphdr.h" - -using namespace wxjs; -using namespace wxjs::io; - -WXJS_INIT_CLASS(HTTPHeader, "wxHTTPHeader", 0) - -bool HTTPHeader::AddProperty(HTTPHeader *p, JSContext *cx, JSObject *obj, - const wxString &prop, jsval *vp) -{ - JSObject *objParent = JS_GetParent(cx, obj); - SocketBasePrivate *base = HTTP::GetPrivate(cx, objParent); - wxHTTP *http = dynamic_cast(base->GetBase()); - if ( http ) - { - wxString value; - FromJS(cx, *vp, value); - http->SetHeader(prop, value); - } - return true; -} - -bool HTTPHeader::GetStringProperty(HTTPHeader *p, JSContext *cx, JSObject *obj, - const wxString &propertyName, jsval *vp) -{ - JSObject *objParent = JS_GetParent(cx, obj); - SocketBasePrivate *base = HTTP::GetPrivate(cx, objParent); - wxHTTP *http = dynamic_cast(base->GetBase()); - - if ( http ) - { - wxString value = http->GetHeader(propertyName); - *vp = ToJS(cx, value); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/httphdr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/process.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/process.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/process.cpp (nonexistent) @@ -1,403 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - process.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: process.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "process.h" -#include "stream.h" -#include "istream.h" -#include "ostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -Process::Process( JSContext *cx - , JSObject *obj - , int flags) : wxProcess(flags) -{ -} - -Process::~Process() -{ -} - -/*** - * process - * io - * - * The objects of this class are used in conjunction with the @wxExecute function. - * When a wxProcess object is passed to @wxExecute(), its @wxProcess#onTerminate event - * is called when the process terminates. This allows the program to be (asynchronously) - * notified about the process termination and also retrieve its exit status which is - * unavailable from @wxExecute in the case of asynchronous execution. - *

- * wxProcess also supports IO redirection of the child process. For this, you have to call - * its @wxProcess#redirect method before passing it to @wxExecute. If the child process was launched successfully, - * @wxProcess#inputStream, @wxProcess#outputStream and @wxProcess#errorStream can then be used to retrieve the - * streams corresponding to the child process standard output, input and error output respectively. - *
- */ -WXJS_INIT_CLASS(Process, "wxProcess", 1) - -/*** - * - * - * - * Turn on redirection - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * no error - * no such signal - * permission denied - * no such process - * another, unspecified error - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Process) - WXJS_CONSTANT(wxPROCESS_, DEFAULT) - WXJS_CONSTANT(wxPROCESS_, REDIRECT) -WXJS_END_CONSTANT_MAP() - -void Process::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxSignalType[] = - { - WXJS_CONSTANT(wx, SIGNONE) - WXJS_CONSTANT(wx, SIGHUP) - WXJS_CONSTANT(wx, SIGINT) - WXJS_CONSTANT(wx, SIGQUIT) - WXJS_CONSTANT(wx, SIGILL) - WXJS_CONSTANT(wx, SIGTRAP) - WXJS_CONSTANT(wx, SIGABRT) - WXJS_CONSTANT(wx, SIGEMT) - WXJS_CONSTANT(wx, SIGFPE) - WXJS_CONSTANT(wx, SIGKILL) - WXJS_CONSTANT(wx, SIGBUS) - WXJS_CONSTANT(wx, SIGSEGV) - WXJS_CONSTANT(wx, SIGSYS) - WXJS_CONSTANT(wx, SIGPIPE) - WXJS_CONSTANT(wx, SIGALRM) - WXJS_CONSTANT(wx, SIGTERM) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxSignal", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSignalType); - - JSConstDoubleSpec wxKillErrorType[] = - { - WXJS_CONSTANT(wxKILL_, OK) - WXJS_CONSTANT(wxKILL_, BAD_SIGNAL) - WXJS_CONSTANT(wxKILL_, ACCESS_DENIED) - WXJS_CONSTANT(wxKILL_, NO_PROCESS) - WXJS_CONSTANT(wxKILL_, ERROR) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxKillError", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxKillErrorType); -} - -/*** - * - * - * Returns an input stream which corresponds to the standard error output (stderr) of the child process. - * - * - * It returns an input stream corresponding to the standard output stream of the subprocess. - * If it is null, you have not turned on the redirection - * - * - * It returns an output stream corresponding to the input stream of the subprocess. - * If it is null, you have not turned on the redirection. - * - * - * Returns true if there is data to be read on the child process standard error stream. - * - * - * Returns true if there is data to be read on the child process standard output stream. - * - * - * Returns true if the child process standard output stream is opened. - * - * - * Returns the process ID of the process launched by @wxProcess#open. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Process) - WXJS_READONLY_PROPERTY(P_ERROR_STREAM, "errorStream") - WXJS_READONLY_PROPERTY(P_INPUT_STREAM, "inputStream") - WXJS_READONLY_PROPERTY(P_OUTPUT_STREAM, "outputStream") - WXJS_READONLY_PROPERTY(P_ERROR_AVAILABLE, "errorAvailable") - WXJS_READONLY_PROPERTY(P_INPUT_AVAILABLE, "inputAvailable") - WXJS_READONLY_PROPERTY(P_INPUT_OPENED, "inputOpened") - WXJS_READONLY_PROPERTY(P_PID, "pid") -WXJS_END_PROPERTY_MAP() - -bool Process::GetProperty(Process *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ERROR_STREAM: - { - wxInputStream *in = p->GetErrorStream(); - if ( in != NULL ) - { - *vp = InputStream::CreateObject(cx, new Stream(in)); - } - } - break; - case P_INPUT_STREAM: - { - wxInputStream *in = p->GetInputStream(); - if ( in != NULL ) - { - *vp = InputStream::CreateObject(cx, new Stream(in)); - } - } - break; - case P_OUTPUT_STREAM: - { - wxOutputStream *out = p->GetOutputStream(); - if ( out != NULL ) - { - *vp = OutputStream::CreateObject(cx, new Stream(out)); - } - } - break; - case P_ERROR_AVAILABLE: - *vp = ToJS(cx, p->IsErrorAvailable()); - break; - case P_INPUT_AVAILABLE: - *vp = ToJS(cx, p->IsInputAvailable()); - break; - case P_INPUT_OPENED: - *vp = ToJS(cx, p->IsInputOpened()); - break; - case P_PID: - *vp = ToJS(cx, p->GetPid()); - break; - } - return true; -} - -/*** - * - * - * - * - * - * Constructs a new wxProcess object. - * - * - */ -Process *Process::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int flags = wxPROCESS_DEFAULT; - if ( argc == 1 ) - { - if ( ! FromJS(cx, argv[0], flags) ) - return NULL; - } - return new Process(cx, obj, flags); -} - -void Process::Destruct(JSContext *cx, Process *p) -{ -} - -WXJS_BEGIN_METHOD_MAP(Process) - WXJS_METHOD("closeOutput", closeOutput, 0) - WXJS_METHOD("detach", detach, 0) - WXJS_METHOD("redirect", redirect, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Closes the output stream (the one connected to the stdin of the child process). - * This function can be used to indicate to the child process that there is no more - * data to be read - usually, a filter program will only terminate when the input stream is closed. - * - * - */ -JSBool Process::closeOutput(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Process *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->CloseOutput(); - - return JS_TRUE; -} - -/*** - * - * - * - * Normally, a wxProcess object is destroyed when it receives the notification about the process termination. - * However, it might happen that the parent application ends before the external process is terminated - * (e.g. a window from which this external process was launched is closed by the user) and in this case - * it should detach. - * - * - */ -JSBool Process::detach(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Process *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Detach(); - - return JS_TRUE; -} - -/*** - * - * - * - * Turns on redirection. @wxExecute will try to open a couple of pipes to catch the subprocess stdio. - * The caught input stream is returned by @wxProcess#outputStream as a non-seekable stream. The caught - * output stream is returned by @wxProcess#inputStream as a non-seekable stream. - * - * - */ -JSBool Process::redirect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Process *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Redirect(); - - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(Process) - WXJS_METHOD("kill", kill, 1) - WXJS_METHOD("exists", exists, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The process ID - * The signal to send to the process - * Kill child processes? - * - * - * Send the specified signal to the given process. - * - * - */ -JSBool Process::kill(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Process *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 3 ) - argc = 3; - - int signal = wxSIGNONE; - bool killChildren = false; - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], killChildren) ) - break; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], signal ) ) - break; - // Fall through - default: - { - long pid; - if ( FromJS(cx, argv[0], pid) ) - { - *rval = ToJS(cx, (int) wxProcess::Kill(pid, (wxSignal) signal, killChildren ? wxKILL_CHILDREN : wxKILL_NOCHILDREN)); - return JS_TRUE; - } - } - } - return JS_FALSE; -} - -/*** - * - * - * Process ID - * - * - * Returns true if the given process exists in the system - * - * - */ -JSBool Process::exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Process *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pid; - if ( FromJS(cx, argv[0], pid) ) - { - *rval = ToJS(cx, wxProcess::Exists(pid)); - return JS_TRUE; - } - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/process.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fostream.cpp (nonexistent) @@ -1,91 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fostream.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: fostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif -#include "wx/wfstream.h" - -#include "../common/main.h" - -#include "file.h" -#include "stream.h" -#include "fostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * fostream - * io - * - * This class represents data written to a file. There are actually two such groups of classes: - * this one is based on @wxFile whereas @wxFFileOutputStream is based on the @wxFFile class. - * - */ -WXJS_INIT_CLASS(FileOutputStream, "wxFileOutputStream", 1) - -/*** - * - * - * The name of a file - * - * - * - * - * - * A file descriptor - * - * - * Constructs a new wxFileOutputStream object. A wxFileOutputStream is always opened in write-only mode. - * - * - */ -Stream* FileOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( File::HasPrototype(cx, argv[0]) ) - { - wxFile *file = File::GetPrivate(cx, argv[0], false); - // This is needed, because otherwise the file can be garbage collected. - // Another method could be to root file, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__file__", argv[0], NULL, NULL, JSPROP_READONLY); - return new Stream(new wxFileOutputStream(*file)); - } - else if ( JSVAL_IS_STRING(argv[0]) ) - { - wxString name; - FromJS(cx, argv[0], name); - return new Stream(new wxFileOutputStream(name)); - } - else if ( JSVAL_IS_INT(argv[0]) ) - { - int fd; - if ( FromJS(cx, argv[0], fd) ) - return new Stream(new wxFileOutputStream(fd)); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/filename.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/filename.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/filename.cpp (nonexistent) @@ -1,1724 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - filename.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: filename.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// filename.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/jsutil.h" - -#include "filename.h" -#include "file.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * filename - * io - * - * wxFileName encapsulates a file name. This class serves two purposes: first, it provides - * the functions to split the file names into components and to recombine these components - * in the full file name which can then be passed to the OS file functions (and wxWindows - * functions wrapping them). Second, it includes the functions for working with the files - * itself. - *

- * Remark: To change the file data you should use @wxFile class instead. - * wxFileName provides functions for working with the file attributes. - *

- * Remark: Some of the properties of wxFileName causes IO processing. For example: - * @wxFileName#accessTime will execute an IO API to retrieve the last access time - * of the file. This can result in performance issues when you use this property - * frequently. The best solution for this is to put the property in a variable and - * use that variable instead of the property: - *

- *   // Do this
- *   var fileName = new wxFileName("test.txt");
- *   var acc = fileName.accessTime;
- *   // From now on use var acc instead of fileName.accessTime
- *  
- *
- */ -WXJS_INIT_CLASS(FileName, "wxFileName", 0) - -/*** - * - * - * - * - * - * - * - * - * - * - * - * wxPathFormat is ported as a separate JavaScript object. - * Many wxFileName methods accept the path format argument which is - * wxPathFormat.NATIVE by default meaning to use the path format native for - * the current platform. - *

- * The path format affects the operation of wxFileName functions in - * several ways: first and foremost, it defines the path separator character - * to use, but it also affects other things such as whether the path has - * the drive part or not. - *
- *
- * - * Replace env vars with their values - * Squeeze all .. and . and prepend cwd - * Unix only: replace ~ and ~user - * Case insensitive => tolower - * Make the path absolute - * Make the path the long form - * Resolve if it is a shortcut (Windows only) - * - * - * wxPathNormalize is ported as a separate JavaScript object. - * The kind of normalization to do with the file name: these values can be or'd - * together to perform several operations at once in @wxFileName#normalize. - * - * - * - * Return the path with the volume (does nothing for the filename formats without volumes) - * Return the path with the trailing separator, if this flag is not given - * there will be no separator at the end of the path. - * - * wxPathGet is ported as a separate JavaScript object. - * - * - * - * Try to create each directory in the path and also don't return an error - * if the target directory already exists. - * - * wxPathMkDir is ported as a separate JavaScript object. - * - * - *
- */ -void FileName::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxPathFormatMap[] = - { - WXJS_CONSTANT(wxPATH_, NATIVE) - WXJS_CONSTANT(wxPATH_, UNIX) - WXJS_CONSTANT(wxPATH_, MAC) - WXJS_CONSTANT(wxPATH_, DOS) - WXJS_CONSTANT(wxPATH_, VMS) - WXJS_CONSTANT(wxPATH_, BEOS) - WXJS_CONSTANT(wxPATH_, WIN) - WXJS_CONSTANT(wxPATH_, OS2) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxPathFormat", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxPathFormatMap); - - JSConstDoubleSpec wxPathNormalizeMap[] = - { - WXJS_CONSTANT(wxPATH_NORM_, ENV_VARS) - WXJS_CONSTANT(wxPATH_NORM_, DOTS) - WXJS_CONSTANT(wxPATH_NORM_, TILDE) - WXJS_CONSTANT(wxPATH_NORM_, CASE) - WXJS_CONSTANT(wxPATH_NORM_, ABSOLUTE) - WXJS_CONSTANT(wxPATH_NORM_, LONG) - WXJS_CONSTANT(wxPATH_NORM_, SHORTCUT) - WXJS_CONSTANT(wxPATH_NORM_, ALL) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxPathNormalize", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxPathNormalizeMap); - - JSConstDoubleSpec wxPathGetMap[] = - { - WXJS_CONSTANT(wxPATH_GET_, VOLUME) - WXJS_CONSTANT(wxPATH_GET_, SEPARATOR) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxPathGet", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxPathGetMap); - - JSConstDoubleSpec wxPathMkdirMap[] = - { - WXJS_CONSTANT(wxPATH_MKDIR_, FULL) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxPathMkdir", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxPathMkdirMap); -} - -/*** - * - * Get/Set the current working directory. - * Get/Set the home directory. - * - * Returns the usually used path separator for the native platform. - * For all platforms but DOS and Windows there is only one path separator anyhow, - * but for DOS and Windows there are two of them. - * - * - * Gets the path separator of the native platform - * - * - * Gets the string separating the volume from the path for the native format. - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(FileName) - WXJS_STATIC_PROPERTY(P_CWD, "cwd") - WXJS_STATIC_PROPERTY(P_HOME_DIR, "homeDir") - WXJS_READONLY_STATIC_PROPERTY(P_PATH_SEPARATOR, "pathSeparator") - WXJS_READONLY_STATIC_PROPERTY(P_PATH_SEPARATORS, "pathSeparators") - WXJS_READONLY_STATIC_PROPERTY(P_VOLUME_SEPARATOR, "volumeSeparator") -WXJS_END_PROPERTY_MAP() - -bool FileName::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - switch(id) - { - case P_CWD: - *vp = ToJS(cx, wxFileName::GetCwd()); - break; - case P_HOME_DIR: - *vp = ToJS(cx, wxFileName::GetHomeDir()); - break; - case P_PATH_SEPARATOR: - *vp = ToJS(cx, wxString(wxFileName::GetPathSeparator())); - break; - case P_PATH_SEPARATORS: - *vp = ToJS(cx, wxFileName::GetPathSeparators()); - break; - case P_VOLUME_SEPARATOR: - *vp = ToJS(cx, wxFileName::GetVolumeSeparator()); - break; - } - return true; -} - -bool FileName::SetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - switch(id) - { - case P_CWD: - { - wxString cwd; - FromJS(cx, *vp, cwd); - wxFileName::SetCwd(cwd); - } - } - return JS_TRUE; -} - -/*** - * - * Get/Set the last access time - * Get/Set the creation time - * Returns the number of directories in the file name. - * Returns true when the directory exists. - * Get/Set the extension - * Returns true when the file exists. - * Get/Set the full name (including extension but without directories). - * Returns the full path with name and extension for the native platform. - * Returns true when an extension is present. - * Returns true if this object represents a directory, false otherwise (i.e. if it is a file). - * This property doesn't test whether the directory or file really exists, - * you should use @wxFileName#dirExists or @wxFileName#fileExists for this. - * Return the long form of the path (returns identity on non-Windows platforms). - * Get/Set the time the file was last modified - * - * Returns true if the filename is valid, false if it is not initialized yet. - * The assignment functions and @wxFileName#clear may reset the object to - * the uninitialized, invalid state. - * - * Return the short form of the path (returns identity on non-Windows platforms). - * - * Get/Set the volume name for this file name. - * - */ -WXJS_BEGIN_PROPERTY_MAP(FileName) - WXJS_READONLY_PROPERTY(P_DIR_COUNT, "dirCount") - WXJS_READONLY_PROPERTY(P_DIRS, "dirs") - WXJS_READONLY_PROPERTY(P_DIR_EXISTS, "dirExists") - WXJS_PROPERTY(P_EXT, "ext") - WXJS_READONLY_PROPERTY(P_FILE_EXISTS, "fileExists") - WXJS_READONLY_PROPERTY(P_FULL_NAME, "fullName") - WXJS_READONLY_PROPERTY(P_FULL_PATH, "fullPath") - WXJS_READONLY_PROPERTY(P_HAS_EXT, "hasExt") - WXJS_READONLY_PROPERTY(P_LONG_PATH, "longPath") - WXJS_PROPERTY(P_MODIFICATION_TIME, "modificationTime") - WXJS_PROPERTY(P_NAME, "name") - WXJS_READONLY_PROPERTY(P_SHORT_PATH, "shortPath") - WXJS_PROPERTY(P_ACCESS_TIME, "accessTime") - WXJS_PROPERTY(P_CREATE_TIME, "createTime") - WXJS_PROPERTY(P_VOLUME, "volume") - WXJS_READONLY_PROPERTY(P_OK, "ok") - WXJS_READONLY_PROPERTY(P_IS_DIR, "isDir") -WXJS_END_PROPERTY_MAP() - -bool FileName::GetProperty(wxFileName *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DIR_COUNT: - *vp = ToJS(cx, p->GetDirCount()); - break; - case P_DIR_EXISTS: - *vp = ToJS(cx, p->DirExists()); - break; - case P_DIRS: - *vp = ToJS(cx, p->GetDirs()); - break; - case P_EXT: - *vp = ToJS(cx, p->GetExt()); - break; - case P_FILE_EXISTS: - *vp = ToJS(cx, p->FileExists()); - break; - case P_FULL_NAME: - *vp = ToJS(cx, p->GetFullName()); - break; - case P_FULL_PATH: - *vp = ToJS(cx, p->GetFullPath()); - break; - case P_HAS_EXT: - *vp = ToJS(cx, p->HasExt()); - break; - case P_LONG_PATH: - *vp = ToJS(cx, p->GetLongPath()); - break; - case P_MODIFICATION_TIME: - *vp = ToJS(cx, p->GetModificationTime()); - break; - case P_NAME: - *vp = ToJS(cx, p->GetName()); - break; - case P_SHORT_PATH: - *vp = ToJS(cx, p->GetShortPath()); - break; - case P_ACCESS_TIME: - { - wxDateTime date; - p->GetTimes(&date, NULL, NULL); - *vp = ToJS(cx, date); - break; - } - case P_CREATE_TIME: - { - wxDateTime date; - p->GetTimes(NULL, NULL, &date); - *vp = ToJS(cx, date); - break; - } - case P_VOLUME: - *vp = ToJS(cx, p->GetVolume()); - break; - case P_OK: - *vp = ToJS(cx, p->IsOk()); - break; - case P_IS_DIR: - *vp = ToJS(cx, p->IsDir()); - break; - } - return true; -} - -bool FileName::SetProperty(wxFileName *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_EXT: - { - wxString ext; - FromJS(cx, *vp, ext); - p->SetExt(ext); - break; - } - case P_FULL_NAME: - { - wxString fullName; - FromJS(cx, *vp, fullName); - p->SetFullName(fullName); - break; - } - case P_NAME: - { - wxString name; - FromJS(cx, *vp, name); - p->SetName(name); - break; - } - case P_ACCESS_TIME: - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetTimes(&date, NULL, NULL); - break; - } - case P_CREATE_TIME: - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetTimes(NULL, NULL, &date); - break; - } - case P_MODIFICATION_TIME: - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetTimes(NULL, &date, NULL); - break; - } - case P_VOLUME: - { - wxString vol; - FromJS(cx, *vp, vol); - p->SetVolume(vol); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * A full path. When it terminates with a pathseparator, a directory path is constructed, - * otherwise a filename and extension is extracted from it. - * - * - * - * - * A directory name - * A filename - * - * - * - * A directory name - * A filename - * An extension - * - * - * - * A volume name - * A directory name - * A filename - * An extension - * - * - * - * Constructs a new wxFileName object. - * - * - */ -wxFileName* FileName::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxFileName(); - - if ( argc == 1 ) - { - if ( FileName::HasPrototype(cx, argv[0]) ) - { - return new wxFileName(*GetPrivate(cx, argv[0], false)); - } - - wxString filename; - FromJS(cx, argv[0], filename); - return new wxFileName(filename); - } - - wxFileName *p = NULL; - - // Argc > 1 - int format = wxPATH_NATIVE; - uintN stringCount = argc; - if ( JSVAL_IS_INT(argv[argc-1]) ) - { - FromJS(cx, argv[argc-1], format); - stringCount--; - } - - wxString *str = new wxString[stringCount]; - for(uintN i = 0; i < stringCount; i++) - FromJS(cx, argv[i], str[i]); - - switch(stringCount) - { - case 1: - p = new wxFileName(str[0], (wxPathFormat) format); - break; - case 2: - p = new wxFileName(str[0], str[1], (wxPathFormat) format); - break; - case 3: - p = new wxFileName(str[0], str[1], str[2], (wxPathFormat) format); - break; - case 4: - p = new wxFileName(str[0], str[1], str[2], str[3], (wxPathFormat) format); - break; - } - - delete[] str; - - return p; -} - -WXJS_BEGIN_METHOD_MAP(FileName) - WXJS_METHOD("appendDir", appendDir, 1) - WXJS_METHOD("assign", assign, 1) - WXJS_METHOD("assignDir", assignDir, 1) - WXJS_METHOD("assignHomeDir", assignHomeDir, 0) - WXJS_METHOD("assignTempFileName", assignTempFileName, 1) - WXJS_METHOD("clear", clear, 0) - WXJS_METHOD("getFullPath", getFullPath, 0) - WXJS_METHOD("getPath", getPath, 0) - WXJS_METHOD("getPathSeparator", getPathSeparator, 0) - WXJS_METHOD("getPathSeparators", getPathSeparators, 0) - WXJS_METHOD("getTimes", getTimes, 3) - WXJS_METHOD("setTimes", setTimes, 3) - WXJS_METHOD("getVolumeSeparator", getVolumeSeparator, 0) - WXJS_METHOD("insertDir", insertDir, 2) - WXJS_METHOD("isAbsolute", isAbsolute, 0) - WXJS_METHOD("isPathSeparator", isPathSeparator, 1) - WXJS_METHOD("isRelative", isRelative, 0) - WXJS_METHOD("makeRelativeTo", makeRelativeTo, 0) - WXJS_METHOD("mkdir", mkdir, 0) - WXJS_METHOD("normalize", normalize, 0) - WXJS_METHOD("prependDir", prependDir, 1) - WXJS_METHOD("removeDir", removeDir, 1) - WXJS_METHOD("removeLastDir", removeLastDir, 0) - WXJS_METHOD("rmdir", rmdir, 0) - WXJS_METHOD("sameAs", sameAs, 1) - WXJS_METHOD("setCwd", setCwd, 0) - WXJS_METHOD("touch", touch, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Appends a directory component to the path. This component - * should contain a single directory name level, i.e. not contain - * any path or volume separators nor should it be empty, otherwise the function does nothing - * - * - */ -JSBool FileName::appendDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString dir; - FromJS(cx, argv[0], dir); - p->AppendDir(dir); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * A full path. When it terminates with a pathseparator, a directory path is constructed, - * otherwise a filename and extension is extracted from it. - * - * - * - * - * A directory name - * A filename - * - * - * - * A directory name - * A filename - * An extension - * - * - * - * A volume name - * A directory name - * A filename - * An extension - * - * - * - * Creates the file name from various combinations of data. - * - * - */ -JSBool FileName::assign(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - if ( HasPrototype(cx, argv[0]) ) - { - p->Assign(*GetPrivate(cx, argv[0], false)); - return JS_TRUE; - } - - wxString filename; - FromJS(cx, argv[0], filename); - p->Assign(filename); - return JS_TRUE; - } - - // Argc > 1 - int format = wxPATH_NATIVE; - uintN stringCount = argc; - if ( JSVAL_IS_INT(argv[argc-1]) ) - { - FromJS(cx, argv[argc-1], format); - stringCount--; - } - - wxString *str = new wxString[stringCount]; - for(uintN i = 0; i < stringCount; i++) - FromJS(cx, argv[i], str[i]); - - switch(stringCount) - { - case 1: - p->Assign(str[0], (wxPathFormat) format); - break; - case 2: - p->Assign(str[0], str[1], (wxPathFormat) format); - break; - case 3: - p->Assign(str[0], str[1], str[2], (wxPathFormat) format); - break; - case 4: - p->Assign(str[0], str[1], str[2], str[3], (wxPathFormat) format); - break; - } - - delete[] str; - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Sets this file name object to the given directory name. - * The name and extension will be empty. - * - * - */ -JSBool FileName::assignDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString dir; - FromJS(cx, argv[0], dir); - - int format = wxPATH_NATIVE; - if ( argc > 1 - && ! FromJS(cx, argv[1], format) ) - return JS_FALSE; - - p->AssignDir(dir, (wxPathFormat) format); - return JS_TRUE; -} - -/*** - * - * - * - * Sets this file name object to the home directory. - * - * - */ -JSBool FileName::assignHomeDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->AssignHomeDir(); - return JS_TRUE; -} - -/*** - * - * - * - * - * Object with wil get the file pointer to the temp file. - * - * - * - * The function calls @wxFileName#createTempFileName to create - * a temporary file and sets this object to the name of the file. - * If a temporary file couldn't be created, the object is put into the invalid state. - * See also @wxFile. - *

- * The following sample shows how to create a file with a temporary filename: - *

- *    var name = new wxFileName();
- *    var file = new wxFile();
- * 
- *    name.assignTempFileName('wxjs', file);
- *    file.write('This is a test');
- *    file.close();
- *
- *    wxMessageBox('Filename: ' + name.fullPath);
- *   
- *
- *
- */ -JSBool FileName::assignTempFileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString prefix; - FromJS(cx, argv[0], prefix); - - wxFile *file = NULL; - if ( argc > 1 - && (file = File::GetPrivate(cx, argv[1])) == NULL ) - return JS_FALSE; - - p->AssignTempFileName(prefix, file); - return JS_TRUE; -} - -/*** - * - * - * Reset all components to default, uninitialized state. - * - */ -JSBool FileName::clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Clear(); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the full path with name and extension. - * - * - */ -JSBool FileName::getFullPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, p->GetFullPath((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Returns the path part of the filename (without the name or extension). - * - * - */ -JSBool FileName::getPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int flag = wxPATH_GET_VOLUME; - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], flag) ) - return JS_FALSE; - - if ( argc > 1 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, p->GetPath(flag, (wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Gets the last access, last modification and creation times. - * The last access time is updated whenever the file is read - * or written (or executed in the case of Windows), last modification - * time is only changed when the file is written to. Finally, - * the creation time is indeed the time when the file was created under - * Windows and the inode change time under Unix (as it is impossible to - * retrieve the real file creation time there anyhow) which can also be - * changed by many operations after the file creation. - *

- * Any of the arguments may be null if the corresponding time is not needed. - *
- *
- */ -JSBool FileName::getTimes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxDateTime access; - wxDateTime mod; - wxDateTime create; - - if ( p->GetTimes(&access, &mod, &create) ) - { - if ( argv[0] != JSVAL_VOID ) - { - if ( ! SetDate(cx, argv[0], access) ) - return JS_FALSE; - } - - if ( argv[1] != JSVAL_VOID ) - { - if ( ! SetDate(cx, argv[1], mod) ) - return JS_FALSE; - } - - if ( argv[2] != JSVAL_VOID ) - { - if ( ! SetDate(cx, argv[2], create) ) - return JS_FALSE; - } - *rval = JSVAL_TRUE; - } - else - *rval = JSVAL_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Sets the file creation and last access/modification times. - * Any of the arguments may be null if the corresponding time is not needed. - * - * - */ -JSBool FileName::setTimes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxDateTime acc; - wxDateTime mod; - wxDateTime create; - - if ( argv[0] == JSVAL_VOID ) - { - if ( ! FromJS(cx, argv[0], acc) ) - return JS_FALSE; - } - - if ( argv[1] != JSVAL_VOID ) - { - if ( ! FromJS(cx, argv[1], mod) ) - return JS_FALSE; - } - - if ( argv[2] != JSVAL_VOID ) - { - if ( ! FromJS(cx, argv[2], create) ) - return JS_FALSE; - } - - *rval = ToJS(cx, p->SetTimes(acc.IsValid() ? &acc : NULL, - mod.IsValid() ? &mod : NULL, - create.IsValid() ? &create : NULL)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Inserts a directory before the zero-based position in the directory list. - * - * - */ -JSBool FileName::insertDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - wxString dir; - - if ( FromJS(cx, argv[0], pos) - && FromJS(cx, argv[1], dir) ) - p->InsertDir(pos, dir); - else - return JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if this filename is absolute. - * - * - */ -JSBool FileName::isAbsolute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, p->IsAbsolute((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if this filename is not absolute. - * - * - */ -JSBool FileName::isRelative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, p->IsRelative((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * The directory to use as root. When not given, the current directory is used. - * - * - * - * - * This function tries to put this file name in a form relative to Base. - * In other words, it returns the file name which should be used to access - * this file if the current directory were Base. - *

- * Returns true if the file name has been changed, false if we failed to do anything - * with it (currently this only happens if the file name is on a volume different from - * the volume specified by Base). - *
- *
- */ -JSBool FileName::makeRelativeTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString base = wxEmptyString; - int format = wxPATH_NATIVE; - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], format) ) - return JS_FALSE; - // Fall through - case 1: - FromJS(cx, argv[0], base); - } - - *rval = ToJS(cx, p->MakeRelativeTo(base, (wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * Permission for the directory - * - * Default is 0. If the flags contain wxPathMkdir.FULL flag, - * try to create each directory in the path and also don't return - * an error if the target directory already exists. - * - * - * - * Creates a directory. Returns true on success. - * - * - */ -JSBool FileName::mkdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int perm = 777; - int flag = 0; - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], flag) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[1], perm) ) - return JS_FALSE; - } - - *rval = ToJS(cx, p->Mkdir(perm, flag)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Normalize the path: with the default flags value, the path will be made absolute, - * without any ".." and "." and all environment variables will be expanded in it this - * may be done using another (than current) value of cwd. - * - * - */ -JSBool FileName::normalize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString cwd = wxEmptyString; - int format = wxPATH_NATIVE; - int flag = wxPATH_NORM_ALL; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], format) ) - return JS_FALSE; - // Fall through - case 2: - FromJS(cx, argv[1], cwd); - // Fall through - case 1: - // Fall through - if ( ! FromJS(cx, argv[0], flag) ) - return JS_FALSE; - case 0: - *rval = ToJS(cx, p->Normalize(flag, cwd, (wxPathFormat) format)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Prepends a directory name. - * - * - */ -JSBool FileName::prependDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString dir; - - FromJS(cx, argv[1], dir); - p->PrependDir(dir); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Removes a directory name. - * - * - */ -JSBool FileName::removeDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - - if ( FromJS(cx, argv[0], pos) ) - p->RemoveDir(pos); - else - return JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * Removes the last directory component from the path. - * - * - */ -JSBool FileName::removeLastDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->RemoveLastDir(); - - return JS_TRUE; -} - -/*** - * - * - * - * Deletes the directory from the file system. - * - * - */ -JSBool FileName::rmdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Rmdir(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Compares the filename using the rules of the format. - * - * - */ -JSBool FileName::sameAs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxFileName *compareTo = GetPrivate(cx, argv[0]); - if ( compareTo == NULL ) - return JS_FALSE; - - int format = wxPATH_NATIVE; - if ( argc > 1 - && ! FromJS(cx, argv[1], format) ) - return JS_FALSE; - - *rval = ToJS(cx, p->SameAs(*compareTo, (wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * Set this to the current directory. - * - * - */ -JSBool FileName::setCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->SetCwd(); - - return JS_TRUE; -} - -/*** - * - * - * - * Sets the access and modification times to the current moment. - * - * - */ -JSBool FileName::touch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Touch(); - - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(FileName) - WXJS_METHOD("assignCwd", assignCwd, 0) - WXJS_METHOD("createTempFileName", createTempFileName, 2) - WXJS_METHOD("dirExists", dirExists, 1) - WXJS_METHOD("dirName", dirName, 1) - WXJS_METHOD("fileExists", fileExists, 1) - WXJS_METHOD("fileName", fileName, 1) - WXJS_METHOD("getCwd", getCwd, 0) - WXJS_METHOD("getFormat", getFormat, 0) - WXJS_METHOD("mkdir", smkdir, 1) - WXJS_METHOD("rmdir", srmdir, 1) - WXJS_METHOD("splitPath", splitPath, 1) - WXJS_METHOD("getPathSeparator", getPathSeparator, 0) - WXJS_METHOD("getPathSeparators", getPathSeparators, 0) - WXJS_METHOD("getVolumeSeparator", getVolumeSeparator, 0) - WXJS_METHOD("isCaseSensitive", isAbsolute, 0) - WXJS_METHOD("isPathSeparator", isPathSeparator, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Makes this object refer to the current working directory on the - * specified volume (or current volume if volume is not specified). - * - * - */ -JSBool FileName::assignCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFileName *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString volume = wxEmptyString; - if ( argc > 0 ) - FromJS(cx, argv[0], volume); - - p->AssignCwd(volume); - return JS_TRUE; -} - -/*** - * - * - * - * - * Object which wil get the file pointer to the temp file. - * - * - * - * Returns a temporary file name starting with the given prefix. - * If the prefix is an absolute path, the temporary file is created - * in this directory, otherwise it is created in the default system - * directory for the temporary files or in the current directory. - *

- * If the function succeeds, the temporary file is actually created. - * When File is not omitted, this file will be opened using the name - * of the temporary file. When possible, this is done in an atomic way ensuring - * that no race condition occurs between the temporary file name generation and - * opening it which could often lead to security compromise on the multiuser systems. - * If file is omitted, the file is only created, but not opened. - *

- * Under Unix, the temporary file will have read and write permissions for the owner - * only to minimize the security problems. - *
- *
- */ -JSBool FileName::createTempFileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString prefix; - FromJS(cx, argv[0], prefix); - - wxFile *file = NULL; - if ( argc > 1 - && (file = File::GetPrivate(cx, argv[1])) == NULL ) - return JS_FALSE; - - wxFileName::CreateTempFileName(prefix, file); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true when the directory exists. - * - * - */ -JSBool FileName::dirExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - FromJS(cx, argv[0], dir); - - *rval = ToJS(cx, wxFileName::DirExists(dir)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Creates a new wxFileName object based on the given directory. - * - * - */ -JSBool FileName::dirName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - FromJS(cx, argv[0], dir); - - *rval = CreateObject(cx, new wxFileName(wxFileName::DirName(dir))); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true when the file exists. - * - * - */ -JSBool FileName::fileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file; - FromJS(cx, argv[0], file); - - *rval = ToJS(cx, wxFileName::FileExists(file)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Creates a new wxFileName object based on the given file. - * - * - */ -JSBool FileName::fileName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString file; - FromJS(cx, argv[0], file); - - *rval = CreateObject(cx, new wxFileName(wxFileName::FileName(file))); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Retrieves the value of the current working directory on the specified volume. - * When the volume is omitted, the programs current working directory is returned - * for the current volume. - * - * - */ -JSBool FileName::getCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString vol = wxEmptyString; - if ( argc > 0 ) - FromJS(cx, argv[0], vol); - - *rval = ToJS(cx, wxFileName::GetCwd(vol)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the canonical path format for this platform. - * - * - */ -JSBool FileName::getFormat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int format = wxPATH_NATIVE; - if ( argc > 0 ) - FromJS(cx, argv[0], format); - - *rval = ToJS(cx, wxFileName::GetFormat((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the usually used path separator for this format. - * For all formats but wxPathFormat.DOS there is only one path - * separator anyhow, but for DOS there are two of them and the - * native one, i.e. the backslash is returned by this method. - * - * - */ -JSBool FileName::getPathSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, wxString(wxFileName::GetPathSeparator((wxPathFormat) format))); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the string containing all the path separators for this format. - * For all formats but wxPathFormat.DOS this string contains only one character - * but for DOS and Windows both '/' and '\' may be used as separators. - * - * - */ -JSBool FileName::getPathSeparators(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, wxFileName::GetPathSeparators((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the string separating the volume from the path for this format. - * - * - */ -JSBool FileName::getVolumeSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, wxString(wxFileName::GetVolumeSeparator((wxPathFormat) format))); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true if filenames for the given format are case-sensitive. - * - * - */ -JSBool FileName::isCaseSensitive(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int format = wxPATH_NATIVE; - if ( argc > 0 - && ! FromJS(cx, argv[0], format) ) - return JS_FALSE; - - *rval = ToJS(cx, wxFileName::IsCaseSensitive((wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * A path separator - * - * - * - * Returns true if the given string (only the first character is checked!) - * is a separator on the format. - * - * - */ -JSBool FileName::isPathSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString sep; - FromJS(cx, argv[0], sep); - if ( sep.Length() == 0 ) - return JS_TRUE; - - int format = wxPATH_NATIVE; - if ( argc > 1 - && ! FromJS(cx, argv[1], format) ) - return JS_FALSE; - - *rval = ToJS(cx, wxFileName::IsPathSeparator(sep[0], (wxPathFormat) format)); - return JS_TRUE; -} - -/*** - * - * - * Name of the directory - * Permissions - * - * Default is 0. If the flags contain wxPathMkdir.FULL flag, - * try to create each directory in the path and also don't return - * an error if the target directory already exists. - * - * - * - * Creates a directory. Returns true on success. - * - * - */ -JSBool FileName::smkdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc > 3 ) - argc = 3; - - wxString dir; - int perm = 777; - int flag = 0; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], perm) ) - return JS_FALSE; - default: - FromJS(cx, argv[0], dir); - *rval = ToJS(cx, wxFileName::Mkdir(dir, perm, flag)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Deletes the directory from the file system. - * - * - */ -JSBool FileName::srmdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString dir; - FromJS(cx, argv[0], dir); - wxFileName::Rmdir(dir); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * This function splits a full file name into components: the volume, path, - * the base name and the extension. - *

Remark: In wxWindows the arguments are passed as - * pointers. Because this is not possible in JavaScript, wxJS returns an array containing - * the parts of the path. - *

- * The following code illustrates how splitPath works in JavaScript. parts[0] contains "C", - * parts[1] contains "\\", parts[2] contains "Temp" and parts[3] is empty. - *

- *    var parts = wxFileName.splitPath("C:\\Temp");
- *    for(element in parts)
- *    {
- *      ...
- *    }
- *    
- *
- *
- */ -JSBool FileName::splitPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString path; - FromJS(cx, argv[0], path); - - int format = wxPATH_NATIVE; - if ( argc > 1 - && ! FromJS(cx, argv[1], format) ) - return JS_FALSE; - - wxString parts[4]; - wxFileName::SplitPath(path, &parts[0], &parts[1], &parts[2], &parts[3], (wxPathFormat) format); - - JSObject *objArray = JS_NewArrayObject(cx, 4, NULL); - *rval = OBJECT_TO_JSVAL(objArray); - for(int i = 0; i < 4; i++) - { - jsval element = ToJS(cx, parts[i]); - JS_SetElement(cx, objArray, i, &element); - } - - return JS_TRUE; -} - -bool FileName::SetDate(JSContext *cx, jsval v, const wxDateTime &date) -{ - if ( JSVAL_IS_OBJECT(v) ) - { - JSObject *obj = JSVAL_TO_OBJECT(v); - if ( js_DateIsValid(cx, obj) ) - { - js_DateSetYear(cx, obj, date.GetYear()); - js_DateSetMonth(cx, obj, date.GetMonth()); - js_DateSetDate(cx, obj, date.GetDay()); - js_DateSetHours(cx, obj, date.GetHour()); - js_DateSetMinutes(cx, obj, date.GetMinute()); - js_DateSetSeconds(cx, obj, date.GetSecond()); - return true; - } - } - return false; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/filename.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffistream.cpp (nonexistent) @@ -1,86 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ffistream.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: ffistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "wx/wfstream.h" -#include "../common/main.h" - -#include "ffile.h" -#include "stream.h" -#include "ffistream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ffistream - * io - * - * This class represents data read in from a file. There are actually two such groups of classes: - * this one is based on @wxFFile whereas @wxFileInputStream is based on the @wxFile class. - * - */ -WXJS_INIT_CLASS(FFileInputStream, "wxFFileInputStream", 1) - -/*** - * - * - * The name of a file - * - * - * - * - * - * A file descriptor - * - * - * Constructs a new wxFFileInputStream object. A wxFFileInputStream is always opened in read-only mode. - * - * - */ -Stream* FFileInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( FFile::HasPrototype(cx, argv[0]) ) - { - wxFFile *file = FFile::GetPrivate(cx, argv[0], false); - // This is needed, because otherwise the file can be garbage collected. - // Another method could be to root ffile, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__ffile__", argv[0], NULL, NULL, JSPROP_READONLY); - - return new Stream(new wxFFileInputStream(*file)); - } - else if ( JSVAL_IS_STRING(argv[0]) ) - { - wxString name; - FromJS(cx, argv[0], name); - return new Stream(new wxFFileInputStream(name)); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/costream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/costream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/costream.h (nonexistent) @@ -1,39 +0,0 @@ -/* - * wxJavaScript - costream.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: costream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_costream_h -#define wxjs_io_costream_h - -namespace wxjs -{ - namespace io - { - class CountingOutputStream : public ApiWrapper - { - public: - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_costream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/costream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/main.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/main.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/main.cpp (nonexistent) @@ -1,88 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - main.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: main.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// main.cpp -#ifdef __WXMSW__ - #include - #include -#endif -#include - -#include "../common/main.h" -#include "../common/wxjs.h" -#include "init.h" - -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) - { - BOOL result = TRUE; - - switch(fdwReason) - { - 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; - } - - return result; - } -#endif - -WXJSAPI bool wxJS_InitClass(JSContext *cx, JSObject *global) -{ - return InitClass(cx, global); -} - -WXJSAPI bool wxJS_InitObject(JSContext *cx, JSObject *global) -{ - return InitObject(cx, global); -} - -WXJSAPI void wxJS_Destroy() -{ - Destroy(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/main.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/http.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/http.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/http.h (nonexistent) @@ -1,53 +0,0 @@ -/* - * wxJavaScript - http.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: http.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_http_h -#define _wxjs_io_http_h - -#include - -namespace wxjs -{ - namespace io - { - class SocketBasePrivate; - - class HTTP : public ApiWrapper - { - public: - - static SocketBasePrivate *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, SocketBasePrivate *p); - static bool GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_RESPONSE = WXJS_START_PROPERTY_ID - , P_HEADERS - }; - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_http_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/http.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ffostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ffostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ffostream.cpp (nonexistent) @@ -1,83 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ffostream.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: ffostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "wx/wfstream.h" - -#include "../common/main.h" - -#include "ffile.h" -#include "stream.h" -#include "ffostream.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * ffostream - * io - * - * This class represents data written to a file. There are actually two such groups of classes: - * this one is based on @wxFFile whereas @wxFileOutputStream is based on the @wxFile class. - * - */ -WXJS_INIT_CLASS(FFileOutputStream, "wxFFileOutputStream", 1) - -/*** - * - * - * The name of a file - * - * - * - * - * - * Constructs a new wxFFileOutputStream object. A wxFFileOutputStream is always opened in write-only mode. - * - * - */ -Stream* FFileOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( FFile::HasPrototype(cx, argv[0]) ) - { - wxFFile *file = FFile::GetPrivate(cx, argv[0], false); - // This is needed, because otherwise the file can be garbage collected. - // Another method could be to root ffile, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__ffile__", argv[0], NULL, NULL, JSPROP_READONLY); - return new Stream(new wxFFileOutputStream(*file)); - } - else if ( JSVAL_IS_STRING(argv[0]) ) - { - wxString name; - FromJS(cx, argv[0], name); - return new Stream(new wxFFileOutputStream(name)); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ffostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sound.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sound.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sound.cpp (nonexistent) @@ -1,179 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sound.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: sound.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "sound.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * sound - * io - * - * This class represents a short sound (loaded from Windows WAV file), that can be stored in memory and played. - * - */ -WXJS_INIT_CLASS(Sound, "wxSound", 0) - -/*** - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Sound) - WXJS_CONSTANT(wxSOUND_, SYNC) - WXJS_CONSTANT(wxSOUND_, ASYNC) - WXJS_CONSTANT(wxSOUND_, LOOP) -WXJS_END_CONSTANT_MAP() - -WXJS_BEGIN_STATIC_METHOD_MAP(Sound) - WXJS_METHOD("stop", stop, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Stops the sound - * - * - */ -JSBool Sound::stop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSound::Stop(); - return JS_TRUE; -} - -/*** - * - * - * - * The name of the soundfile. - * - * - * Constructs a new wxSound object. When no argument is specified, use @wxSound#create - * afterwards. - * - * - */ -wxSound* Sound::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxSound(); - - if ( argc == 1 ) - { - wxString f; - FromJS(cx, argv[0], f); - return new wxSound(f); - } - - return NULL; -} - -/*** - * - * - * Returns true when the soundfile is successfully loaded. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Sound) - WXJS_READONLY_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -bool Sound::GetProperty(wxSound *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_OK ) - *vp = ToJS(cx, p->IsOk()); - return true; -} - -WXJS_BEGIN_METHOD_MAP(Sound) - WXJS_METHOD("play", play, 0) - WXJS_METHOD("create", create, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The name of the soundfile - * - * - * Constructs a sound object. - * - * - */ -JSBool Sound::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSound *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString file; - FromJS(cx, argv[0], file); - *rval = ToJS(cx, p->Create(file)); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Plays the sound. - * - * - */ -JSBool Sound::play(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSound *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int flag = wxSOUND_ASYNC; - if ( argc > 0 ) - { - if ( ! FromJS(cx, argv[0], flag) ) - return JS_FALSE; - } - *rval = ToJS(cx, p->Play((unsigned int) flag)); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sound.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zipentry.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zipentry.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zipentry.h (nonexistent) @@ -1,71 +0,0 @@ -/* - * wxJavaScript - zipentry.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: zipentry.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_zipentry_h -#define wxjs_io_zipentry_h - -#include - -namespace wxjs -{ - namespace io - { - class ZipEntry : public ApiWrapper - { - public: - - static wxZipEntry* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - /** - * Callback for retrieving properties - */ - static bool GetProperty(wxZipEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxZipEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_COMMENT - , P_COMPRESSED_SIZE - , P_CRC - , P_EXTERNAL_ATTR - , P_EXTRA - , P_FLAGS - , P_LOCAL_EXTRA - , P_MODE - , P_METHOD - , P_SYSTEM_MADE_BY - , P_MADE_BY_UNIX - , P_TEXT - }; - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_zipentry_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zipentry.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/io_init.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/io_init.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/io_init.cpp (nonexistent) @@ -1,333 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - init.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: init.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// main.cpp -#include - -#include "../common/main.h" -#include "init.h" -#include "../common/index.h" -#include "../common/jsutil.h" - -#include "constant.h" -#include "file.h" -#include "ffile.h" -#include "dir.h" -#include "dirtrav.h" -#include "stream.h" -#include "istream.h" -#include "ostream.h" -#include "fistream.h" -#include "fostream.h" -#include "ffistream.h" -#include "ffostream.h" -#include "costream.h" -#include "mistream.h" -#include "mostream.h" -#include "bostream.h" -#include "bistream.h" -#include "tistream.h" -#include "tostream.h" -#include "filename.h" -#include "aistream.h" -#include "archentry.h" -#include "zipentry.h" -#include "zistream.h" -#include "aostream.h" -#include "zostream.h" -#include "tempfile.h" -#include "textfile.h" -#include "textline.h" -#include "distream.h" -#include "dostream.h" -#include "sockaddr.h" -#include "sockbase.h" -#include "sockclient.h" -#include "socksrv.h" -#include "sostream.h" -#include "sistream.h" -#include "ipaddr.h" -#include "ipv4addr.h" -#include "protocol.h" -#include "uri.h" -#include "url.h" -#include "http.h" -#include "httphdr.h" -#include "sound.h" -#include "fn.h" -#include "process.h" - -using namespace wxjs; - -bool io::InitClass(JSContext *cx, JSObject *global) -{ - InitConstants(cx, global); - - JSObject *obj = File::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxFile prototype creation failed")); - if (! obj ) - return false; - - obj = FFile::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxFFile prototype creation failed")); - if (! obj ) - return false; - - obj = TempFile::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxTempFile prototype creation failed")); - if (! obj ) - return false; - - obj = Dir::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxDir prototype creation failed")); - if (! obj ) - return false; - - obj = DirTraverser::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxDirTraverser prototype creation failed")); - if (! obj ) - return false; - - obj = StreamBase::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxStreamBase prototype creation failed")); - if (! obj ) - return false; - - obj = InputStream::JSInit(cx, global, StreamBase::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = BufferedInputStream::JSInit(cx, global, InputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxBufferedInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = OutputStream::JSInit(cx, global, StreamBase::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = BufferedOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxBufferedOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = CountingOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCountingOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = FileInputStream::JSInit(cx, global, InputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFileInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = FileOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFileOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = MemoryInputStream::JSInit(cx, global, InputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxMemoryInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = MemoryOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxMemoryOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = TextInputStream::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTextInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = TextOutputStream::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTextOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = FileName::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFileName prototype creation failed")); - if (! obj ) - return false; - - obj = ArchiveInputStream::JSInit(cx, global, InputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxArchiveInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = ArchiveOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxArchiveOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = ArchiveEntry::JSInit(cx, global, NULL); - wxASSERT_MSG(obj != NULL, wxT("wxArchiveEntry prototype creation failed")); - if (! obj ) - return false; - - obj = ZipEntry::JSInit(cx, global, ArchiveEntry::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxZipEntry prototype creation failed")); - if (! obj ) - return false; - - obj = ZipInputStream::JSInit(cx, global, ArchiveInputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxZipInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = ZipOutputStream::JSInit(cx, global, ArchiveOutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxZipOutputStream")); - if (! obj ) - return false; - - obj = TextFile::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTextFile")); - if (! obj ) - return false; - - obj = TextLine::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTextLine")); - if (! obj ) - return false; - - obj = DataInputStream::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxDataInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = DataOutputStream::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxDataOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = SocketBase::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxSocketBase prototype creation failed")); - if (! obj ) - return false; - - obj = SockAddress::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxSocketAddr prototype creation failed")); - if (! obj ) - return false; - - obj = SocketClient::JSInit(cx, global, SocketBase::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSocketClient prototype creation failed")); - if (! obj ) - return false; - - obj = SocketServer::JSInit(cx, global, SocketBase::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSocketServer prototype creation failed")); - if (! obj ) - return false; - - obj = SocketInputStream::JSInit(cx, global, InputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSocketInputStream prototype creation failed")); - if (! obj ) - return false; - - obj = SocketOutputStream::JSInit(cx, global, OutputStream::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSocketOutputStream prototype creation failed")); - if (! obj ) - return false; - - obj = IPaddress::JSInit(cx, global, SockAddress::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxIPaddress prototype creation failed")); - if (! obj ) - return false; - - obj = IPV4address::JSInit(cx, global, IPaddress::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxIPV4address prototype creation failed")); - if (! obj ) - return false; - - obj = Protocol::JSInit(cx, global, SocketClient::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxProtocol prototype creation failed")); - if (! obj ) - return false; - - obj = URI::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxURI prototype creation failed")); - if (! obj ) - return false; - - obj = HTTP::JSInit(cx, global, Protocol::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxHTTP prototype creation failed")); - if (! obj ) - return false; - - obj = HTTPHeader::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxHTTPHeader prototype creation failed")); - if (! obj ) - return false; - - obj = URL::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxURL prototype creation failed")); - if (! obj ) - return false; - - obj = Sound::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxSound prototype creation failed")); - if (! obj ) - return false; - - obj = Process::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxProcess prototype creation failed")); - if (! obj ) - return false; - - JS_DefineFunction(cx, global, "wxConcatFiles", concatFiles, 3, 0); - JS_DefineFunction(cx, global, "wxCopyFile", copyFile, 2, 0); - JS_DefineFunction(cx, global, "wxFileExists", fileExists, 1, 0); - JS_DefineFunction(cx, global, "wxRenameFile", renameFile, 2, 0); - JS_DefineFunction(cx, global, "wxGetCwd", getCwd, 0, 0); - JS_DefineFunction(cx, global, "wxGetFreeDiskSpace", getFreeDiskSpace, 1, 0); - JS_DefineFunction(cx, global, "wxGetTotalDiskSpace", getTotalDiskSpace, 1, 0); - JS_DefineFunction(cx, global, "wxGetOSDirectory", getOSDirectory, 0, 0); - JS_DefineFunction(cx, global, "wxIsAbsolutePath", isAbsolutePath, 1, 0); - JS_DefineFunction(cx, global, "wxIsWild", isWild, 1, 0); - JS_DefineFunction(cx, global, "wxDirExists", dirExists, 1, 0); - JS_DefineFunction(cx, global, "wxMatchWild", matchWild, 3, 0); - JS_DefineFunction(cx, global, "wxMkDir", mkDir, 2, 0); - JS_DefineFunction(cx, global, "wxRemoveFile", removeFile, 1, 0); - JS_DefineFunction(cx, global, "wxRmDir", rmDir, 1, 0); - JS_DefineFunction(cx, global, "wxSetWorkingDirectory", setWorkingDirectory, 1, 0); - JS_DefineFunction(cx, global, "wxExecute", execute, 1, 0); - JS_DefineFunction(cx, global, "wxShell", shell, 1, 0); - - return true; -} - -bool io::InitObject(JSContext *cx, JSObject *obj) -{ - return true; -} - -void io::Destroy() -{ -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/io_init.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockbase.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockbase.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockbase.cpp (nonexistent) @@ -1,816 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sockbase.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: sockbase.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// file.cpp -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" -#include "sockbase.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * sockbase - * io - * - * wxSocketBase is the property class for all socket-related objects, - * and it defines all basic IO functionality. - * - */ -WXJS_INIT_CLASS(SocketBase, "wxSocketBase", 0) - -/*** - * - * - * No error happened. - * Invalid operation. - * Input/Output error. - * Invalid address. - * Invalid socket (uninitialized). - * No corresponding host. - * Invalid port. - * The socket is non-blocking and the operation would block. - * The timeout for this operation expired. - * Memory exhausted. - * - * wxSocketError is ported to JavaScript as a separate class. Note that this - * class doesn't exist in wxWidgets. - * - * - * - * There is data available for reading. - * The socket is ready to be written to. - * Incoming connection request (server), or successful connection establishment (client). - * The connection has been closed. - * - * wxSocketEventType is ported to JavaScript as a separate class. Note that this - * class doesn't exist in wxWidgets. - * - * - * - * Normal functionality. - * Read/write as much data as possible and return immediately. - * Wait for all required data to be read/written unless an error occurs. - * Block the GUI (do not yield) while reading/writing data. - * Allows the use of an in-use port (wxServerSocket only) - * - * wxSocketFlags is ported to JavaScript as a separate class. Note that this - * class doesn't exist in wxWidgets. - * - * - * - */ -void SocketBase::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxSocketErrorMap[] = - { - WXJS_CONSTANT(wxSOCKET_, NOERROR) - WXJS_CONSTANT(wxSOCKET_, INVOP) - WXJS_CONSTANT(wxSOCKET_, IOERR) - WXJS_CONSTANT(wxSOCKET_, INVADDR) - WXJS_CONSTANT(wxSOCKET_, INVSOCK) - WXJS_CONSTANT(wxSOCKET_, NOHOST) - WXJS_CONSTANT(wxSOCKET_, INVPORT) - WXJS_CONSTANT(wxSOCKET_, WOULDBLOCK) - WXJS_CONSTANT(wxSOCKET_, TIMEDOUT) - WXJS_CONSTANT(wxSOCKET_, MEMERR) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxSocketError", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSocketErrorMap); - - JSConstDoubleSpec wxSocketEventTypeMap[] = - { - WXJS_CONSTANT(wxSOCKET_, INPUT) - WXJS_CONSTANT(wxSOCKET_, OUTPUT) - WXJS_CONSTANT(wxSOCKET_, CONNECTION) - WXJS_CONSTANT(wxSOCKET_, LOST) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxSocketEventType", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSocketEventTypeMap); - - JSConstDoubleSpec wxSocketFlagMap[] = - { - WXJS_CONSTANT(wxSOCKET_, NONE) - WXJS_CONSTANT(wxSOCKET_, NOWAIT) - WXJS_CONSTANT(wxSOCKET_, WAITALL) - WXJS_CONSTANT(wxSOCKET_, BLOCK) - WXJS_CONSTANT(wxSOCKET_, REUSEADDR) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxSocketFlags", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSocketFlagMap); -} - -/*** - * - * - * Returns true if the socket is connected. - * - * - * This property waits until the socket is readable. This might mean that queued data - * is available for reading or, for streamed sockets, that the connection has been closed, - * so that a read operation will complete immediately without blocking - * (unless the wxSocketFlags.WAITALL flag is set, in which case the operation might still block). - * - * - * Returns true if the socket is disconnected. - * - * - * Returns true if an error occurred in the last IO operation. - * - * - * Returns the number of bytes read or written by the last IO call - * - * - * Returns the last wxSocket error. - * Please note that this property merely returns the last error code, but it should not - * be used to determine if an error has occurred (this is because successful operations - * do not change the lastError value). Use @wxSocketBase#error first, in order to determine - * if the last IO call failed. If this returns true, use lastError to discover the cause of the error. - * - * - * Returns true if the socket is initialized and ready and false in other cases. - *
Remark/Warning:
- * For @wxSocketClient, ok won't return true unless the client is connected to a server. - * For @wxSocketServer, ok will return true if the server could bind to the specified - * address and is already listening for new connections. - * ok does not check for IO errors; use @wxSocketBase#error instead for that purpose. - *
- *
- */ -WXJS_BEGIN_PROPERTY_MAP(SocketBase) - WXJS_READONLY_PROPERTY(P_CONNECTED, "connected") - WXJS_READONLY_PROPERTY(P_DATA, "data") - WXJS_READONLY_PROPERTY(P_DISCONNECTED, "disconnected") - WXJS_READONLY_PROPERTY(P_ERROR, "error") - WXJS_READONLY_PROPERTY(P_LASTCOUNT, "lastCount") - WXJS_READONLY_PROPERTY(P_LASTCOUNT, "lastError") - WXJS_READONLY_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -bool SocketBase::GetProperty(SocketBasePrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_CONNECTED: - *vp = ToJS(cx, p->GetBase()->IsConnected()); - break; - case P_DATA: - *vp = ToJS(cx, p->GetBase()->IsData()); - break; - case P_DISCONNECTED: - *vp = ToJS(cx, p->GetBase()->IsDisconnected()); - break; - case P_ERROR: - *vp = ToJS(cx, p->GetBase()->Error()); - break; - case P_LASTCOUNT: - { - long count = p->GetBase()->LastCount(); - *vp = ToJS(cx, count); - break; - } - case P_LASTERROR: - { - int error = p->GetBase()->LastError(); - *vp = ToJS(cx, error); - break; - } - case P_OK: - *vp = ToJS(cx, p->GetBase()->Ok()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(SocketBase) - WXJS_METHOD("close", close, 0) - WXJS_METHOD("discard", discard, 0) - WXJS_METHOD("interruptWait", interruptWait, 0) - WXJS_METHOD("notify", notify, 1) - WXJS_METHOD("peek", peek, 1) - WXJS_METHOD("read", read, 1) - WXJS_METHOD("readMsg", readMsg, 1) - WXJS_METHOD("restoreState", restoreState, 0) - WXJS_METHOD("saveState", saveState, 0) - WXJS_METHOD("setTimeout", setTimeout, 1) - WXJS_METHOD("unread", unread, 1) - WXJS_METHOD("wait", wait, 0) - WXJS_METHOD("waitForLost", waitForLost, 0) - WXJS_METHOD("waitForRead", waitForRead, 0) - WXJS_METHOD("waitForWrite", waitForWrite, 0) - WXJS_METHOD("write", write, 1) - WXJS_METHOD("writeMsg", writeMsg, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * This function shuts down the socket, disabling further transmission and reception of data; - * it also disables events for the socket and frees the associated system resources. - * Upon socket destruction, close is automatically called, so in most cases you won't need to - * do it yourself, unless you explicitly want to shut down the socket, typically to notify - * the peer that you are closing the connection. - *

- * Remark/Warning: Although close immediately disables events for the socket, - * it is possible that event messages may be waiting in the application's event queue. - * The application must therefore be prepared to handle socket event messages even after calling close. - *
- *
- */ -JSBool SocketBase::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->GetBase()->Close(); - - return JS_TRUE; -} - -/*** - * - * - * - * This function simply deletes all bytes in the incoming queue. - * This function always returns immediately and its operation is not affected by IO flags. - * Use @wxSocketBase#lastCount to verify the number of bytes actually discarded. - * If you use @wxSocketBase#error, it will always return false. - * - * - */ -JSBool SocketBase::discard(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->GetBase()->Discard(); - - return JS_TRUE; -} - -/*** - * - * - * - * Use this method to interrupt any wait operation currently in progress. Note that this is not intended - * as a regular way to interrupt a @wxSocketBase#wait call, but only as an escape mechanism for - * exceptional situations where it is absolutely necessary to use it, for example to abort - * an operation due to some exception or abnormal problem. InterruptWait is automatically called when - * you @wxSocketBase#close a socket (and thus also upon socket destruction), so you don't need - * to use it in these cases. - * - * - */ -JSBool SocketBase::interruptWait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->GetBase()->InterruptWait(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * According to the Flag value, this function enables or disables socket events. - * If Flag is true, the events configured with @wxSocketBase#setNotify will be sent - * to the application. If Flag is false; no events will be sent. - * - * - */ -JSBool SocketBase::notify(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool notify; - if ( FromJS(cx, argv[0], notify) ) - { - p->GetBase()->Notify(notify); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * This function peeks a buffer (with the given size of the buffer) from the socket. - * Peeking a buffer doesn't delete it from the socket input queue. - * Use @wxSocketBase#lastCount to verify the number of bytes actually peeked. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - *

- * Remark/Warning: The exact behaviour of peek depends on the combination - * of flags being used. - *
- *
- */ -JSBool SocketBase::peek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - p->GetBase()->Peek(buffer->GetData(), buffer->GetBufSize()); - - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * This function reads a buffer (with the given size of the buffer) from the socket. - * Use @wxSocketBase#lastCount to verify the number of bytes actually read. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - *

- * Remark/Warning: The exact behaviour of read depends on the combination - * of flags being used. - *
- *
- */ -JSBool SocketBase::read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - p->GetBase()->Read(buffer->GetData(), buffer->GetBufSize()); - - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * This method reads a buffer sent by @wxSocketBase#writeMsg on a socket. - * If the buffer passed to the function isn't big enough, the remaining bytes - * will be discarded. This function always waits for the buffer to be entirely filled, - * unless an error occurs. - * Use @wxSocketBase#lastCount to verify the number of bytes actually read. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - *

- * Remark/Warning: readMsg will behave as if the wxSocketFlag.WAITALL flag was always - * set and it will always ignore the wxSocketFlag.NOWAIT flag. - *
- *
- */ -JSBool SocketBase::readMsg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - p->GetBase()->ReadMsg(buffer->GetData(), buffer->GetBufSize()); - - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * This function unreads a buffer. That is, the data in the buffer is put back in the incoming queue. - * This function is not affected by wxSocketFlag. - * Use @wxSocketBase#lastCount to verify the number of bytes actually read. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - * - * - */ -JSBool SocketBase::unread(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - p->GetBase()->Unread(buffer->GetData(), buffer->GetDataLen()); - - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * This function restores the previous state of the socket, as saved with @wxSocketBase#saveState. - * Calls to saveState and restoreState can be nested. - * - * - */ -JSBool SocketBase::restoreState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->GetBase()->RestoreState(); - - return JS_TRUE; -} - -/*** - * - * - * - * This method saves the current state of the socket in a stack. - * Socket state includes flags, as set with @wxSocketBase#flags, - * event mask, as set with @wxSocketBase#setNotify and @wxSocketBase#notify, - * user data, as set with @wxSocketBase#clientData. - * Calls to saveState and restoreState can be nested. - * - * - */ -JSBool SocketBase::saveState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->GetBase()->SaveState(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * This function sets the default socket timeout in seconds. - * This timeout applies to all IO calls, and also to the Wait - * family of functions if you don't specify a wait interval. Initially, - * the default timeout is 10 minutes. - * - * - */ -JSBool SocketBase::setTimeout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs; - if ( FromJS(cx, argv[0], secs) ) - { - p->GetBase()->SetTimeout(secs); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * This function waits until any of the following conditions is true: - *
    - *
  • The socket becomes readable.
  • - *
  • The socket becomes writable.
  • - *
  • An ongoing connection request has completed (@wxSocketClient only)
  • - *
  • An incoming connection request has arrived (@wxSocketServer only)
  • - *
  • The connection has been closed.
  • - *
- * Note that it is recommended to use the individual wait functions to wait for - * the required condition, instead of this one. - *
Returns true when any of the above conditions is satisfied, false if the timeout was reached. - *
- *
- */ -JSBool SocketBase::wait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - *rval = ToJS(cx, p->GetBase()->Wait(secs, ms)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * This function waits until the connection is lost. - * This may happen if the peer gracefully closes the connection or if the connection breaks. - * Returns true if the connection was lost, false if the timeout was reached. - * - * - */ -JSBool SocketBase::waitForLost(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - *rval = ToJS(cx, p->GetBase()->WaitForLost(secs, ms)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * This function waits until the socket is readable. This might mean that queued data - * is available for reading or, for streamed sockets, that the connection has been closed, - * so that a read operation will complete immediately without blocking (unless the - * wxSocketFlag.WAITALL flag is set, in which case the operation might still block). - * Returns true if the socket becomes readable, false on timeout. - * - * - */ -JSBool SocketBase::waitForRead(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - *rval = ToJS(cx, p->GetBase()->WaitForRead(secs, ms)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * This function waits until the socket becomes writable. - * This might mean that the socket is ready to send new data, - * or for streamed sockets, that the connection has been closed, - * so that a write operation is guaranteed to complete immediately - * (unless the wxSocketFlag.WAITALL flag is set, in which case the operation might still block) - * Returns true if the socket becomes writable, false on timeout. - * - * - */ -JSBool SocketBase::waitForWrite(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - *rval = ToJS(cx, p->GetBase()->WaitForWrite(secs, ms)); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * This function writes a buffer (with the given size of the buffer) to the socket. - * Use @wxSocketBase#lastCount to verify the number of bytes actually written. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - *

- * Remark/Warning: The exact behaviour of write depends on the combination - * of flags being used. - *
- *
- */ -JSBool SocketBase::write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - p->GetBase()->Write(buffer->GetData(), buffer->GetDataLen()); - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * This function writes a buffer to the socket, but it writes a short header - * before so that @wxSocketBase#readMsg knows how much data should it actually read. - * So, a buffer sent with writeMsg must be read with @wxSocketBase#readMsg. - * This function always waits for the entire buffer to be sent, unless an error occurs. - * Use @wxSocketBase#lastCount to verify the number of bytes actually read. - * Use @wxSocketBase#error to determine if the operation succeeded. - * Returns a reference to the current object. - *

- * Remark/Warning: writeMsg will behave as if the wxSocketFlag.WAITALL flag was always - * set and it will always ignore the wxSocketFlag.NOWAIT flag. - *
- *
- */ -JSBool SocketBase::writeMsg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - - if ( buffer != NULL ) - { - p->GetBase()->WriteMsg(buffer->GetData(), buffer->GetDataLen()); - - *rval = OBJECT_TO_JSVAL(obj); - return JS_TRUE; - } - } - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockbase.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockaddr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockaddr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockaddr.cpp (nonexistent) @@ -1,67 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sockaddr.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: sockaddr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "sockaddr.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * sockaddr - * io - * - * Prototype class for socket addresses. - * - */ -WXJS_INIT_CLASS(SockAddress, "wxSockAddress", 0) - -WXJS_BEGIN_METHOD_MAP(SockAddress) - WXJS_METHOD("clear", clear, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Delete all information of the address. - * - * - */ -JSBool SockAddress::clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSockAddress *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Clear(); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockaddr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockevth.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockevth.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockevth.h (nonexistent) @@ -1,57 +0,0 @@ -/* - * wxJavaScript - sockevth.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: sockevth.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxJS_SockEventHandler_H -#define _wxJS_SockEventHandler_H - -#include - -namespace wxjs -{ - namespace io - { - class SocketEventHandler : public wxEvtHandler, - public Object - { - public: - - /** - * Constructors - */ - SocketEventHandler(JSContext *cx, JSObject *obj) : wxEvtHandler(), Object(obj, cx) - { - } - - virtual ~SocketEventHandler() - { - } - - protected: - DECLARE_EVENT_TABLE() - - void OnSocketEvent(wxSocketEvent &event); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxJS_EventHandler_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockevth.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sistream.h (nonexistent) @@ -1,47 +0,0 @@ -/* - * wxJavaScript - sistream.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: sistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sistream_h -#define _wxjs_io_sistream_h - -#include - -namespace wxjs -{ - namespace io - { - class SocketInputStream : public wxSocketInputStream, - public ApiWrapper - { - public: - #ifdef __MINGW32__ - // MingW needs a default constructor - SocketInputStream() {} - #endif - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, Stream *p); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sistream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zistream.cpp (nonexistent) @@ -1,145 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - zistream.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: zistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" - -#include "stream.h" -#include "istream.h" -#include "zistream.h" -#include "zipentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -ZipInputStream::ZipInputStream(wxInputStream &str) : wxZipInputStream(str) -{ -} - -/*** - * zistream - * io - * - * Input stream for reading zip files. - * - */ -WXJS_INIT_CLASS(ZipInputStream, "wxZipInputStream", 1) - -/*** - * - * - * An input stream - * - * - * Constructs a new wxZipInputStream object. - * - * - */ -Stream* ZipInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( InputStream::HasPrototype(cx, argv[0]) ) - { - Stream *in = InputStream::GetPrivate(cx, argv[0], false); - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - ZipInputStream *stream = new ZipInputStream(*(wxInputStream*) in->GetStream()); - stream->m_refStream = *in; - return new Stream(stream); - } - return NULL; -} - -void ZipInputStream::Destruct(JSContext *cx, Stream *p) -{ - if ( p != NULL ) - { - ZipInputStream *stream = (ZipInputStream*) p->GetStream(); - - // Keep stream alive for a moment, so that the base class - // doesn't crash when it flushes the stream. - Stream tempRefStream(stream->m_refStream); - - delete p; - p = NULL; - } -} - -/*** - * - * - * The comment of the zip file - * - * - * Closes the current entry if one is open, then reads the meta-data for the next - * entry and returns it in a @wxZipEntry object. The stream is then open and can be read. - * - * - * The number of entries in the zip file - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ZipInputStream) - WXJS_READONLY_PROPERTY(P_COMMENT, "comment") - WXJS_READONLY_PROPERTY(P_TOTAL_ENTRIES, "totalEntries") - WXJS_READONLY_PROPERTY(P_NEXT_ENTRY, "nextEntry") -WXJS_END_PROPERTY_MAP() - -bool ZipInputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxZipInputStream *in = (wxZipInputStream*) p->GetStream(); - switch(id) - { - case P_COMMENT: - *vp = ToJS(cx, in->GetComment()); - break; - case P_TOTAL_ENTRIES: - *vp = ToJS(cx, in->GetTotalEntries()); - break; - case P_NEXT_ENTRY: - { - wxZipEntry *entry = in->GetNextEntry(); - if ( entry == NULL ) - { - *vp = JSVAL_VOID; - } - else - { - *vp = ZipEntry::CreateObject(cx, entry); - } - } - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockclient.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockclient.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockclient.cpp (nonexistent) @@ -1,184 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sockclient.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: sockclient.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../common/jsutil.h" -#include "sockaddr.h" -#include "sockclient.h" -#include "sockevth.h" - -using namespace wxjs; -using namespace wxjs::io; - -SocketClient::SocketClient( JSContext *cx - , JSObject *obj - , wxSocketFlags flags) : wxSocketClient(flags) -{ - m_evtHandler = new SocketEventHandler(cx, obj); - SetEventHandler(*m_evtHandler, -1); -} - -SocketClient::~SocketClient() -{ - delete m_evtHandler; -} - -/*** - * sockclient - * io - * - * This class implements client sockets. - * - */ -WXJS_INIT_CLASS(SocketClient, "wxSocketClient", 0) - -/*** - * - * - * - * - * - * Constructs a new wxSocketClient. - * - * - */ -SocketBasePrivate *SocketClient::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - { - return new SocketBasePrivate(new SocketClient(cx, obj)); - } - else - { - int flags; - if ( FromJS(cx, argv[0], flags) ) - { - return new SocketBasePrivate(new SocketClient(cx, obj, flags)); - } - } - return NULL; -} - -void SocketClient::Destruct(JSContext *cx, SocketBasePrivate *p) -{ - p->GetBase()->Destroy(); - delete p; -} - -WXJS_BEGIN_METHOD_MAP(SocketClient) - WXJS_METHOD("connect", connect, 1) - WXJS_METHOD("waitForConnect", waitOnConnect, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * Address of the server - * Wait for the connection to complete? - * - * - * Connects to a server using the specified address. - * Returns true if the connection is established and no error occurs. - * If Wait is false, connect will try to establish the connection and return - * immediately, without blocking the GUI. When used this way, even if connect - * returns false, the connection request can be completed later. To detect this, - * use @wxSocketClient#waitOnConnect, or catch socket events. - * - * - */ -JSBool SocketClient::connect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxSockAddress *addr = SockAddress::GetPrivate(cx, argv[0]); - if ( addr != NULL ) - { - bool wait = true; - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], wait) ) - return JS_FALSE; - } - wxSocketClient *sockClient = dynamic_cast(p->GetBase()); - *rval = ToJS(cx, sockClient->Connect(*addr, wait)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Wait until a connection request completes, or until the specified timeout - * elapses. Use this function after issuing a call to Connect with wait set to false. - * waitOnConnect returns true if the connection request completes. This does not necessarily - * mean that the connection was successfully established; it might also happen that the - * connection was refused by the peer. Use @wxSocketBase#connected to distinguish between - * these two situations. - * - * - */ -JSBool SocketClient::waitOnConnect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SocketBasePrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long secs = -1; - long ms = 0; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], ms) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], secs) ) - return JS_FALSE; - // Fall through - default: - { - wxSocketClient *sockClient = dynamic_cast(p->GetBase()); - *rval = ToJS(cx, sockClient->WaitOnConnect(secs, ms)); - } - } - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockclient.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/archentry.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/archentry.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/archentry.cpp (nonexistent) @@ -1,171 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - archentry.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: archentry.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "archentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * archentry - * io - * - * A prototype class used for entries in an archive. - * - */ - -WXJS_INIT_CLASS(ArchiveEntry, "wxArchiveEntry", 0) - -/*** - * - * - * Get/Set the timestamp of the entryset - * - * - * Returns the path format used internally within the archive to store filenames. - * - * - * Returns the entry's filename in the internal format used within the archive. - * The name can include directory components, i.e. it can be a full path. - *

- * The names of directory entries are returned without any trailing path separator. - * This gives a canonical name that can be used in comparisons. - *
- * - * True if this is a directory entry. - *

- * Directory entries are entries with no data, which are used to store the - * meta-data of directories. They also make it possible for completely empty - * directories to be stored. - *

- * The names of entries within an archive can be complete paths, and unarchivers - * typically create whatever directories are necessary as they restore files, - * even if the archive contains no explicit directory entries. - *
- * - * True if the entry is a read-only file. - * - * - * Returns a numeric value unique to the entry within the archive. - * - * - * Get/Set the size of the entry's data in bytes. - * - *
- */ -WXJS_BEGIN_PROPERTY_MAP(ArchiveEntry) - WXJS_PROPERTY(P_DATE_TIME, "dateTime") - WXJS_READONLY_PROPERTY(P_INTERNAL_FMT, "internalFormat") - WXJS_READONLY_PROPERTY(P_INTERNAL_NAME, "internalName") - WXJS_PROPERTY(P_DIR, "dir") - WXJS_PROPERTY(P_READ_ONLY, "readOnly") - WXJS_PROPERTY(P_NAME, "name") - WXJS_READONLY_PROPERTY(P_OFFSET, "offset") - WXJS_PROPERTY(P_SIZE, "size") -WXJS_END_PROPERTY_MAP() - -bool ArchiveEntry::GetProperty(wxArchiveEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DATE_TIME: - *vp = ToJS(cx, p->GetDateTime()); - break; - case P_INTERNAL_FMT: - *vp = ToJS(cx, p->GetInternalFormat()); - break; - case P_INTERNAL_NAME: - *vp = ToJS(cx, p->GetInternalName()); - break; - case P_DIR: - *vp = ToJS(cx, p->IsDir()); - break; - case P_READ_ONLY: - *vp = ToJS(cx, p->IsReadOnly()); - break; - case P_NAME: - *vp = ToJS(cx, p->GetName()); - break; - case P_OFFSET: - *vp = ToJS(cx, p->GetOffset()); - break; - case P_SIZE: - *vp = ToJS(cx, p->GetSize()); - break; - } - return true; -} - -bool ArchiveEntry::SetProperty(wxArchiveEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DATE_TIME: - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetDateTime(date); - } - break; - case P_DIR: - { - bool dir; - if ( FromJS(cx, *vp, dir) ) - p->SetIsDir(dir); - } - break; - case P_READ_ONLY: - { - bool readonly; - if ( FromJS(cx, *vp, readonly) ) - p->SetIsReadOnly(readonly); - } - break; - case P_NAME: - { - wxString name; - FromJS(cx, *vp, name); - p->SetName(name); - } - break; - case P_SIZE: - { - long size; - if ( FromJS(cx, *vp, size) ) - { - p->SetSize(size); - } - } - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/archentry.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/stream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/stream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/stream.h (nonexistent) @@ -1,66 +0,0 @@ -/* - * wxJavaScript - stream.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: stream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSStream_H -#define _WXJSStream_H - -///////////////////////////////////////////////////////////////////////////// -// Name: stream.h -// Author: Franky Braem -// Modified by: -// Created: 08-10-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include "jsstream.h" - -namespace wxjs -{ - namespace io - { - - class StreamBase : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxInputStream - */ - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_OK - , P_SIZE - , P_LAST_ERROR - }; - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/stream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sostream.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * wxJavaScript - sostream.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: sostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sostream_h -#define _wxjs_io_sostream_h - -#include - -namespace wxjs -{ - namespace io - { - class SocketOutputStream : public ApiWrapper - { - public: - static Stream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zostream.cpp (nonexistent) @@ -1,192 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - zostream.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: zostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" - -#include "stream.h" -#include "ostream.h" -#include "zostream.h" -#include "zistream.h" -#include "zipentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -ZipOutputStream::ZipOutputStream(wxOutputStream &str, int level) : wxZipOutputStream(str, level) -{ -} - -/*** - * zostream - * io - * - * Output stream for writing zip files. The following sample shows how easy it is - * to create a zip archive with files from one directory: - *

- *   var zos = new wxZipOutputStream(new wxFileOutputStream("temp.zip"));
- *   zos.setComment("This archive is created as test");
- *   var dir = new wxDir("c:\\temp");
- *
- *   var trav = new wxDirTraverser();
- *   trav.onFile = function(filename)
- *   {
- *     var entry = new wxZipEntry(filename);
- *     zos.putNextEntry(entry);
- *     var fis = new wxFileInputStream(filename);
- *     var bfs = new wxBufferedOutputStream(zos);
- *     fis.read(bfs);
- *
- *     // Don't forget to sync (flush), otherwise you loose content
- *     bfs.sync();
- *
- *     return wxDirTraverser.CONTINUE;
- *   }
- *   dir.traverse(trav);
- *  
- *
- */ -WXJS_INIT_CLASS(ZipOutputStream, "wxZipOutputStream", 1) - -/*** - * - * - * An Output stream - * - * Level is the compression level to use. It can be a value between 0 and 9 - * or -1 to use the default value which currently is equivalent to 6. - * - * - * - * Constructs a new wxZipOutputStream object. - * - * - */ -Stream* ZipOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( OutputStream::HasPrototype(cx, argv[0]) ) - { - Stream *out = OutputStream::GetPrivate(cx, argv[0], false); - - int level = -1; - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], level) ) - return NULL; - } - - // This is needed, because otherwise the stream can be garbage collected. - // Another method could be to root the stream, but how are we going to unroot it? - JS_DefineProperty(cx, obj, "__stream__", argv[0], NULL, NULL, JSPROP_READONLY); - - ZipOutputStream *stream = new ZipOutputStream(*(wxOutputStream*) out->GetStream(), level); - stream->m_refStream = *out; - return new Stream(stream); - } - return NULL; -} - -void ZipOutputStream::Destruct(JSContext *cx, Stream *p) -{ - if ( p != NULL ) - { - ZipOutputStream *stream = (ZipOutputStream*) p->GetStream(); - stream->Close(); - - // Keep stream alive for a moment, so that the base class - // doesn't crash when it flushes the stream. - Stream tempRefStream(stream->m_refStream); - - delete p; - p = NULL; - } -} - -/*** - * - * - * The comment of the zip file - * - * - * Closes the current entry if one is open, then reads the meta-data for the next - * entry and returns it in a @wxZipEntry object. The stream is then open and can be read. - * - * - * The number of entries in the zip file - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ZipOutputStream) - WXJS_PROPERTY(P_LEVEL, "level") -WXJS_END_PROPERTY_MAP() - -bool ZipOutputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxZipOutputStream *out = (wxZipOutputStream*) p->GetStream(); - switch(id) - { - case P_LEVEL: - *vp = ToJS(cx, out->GetLevel()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(ZipOutputStream) - WXJS_METHOD("setComment", setComment, 1) -WXJS_END_METHOD_MAP() - - -/*** - * - * - * - * - * - * Sets the comment on the archive - * - * - */ -JSBool ZipOutputStream::setComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = ZipOutputStream::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxZipOutputStream *zos = (wxZipOutputStream *) p->GetStream(); - - wxString comment; - FromJS(cx, argv[0], comment); - zos->SetComment(comment); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/aistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/aistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/aistream.cpp (nonexistent) @@ -1,102 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - aistream.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: aistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../common/main.h" -#include "stream.h" -#include "aistream.h" -#include "archentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * aistream - * io - * - * wxArchiveInputStream is a prototype object for archive input streams such - * as @wxZipInputStream. - * - */ - -WXJS_INIT_CLASS(ArchiveInputStream, "wxArchiveInputStream", 0) - -WXJS_BEGIN_METHOD_MAP(ArchiveInputStream) - WXJS_METHOD("closeEntry", closeentry, 0) - WXJS_METHOD("openEntry", openEntry, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Closes the current entry. On a non-seekable stream reads to the end of the current entry first. - * - * - */ -JSBool ArchiveInputStream::closeentry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, ((wxArchiveInputStream *)p->GetStream())->CloseEntry()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Closes the current entry if one is open, then opens the entry specified by the entry object. - * entry should be from the same zip file, and the zip should be on a seekable stream. - * - * - */ -JSBool ArchiveInputStream::openEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxArchiveInputStream *ais = dynamic_cast(p->GetStream()); - - wxArchiveEntry *entry = ArchiveEntry::GetPrivate(cx, argv[0]); - if ( entry != NULL ) - { - *rval = ToJS(cx, ais->OpenEntry(*entry)); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/aistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/fn.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/fn.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/fn.h (nonexistent) @@ -1,56 +0,0 @@ -/* - * wxJavaScript - fn.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: fn.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_fn_h -#define wxjs_io_fn_h - -// Common functions - -namespace wxjs -{ - namespace io - { - JSBool concatFiles(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool copyFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool renameFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool removeFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool fileExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool getCwd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool getFreeDiskSpace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool getTotalDiskSpace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool getOSDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool isAbsolutePath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool isWild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool dirExists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool matchWild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool mkDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool rmDir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool setWorkingDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - // Process functions - JSBool execute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool shell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; // namespace io -}; // namespace wxjs -#endif //wxjs_io_fn_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/fn.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/istream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/istream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/istream.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - istream.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: istream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_istream_h -#define wxjs_io_istream_h - -namespace wxjs -{ - namespace io - { - class InputStream : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxInputStream - */ - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_EOF - , P_LAST_READ - , P_TELL_I - , P_C - , P_PEEK - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool getC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool peek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seekI(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool ungetch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // wxjs_io_istream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/istream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/aostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/aostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/aostream.cpp (nonexistent) @@ -1,241 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - aostream.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: aostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../common/main.h" -#include "stream.h" -#include "aostream.h" -#include "aistream.h" -#include "archentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * aostream - * io - * - * wxArchiveOutputStream is a prototype object for archive output streams such - * as @wxZipOutputStream. - * - */ - -WXJS_INIT_CLASS(ArchiveOutputStream, "wxArchiveOutputStream", 0) - -WXJS_BEGIN_METHOD_MAP(ArchiveOutputStream) - WXJS_METHOD("closeEntry", closeentry, 0) - WXJS_METHOD("copyEntry", copyEntry, 2) - WXJS_METHOD("copyArchiveMetaData", copyArchiveMetaData, 1) - WXJS_METHOD("putNextEntry", putNextEntry, 1) - WXJS_METHOD("putNextDirEntry", putNextDirEntry, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Closes the current entry. On a non-seekable stream reads to the end of the current entry first. - * - * - */ -JSBool ArchiveOutputStream::closeentry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, ((wxArchiveOutputStream *)p->GetStream())->CloseEntry()); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Transfers the zip comment from the @wxArchiveInputStream to this output stream. - * - * - */ -JSBool ArchiveOutputStream::copyArchiveMetaData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxArchiveOutputStream *aos = dynamic_cast(p->GetStream()); - - Stream *in = ArchiveInputStream::GetPrivate(cx, obj); - if ( in != NULL ) - { - *rval = ToJS(cx, aos->CopyArchiveMetaData(*dynamic_cast(in->GetStream()))); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Takes ownership of entry and uses it to create a new entry in the zip. - * Entry is then opened in inputStream and its contents copied to this stream. - * copyEntry() is much more efficient than transferring the data using read() - * and write() since it will copy them without decompressing and recompressing them. - * Creates a new entry in the archive. - * - * - */ -JSBool ArchiveOutputStream::copyEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxArchiveOutputStream *aos = dynamic_cast(p->GetStream()); - - wxArchiveEntry *entry = ArchiveEntry::GetPrivate(cx, argv[0]); - if ( entry != NULL ) - { - Stream *str = ArchiveInputStream::GetPrivate(cx, argv[1]); - if ( str != NULL ) - { - *rval = ToJS(cx, aos->CopyEntry(entry, *dynamic_cast(str->GetStream()))); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Creates a new directory entry in the archive with the given name and timestamp. - * - * - */ -JSBool ArchiveOutputStream::putNextDirEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxArchiveOutputStream *zos = dynamic_cast(p->GetStream()); - - wxDateTime dt = wxDateTime::Now(); - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], dt) ) - break; - // Fall through - default: - { - wxString name; - FromJS(cx, argv[0], name); - *rval = ToJS(cx, zos->PutNextDirEntry(name, dt)); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * Creates a new entry in the archive - * - * - */ -JSBool ArchiveOutputStream::putNextEntry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Stream *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxArchiveOutputStream *aos = dynamic_cast(p->GetStream()); - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxArchiveEntry *entry = ArchiveEntry::GetPrivate(cx, argv[0]); - if ( entry != NULL ) - { - // Clone the entry, because wxArchiveOutputStream manages the deletion - // and we don't want to delete our JavaScript object - *rval = ToJS(cx, aos->PutNextEntry(entry->Clone())); - return JS_TRUE; - } - } - else - { - off_t size = wxInvalidOffset; - wxDateTime dt = wxDateTime::Now(); - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], size) ) - break; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], dt) ) - break; - // Fall through - default: - { - wxString name; - FromJS(cx, argv[0], name); - *rval = ToJS(cx, aos->PutNextEntry(name, dt, size)); - return JS_TRUE; - } - } - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/aostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/distream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/distream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/distream.h (nonexistent) @@ -1,54 +0,0 @@ -/* - * wxJavaScript - distream.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: distream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDataInputStream_H -#define _WXJSDataInputStream_H - -#include - -namespace wxjs -{ - namespace io - { - class DataInputStream: public ApiWrapper - { - public: - /** - * Callback for when a wxTextInputStream object is created - */ - static wxDataInputStream *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_METHOD_MAP() - static JSBool bigEndianOrdered(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read64(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSDataInputStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/distream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/ostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/ostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/ostream.h (nonexistent) @@ -1,57 +0,0 @@ -/* - * wxJavaScript - ostream.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: ostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef wxjs_io_ostream_h -#define wxjs_io_ostream_h - -namespace wxjs -{ - namespace io - { - class OutputStream : public ApiWrapper - { - public: - static bool GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_LAST_WRITE - , P_TELL_O - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool putC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool seekO(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool sync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif //wxjs_io_ostream_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/ostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/mistream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/mistream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/mistream.cpp (nonexistent) @@ -1,109 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - mistream.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: mistream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "mistream.h" - -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" - -using namespace wxjs; -using namespace wxjs::io; - -MemoryInputStream::MemoryInputStream( JSContext *cx - , JSObject *obj - , char *data - , size_t len) : wxMemoryInputStream(data, len) - , Object(obj, cx) - , m_data(data) -{ -} - -MemoryInputStream::~MemoryInputStream() -{ - delete[] m_data; -} - -/*** - * mistream - * io - * - * wxMemoryInputStream allows an application to create an input stream - * in which the bytes read are supplied by a memory buffer or a string. - * See also @wxMemoryOutputStream. - * - */ -WXJS_INIT_CLASS(MemoryInputStream, "wxMemoryInputStream", 1) - -/*** - * - * - * - * - * - * - * - * - * Constructs a new wxMemoryInputStream object. A copy is created - * of the data and passed to the stream. - *

- * When a String is used, the string is stored as UTF-16! - *
- *
- */ -Stream* MemoryInputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer* buffer = wxjs::ext::GetMemoryBuffer(cx, JSVAL_TO_OBJECT(argv[0])); - if ( buffer != NULL ) - { - char *dataPtr = new char[buffer->GetDataLen()]; - memcpy(dataPtr, buffer->GetData(), buffer->GetDataLen()); - return new Stream(new MemoryInputStream(cx, obj, dataPtr, (size_t) buffer->GetDataLen())); - } - } - - wxString data; - FromJS(cx, argv[0], data); - - wxMBConvUTF16 utf16; - int length = utf16.WC2MB(NULL, data, 0); - if ( length > 0 ) - { - char *buffer = new char[length + utf16.GetMBNulLen()]; - length = utf16.WC2MB(buffer, data, length + utf16.GetMBNulLen()); - return new Stream(new MemoryInputStream(cx, obj, buffer, (size_t) length)); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/mistream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/httphdr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/httphdr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/httphdr.h (nonexistent) @@ -1,43 +0,0 @@ -/* - * wxJavaScript - httphdr.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: httphdr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_httphdr_h -#define _wxjs_io_httphdr_h - -namespace wxjs -{ - namespace io - { - class HTTPHeader : public ApiWrapper - { - public: - - static bool AddProperty(HTTPHeader *p, JSContext *cx, JSObject *obj, - const wxString& prop, jsval *vp); - static bool GetStringProperty(HTTPHeader *p, JSContext *cx, JSObject *obj, - const wxString &propertyName, jsval *vp); - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_url_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/httphdr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/dostream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/dostream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/dostream.h (nonexistent) @@ -1,54 +0,0 @@ -/* - * wxJavaScript - dostream.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: dostream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDataOutputStream_H -#define _WXJSDataOutputStream_H - -#include - -namespace wxjs -{ - namespace io - { - class DataOutputStream : public ApiWrapper - { - public: - - /** - * Callback for when a wxDataOutputStream object is created - */ - static wxDataOutputStream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_METHOD_MAP() - static JSBool bigEndianOrdered(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write64(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool writeDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool writeString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSTextOutputStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/dostream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/zipentry.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/zipentry.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/zipentry.cpp (nonexistent) @@ -1,406 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - zipentry.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: zipentry.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" -#include "zipentry.h" - -using namespace wxjs; -using namespace wxjs::io; - -/*** - * zipentry - * io - * - * Holds the meta-data for an entry in a zip. - * - */ - -WXJS_INIT_CLASS(ZipEntry, "wxZipEntry", 0) - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Compression Mode. wxZipMethod is ported as a separate JavaScript class. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Originating File-System. wxZipSystem is ported as a separate JavaScript object. - * - * - * - * - * - * - * - * - * - * - * wxZipAttributes is ported as a separate JavaScript object - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * wxZipFlags is ported as a separate JavaScript object. - * - * - * - * - */ -void ZipEntry::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxZipMethodMap[] = - { - WXJS_CONSTANT(wxZIP_METHOD_, STORE) - WXJS_CONSTANT(wxZIP_METHOD_, SHRINK) - WXJS_CONSTANT(wxZIP_METHOD_, REDUCE1) - WXJS_CONSTANT(wxZIP_METHOD_, REDUCE2) - WXJS_CONSTANT(wxZIP_METHOD_, REDUCE3) - WXJS_CONSTANT(wxZIP_METHOD_, REDUCE4) - WXJS_CONSTANT(wxZIP_METHOD_, IMPLODE) - WXJS_CONSTANT(wxZIP_METHOD_, TOKENIZE) - WXJS_CONSTANT(wxZIP_METHOD_, DEFLATE) - WXJS_CONSTANT(wxZIP_METHOD_, DEFLATE64) - WXJS_CONSTANT(wxZIP_METHOD_, BZIP2) - WXJS_CONSTANT(wxZIP_METHOD_, DEFAULT) - { 0 } - }; - - JSObject *constObj = JS_DefineObject(cx, obj, "wxZipMethod", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxZipMethodMap); - - JSConstDoubleSpec wxZipSystemMap[] = - { - WXJS_CONSTANT(wxZIP_SYSTEM_, MSDOS) - WXJS_CONSTANT(wxZIP_SYSTEM_, AMIGA) - WXJS_CONSTANT(wxZIP_SYSTEM_, OPENVMS) - WXJS_CONSTANT(wxZIP_SYSTEM_, UNIX) - WXJS_CONSTANT(wxZIP_SYSTEM_, VM_CMS) - WXJS_CONSTANT(wxZIP_SYSTEM_, ATARI_ST) - WXJS_CONSTANT(wxZIP_SYSTEM_, OS2_HPFS) - WXJS_CONSTANT(wxZIP_SYSTEM_, MACINTOSH) - WXJS_CONSTANT(wxZIP_SYSTEM_, Z_SYSTEM) - WXJS_CONSTANT(wxZIP_SYSTEM_, CPM) - WXJS_CONSTANT(wxZIP_SYSTEM_, WINDOWS_NTFS) - WXJS_CONSTANT(wxZIP_SYSTEM_, MVS) - WXJS_CONSTANT(wxZIP_SYSTEM_, VSE) - WXJS_CONSTANT(wxZIP_SYSTEM_, ACORN_RISC) - WXJS_CONSTANT(wxZIP_SYSTEM_, VFAT) - WXJS_CONSTANT(wxZIP_SYSTEM_, ALTERNATE_MVS) - WXJS_CONSTANT(wxZIP_SYSTEM_, BEOS) - WXJS_CONSTANT(wxZIP_SYSTEM_, TANDEM) - WXJS_CONSTANT(wxZIP_SYSTEM_, OS_400) - { 0 } - }; - - constObj = JS_DefineObject(cx, obj, "wxZipSystem", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxZipSystemMap); - - JSConstDoubleSpec wxZipAttributes[] = - { - WXJS_CONSTANT(wxZIP_A_, RDONLY) - WXJS_CONSTANT(wxZIP_A_, HIDDEN) - WXJS_CONSTANT(wxZIP_A_, SYSTEM) - WXJS_CONSTANT(wxZIP_A_, SUBDIR) - WXJS_CONSTANT(wxZIP_A_, ARCH) - WXJS_CONSTANT(wxZIP_A_, MASK) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxZipAttributes", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxZipAttributes); - - JSConstDoubleSpec wxZipFlags[] = - { - WXJS_CONSTANT(wxZIP_, ENCRYPTED) - WXJS_CONSTANT(wxZIP_, DEFLATE_NORMAL) - WXJS_CONSTANT(wxZIP_, DEFLATE_EXTRA) - WXJS_CONSTANT(wxZIP_, DEFLATE_FAST) - WXJS_CONSTANT(wxZIP_, DEFLATE_SUPERFAST) - WXJS_CONSTANT(wxZIP_, DEFLATE_MASK) - WXJS_CONSTANT(wxZIP_, SUMS_FOLLOW) - WXJS_CONSTANT(wxZIP_, ENHANCED) - WXJS_CONSTANT(wxZIP_, PATCH) - WXJS_CONSTANT(wxZIP_, STRONG_ENC) - WXJS_CONSTANT(wxZIP_, UNUSED) - WXJS_CONSTANT(wxZIP_, RESERVED) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxZipFlags", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxZipFlags); -} - -/*** - * - * - * - * - * - * - * - * Creates a new wxZipEntry - * - * - */ -wxZipEntry* ZipEntry::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - off_t size = wxInvalidOffset; - wxDateTime dt = wxDateTime::Now(); - wxString name = wxEmptyString; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], size) ) - return NULL; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], dt) ) - return NULL; - // Fall through - case 1: - FromJS(cx, argv[0], name); - break; - } - - wxZipEntry* entry = new wxZipEntry(name, dt, size); - entry->SetMethod(wxZIP_METHOD_DEFAULT); - return entry; -} - -/*** - * - * - * Get/Set a short comment for this entry. - * - * - * The compressed size of this entry in bytes. - * - * - * CRC32 for this entry's data. - * - * - * Attributes of the entry. See @wxZipEntry#wxZipAttributes. - * - * - * The extra field is used to store platform or application specific data. - * See Pkware's document 'appnote.txt' for information on its format. - * - * - * see @wxZipEntry#wxZipFlags - * - * - * The extra field is used to store platform or application specific data. - * See Pkware's document 'appnote.txt' for information on its format. - * - * - * The compression method. See @wxZipEntry#wxZipMethod. - * - * - * - * The originating file-system. The default constructor sets this to - * wxZipSystem.MSDOS. Set it to wxZipSystem.UNIX in order to be able - * to store unix permissions using @wxZipEntry#mode. - * - * - * Returns true if @wxZipEntry#systemMadeBy is a flavour of unix. - * - * - * Indicates that this entry's data is text in an 8-bit encoding. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ZipEntry) - WXJS_PROPERTY(P_COMMENT, "comment") - WXJS_READONLY_PROPERTY(P_COMPRESSED_SIZE, "compressedSize") - WXJS_READONLY_PROPERTY(P_CRC, "crc") - WXJS_READONLY_PROPERTY(P_EXTERNAL_ATTR, "externalAttributes") - WXJS_PROPERTY(P_EXTRA, "extra") - WXJS_READONLY_PROPERTY(P_FLAGS, "flags") - WXJS_PROPERTY(P_LOCAL_EXTRA, "localExtra") - WXJS_PROPERTY(P_MODE, "mode") - WXJS_PROPERTY(P_METHOD, "method") - WXJS_PROPERTY(P_SYSTEM_MADE_BY, "systemMadeBy") - WXJS_READONLY_PROPERTY(P_MADE_BY_UNIX, "madeByUnix") - WXJS_PROPERTY(P_TEXT, "text") -WXJS_END_PROPERTY_MAP() - -bool ZipEntry::GetProperty(wxZipEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_COMMENT: - *vp = ToJS(cx, p->GetComment()); - break; - case P_COMPRESSED_SIZE: - *vp = ToJS(cx, p->GetCompressedSize()); - break; - case P_CRC: - *vp = ToJS(cx, p->GetCrc()); - break; - case P_EXTERNAL_ATTR: - *vp = ToJS(cx, p->GetExternalAttributes()); - break; - case P_EXTRA: - *vp = ToJS(cx, wxString::FromAscii(p->GetExtra())); - break; - case P_FLAGS: - *vp = ToJS(cx, p->GetFlags()); - break; - case P_LOCAL_EXTRA: - *vp = ToJS(cx, wxString::FromAscii(p->GetLocalExtra())); - break; - case P_METHOD: - *vp = ToJS(cx, p->GetMethod()); - break; - case P_MODE: - *vp = ToJS(cx, p->GetMode()); - break; - case P_SYSTEM_MADE_BY: - *vp = ToJS(cx, p->GetSystemMadeBy()); - break; - case P_MADE_BY_UNIX: - *vp = ToJS(cx, p->IsMadeByUnix()); - break; - case P_TEXT: - *vp = ToJS(cx, p->IsText()); - break; - } - return true; -} - -bool ZipEntry::SetProperty(wxZipEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_EXTRA: - { - wxString extra; - FromJS(cx, *vp, extra); - p->SetExtra(extra.ToAscii(), extra.Length()); - } - break; - case P_LOCAL_EXTRA: - { - wxString extra; - FromJS(cx, *vp, extra); - p->SetLocalExtra(extra.ToAscii(), extra.Length()); - } - break; - case P_MODE: - { - int mode; - if ( FromJS(cx, *vp, mode) ) - { - p->SetMode(mode); - } - break; - } - case P_METHOD: - { - int method; - if ( FromJS(cx, *vp, method) ) - { - p->SetMethod(method); - } - } - case P_SYSTEM_MADE_BY: - { - int madeBy; - if ( FromJS(cx, *vp, madeBy) ) - { - p->SetSystemMadeBy(madeBy); - } - break; - } - case P_TEXT: - { - bool text; - if ( FromJS(cx, *vp, text) ) - { - p->SetIsText(text); - } - break; - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/zipentry.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/sockevth.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/sockevth.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/sockevth.cpp (nonexistent) @@ -1,60 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sockevth.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: sockevth.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../common/main.h" -#include "../common/jsutil.h" - -#include "sockevth.h" - -using namespace wxjs; -using namespace wxjs::io; - -BEGIN_EVENT_TABLE (SocketEventHandler, wxEvtHandler) - EVT_SOCKET(-1, SocketEventHandler::OnSocketEvent) -END_EVENT_TABLE() - -void SocketEventHandler::OnSocketEvent(wxSocketEvent &event) -{ - jsval rval; - switch(event.GetSocketEvent()) - { - case wxSOCKET_INPUT : - CallFunctionProperty(GetContext(), GetObject(), "onInput", 0, NULL, &rval); - break; - case wxSOCKET_LOST : - CallFunctionProperty(GetContext(), GetObject(), "onLost", 0, NULL, &rval); - break; - case wxSOCKET_CONNECTION : - CallFunctionProperty(GetContext(), GetObject(), "onConnection", 0, NULL, &rval); - break; - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/sockevth.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/mostream.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/mostream.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/mostream.cpp (nonexistent) @@ -1,133 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - mostream.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: mostream.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../common/main.h" - -#include "stream.h" -#include "mostream.h" - -#include "../ext/wxjs_ext.h" -#include "../ext/membuf.h" - -using namespace wxjs; -using namespace wxjs::io; - -MemoryOutputStream::MemoryOutputStream( JSContext *cx - , JSObject *obj - , char *data - , size_t len) : wxMemoryOutputStream(data, len) - , Object(obj, cx) - , m_data(data) -{ - if ( m_data == NULL ) - GetOutputStreamBuffer()->SetBufferIO(1024); -} - -MemoryOutputStream::~MemoryOutputStream() -{ - delete[] m_data; -} - -/*** - * mostream - * io - * - * wxMemoryOutputStream collects its output in a buffer which can be converted to a String. - * See also @wxMemoryInputStream. - * An example: - *

- *   var mos = new wxMemoryOutputStream();
- *   mos.write("This is a test");
- *  
- *
- */ -WXJS_INIT_CLASS(MemoryOutputStream, "wxMemoryOutputStream", 0) - -/*** - * - * - * - * The length of the buffer used in memory. - * - * - * - * Constructs a new wxMemoryOutputStream object. When no length is specified, a buffer is - * created with size 1024. If necessary it will grow. - * - * - */ -Stream* MemoryOutputStream::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - { - return new Stream(new MemoryOutputStream(cx, obj, NULL, 0)); - } - - int length; - if ( FromJS(cx, argv[0], length) ) - { - char *dataPtr = new char[length]; - return new Stream(new MemoryOutputStream(cx, obj, dataPtr, length)); - } - - return NULL; -} - -/*** - * - * - * Gets the buffer. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(MemoryOutputStream) - WXJS_READONLY_PROPERTY(P_DATA, "data") -WXJS_END_PROPERTY_MAP() - -bool MemoryOutputStream::GetProperty(Stream *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - MemoryOutputStream *mstream = (MemoryOutputStream *) p->GetStream(); - - switch(id) - { - case P_DATA: - { - int size = mstream->GetOutputStreamBuffer()->GetIntPosition(); - char* buffer = new char[size]; - mstream->CopyTo(buffer, size); - - *vp = OBJECT_TO_JSVAL(wxjs::ext::CreateMemoryBuffer(cx, buffer, size)); - delete[] buffer; - break; - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/io/mostream.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/textfile.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/textfile.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/textfile.h (nonexistent) @@ -1,88 +0,0 @@ -/* - * wxJavaScript - textfile.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: textfile.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJS_TEXTFILE_H -#define _WXJS_TEXTFILE_H - -///////////////////////////////////////////////////////////////////////////// -// Name: file.h -// Purpose: Ports wxFile to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 30.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace io - { - class TextFile : public ApiWrapper - { - public: - - static bool GetProperty(wxTextFile *f, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_CURRENT_LINE - , P_EOF - , P_OPENED - , P_LINE_COUNT - , P_FIRST_LINE - , P_NEXT_LINE - , P_GUESS_TYPE - , P_NAME - , P_LAST_LINE - , P_PREV_LINE - , P_LINES - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static wxTextFile *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool addLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool gotoLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool removeLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - static JSBool getEOL(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif // _WXJS_TEXTFILE Property changes on: ps/trunk/source/tools/atlas/wxJS/io/textfile.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/tistream.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/tistream.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/tistream.h (nonexistent) @@ -1,66 +0,0 @@ -/* - * wxJavaScript - tistream.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: tistream.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTextInputStream_H -#define _WXJSTextInputStream_H - -#include - -namespace wxjs -{ - namespace io - { - class TextInputStream: public ApiWrapper, - public wxTextInputStream - { - public: - TextInputStream(wxInputStream &stream, const wxString &sep, wxMBConv& conv); - /** - * Callback for when a wxTextInputStream object is created - */ - static TextInputStream* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static bool GetProperty(TextInputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(TextInputStream *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_STRING_SEPARATORS - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool read32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read16(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool read8(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readDouble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool readWord(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace io -}; // namespace wxjs -#endif //_WXJSTextInputStream_H Property changes on: ps/trunk/source/tools/atlas/wxJS/io/tistream.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/io/socksrv.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/io/socksrv.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/io/socksrv.h (nonexistent) @@ -1,58 +0,0 @@ -/* - * wxJavaScript - socksrv.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: socksrv.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_io_sockserver_h -#define _wxjs_io_sockserver_h - -#include -#include - -namespace wxjs -{ - namespace io - { - class SocketEventHandler; - - class SocketServer : public ApiWrapper - , public wxSocketServer - { - public: - SocketServer(JSContext *cx, JSObject *obj, wxSockAddress &address, wxSocketFlags flags = wxSOCKET_NONE); - virtual ~SocketServer(); - - static wxSocketServer *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxSocketServer *p); - - WXJS_DECLARE_METHOD_MAP() - - static JSBool accept(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool acceptWith(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool waitForAccept(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - private: - SocketEventHandler *m_evtHandler; - }; - }; // namespace io -}; // namespace wxjs -#endif // _wxjs_io_sockserver_h Property changes on: ps/trunk/source/tools/atlas/wxJS/io/socksrv.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/apiwrap.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/apiwrap.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/apiwrap.h (nonexistent) @@ -1,703 +0,0 @@ -/* - * wxJavaScript - apiwrap.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: apiwrap.h 634 2007-03-24 22:34:20Z fbraem $ - */ -///////////////////////////////////////////////////////////////////////////// -// Name: apiwrap.h -// Purpose: Templates for reducing code in ported classes. -// It tries to hide the complexity of porting classes as much -// as possible. -// Author: Franky Braem -// Modified by: -// Created: 30.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -// -// ApiWrapper uses the Barton and Nackman trick (also known as -// "Curiously Recursive Template Pattern") -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WXJS_APIWRAPPER_H -#define _WXJS_APIWRAPPER_H - -#include -#include "../common/type.h" - -namespace wxjs -{ - - template - class ApiWrapper - { - public: - typedef ApiWrapper TOBJECT; - - /** - * Creates an object for the given WX class. From now - * on wxJS owns the pointer to the WX class. So don't delete it. - */ - static jsval CreateObject(JSContext *cx, T_Priv *p, JSObject *parent = NULL) - { - JSObject *obj = JS_NewObject(cx, &wxjs_class, m_classProto, parent); - JS_SetPrivate(cx, obj, p); - return OBJECT_TO_JSVAL(obj); - } - - // A type-safe SetPrivate method - static void SetPrivate(JSContext *cx, JSObject *obj, T_Priv *p) - { - JS_SetPrivate(cx, obj, p); - } - - /** - * Creates an object for the given WX class and defines it as a property - * of the given object. From now on wxJS owns the pointer to the WX class. - * So don't delete it. - */ - static JSObject* DefineObject(JSContext *cx, JSObject *obj, const char *name, T_Priv *p) - { - JSObject *propObj = JS_DefineObject(cx, obj, name, - &wxjs_class, m_classProto, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_SetPrivate(cx, propObj, p); - return propObj; - } - - /** - * Returns the ported class from the private data of an object. - * When check is true, it will check the type of the class and - * returns NULL, when the class is not of the correct type. - */ - static T_Priv* GetPrivate(JSContext *cx, JSObject *obj, bool check = true) - { - T_Priv *p = NULL; - if ( check ) - { - if ( - ! ( JS_InstanceOf(cx, obj, &wxjs_class, NULL) - || HasPrototype(cx, obj)) - ) - { - JS_ReportError(cx, "The object should be an instance of %s", m_jsClassName); - return NULL; - } - } - -#ifdef JS_THREADSAFE - JSClass *clazz = JS_GetClass(cx, obj); -#else - JSClass *clazz = JS_GetClass(obj); -#endif - while((clazz->flags & JSCLASS_HAS_PRIVATE) != JSCLASS_HAS_PRIVATE) - { - obj = JS_GetPrototype(cx, obj); - if ( obj == NULL ) - return NULL; -#ifdef JS_THREADSAFE - clazz = JS_GetClass(cx, obj); -#else - clazz = JS_GetClass(obj); -#endif - } - - p = (T_Priv*) JS_GetPrivate(cx, obj); - - return p; - } - - /** - * Returns the ported class from the private data of an object. - * Does the same as above, but for an object which is stored in a jsval. - */ - static T_Priv* GetPrivate(JSContext *cx, jsval v, bool check = true) - { - if ( JSVAL_IS_VOID(v) - || JSVAL_IS_NULL(v) ) - return NULL; - return JSVAL_IS_OBJECT(v) ? GetPrivate(cx, JSVAL_TO_OBJECT(v), check) : NULL; - } - - /** - * Returns true when the prototype of the object is this class. - */ - static bool HasPrototype(JSContext *cx, JSObject *obj) - { - JSObject *prototype = JS_GetPrototype(cx, obj); - while( prototype != NULL - && JS_InstanceOf(cx, prototype, &wxjs_class, NULL) == JS_FALSE ) - { - prototype = JS_GetPrototype(cx, prototype); - } - return prototype != NULL; - } - - /** - * Same as above, but for an object that is stored in a jsval - */ - static bool HasPrototype(JSContext *cx, jsval v) - { - if ( JSVAL_IS_OBJECT(v) ) - return HasPrototype(cx, JSVAL_TO_OBJECT(v)); - else - return false; - } - - /** - * Initializes the class. - */ - static JSObject* JSInit(JSContext *cx, - JSObject *obj, - JSObject *proto = NULL) - { - m_classProto = JS_InitClass(cx, obj, proto, &wxjs_class, - T_Port::JSConstructor, m_ctorArguments, NULL, - NULL, NULL, NULL); - if ( m_classProto != NULL ) - { - T_Port::DefineProperties(cx, m_classProto); - T_Port::DefineMethods(cx, m_classProto); - - JSObject *ctor = JS_GetConstructor(cx, m_classProto); - if ( ctor != NULL ) - { - T_Port::DefineConstants(cx, ctor); - T_Port::DefineStaticProperties(cx, ctor); - T_Port::DefineStaticMethods(cx, ctor); - } - T_Port::InitClass(cx, obj, m_classProto); - } - return m_classProto; - } - - /** - * Default implementation for adding a property - * Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool AddProperty(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - const wxString& WXUNUSED(prop), - jsval* WXUNUSED(vp)) - { - return true; - } - /** - * The default implementation of the Get method for a ported object. - * Overwrite this method when your object has properties. - * Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool GetProperty(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - int WXUNUSED(id), - jsval* WXUNUSED(vp)) - { - return true; - } - - /** - * The default implementation of the Get method for a ported object. - * Overwrite this method when your object has properties. - * Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool GetStringProperty(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - const wxString& WXUNUSED(propertyName), - jsval* WXUNUSED(vp)) - { - return true; - } - - /** - * The default implementation of the Set method for a ported object. - * Overwrite this method when your object has properties. - * @remark Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool SetProperty(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - int WXUNUSED(id), - jsval* WXUNUSED(vp)) - { - return true; - } - static bool SetStringProperty(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - const wxString& WXUNUSED(propertyName), - jsval* WXUNUSED(vp)) - { - return true; - } - - static bool Resolve(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - jsval WXUNUSED(id)) - { - return true; - } - - /** - * The default implementation of the Destruct method. Overwrite this - * when you need to do some cleanup before the object is destroyed. - * The default implementation calls the destructor of the private object. - */ - static void Destruct(JSContext* WXUNUSED(cx), - T_Priv* p) - { - delete p; - p = NULL; - } - - /** - * The default implementation of the Construct method. Overwrite this - * when a script is allowed to create an object with the new statement. - * The default implementation returns NULL, which means that is not allowed - * to create an object. - */ - static T_Priv* Construct(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - uintN WXUNUSED(argc), - jsval* WXUNUSED(argv), - bool WXUNUSED(constructing)) - { - return NULL; - } - - /** - * Default implementation for defining properties. - * Use the WXJS_DECLARE_PROPERTY_MAP, WXJS_BEGIN_PROPERTY_MAP and - * WXJS_END_PROPERTY_MAP macro's for hiding the complexity of defining properties. - * The default implementation does nothing. - */ - static void DefineProperties(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj)) - { - } - - /** - * InitClass is called when the prototype object is created - * It can be used for example to initialize constants related to this class. - * The argument obj is normally the global object. - * The default implementation does nothing. - */ - static void InitClass(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - JSObject* WXUNUSED(proto)) - { - } - - /** - * Default implementation for defining methods. - * Use the WXJS_DECLARE_METHOD_MAP, WXJS_BEGIN_METHOD_MAP and - * WXJS_END_METHOD_MAP macro's for hiding the complexity of defining methods. - * The default implementation does nothing. - */ - static void DefineMethods(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj)) - { - } - - /** - * Default implementation for defining constants. - * Use the WXJS_DECLARE_CONSTANT_MAP, WXJS_BEGIN_CONSTANT_MAP and - * WXJS_END_CONSTANT_MAP macro's for hiding the complexity of defining constants. - * The default implementation does nothing. - * Only numeric constants are allowed. - */ - static void DefineConstants(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj)) - { - } - - /** - * Default implementation for defining static(class) properties. - * Use the WXJS_DECLARE_STATIC_PROPERTY_MAP, WXJS_BEGIN_STATIC_PROPERTY_MAP and - * WXJS_END_PROPERTY_MAP macro's for hiding the complexity of defining properties. - * The default implementation does nothing. - */ - static void DefineStaticProperties(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj)) - { - } - - /** - * Default implementation for defining static(class) methods. - * Use the WXJS_DECLARE_STATIC_METHOD_MAP, WXJS_BEGIN_STATIC_METHOD_MAP and - * WXJS_END_METHOD_MAP macro's for hiding the complexity of defining methods. - * The default implementation does nothing. - */ - static void DefineStaticMethods(JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj)) - { - } - - /** - * Returns the JSClass of the object - */ - static JSClass* GetClass() - { - return &wxjs_class; - } - - /** - * The default implementation of the static Get method for a ported object. - * Overwrite this method when your object has static properties. - * Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool GetStaticProperty(JSContext* WXUNUSED(cx), - int WXUNUSED(id), - jsval* WXUNUSED(vp)) - { - return true; - } - - /** - * The default implementation of the static Set method for a ported object. - * Overwrite this method when your object has static properties. - * Returning false, will end the execution of the script. - * The default implementation returns true. - */ - static bool SetStaticProperty(JSContext* WXUNUSED(cx), - int WXUNUSED(id), - jsval* WXUNUSED(vp)) - { - return true; - } - - static bool Enumerate(T_Priv* WXUNUSED(p), - JSContext* WXUNUSED(cx), - JSObject* WXUNUSED(obj), - JSIterateOp WXUNUSED(enum_op), - jsval* WXUNUSED(statep), - jsid* WXUNUSED(idp)) - { - return true; - } - - // The JS API callbacks - - static JSBool JSGetStaticProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) - { - if ( JSVAL_IS_INT(id) ) - { - return T_Port::GetStaticProperty(cx, JSVAL_TO_INT(id), vp) ? JS_TRUE : JS_FALSE; - } - return JS_TRUE; - } - - static JSBool JSSetStaticProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) - { - if ( JSVAL_IS_INT(id) ) - { - return T_Port::SetStaticProperty(cx, JSVAL_TO_INT(id), vp) ? JS_TRUE : JS_FALSE; - } - return JS_TRUE; - } - - static JSObject *GetClassPrototype() - { - return m_classProto; - } - - private: - /** - * Contains the number of arguments that a constructor can receive. This - * doesn't mean that the constructor always receives these number of arguments. - * SpiderMonkey makes sure that the constructor receives a correct number of arguments. - * When not all arguments are given, SpiderMonkey will create arguments of the - * 'undefined' type. It's also possible that the constructor receives more arguments. - * It's up to you to decide what happens with these arguments. A rule of thumb: Set this - * value to the number of required arguments. This way you never have to check the number - * of arguments when you check the type of these arguments. When argc is greater - * then this value, you know there are optional values passed. - * You can use the WXJS_INIT_CLASS macro, to initialize this. - * @endif - */ - static int m_ctorArguments; - - /** - * The prototype object of the class - */ - static JSObject *m_classProto; - - /** - * The name of the class. - * You can use the WXJS_INIT_CLASS macro, to initialize this. - */ - static const char* m_jsClassName; - - /** - * The JSClass structure - */ - static JSClass wxjs_class; - - /** - * Enumeration callback - */ - static JSBool JSEnumerate(JSContext *cx, JSObject *obj, - JSIterateOp enum_op, - jsval *statep, jsid *idp) - { - JSBool res = JS_TRUE; - T_Priv *p = (T_Priv *) GetPrivate(cx, obj, false); - if ( p != NULL ) - { - res = T_Port::Enumerate(p, cx, obj, enum_op, statep, idp) ? JS_TRUE : JS_FALSE; - } - return res; - } - - /** - * AddProperty callback. This will call the AddProperty method of the ported object. - */ - static JSBool JSAddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) - { - if (JSVAL_IS_STRING(id)) - { - T_Priv *p = (T_Priv *) GetPrivate(cx, obj, false); - if ( p != NULL ) - { - wxString str; - FromJS(cx, id, str); - JSBool res = T_Port::AddProperty(p, cx, obj, str, vp) ? JS_TRUE : JS_FALSE; - return res; - } - } - return JS_TRUE; - } - - /** - * GetProperty callback. This will call the Get method of the ported object. - */ - static JSBool JSGetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) - { - T_Priv *p = (T_Priv *) GetPrivate(cx, obj, false); - if (JSVAL_IS_INT(id)) - { - return T_Port::GetProperty(p, cx, obj, JSVAL_TO_INT(id), vp) ? JS_TRUE : JS_FALSE; - } - else - { - if (JSVAL_IS_STRING(id)) - { - wxString s; - FromJS(cx, id, s); - JSBool res = T_Port::GetStringProperty(p, cx, obj, s, vp) ? JS_TRUE : JS_FALSE; - return res; - } - } - return JS_TRUE; - } - - /** - * SetProperty callback. This will call the Set method of the ported object. - */ - static JSBool JSSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) - { - T_Priv *p = (T_Priv *) GetPrivate(cx, obj, false); - if (JSVAL_IS_INT(id)) - { - return T_Port::SetProperty(p, cx, obj, JSVAL_TO_INT(id), vp) ? JS_TRUE : JS_FALSE; - } - else - { - if (JSVAL_IS_STRING(id)) - { - wxString s; - FromJS(cx, id, s); - JSBool res = T_Port::SetStringProperty(p, cx, obj, s, vp) ? JS_TRUE : JS_FALSE; - return res; - } - } - return JS_TRUE; - } - - static JSBool JSResolve(JSContext *cx, JSObject *obj, jsval id) - { - return T_Port::Resolve(cx, obj, id) ? JS_TRUE : JS_FALSE; - } - - /** - * Constructor callback. This will call the static Construct method of the ported object. - * When this is not available, the ported object can't be created with a new statement in - * JavaScript. - */ - static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval* WXUNUSED(rval)) - { - T_Priv *p = T_Port::Construct(cx, obj, argc, argv, JS_IsConstructing(cx) == JS_TRUE); - if ( p == NULL ) - { - JS_ReportError(cx, "Class %s can't be constructed", m_jsClassName); - return JS_FALSE; - } - JS_SetPrivate(cx, obj, p); - return JS_TRUE; - } - - /** - * Destructor callback. This will call the Destruct method of the ported object. - */ - static void JSDestructor(JSContext *cx, JSObject *obj) - { - T_Priv *p = (T_Priv *) JS_GetPrivate(cx, obj); - if ( p != NULL ) - { - T_Port::Destruct(cx, p); - } - } - }; -}; // namespace wxjs - -// The initialisation of wxjs_class -template -JSClass wxjs::ApiWrapper::wxjs_class = -{ - wxjs::ApiWrapper::m_jsClassName, - JSCLASS_HAS_PRIVATE | JSCLASS_NEW_ENUMERATE, - wxjs::ApiWrapper::JSAddProperty, - JS_PropertyStub, - wxjs::ApiWrapper::JSGetProperty, - wxjs::ApiWrapper::JSSetProperty, - (JSEnumerateOp) wxjs::ApiWrapper::JSEnumerate, - wxjs::ApiWrapper::JSResolve, - JS_ConvertStub, - wxjs::ApiWrapper::JSDestructor, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -// Some usefull macro's that makes the use of ApiWrapper easy -// PROPERTY MACROS -#define WXJS_NORMAL JSPROP_ENUMERATE | JSPROP_PERMANENT -#define WXJS_READONLY JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY - -// Declare a property map (use it in headers) -#define WXJS_DECLARE_PROPERTY_MAP() \ - static void DefineProperties(JSContext *cx, JSObject *obj); - -// Declare a static property map (use it in headers) -#define WXJS_DECLARE_STATIC_PROPERTY_MAP() \ - static void DefineStaticProperties(JSContext *cx, JSObject *obj); - -// Begins a property map (use it in source files) -#define WXJS_BEGIN_PROPERTY_MAP(className) \ - void className::DefineProperties(JSContext *cx, JSObject *obj) \ - { \ - JSPropertySpec props[] = \ - { -// Ends a property map (use it in source files) -#define WXJS_END_PROPERTY_MAP() \ - { 0, 0, 0, 0, 0 } \ - }; \ - JS_DefineProperties(cx, obj, props); \ - } -// Begins a static property map -#define WXJS_BEGIN_STATIC_PROPERTY_MAP(className) \ - void className::DefineStaticProperties(JSContext *cx, JSObject *obj) \ - { \ - JSPropertySpec props[] = \ - { - -// Defines a property -#define WXJS_PROPERTY(id, name) \ - { name, id, WXJS_NORMAL, 0, 0 }, - -// Defines a static property -#define WXJS_STATIC_PROPERTY(id, name) \ - { name, id, WXJS_NORMAL, JSGetStaticProperty, JSSetStaticProperty }, - -// Defines a readonly property -#define WXJS_READONLY_PROPERTY(id, name) \ - { name, id, WXJS_READONLY, 0, 0 }, - -// Defines a readonly static property -#define WXJS_READONLY_STATIC_PROPERTY(id, name) \ - { name, id, WXJS_READONLY, JSGetStaticProperty, 0 }, - -// Declares a constant map -#define WXJS_DECLARE_CONSTANT_MAP() static void DefineConstants(JSContext *cx, JSObject *obj); - -// Begins a constant map -#define WXJS_BEGIN_CONSTANT_MAP(className) \ - void className::DefineConstants(JSContext *cx, JSObject *obj) \ - { \ - JSConstDoubleSpec consts[] = \ - { - -// Ends a constant map -#define WXJS_END_CONSTANT_MAP() \ - { 0, 0, 0 } \ - }; \ - JS_DefineConstDoubles(cx, obj, consts); \ - } - -// Defines a constant with a prefix -#define WXJS_CONSTANT(prefix, name) { prefix##name, #name, WXJS_READONLY }, -// Defines a constant -#define WXJS_SIMPLE_CONSTANT(name) { name, #name, WXJS_READONLY }, - -// METHOD MACROS -#define WXJS_DECLARE_METHOD_MAP() static void DefineMethods(JSContext *cx, JSObject *obj); - -#define WXJS_BEGIN_METHOD_MAP(className) \ - void className::DefineMethods(JSContext *cx, JSObject *obj) \ - { \ - JSFunctionSpec methods[] = \ - { - -#define WXJS_END_METHOD_MAP() \ - { 0, 0, 0, 0, 0 } \ - }; \ - JS_DefineFunctions(cx, obj, methods); \ - } - -#define WXJS_METHOD(name, fun, args) \ - { name, fun, args, 0, 0 }, - -#define WXJS_DECLARE_STATIC_METHOD_MAP() static void DefineStaticMethods(JSContext *cx, JSObject *obj); - -#define WXJS_BEGIN_STATIC_METHOD_MAP(className) \ - void className::DefineStaticMethods(JSContext *cx, JSObject *obj) \ - { \ - JSFunctionSpec methods[] = \ - { - -// CLASS MACROS -#define WXJS_INIT_CLASS(type, name, ctor) \ - template<> JSObject *type::TOBJECT::m_classProto = NULL; \ - template<> int type::TOBJECT::m_ctorArguments = ctor; \ - template<> const char* type::TOBJECT::m_jsClassName = name; -#endif // _JSOBJECT_H Property changes on: ps/trunk/source/tools/atlas/wxJS/common/apiwrap.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/main.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/main.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/main.h (nonexistent) @@ -1,55 +0,0 @@ -/* - * wxJavaScript - main.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: main.h 598 2007-03-07 20:13:28Z fbraem $ - */ -///////////////////////////////////////////////////////////////////////////// -// Name: main.h -// Purpose: Global definitions for wxJS -// Author: Franky Braem -// Modified by: -// Created: 18.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#ifndef _wxJS_H -#define _wxJS_H - -#ifdef _MSC_VER - // Turn off identifier was truncated warning - #pragma warning(disable:4786) - // Turn off deprecated warning - #pragma warning(disable:4996) -#endif - -#include - -#include "defs.h" -#include "object.h" -#include "apiwrap.h" -#include "type.h" - -static const int WXJS_CONTEXT_SIZE = 32768; -static const int WXJS_START_PROPERTY_ID = -128; - -#endif //_wxJS_H Property changes on: ps/trunk/source/tools/atlas/wxJS/common/main.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/jsutil.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/jsutil.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/jsutil.cpp (nonexistent) @@ -1,122 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - jsutil.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: jsutil.cpp 603 2007-03-08 20:36:17Z fbraem $ - */ - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "jsutil.h" - -JSBool wxjs::GetFunctionProperty(JSContext *cx, JSObject *obj, const char *propertyName, jsval *property) -{ - if ( JS_GetProperty(cx, obj, propertyName, property) == JS_TRUE - && JS_TypeOfValue(cx, *property) == JSTYPE_FUNCTION ) - { - return JS_TRUE; - } - else - { - return JS_FALSE; - } -} - -JSBool wxjs::CallFunctionProperty(JSContext *cx, JSObject *obj, const char *propertyName, uintN argc, jsval* args, jsval *rval) -{ - jsval property; - if ( ( GetFunctionProperty(cx, obj, propertyName, &property) == JS_TRUE ) ) - { - if ( JS_CallFunctionValue(cx, obj, property, argc, args, rval) == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return JS_FALSE; - } - return JS_TRUE; - } - return JS_FALSE; -} - -JSClass* wxjs::GetClass(JSContext *cx, const char* className) -{ - jsval ctor, proto; - - if (JS_LookupProperty(cx, JS_GetGlobalObject(cx), className, &ctor) == JS_FALSE) - return NULL; - - if (JS_LookupProperty(cx, JSVAL_TO_OBJECT(ctor), "prototype", &proto) == JS_FALSE) - return NULL; - - JSObject *protoObj = JSVAL_TO_OBJECT(proto); - - return JS_GET_CLASS(cx, protoObj); -} - -bool wxjs::HasPrototype(JSContext *cx, JSObject *obj, const char *className) -{ - JSClass *jsclass = GetClass(cx, className); - if ( jsclass == NULL ) - return false; - - JSObject *prototype = JS_GetPrototype(cx, obj); - while( prototype != NULL - && JS_InstanceOf(cx, prototype, jsclass, NULL) == JS_FALSE ) - { - prototype = JS_GetPrototype(cx, prototype); - } - return prototype != NULL; -} - -bool wxjs::HasPrototype(JSContext *cx, jsval v, const char *className) -{ - if ( JSVAL_IS_OBJECT(v) ) - return HasPrototype(cx, JSVAL_TO_OBJECT(v), className); - else - return false; -} - -bool wxjs::GetScriptRoot(JSContext *cx, jsval *v) -{ - return JS_GetProperty(cx, JS_GetGlobalObject(cx), "scriptRoot", v) == JS_TRUE; -} - -JSBool wxjs::DefineUnicodeProperty(JSContext *cx, - JSObject *obj, - const wxString &propertyName, - jsval *propertyValue) -{ - wxMBConvUTF16 utf16; - 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(), - *propertyValue, NULL, NULL, JSPROP_ENUMERATE); - delete[] jsValue; - return ret; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/common/jsutil.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/object.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/object.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/object.h (nonexistent) @@ -1,89 +0,0 @@ -/* - * wxJavaScript - object.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: object.h 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * (c) 2001-2002 Franky Braem (S.A.W.) - * - * This file is part of wxJS. wxJS ports wxWindows to JavaScript - * - * File : object.h - * Desc. : Keeps a pointer to the associated JSObject. - * Created : 06-01-2002 - */ - -#ifndef _Object_H -#define _Object_H - -namespace wxjs -{ - class Object - { - public: - /** - * Constructor - */ - - Object() : m_obj(NULL), m_cx(NULL) - { - } - - Object(JSObject *obj, JSContext *cx); - - Object(const Object ©); - - /** - * Destructor - */ - virtual ~Object(); - - /** - * Returns the JavaScript object - */ - inline JSObject* GetObject() const - { - return m_obj; - } - - inline JSContext *GetContext() const - { - return m_cx; - } - - inline void SetObject(JSObject *obj) - { - m_obj = obj; - } - - private: - - // The actual JSObject. We don't have to root this - // because it is stored in the private data of the JSObject. - // The private data will only be destroyed together with the object - // when it is garbage collected. - - JSObject *m_obj; - JSContext *m_cx; - }; -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/common/object.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/index.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/index.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/index.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - index.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: index.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxJS_Index_h -#define _wxJS_Index_h - -///////////////////////////////////////////////////////////////////////////// -// Name: index.h -// Purpose: wxJS_Index is used to keep information about indexed objects -// Author: Franky Braem -// Modified by: -// Created: 23.09.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - class Index - { - public: - - Index(int idx) : m_index(idx) - { - } - - inline int GetIndex() const - { - return m_index; - } - - inline void SetIndex(int idx) - { - m_index = idx; - } - - private: - int m_index; - }; -}; -#endif // _wxJS_Index_h Property changes on: ps/trunk/source/tools/atlas/wxJS/common/index.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/jsutil.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/jsutil.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/jsutil.h (nonexistent) @@ -1,46 +0,0 @@ -/* - * wxJavaScript - jsutil.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: jsutil.h 603 2007-03-08 20:36:17Z fbraem $ - */ -#ifndef _wxjs_util_h -#define _wxjs_util_h - -namespace wxjs -{ - // Returns a function from a property - JSBool GetFunctionProperty(JSContext *cx, JSObject *obj, const char *propertyName, jsval *property); - JSBool CallFunctionProperty(JSContext *cx, JSObject *obj, const char *propertyName, uintN argc, jsval* args, jsval *rval); - - // Returns the JSClass structure for the given classname - JSClass *GetClass(JSContext *cx, const char* className); - - // Returns true when the object has class as its prototype - bool HasPrototype(JSContext *cx, JSObject *obj, const char *className); - bool HasPrototype(JSContext *cx, jsval v, const char *className); - - bool GetScriptRoot(JSContext *cx, jsval *v); - - // Define a UNICODE property - JSBool DefineUnicodeProperty(JSContext *cx, JSObject *obj, const wxString &propertyName, jsval *propertyValue); -}; -#endif //wxjs_util_h Property changes on: ps/trunk/source/tools/atlas/wxJS/common/jsutil.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/wxjs.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/wxjs.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/wxjs.h (nonexistent) @@ -1,38 +0,0 @@ -/* - * wxJavaScript - wxjs.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: wxjs.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WXJS_H_ -#define WXJS_H_ - -#include -#ifdef WXJSDLL_BUILD - #define WXJSAPI WXEXPORT -#else - #define WXJSAPI WXIMPORT -#endif -extern "C" WXJSAPI bool wxJS_InitClass(JSContext *cx, JSObject *global); -extern "C" WXJSAPI bool wxJS_InitObject(JSContext *cx, JSObject *obj); -extern "C" WXJSAPI void wxJS_Destroy(); - -#endif /*WXJS_H_*/ Property changes on: ps/trunk/source/tools/atlas/wxJS/common/wxjs.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/type.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/type.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/type.cpp (nonexistent) @@ -1,349 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - type.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: type.cpp 600 2007-03-07 22:08:44Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "type.h" - -//template -//bool FromJS(JSContext *cx, jsval v, T& to); - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, int &to) -{ - int32 temp; - if ( JS_ValueToInt32(cx, v, &temp) == JS_TRUE ) - { - to = temp; - return true; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, unsigned int &to) -{ - int32 temp; - if ( JS_ValueToInt32(cx, v, &temp) == JS_TRUE ) - { - to = temp; - return true; - } - else - return false; -} - - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, long &to) -{ - int32 temp; - if ( JS_ValueToInt32(cx, v, &temp) ) - { - to = temp; - return JS_TRUE; - } - return JS_FALSE; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, double &to) -{ - jsdouble d; - if ( JS_ValueToNumber(cx, v, &d) == JS_TRUE ) - { - to = d; - return true; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, bool &to) -{ - JSBool b; - if ( JS_ValueToBoolean(cx, v, &b) == JS_TRUE ) - { - to = (b == JS_TRUE); - return true; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, wxString &to) -{ - wxMBConvUTF16 conv; - JSString *str = JS_ValueToString(cx, v); - jschar *s = JS_GetStringChars(str); - to = wxString(conv.cMB2WX((char *) s)); - return true; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, wxDateTime& to) -{ - to.SetToCurrent(); // To avoid invalid date asserts. - - JSObject *obj = JSVAL_TO_OBJECT(v); - if ( js_DateIsValid(cx, obj) ) - { - to.SetYear(js_DateGetYear(cx, obj)); - to.SetMonth((wxDateTime::Month) js_DateGetMonth(cx, obj)); - to.SetDay((unsigned short) js_DateGetDate(cx, obj)); - to.SetHour((unsigned short) js_DateGetHours(cx, obj)); - to.SetMinute((unsigned short) js_DateGetMinutes(cx, obj)); - to.SetSecond((unsigned short) js_DateGetSeconds(cx, obj)); - return true; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext*cx, jsval v, StringsPtr &to) -{ - if ( JSVAL_IS_OBJECT(v) ) - { - JSObject *objItems = JSVAL_TO_OBJECT(v); - if ( objItems != (JSObject *) NULL - && JS_IsArrayObject(cx, objItems) ) - { - jsuint length = 0; - JS_GetArrayLength(cx, objItems, &length); - to.Allocate(length); - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, objItems, i, &element); - wxjs::FromJS(cx, element, to[i]); - } - } - return true; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, wxArrayString &to) -{ - if ( JSVAL_IS_OBJECT(v) ) - { - JSObject *obj = JSVAL_TO_OBJECT(v); - if ( obj != NULL - && JS_IsArrayObject(cx, obj) ) - { - jsuint length = 0; - JS_GetArrayLength(cx, obj, &length); - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, obj, i, &element); - wxString stringElement; - if ( FromJS(cx, element, stringElement) ) - to.Add(stringElement); - } - return true; - } - else - return false; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, wxStringList &to) -{ - if ( JSVAL_IS_OBJECT(v) ) - { - JSObject *obj = JSVAL_TO_OBJECT(v); - if ( obj != NULL - && JS_IsArrayObject(cx, obj) ) - { - jsuint length = 0; - JS_GetArrayLength(cx, obj, &length); - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, obj, i, &element); - wxString stringElement; - if ( FromJS(cx, element, stringElement) ) - to.Add(stringElement); - } - return true; - } - else - return false; - } - else - return false; -} - -template<> -bool wxjs::FromJS(JSContext *cx, jsval v, long long &to) -{ - int32 temp; - if ( JS_ValueToInt32(cx, v, &temp) == JS_TRUE ) - { - to = temp; - return true; - } - else - return false; -} - -//template -//jsval ToJS(JSContext *cx, T wx); - -template<> -jsval wxjs::ToJS(JSContext* WXUNUSED(cx), const int &from) -{ - return INT_TO_JSVAL(from); -} - -template<> -jsval wxjs::ToJS(JSContext* WXUNUSED(cx), const unsigned int&from) -{ - return INT_TO_JSVAL(from); -} - -template<> -jsval wxjs::ToJS(JSContext* WXUNUSED(cx), const long &from) -{ - return INT_TO_JSVAL(from); -} - -template<> -jsval wxjs::ToJS(JSContext* cx, const unsigned long&from) -{ - jsval v; - JS_NewDoubleValue(cx, from, &v); - return v; -} - -template<> -jsval wxjs::ToJS(JSContext* cx, const float &from) -{ - jsval v; - JS_NewDoubleValue(cx, from, &v); - return v; -} - -template<> -jsval wxjs::ToJS(JSContext* cx, const double &from) -{ - jsval v; - JS_NewDoubleValue(cx, from, &v); - return v; -} - -template<> -jsval wxjs::ToJS(JSContext* WXUNUSED(cx), const bool &from) -{ - return BOOLEAN_TO_JSVAL(from); -} - -template<> -jsval wxjs::ToJS(JSContext* cx, const wxString &from) -{ - if ( from.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; - } - return val; -} - -template<> -jsval wxjs::ToJS(JSContext *cx, const wxDateTime &from) -{ - if ( from.IsValid() ) - { - return OBJECT_TO_JSVAL(js_NewDateObject(cx, - from.GetYear(), - from.GetMonth(), - from.GetDay(), - from.GetHour(), - from.GetMinute(), - from.GetSecond())); - } - else - return JSVAL_VOID; -} - -template<> -jsval wxjs::ToJS(JSContext *cx, const wxArrayString &from) -{ - JSObject *objArray = JS_NewArrayObject(cx, 0, NULL); - JS_AddRoot(cx, &objArray); - for(size_t i = 0; i < from.GetCount(); i++) - { - jsval element = ToJS(cx, from.Item(i)); - JS_SetElement(cx, objArray, i, &element); - } - JS_RemoveRoot(cx, &objArray); - return OBJECT_TO_JSVAL(objArray); -} - -template<> -jsval wxjs::ToJS(JSContext *cx, const wxStringList &from) -{ - JSObject *objArray = JS_NewArrayObject(cx, 0, NULL); - JS_AddRoot(cx, &objArray); - - int i = 0; - wxStringListNode *node = from.GetFirst(); - while(node) - { - wxString s(node->GetData()); - - jsval element = ToJS(cx, s); - JS_SetElement(cx, objArray, i++, &element); - - node = node->GetNext(); - } - JS_RemoveRoot(cx, &objArray); - return OBJECT_TO_JSVAL(objArray); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/common/type.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/evtconn.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/evtconn.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/evtconn.h (nonexistent) @@ -1,78 +0,0 @@ -/* - * wxJavaScript - evtconn.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: evtconn.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_evt_conn_h -#define _wxjs_evt_conn_h - -// A helper class to connect an event to a method of a class -// This is used to avoid a big if-statement for selecting -// the correct event connector -// An event connector is a function that connects an event - -#include - -namespace wxjs -{ - template - class EventConnector - { - public: - typedef void (*ConnectEventFn)(T_Priv *p); - typedef std::map ConnectEventMap; - protected: - static bool ConnectEvent(T_Priv *p, const wxString &name) - { - #if (__GNUC__ >= 4) - typename ConnectEventMap::iterator it = m_eventMap.find(name); - #else - ConnectEventMap::iterator it = m_eventMap.find(name); - #endif - if ( it != m_eventMap.end() ) - { - it->second(p); - return true; - } - return false; - } - - static ConnectEventMap m_eventMap; - }; - -} // end namespace wxjs - -// Some macro's -#if (__GNUC__ >= 4) - #define WXJS_INIT_EVT_CONNECTOR_MAP(priv) template <> EventConnector::ConnectEventMap EventConnector::m_eventMap = EventConnector< priv >::ConnectEventMap(); -#else - #define WXJS_INIT_EVT_CONNECTOR_MAP(priv) EventConnector::ConnectEventMap EventConnector::m_eventMap; -#endif - -#define WXJS_BEGIN_EVT_CONNECTOR_MAP(cl) \ - void cl::InitConnectEventMap() \ - { -#define WXJS_EVT_CONNECTOR(name, fun) m_eventMap[name] = fun; - -#define WXJS_END_EVT_CONNECTOR_MAP() } - -#endif // _wxjs_evt_conn_h Property changes on: ps/trunk/source/tools/atlas/wxJS/common/evtconn.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/type.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/type.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/type.h (nonexistent) @@ -1,113 +0,0 @@ -/* - * wxJavaScript - type.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: type.h 600 2007-03-07 22:08:44Z fbraem $ - */ -#ifndef _wxJS_Type_H -#define _wxJS_Type_H - -#include -#include - -#include -#include "strsptr.h" - -class wxStringList; -class wxArrayString; - -namespace wxjs -{ - template - bool FromJS(JSContext *cx, jsval v, T& to); - - template<> - bool FromJS(JSContext *cx, jsval v, int &to); - - template<> - bool FromJS(JSContext *cx, jsval v, unsigned int &to); - - template<> - bool FromJS(JSContext *cx, jsval v, long &to); - - template<> - bool FromJS(JSContext *cx, jsval v, double &to); - - template<> - bool FromJS(JSContext *cx, jsval v, long long &to); - - template<> - bool FromJS(JSContext *cx, jsval v, bool &to); - - template<> - bool FromJS(JSContext *cx, jsval v, wxString &to); - - template<> - bool FromJS(JSContext *cx, jsval v, wxDateTime& to); - - template<> - bool FromJS(JSContext *cx, jsval v, StringsPtr &to); - - template<> - bool FromJS(JSContext *cx, jsval v, wxArrayString &to); - - template<> - bool FromJS(JSContext *cx, jsval v, wxStringList &to); - - template - jsval ToJS(JSContext *cx, const T &wx); - - template<> - jsval ToJS(JSContext *cx, const int &from); - - template<> - jsval ToJS(JSContext *cx, const unsigned int &from); - - template<> - jsval ToJS(JSContext *cx, const long &from); - - template<> - jsval ToJS(JSContext *cx, const unsigned long&from); - - template<> - jsval ToJS(JSContext *cx, const float& from); - - template<> - jsval ToJS(JSContext *cx, const double &from); - - template<> - jsval ToJS(JSContext *cx, const bool &from); - - template<> - jsval ToJS(JSContext *cx, const wxString &from); - - template<> - jsval ToJS(JSContext *cx, const wxDateTime &from); - - template<> - jsval ToJS(JSContext *cx, const wxArrayString &from); - - template<> - jsval ToJS(JSContext *cx, const wxStringList &from); - -}; // Namespace wxjs - -#endif // _wxJS_Type_H Property changes on: ps/trunk/source/tools/atlas/wxJS/common/type.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/defs.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/defs.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/defs.h (nonexistent) @@ -1,38 +0,0 @@ -/* - * wxJavaScript - defs.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: defs.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_defs_h -#define _wxjs_defs_h - -#define wxJS_MAJOR_VERSION 0 -#define wxJS_MINOR_VERSION 9 -#define wxJS_RELEASE_NUMBER 6 -#define wxJS_STR_VERSION wxT("0.9.6") - -// Encoding used internally. SpiderMonkey uses UTF-16 -#define wxJS_INTERNAL_ENCODING wxT("UTF-16") -// Default encoding to use when reading files, ... -#define wxJS_EXTERNAL_ENCODING wxT("UTF-8") - -#endif // _wxjs_defs_h Property changes on: ps/trunk/source/tools/atlas/wxJS/common/defs.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/strsptr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/strsptr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/strsptr.h (nonexistent) @@ -1,97 +0,0 @@ -/* - * wxJavaScript - strsptr.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: strsptr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _STRINGSPTR_H -#define _STRINGSPTR_H - -///////////////////////////////////////////////////////////////////////////// -// Name: strsptr.h -// Purpose: Proxy for a pointer to an array of wxString elements. -// Use this class to convert a JavaScript array of strings into -// a wxString array. -// -// The pointer returned to the array is only valid in the scoop -// of this object. When the object goes out of scoop, the array -// will be destroyed. -// -// Author: Franky Braem -// Modified by: -// Created: 11.09.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - - class StringsPtr - { - public: - - StringsPtr() : m_strings(NULL), m_count(0) - { - } - - virtual ~StringsPtr() - { - delete[] m_strings; - } - - unsigned int GetCount() const - { - return m_count; - } - - const wxString* GetStrings() const - { - return m_strings; - } - - private: - - wxString& operator[](unsigned int i) - { - return m_strings[i]; - } - - void Allocate(unsigned int count) - { - if ( m_strings != NULL ) - delete[] m_strings; - - m_count = count; - m_strings = new wxString[m_count]; - } - - template friend bool FromJS(JSContext*cx, jsval v, T &to); - - // Avoid copying - StringsPtr(const StringsPtr&); - - wxString *m_strings; - unsigned int m_count; - }; -}; - -#endif //_STRINGSPTR_H Property changes on: ps/trunk/source/tools/atlas/wxJS/common/strsptr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/common/object.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/common/object.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/common/object.cpp (nonexistent) @@ -1,42 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - object.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: object.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// object.cpp -#include -#include "object.h" - -wxjs::Object::Object(JSObject *obj, JSContext *cx) : m_obj(obj), m_cx(cx) -{ -} - -wxjs::Object::Object(const wxjs::Object ©) : m_obj(copy.m_obj), m_cx(copy.m_cx) -{ -} - -wxjs::Object::~Object() -{ -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/common/object.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/precompiled.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/precompiled.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/precompiled.h (nonexistent) @@ -1,24 +0,0 @@ -#ifndef INCLUDED_STDAFX -#define INCLUDED_STDAFX - -// Global definitions, since this is a convenient place: - -#ifdef _WIN32 -# define XP_WIN -#else -# define XP_UNIX -#endif // (we don't support XP_OS2 or XP_BEOS) - -#define JS_THREADSAFE - -// Precompiled headers: - -#ifdef USING_PCH - -#define WX_PRECOMP -#include "common/main.h" -#include "wx/wxprec.h" - -#endif - -#endif // INCLUDED_STDAFX Property changes on: ps/trunk/source/tools/atlas/wxJS/precompiled.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/README.txt =================================================================== --- ps/trunk/source/tools/atlas/wxJS/README.txt (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/README.txt (nonexistent) @@ -1,15 +0,0 @@ -Based on wxJavaScript 0.9.6, with some modifications: - -Added #include "precompiled.h" to every .cpp file -Changed #include into #include - -Renamed io/{init,constant}.cpp to io/io_{init,constant}.cpp (to prevent naming conflicts when we compile everything together) -Renamed ext/main.cpp to ext/ext_main.cpp -Removed wxGlobalMap from io/io_constant.cpp -Removed everything except wxjs::ext:: definitions from ext/main.cpp - -Fixed warnings from common/apiwrap.h - -Fixed bugs: -http://sourceforge.net/tracker/index.php?func=detail&aid=1730754&group_id=50913&atid=461416 -http://sourceforge.net/tracker/index.php?func=detail&aid=1730960&group_id=50913&atid=461416 Property changes on: ps/trunk/source/tools/atlas/wxJS/README.txt ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/wxjs_ext.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/wxjs_ext.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/wxjs_ext.h (nonexistent) @@ -1,52 +0,0 @@ -/* - * wxJavaScript - wxjs_ext.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: wxjs_ext.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_ext_h -#define _wxjs_ext_h - -#include - -#include - -#ifdef WXJSDLL_BUILD - #define WXJSAPI WXEXPORT -#else - #define WXJSAPI WXIMPORT -#endif - -WXJSAPI bool wxJS_EXTInit(JSContext *cx, JSObject *global); -WXJSAPI bool wxJS_EXTInitClass(JSContext *cx, JSObject *obj); -WXJSAPI void wxJS_EXTDestroy(); - -namespace wxjs -{ - namespace ext - { - WXJSAPI wxMemoryBuffer* NewMemoryBuffer(void *buffer, int size); - WXJSAPI JSObject *CreateMemoryBuffer(JSContext *cx, void *buffer, int size); - WXJSAPI wxMemoryBuffer* GetMemoryBuffer(JSContext *cx, JSObject *obj); - }; -}; - -#endif // _wxjs_ext_h Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/wxjs_ext.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/membuf.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/membuf.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/membuf.h (nonexistent) @@ -1,169 +0,0 @@ -/* - * wxJavaScript - membuf.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: membuf.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef __MEMBUF_H__ -#define __MEMBUF_H__ - -#include - -typedef unsigned __MEMBUF_INT__; // Buffer size for 32-bit compilers -const __MEMBUF_INT__ __MEMBUF_NO_MATCH__ = 0xFFFFFFFF; - -// 09/14/2005: Added null buffer class used to reserve address space -// for null memory buffers -class MemoryBufferNULLPtr -{ -public: - MemoryBufferNULLPtr() { } - ~MemoryBufferNULLPtr() { } - -public: // Global null memory buffer pointers - static unsigned char MemoryBufferNUllChar; - static unsigned char MemoryBufferNUllBuf[1]; -}; - -// Memory buffer class -class MemoryBuffer -{ -public: - MemoryBuffer() { mptr = 0; l_length = d_length = 0; } - MemoryBuffer(__MEMBUF_INT__ bytes) { - mptr = 0; l_length = d_length = 0; Alloc(bytes); - } - MemoryBuffer(const void *buf, __MEMBUF_INT__ bytes); - ~MemoryBuffer() { if(mptr) delete mptr; } - MemoryBuffer(const MemoryBuffer &buf); - MemoryBuffer &operator=(const MemoryBuffer &buf); - -public: // Pointer and length functions - __MEMBUF_INT__ length() const { return l_length; } // Returns logical length - __MEMBUF_INT__ dlength() const { return d_length; } // Returns actual length - int resize(__MEMBUF_INT__ bytes, int keep = 1); - unsigned char *m_buf() { return mptr; } - const unsigned char *m_buf() const { return mptr; } - int is_null() { return ((mptr == 0) || (l_length == 0)); } - int is_null() const { return ((mptr == 0) || (l_length == 0)); } - int Load(const void *buf, __MEMBUF_INT__ bytes); - void Clear(int clean_buf = 1); - int MemSet(const char c, __MEMBUF_INT__ offset = 0, __MEMBUF_INT__ num = 0); - - std::string toString() { return std::string((char *) mptr, l_length); } - -public: // Append, Insert, delete, and remove functions - void Cat(const void *buf, __MEMBUF_INT__ bytes) { - InsertAt(l_length, buf, bytes); - } - void Cat(unsigned char byte) { Cat((void *)&byte, 1); } - void Cat(char byte) { Cat((void *)&byte, 1); } - __MEMBUF_INT__ DeleteAt(__MEMBUF_INT__ position, __MEMBUF_INT__ bytes); - __MEMBUF_INT__ InsertAt(__MEMBUF_INT__ position, const void *buf, - __MEMBUF_INT__ bytes); - __MEMBUF_INT__ InsertAt(__MEMBUF_INT__ position, const MemoryBuffer &buf) { - return InsertAt(position, (const void *)buf.mptr, buf.l_length); - } - __MEMBUF_INT__ ReplaceAt(__MEMBUF_INT__ position, const void *buf, - __MEMBUF_INT__ bytes); - __MEMBUF_INT__ ReplaceAt(__MEMBUF_INT__ position, const MemoryBuffer &buf) { - return ReplaceAt(position, (const void *)buf.mptr, buf.l_length); - } - -public: // Search functions - __MEMBUF_INT__ Find(void *buf, __MEMBUF_INT__ offset = 0); - __MEMBUF_INT__ Find(const void *buf, __MEMBUF_INT__ bytes, - __MEMBUF_INT__ offset = 0) const; - __MEMBUF_INT__ Find(MemoryBuffer &buf, - __MEMBUF_INT__ offset = 0) { - return Find(buf.mptr, buf.l_length, offset); - } - __MEMBUF_INT__ Find(const MemoryBuffer &buf, - __MEMBUF_INT__ offset = 0) const { - return Find(buf.mptr, buf.l_length, offset); - } - -public: // Memory allocation/de-allocation routines - void *Alloc(__MEMBUF_INT__ bytes); - void *Realloc(__MEMBUF_INT__ bytes, int keep = 1, int reuse = 1); - void Destroy(); - void *FreeBytes(); - -public: // Conversion functions - operator char *() const { return (char *)mptr; } - operator const char *() const { return (const char*)mptr; } - operator const int () const { return ((mptr != 0) && (l_length != 0)); } - operator int () { return ((mptr != 0) && (l_length != 0)); } - -public: // Overloaded operators - int operator!() { return ((mptr == 0) || (l_length == 0)); } - int operator!() const { return ((mptr == 0) || (l_length == 0)); } - unsigned char &operator[](__MEMBUF_INT__ i); - unsigned char &operator[](__MEMBUF_INT__ i) const; - void operator+=(const MemoryBuffer &buf) { Cat(buf.mptr, buf.l_length); } - void operator+=(const unsigned char &byte) { Cat(byte); } - void operator+=(const char &byte) { Cat(byte); } - friend MemoryBuffer operator+(const MemoryBuffer &a, - const MemoryBuffer &b); - - friend int operator==(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) == 0; - } - - friend int operator!=(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) != 0; - } - - friend int operator>(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) > 0; - } - - friend int operator>=(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) >= 0; - } - - friend int operator<(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) < 0; - } - - friend int operator<=(const MemoryBuffer &a, - const MemoryBuffer &b) { - return BufferCompare(a, b) <= 0; - } - -public: // Friend functions - // Returns -1 if a < b, 0 if a == b, and 1 if a > b - friend int BufferCompare(const MemoryBuffer &a, - const MemoryBuffer &b); - -private: - unsigned char *mptr; // Pointer to start of buffer - __MEMBUF_INT__ d_length; // Number of bytes allocated for the buffer - __MEMBUF_INT__ l_length; // Logical length of the buffer -}; - -#endif // __MEMBUF_H__ - Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/membuf.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/ext_main.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/ext_main.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/ext_main.cpp (nonexistent) @@ -1,92 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - main.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: main.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifdef __WXMSW__ - #include -#endif -#include "../common/main.h" - -#include "jsmembuf.h" -#include "wxjs_ext.h" - -using namespace wxjs; -using namespace wxjs::ext; - -#if 0 -#ifdef __WXMSW__ - BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) - { - BOOL result = TRUE; - - switch(fdwReason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); - break; - case DLL_PROCESS_DETACH: - break; - } - - return result; - } -#endif - -WXJSAPI bool wxJS_EXTInit(JSContext *cx, JSObject *global) -{ - MemoryBuffer::JSInit(cx, global); - return true; -} - -WXJSAPI bool wxJS_EXTInitClass(JSContext *cx, JSObject *obj) -{ - return true; -} - -WXJSAPI void wxJS_EXTDestroy() -{ -} -#endif - -WXJSAPI JSObject *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; -} - -WXJSAPI wxMemoryBuffer* wxjs::ext::GetMemoryBuffer(JSContext *cx, JSObject *obj) -{ - return MemoryBuffer::GetPrivate(cx, obj); -} - -WXJSAPI wxMemoryBuffer* wxjs::ext::NewMemoryBuffer(void *buffer, int size) -{ - wxMemoryBuffer *membuf = new wxMemoryBuffer(size); - membuf->AppendData(buffer, size); - return membuf; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/ext_main.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.cpp (nonexistent) @@ -1,323 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - jsmembuf.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: jsmembuf.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsmembuf.cpp -#include "../common/main.h" -#include "jsmembuf.h" -#include - -using namespace wxjs; -using namespace ext; - -/*** - * memorybuffer - * ext - * - * A wxMemoryBuffer is a useful data structure for storing arbitrary sized blocks of memory. - *
- *
- * You can access the data of the buffer as a JavaScript array. - * For example:
- *

- *   var buffer = new wxMemoryBuffer(10);
- *   buffer[0] = 10;
- *   buffer[1] = 'a';
- *  
- *
- */ -WXJS_INIT_CLASS(MemoryBuffer, "wxMemoryBuffer", 0) - -/*** - * - * - * Is the buffer null? (dataLen and bufSize are 0). - * - * - * Get/Set the length of the data in the buffer. The length of the data - * can be less then the length of the buffer. - * - * - * Get/Set the size of the buffer. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(MemoryBuffer) - WXJS_PROPERTY(P_DATA_LENGTH, "dataLen") - WXJS_PROPERTY(P_LENGTH, "bufSize") - WXJS_READONLY_PROPERTY(P_IS_NULL, "isNull") -WXJS_END_PROPERTY_MAP() - -bool MemoryBuffer::GetProperty(wxMemoryBuffer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id > -1 ) - { - if ( (unsigned int) id < p->GetDataLen() ) - { - unsigned int *data = (unsigned int*) p->GetData(); - *vp = ToJS(cx, (int) data[id]); - } - } - else - { - switch(id) - { - case P_DATA_LENGTH: - *vp = ToJS(cx, p->GetDataLen()); - break; - case P_LENGTH: - *vp = ToJS(cx, p->GetBufSize()); - break; - case P_IS_NULL: - *vp = ToJS(cx, p->GetDataLen() == 0 && p->GetBufSize() == 0); - break; - } - } - return true; -} - -bool MemoryBuffer::SetProperty(wxMemoryBuffer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id > -1 ) - { - if ( (unsigned int) id < p->GetDataLen() ) - { - if ( JSVAL_IS_STRING(*vp) ) - { - wxString str; - FromJS(cx, *vp, str); - if ( str.Length() > 0 ) - { - char *bufdata = (char *) p->GetData(); - bufdata[id] = str[0]; - } - } - else - { - int data; - if ( FromJS(cx, *vp, data) ) - { - char *bufdata = (char *) p->GetData(); - bufdata[id] = data; - } - } - } - } - else - { - switch(id) - { - case P_DATA_LENGTH: - { - int length = 0; - if ( FromJS(cx, *vp, length) ) - p->SetDataLen(length); - break; - } - case P_LENGTH: - { - int dlength = 0; - if ( FromJS(cx, *vp, dlength) ) - p->SetBufSize(dlength); - break; - } - } - } - return true; -} - -/*** - * - * - * The size of the buffer - * - * - * A string to fill the buffer - * The encoding to use to put this string in the buffer - * - * - * Creates a new wxMemoryBuffer object with the given size or with - * string as content. - * - * - */ -wxMemoryBuffer *MemoryBuffer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxMemoryBuffer(); - - if ( argc == 1 - && JSVAL_IS_INT(argv[0]) ) - { - int size = 0; - if ( FromJS(cx, argv[0], size) - && size > 0 ) - { - return new wxMemoryBuffer(size); - } - } - - wxString encoding(wxJS_INTERNAL_ENCODING); - if ( argc > 1 ) - { - FromJS(cx, argv[1], encoding); - } - wxString data; - FromJS(cx, argv[0], data); - - wxCharBuffer content; - if ( encoding.CmpNoCase(wxJS_INTERNAL_ENCODING) == 0 ) - { - content = data.mb_str(); - } - else - { - wxCSConv conv(encoding); - content = data.mb_str(conv); - } - - wxMemoryBuffer *buffer = new wxMemoryBuffer(); - buffer->AppendData(content, strlen(content)); - - return buffer; -} - -WXJS_BEGIN_METHOD_MAP(MemoryBuffer) - WXJS_METHOD("append", append, 1) - WXJS_METHOD("toString", toString, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The byte to add - * - * - * The buffer to add - * The size of the buffer to add. When not set, the full buffer is added. - * - * - * Concatenate a byte or buffer to this buffer. - * - * - */ -JSBool MemoryBuffer::append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMemoryBuffer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_INT(argv[0]) ) - { - int byte; - FromJS(cx, argv[0], byte); - p->AppendByte((char) byte); - return JS_TRUE; - } - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMemoryBuffer *buffer = GetPrivate(cx, argv[0], false); - if ( buffer != NULL ) - { - if ( argc > 1 ) - { - int size; - if ( FromJS(cx, argv[1], size) ) - { - if ( size > (int) buffer->GetDataLen() ) - size = buffer->GetDataLen(); - p->AppendData(buffer->GetData(), size); - } - else - { - return JS_FALSE; - } - } - else - { - p->AppendData(buffer->GetData(), buffer->GetDataLen()); - return JS_TRUE; - } - } - } - - wxString encoding(wxJS_INTERNAL_ENCODING); - if ( argc > 1 ) - { - FromJS(cx, argv[1], encoding); - } - - wxString data; - FromJS(cx, argv[0], data); - - wxCharBuffer content; - if ( encoding.CmpNoCase(wxJS_INTERNAL_ENCODING) == 0 ) - { - content = data.mb_str(); - } - else - { - wxCSConv conv(encoding); - content = data.mb_str(conv); - } - - wxMemoryBuffer *buffer = new wxMemoryBuffer(); - p->AppendData(content, strlen(content)); - - return JS_TRUE; -} - -/*** - * - * - * - * The encoding of the string in this buffer. - * - * - * - * Converts the content in the buffer to a String. - * The default encoding is UTF-16 because in JavaScript all strings - * are stored in UTF-16. A conversion is done to UTF-16, - * when another encoding is specified. - * - * - */ -JSBool MemoryBuffer::toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMemoryBuffer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString encoding(wxJS_INTERNAL_ENCODING); - if ( argc > 0 ) - FromJS(cx, argv[0], encoding); - - wxCSConv conv(encoding); - wxString content((const char*) p->GetData(), conv, p->GetDataLen()); - *rval = ToJS(cx, content); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/membuf.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/membuf.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/membuf.cpp (nonexistent) @@ -1,383 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - membuf.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: membuf.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include "membuf.h" - -// 09/14/2005: Initialize the global null memory buffer pointers -unsigned char MemoryBufferNULLPtr::MemoryBufferNUllChar = '\0'; -unsigned char MemoryBufferNULLPtr::MemoryBufferNUllBuf[1] = { '\0' }; - -MemoryBuffer::MemoryBuffer(const void *buf, __MEMBUF_INT__ bytes) -{ - mptr = 0; - l_length = d_length = 0; - // PC-lint 09/14/2005: Possibly passing a null pointer - if(buf) { - if(Alloc(bytes)) { - if(mptr) { - memmove(mptr, buf, bytes); - } - } - } -} - -MemoryBuffer::MemoryBuffer(const MemoryBuffer &buf) -{ - mptr = 0; - l_length = d_length = 0; - // PC-lint 09/14/2005: Possibly passing a null pointer - if(buf.mptr) { - if(Alloc(buf.l_length)) { - if(mptr) { - memmove(mptr, buf.mptr, buf.l_length); - } - } - } -} - -MemoryBuffer &MemoryBuffer::operator=(const MemoryBuffer &buf) -{ - if(this != &buf) { // Prevent self assignment - if(Alloc(buf.l_length)) { - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return *this; - memmove(mptr, buf.mptr, buf.l_length); - } - } - return *this; -} - -void *MemoryBuffer::Alloc(__MEMBUF_INT__ bytes) -// Allocate a specified number of bytes for this memory buffer. -// This function will try to re-use the current memory segment -// allocated for this buffer before re-allocating memory for -// the buffer. Returns a void pointer to the buffer or a null -// value if a memory allocation error occurs. -{ - if(mptr) { // Memory was previously allocated for this object - if(d_length >= bytes) { // Try to reuse this space - l_length = bytes; - return (void *)mptr; - } - else { // Must resize the buffer - delete[] mptr;// Delete the previous copy and re-allocate memory - l_length = d_length = 0; - } - } - - // Allocate the specified number of bytes - mptr = new unsigned char[bytes]; - if(!mptr) return 0; // Memory allocation error - - // Set the logical and dimensioned length of the buffer - l_length = d_length = bytes; - return (void *)mptr; // Return a pointer to the buffer -} - -void *MemoryBuffer::Realloc(__MEMBUF_INT__ bytes, int keep, int reuse) -// Resize the logical length of the buffer. If the -// "keep" variable is true the old data will be -// copied into the new space. By default the old -// data will not be deleted. Returns a pointer to the -// buffer or a null value if an error occurs. -{ - // Try to reuse the memory allocated for this object - if((reuse == 1) && (mptr != 0)) { - if(d_length >= bytes) { // No additional memory has to be allocated - l_length = bytes; - return (void *)mptr; - } - } - - unsigned char *nmptr = new unsigned char[bytes]; - if(!nmptr) return 0; - - if((keep == 1) && (mptr != 0)) { // Copy old data into the new memory segment - if(bytes < l_length) l_length = bytes; - memmove(nmptr, mptr, l_length); - } - - if(mptr) delete[] mptr; // Free the previously allocated memory - mptr = nmptr; // Point to new memory buffer - l_length = d_length = bytes; // Record new allocated length - return (void *)mptr; -} - -void MemoryBuffer::Destroy() -// Frees the memory allocated for the buffer and resets the -// length variables. -{ - if(mptr) delete[] mptr; - mptr = 0; - l_length = d_length = 0; -} - -void *MemoryBuffer::FreeBytes() -// Free any unused bytes allocated for this buffer. Returns -// a pointer to the re-allocated memory buffer or a null -// value if an error occurs. -{ - // Check for unused bytes - if(d_length == l_length) return (void *)mptr; - return Realloc(l_length, 1, 0); -} - -int MemoryBuffer::resize(__MEMBUF_INT__ bytes, int keep) -// Resize the logical length of the buffer. If the -// "keep" variable is true the old data will be -// copied into the new space. By default the old -// data will not be deleted. Returns true if -// successful or false if an error occurs. -{ - if(!Realloc(bytes, keep)) return 0; - return 1; -} - -__MEMBUF_INT__ MemoryBuffer::Find(void *buf, __MEMBUF_INT__ offset) -// Returns index of first occurrence of pattern void *buf. -// Returns __MEMBUF_NO_MATCH__ if the pattern is not found. -{ - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return __MEMBUF_NO_MATCH__; - - unsigned char *start = mptr + offset; // Start of buffer data - unsigned char *next = start; // Next buffer element - unsigned char *pattern = (unsigned char *)buf; // Next pattern element - __MEMBUF_INT__ i = offset; // Next buffer element index - - while(i < l_length && *pattern) { - if (*next == *pattern) { - pattern++; - if(*pattern == 0) return i; // Pattern was found - next++; - } - else { - i++; - start++; - next = start; - pattern = (unsigned char *)buf; - } - } - return __MEMBUF_NO_MATCH__; // No match was found -} - -__MEMBUF_INT__ MemoryBuffer::Find(const void *buf, __MEMBUF_INT__ bytes, - __MEMBUF_INT__ offset) const -// Returns index of first occurrence of pattern void *buf. -// Returns __MEMBUF_NO_MATCH__ if the pattern is not found. -{ - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return __MEMBUF_NO_MATCH__; - - unsigned char *start = (unsigned char *)mptr + offset; // Start of buf data - unsigned char *next = start; // Next buffer element - unsigned char *pattern = (unsigned char *)buf; // Next pattern element - __MEMBUF_INT__ i = offset, j = 1; // Buffer and pattern indexes - - while(i < l_length && j <= bytes) { - if (*next == *pattern) { // Matching character - if(j == bytes) return i; // Entire match was found - next++; pattern++; j++; - } - else { // Try next spot in buffer - i++; - start++; - next = start; - pattern = (unsigned char *)buf; j = 1; - } - } - return __MEMBUF_NO_MATCH__; // No match was found -} - -__MEMBUF_INT__ MemoryBuffer::DeleteAt(__MEMBUF_INT__ position, - __MEMBUF_INT__ bytes) -{ - __MEMBUF_INT__ buf; - __MEMBUF_INT__ end; - - if(position < l_length && bytes !=0) { - buf = position + bytes; - if(buf > l_length) buf = l_length; - end = unsigned(buf); - bytes = end - position; - - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return (__MEMBUF_INT__)0; - - memmove(mptr+position, mptr+end, l_length-end); - l_length -= bytes; - } - else - bytes = 0; - - return bytes; -} - -__MEMBUF_INT__ MemoryBuffer::InsertAt(__MEMBUF_INT__ position, const void *buf, - __MEMBUF_INT__ bytes) -// Insert a specified number of bytes a the current position, keeping -// the current buffer intact. Returns the number of bytes inserted or -// zero if an error occurs. -{ - __MEMBUF_INT__ old_length = l_length; // Record the current buffer length - - // Ensure that there are enough bytes to hold the insertion - if(!resize(bytes+l_length)) return 0; - - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return (__MEMBUF_INT__)0; - - if(position < old_length) { // Move the data in the middle of the buffer - memmove(mptr+position+bytes, mptr+position, old_length-position); - } - - if(position > l_length) position = l_length; // Stay in bounds - memmove(mptr+position, buf, bytes); - return bytes; -} - -__MEMBUF_INT__ MemoryBuffer::ReplaceAt(__MEMBUF_INT__ position, - const void *buf, - __MEMBUF_INT__ bytes) -// Replace a specified number of bytes at the specified position. Returns -// the number of bytes replaced or zero if an error occurs. -{ - if(position > l_length) position = l_length; // Stay in bounds - __MEMBUF_INT__ end = l_length-position; - if(bytes > end) { // There are not enough bytes to hold the replacement - __MEMBUF_INT__ needed = bytes-end; - if(!resize(l_length + needed)) return 0; - } - - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return (__MEMBUF_INT__)0; - - memmove(mptr+position, buf , bytes); - return bytes; -} - -int BufferCompare(const MemoryBuffer &a, const MemoryBuffer &b) -// Returns -1 if a < b, 0 if a == b, and 1 if a > b -{ - __MEMBUF_INT__ an = a.l_length; - __MEMBUF_INT__ bn = b.l_length; - __MEMBUF_INT__ sn = (an < bn) ? an : bn; - unsigned char *ap = (unsigned char *)a.mptr; - unsigned char *bp = (unsigned char *)b.mptr; - - for(__MEMBUF_INT__ i = 0; i < sn; i++) { - if(*ap < *bp) return -1; - if(*ap++ > *bp++) return 1; - } - - if(an == bn) return 0; - if(an < bn) return -1; - return 1; -} - -int MemoryBuffer::Load(const void *buf, __MEMBUF_INT__ bytes) -// Load this object with a unique copy of the specified buffer. -// Returns true if successful or false if an error occurs. -{ - if(!mptr) { // Ensure that this buffer has been initialized - if(!Alloc(bytes)) return 0; - } - - if(d_length < bytes) { // Ensure enough byte have been allocated - if(!Realloc(bytes, 0, 0)) return 0; - } - else { // Reuse the current memory segment - l_length = bytes; - } - - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return 0; - - memmove(mptr, (unsigned char *)buf, l_length); - return 1; -} - -void MemoryBuffer::Clear(int clean_buf) -// Clear the buffer. If the "clean_buf" variable is -// true the contents of the buffer will be cleared, -// otherwise the logical length will be set to -// zero and the contents of the buffer will not -// cleared. -{ - if(l_length > 0) { - if(clean_buf) DeleteAt(0, l_length); - } - l_length = 0; -} - -int MemoryBuffer::MemSet(const char c, __MEMBUF_INT__ offset, - __MEMBUF_INT__ num) -// Public member function used to fill the memory buffer -// starting at the specified offset. Returns false if the -// buffer is null or the offset is out of range. The "num" -// variable is used to limit fills to a specified number -// of bytes. -{ - if(is_null()) return 0; // This buffer is null - - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return 0; - - // Test the offset before filling the memory buffer - if((offset + num) > d_length) return 0; - unsigned char *ptr = mptr+offset; - __MEMBUF_INT__ pos = d_length - offset; - for(__MEMBUF_INT__ i = 0; i < pos; i++) { - if((num > 0) && (num == i)) break; - *ptr++ = c; - } - return 1; -} - -MemoryBuffer operator+(const MemoryBuffer &a, - const MemoryBuffer &b) -{ - MemoryBuffer buf(a.l_length + b.l_length); - buf += a; - buf += b; - return buf; -} - -unsigned char &MemoryBuffer::operator[](__MEMBUF_INT__ i) -{ - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return MemoryBufferNULLPtr::MemoryBufferNUllChar; - if(i >= l_length) i = l_length; // If not in bounds truncate to l_length - return mptr[i]; -} - -unsigned char &MemoryBuffer::operator[](__MEMBUF_INT__ i) const -{ - // PC-lint 09/14/2005: Possible use of null pointer - if(!mptr) return MemoryBufferNULLPtr::MemoryBufferNUllChar; - if(i >= l_length) i = l_length; // If not in bounds truncate to l_length - return mptr[i]; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/membuf.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - jsmembuf.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: jsmembuf.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJS_MEMBUF_H -#define _WXJS_MEMBUF_H - -///////////////////////////////////////////////////////////////////////////// -// Name: jsmembuf.h -// Purpose: Ports wxMemoryBuffer to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 02.12.2005 -// Copyright: (c) 2001-2005 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace ext - { - class MemoryBuffer : public ApiWrapper - { - public: - - static bool GetProperty(wxMemoryBuffer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxMemoryBuffer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_DATA_LENGTH = WXJS_START_PROPERTY_ID, - P_LENGTH, - P_IS_NULL - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static wxMemoryBuffer *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace ext -}; // namespace wxjs -#endif Property changes on: ps/trunk/source/tools/atlas/wxJS/ext/jsmembuf.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/init.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/init.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/init.h (nonexistent) @@ -1,40 +0,0 @@ -/* - * wxJavaScript - init.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$ - */ -#ifndef _wxJS_GUI_init_h -#define _wxJS_GUI_init_h - -// Use this to initialize the IO module - -namespace wxjs -{ - namespace gui - { - bool InitClass(JSContext *cx, JSObject *global); - bool InitObject(JSContext *cx, JSObject *obj); - void Destroy(); - }; // namespace gui -}; // namespace wxjs - -#endif // _wxJS_GUI_init_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/init.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.h (nonexistent) @@ -1,104 +0,0 @@ -/* - * wxJavaScript - sizer.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: sizer.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSSIZER_H -#define _WXJSSIZER_H - -///////////////////////////////////////////////////////////////////////////// -// Name: sizer.h -// Purpose: Sizer ports wxSizer to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 01.04.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - /** - * A sizer is owned by wxWidgets once it is attached to a window or an other sizer - * wxJS needs to know this, because when the sizer is not destroyed by wxWidgets - * wxJS has to do this. - */ - class AttachedSizer - { - public: - AttachedSizer() : m_attached(false) - { - } - - bool IsAttached() - { - return m_attached; - } - - void SetAttached(bool attached) - { - m_attached = attached; - } - - private: - bool m_attached; - }; - - class Sizer : public ApiWrapper - { - public: - /** - * Callback for retrieving properties. - * @param vp Contains the value of the property. - */ - static bool GetProperty(wxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - * @param vp Contains the new value of the property. - */ - static bool SetProperty(wxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static JSBool add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool layout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool prepend(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setDimension(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setMinSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemMinSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_MIN_SIZE - , P_POSITION - , P_SIZE - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSSIZER_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.cpp (nonexistent) @@ -1,114 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fontlist.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: fontlist.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// fontlist.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "font.h" -#include "fontlist.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/fontlist - * gui - * - * A font list is a list containing all fonts which have been created. - * There is only one instance of this class: wxTheFontList. Use this object - * to search for a previously created font of the desired type and create it - * if not already found. In some windowing systems, the font may be a scarce resource, - * so it is best to reuse old resources if possible. - * When an application finishes, all fonts will be deleted and their resources freed, - * eliminating the possibility of 'memory leaks'. - * See @wxFont, @wxFontEncoding and @wxFontEnumerator - * - */ -WXJS_INIT_CLASS(FontList, "wxFontList", 0) - -// To avoid delete of wxTheFontList -void FontList::Destruct(JSContext *cx, wxFontList *p) -{ -} - -WXJS_BEGIN_METHOD_MAP(FontList) - WXJS_METHOD("findOrCreateFont", findOrCreate, 7) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * - * - * - * - * - * Finds a font of the given specification, or creates one and adds it to the list. - * The following code shows an example: - * - * var font = wxTheFontList.findOrCreateFont(10, wxFont.DEFAULT, wxFont.NORMAL, wxFont.NORMAL); - * - * - * - */ -JSBool FontList::findOrCreate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - int point; - int family; - int style; - int weight; - bool underline = false; - JSString *faceName = NULL; - int encoding = wxFONTENCODING_DEFAULT; - - if ( JS_ConvertArguments(cx, argc, argv, "iiii/bSi", &point, &family, &style, - &weight, &underline, &faceName, &encoding) == JS_TRUE ) - { - wxString face; - if ( faceName == NULL ) - { - face = wxEmptyString; - } - else - { - face = (wxChar *) JS_GetStringChars(faceName); - } - *rval = Font::CreateObject(cx, wxTheFontList->FindOrCreateFont(point, family, style, - weight, underline, face, - (wxFontEncoding) encoding)); - return JS_TRUE; - } - else - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/tiffhdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/tiffhdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/tiffhdlr.cpp (nonexistent) @@ -1,54 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - tiffhdlr.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: tiffhdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// imghand.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/tiffhdlr - * gui - * - * Image handler for TIFF images. - * - */ -WXJS_INIT_CLASS(TIFFHandler, "wxTIFFHandler", 0) - -ImageHandlerPrivate* TIFFHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxTIFFHandler(), true); -}; - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/tiffhdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.cpp (nonexistent) @@ -1,203 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - colour.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: colour.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// colour.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "colour.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/colour - * gui - * - * A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values. - * This is a list of predefined colour objects: - * wxBLACK, wxWHITE, wxRED, wxBLUE, wxGREEN, wxCYAN and wxLIGHT_GREY - * - * - * - * Gets the Blue value - * - * - * Gets the Green value - * - * - * Returns true when the colour is valid - * - * - * Gets the Red value - * - * - */ -WXJS_INIT_CLASS(Colour, "wxColour", 1) - -WXJS_BEGIN_PROPERTY_MAP(Colour) - WXJS_READONLY_PROPERTY(P_BLUE, "blue") - WXJS_READONLY_PROPERTY(P_GREEN, "green") - WXJS_READONLY_PROPERTY(P_RED, "red") - WXJS_READONLY_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(Colour) - WXJS_METHOD("set", set, 3) -WXJS_END_METHOD_MAP() - -bool Colour::GetProperty(wxColour *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_BLUE: - *vp = ToJS(cx, p->Blue()); - break; - case P_GREEN: - *vp = ToJS(cx, p->Green()); - break; - case P_RED: - *vp = ToJS(cx, p->Red()); - break; - case P_OK: - *vp = ToJS(cx, p->Ok()); - break; - } - return true; -} - -/*** - * - * - * - * The red value - * - * - * The green value - * - * - * The blue value - * - * - * - * - * The name used to retrieve the colour from wxTheColourDatabase - * - * - * - * Constructs a new wxColour object. - * - * - */ -wxColour *Colour::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 3 ) // RGB - { - int R; - int G; - int B; - if ( FromJS(cx, argv[0], R) - && FromJS(cx, argv[1], G) - && FromJS(cx, argv[2], B) ) - { - return new wxColour(R, G, B); - } - } - else if ( argc == 1 ) - { - wxString name; - FromJS(cx, argv[0], name); - return new wxColour(name); - } - return NULL; -} - -/*** - * - * - * - * The red value - * - * - * The green value - * - * - * The blue value - * - * - * - * Sets the RGB values. - * - * - */ -JSBool Colour::set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxColour *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxColour")); - - int R; - int G; - int B; - if ( FromJS(cx, argv[0], R) - && FromJS(cx, argv[1], G) - && FromJS(cx, argv[2], B) ) - { - p->Set((unsigned char) R, - (unsigned char) G, - (unsigned char) B); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -void wxjs::gui::DefineGlobalColours(JSContext *cx, JSObject *obj) -{ - DefineGlobalColour(cx, obj, "wxRED", wxRED); - DefineGlobalColour(cx, obj, "wxBLACK", wxBLACK); - DefineGlobalColour(cx, obj, "wxWHITE", wxWHITE); - DefineGlobalColour(cx, obj, "wxRED", wxRED); - DefineGlobalColour(cx, obj, "wxBLUE", wxBLUE); - DefineGlobalColour(cx, obj, "wxGREEN", wxGREEN); - DefineGlobalColour(cx, obj, "wxCYAN", wxCYAN); - DefineGlobalColour(cx, obj, "wxLIGHT_GREY", wxLIGHT_GREY); -} - -void wxjs::gui::DefineGlobalColour(JSContext *cx, JSObject *obj, - const char*name, const wxColour *colour) -{ - wxASSERT_MSG(colour != NULL, wxT("wxColour can't be NULL")); - // Create a new colour object, because wxWindows destroys the global - // colour objects and wxJSColour does the same. - Colour::DefineObject(cx, obj, name, new wxColour(*colour)); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.cpp (nonexistent) @@ -1,127 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - stsizer.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: stsizer.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// stsizer.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../control/staticbx.h" -#include "sizer.h" -#include "stsizer.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/stsizer - * gui - * - * wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds - * a static box around the sizer. Note that this static box has to be created separately. - * See @wxBoxSizer, @wxSizer and @wxStaticBox - * - */ -WXJS_INIT_CLASS(StaticBoxSizer, "wxStaticBoxSizer", 2) - -/*** - * - * - * The associated static box. - * - * - */ - -WXJS_BEGIN_PROPERTY_MAP(StaticBoxSizer) - WXJS_READONLY_PROPERTY(P_STATIC_BOX, "staticBox") -WXJS_END_PROPERTY_MAP() - -StaticBoxSizer::StaticBoxSizer(JSContext *cx, JSObject *obj, - wxStaticBox *box, - int orient) - : wxStaticBoxSizer(box, orient) - , Object(obj, cx) - , AttachedSizer() -{ -} - -bool StaticBoxSizer::GetProperty(wxStaticBoxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_STATIC_BOX ) - { - Object *staticBox = dynamic_cast(p->GetStaticBox()); - *vp = staticBox == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(staticBox->GetObject()); - } - return true; -} - -/*** - * - * - * - * The staticbox associated with the sizer. - * - * - * Orientation wxVERTICAL or wxHORIZONTAL for creating either a column - * or row sizer. See @wxOrientation - * - * - * - * Constructs a new wxStaticBoxSizer object. - * - * - */ -StaticBoxSizer* StaticBoxSizer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - wxStaticBox *box = StaticBox::GetPrivate(cx, argv[0]); - if ( box == NULL ) - return NULL; - - int orient; - - if ( FromJS(cx, argv[1], orient) ) - { - return new StaticBoxSizer(cx, obj, box, orient); - } - return NULL; -} - -void StaticBoxSizer::Destruct(JSContext *cx, StaticBoxSizer *p) -{ - AttachedSizer *attached = dynamic_cast(p); - if ( attached != NULL - && ! attached->IsAttached() ) - { - delete p; - p = NULL; - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/pcxhdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/pcxhdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/pcxhdlr.cpp (nonexistent) @@ -1,56 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - pcxhdlr.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: pcxhdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/pcxhdlr - * gui - * - * Image handler for PNG images. - * When saving in PCX format, wxPCXHandler will count the number of different colours - * in the image; if there are 256 or less colours, it will save as 8 bit, else it will - * save as 24 bit. - * - */ -WXJS_INIT_CLASS(PCXHandler, "wxPCXHandler", 0) - -ImageHandlerPrivate* PCXHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxPCXHandler(), true); -}; - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/pcxhdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.cpp (nonexistent) @@ -1,431 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - imagelst.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: imagelst.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// imagelst.cpp - -#ifndef WX_PRECOMP - #include -#endif - -/** - * @if JS - * @page wxImageList wxImageList - * @since version 0.5 - * @endif - */ - -#include "../../common/main.h" - -#include "imagelst.h" -#include "bitmap.h" -#include "colour.h" -#include "icon.h" -#include "size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -ImageList::ImageList(JSContext *cx, JSObject *obj) : wxImageList() - , Object(obj, cx) -{ -} - -/*** - * control/imagelst - * gui - * - * A wxImageList contains a list of images, which are stored in an unspecified form. - * Images can have masks for transparent drawing, and can be made from a variety of - * sources including bitmaps and icons. - *

- * wxImageList is used principally in conjunction with @wxTreeCtrl and - * @wxListCtrl classes. - *
- */ -WXJS_INIT_CLASS(ImageList, "wxImageList", 2) - -/*** - * - * - * Returns the number of the images. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ImageList) - WXJS_READONLY_PROPERTY(P_IMAGE_COUNT, "imageCount") -WXJS_END_PROPERTY_MAP() - -bool ImageList::GetProperty(wxImageList *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_IMAGE_COUNT ) - *vp = ToJS(cx, p->GetImageCount()); - return true; -} - -/*** - * - * - * - * - * The width of the images in the list - * - * - * The height of the images in the list. - * - * - * When true (default) a mask is created for each image. - * - * - * The size of the list. - * - * - * - * Constructs a new wxImageList object. - * - * - */ -wxImageList* ImageList::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new ImageList(cx, obj); - - if ( argc > 4 ) - argc = 4; - - bool mask = true; - int count = 1; - - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], count) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], mask) ) - break; - // Fall through - default: - int width; - int height; - - if ( FromJS(cx, argv[1], height) - && FromJS(cx, argv[0], width) ) - { - ImageList *p = new ImageList(cx, obj); - p->Create(width, height, mask, count); - return p; - } - } - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(ImageList) - WXJS_METHOD("create", create, 2) - WXJS_METHOD("add", add, 1) - WXJS_METHOD("draw", draw, 4) - WXJS_METHOD("getSize", getSize, 2) - WXJS_METHOD("remove", remove, 1) - WXJS_METHOD("removeAll", removeAll, 0) - WXJS_METHOD("replace", replace, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The width of the images in the list - * - * - * The height of the images in the list. - * - * - * When true (default) a mask is created for each image. - * - * - * The size of the list. - * - * - * - * Creates an image list. Width and Height specify the size of the images - * in the list (all the same). Mask specifies whether the images have masks or not. - * Count is the initial number of images to reserve. - * - * - */ -JSBool ImageList::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 4 ) - argc = 4; - - bool mask = true; - int count = 1; - - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], count) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], mask) ) - break; - // Fall through - default: - int width; - int height; - - if ( FromJS(cx, argv[1], height) - && FromJS(cx, argv[0], width) ) - { - p->Create(width, height, mask, count); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * Adds a new image using a bitmap and an optional mask bitmap - * or adds a new image using a bitmap and a mask colour - * or adds a new image using an icon. - * Returns the new zero-based index of the image. - * - * - */ -JSBool ImageList::add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Icon::HasPrototype(cx, argv[0]) ) - { - wxIcon *ico = Icon::GetPrivate(cx, argv[0]); - if ( ico != NULL ) - { - *rval = ToJS(cx, p->Add(*ico)); - return JS_TRUE; - } - } - else - { - wxBitmap *bmp = Bitmap::GetPrivate(cx, argv[0], false); - const wxBitmap *mask = &wxNullBitmap; - if ( argc == 2 ) - { - if ( Colour::HasPrototype(cx, argv[1]) ) - { - wxColour *colour = Colour::GetPrivate(cx, argv[1]); - if ( colour != NULL ) - { - *rval = ToJS(cx, p->Add(*bmp, *colour)); - return JS_TRUE; - } - } - else - { - mask = Bitmap::GetPrivate(cx, argv[1]); - if ( mask == NULL ) - return JS_FALSE; - } - } - *rval = ToJS(cx, p->Add(*bmp, *mask)); - return JS_TRUE; - } - return JS_FALSE; -} - -JSBool ImageList::draw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - return JS_FALSE; -} - -/*** - * - * - * - * The index parameter is ignored as all images in the list have the same size. - * - * - * Receives the size of the image. - * - * - * - * The size is put in the Size argument. This method differs from the wxWindow function - * GetSize which uses 3 arguments: index, width and height. wxJS uses @wxSize because JavaScript - * can't pass primitive types by reference. - * - * - */ -JSBool ImageList::getSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int index = 0; - wxSize *size = Size::GetPrivate(cx, argv[1]); - if ( size != NULL ) - { - int width; - int height; - *rval = ToJS(cx, p->GetSize(index, width, height)); - size->SetWidth(width); - size->SetHeight(height); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The index of the image. - * - * - * - * Removes the image with the given index. Returns true on success. - * - * - */ -JSBool ImageList::remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int index; - if ( FromJS(cx, argv[0], index) ) - { - *rval = ToJS(cx, p->Remove(index)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Removes all images. Returns true on success. - * - * - */ -JSBool ImageList::removeAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->RemoveAll()); - return JS_TRUE; -} - -/*** - * - * - * - * The index of the image to replace. - * - * - * The new bitmap. - * - * - * Monochrome mask bitmap, representing the transparent areas of the image. - * Windows only. - * - * - * - * - * The index of the image to replace. - * - * - * Icon to use as image. - * - * - * - * Replaces the image at the given index with a new image. - * - * - */ -JSBool ImageList::replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageList *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int index; - if ( ! FromJS(cx, argv[0], index) ) - return JS_FALSE; - - if ( Bitmap::HasPrototype(cx, argv[1]) ) - { - #ifdef __WXMSW__ - wxBitmap *bmp = Bitmap::GetPrivate(cx, argv[1], false); - const wxBitmap *mask = &wxNullBitmap; - if ( argc == 3 - && (mask = Bitmap::GetPrivate(cx, argv[2])) == NULL ) - return JS_FALSE; - *rval = ToJS(cx, p->Replace(index, *bmp, *mask)); - #endif - return JS_TRUE; - } - else - { - wxIcon *ico = Icon::GetPrivate(cx, argv[0]); - if ( ico != NULL ) - { - *rval = ToJS(cx, p->Replace(index, *ico)); - return JS_TRUE; - } - } - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.h (nonexistent) @@ -1,73 +0,0 @@ -/* - * wxJavaScript - autoobj.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: autoobj.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#if defined(__WXMSW__) - -#ifndef _WXJSAutomationObject_H -#define _WXJSAutomationObject_H - -///////////////////////////////////////////////////////////////////////////// -// Name: autoobj.h -// Purpose: AutomationObject ports wxAutomationObject to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 28-12-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class AutomationObject : public ApiWrapper - { - public: - /** - * Callback for when a wxAutomationObject object is created - */ - static wxAutomationObject* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxAutomationObject *p) - { - p->SetDispatchPtr(NULL); - delete p; - } - static wxVariant* CreateVariant(JSContext *cx, jsval v); - static jsval CreateJSVal(JSContext *cx, const wxVariant &var); - - WXJS_DECLARE_METHOD_MAP() - - static JSBool createInstance(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool callMethod(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getInstance(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool putProperty(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getProperty(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSAutomationObject_H - -#endif // __WXMSW__ Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.cpp (nonexistent) @@ -1,241 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - accentry.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: accentry.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// accentry.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "accentry.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/accentry - * gui - * - * An object used by an application wishing to create an accelerator table. - * See @wxAcceleratorTable, wxMenuItem @wxMenuItem#accel property. - * - */ -WXJS_INIT_CLASS(AcceleratorEntry, "wxAcceleratorEntry", 0) - -/*** - * - * See @wxAcceleratorEntry#flag - * - * See @wxKeyCode - * - * - * The menu or control command identifier. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(AcceleratorEntry) - WXJS_PROPERTY(P_FLAG, "flags") - WXJS_PROPERTY(P_KEYCODE, "keyCode") - WXJS_PROPERTY(P_COMMAND, "command") -WXJS_END_PROPERTY_MAP() - -/*** - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(AcceleratorEntry) - WXJS_CONSTANT(wxACCEL_, NORMAL) - WXJS_CONSTANT(wxACCEL_, ALT) - WXJS_CONSTANT(wxACCEL_, CTRL) - WXJS_CONSTANT(wxACCEL_, SHIFT) -WXJS_END_CONSTANT_MAP() - -bool AcceleratorEntry::GetProperty(wxAcceleratorEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_FLAG: - *vp = ToJS(cx, p->GetFlags()); - break; - case P_KEYCODE: - *vp = ToJS(cx, p->GetKeyCode()); - break; - case P_COMMAND: - *vp = ToJS(cx, p->GetCommand()); - break; - } - return true; -} - -bool AcceleratorEntry::SetProperty(wxAcceleratorEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_FLAG: - { - int flag; - if ( FromJS(cx, *vp, flag) ) - p->Set(flag, p->GetKeyCode(), p->GetCommand()); - break; - } - case P_KEYCODE: - { - int keycode; - if ( FromJS(cx, *vp, keycode) ) - p->Set(p->GetFlags(), keycode, p->GetCommand()); - break; - } - case P_COMMAND: - { - int command; - if ( FromJS(cx, *vp, command) ) - p->Set(p->GetFlags(), p->GetKeyCode(), command); - break; - } - } - return true; -} - -/*** - * - * - * - * - * Indicates which modifier key is pressed. See @wxAcceleratorEntry#constants - * for the possible values. - * - * - * The keycode. See @wxKeyCode - * - * - * The menu or command id. - * - * - * - * Constructs a new wxAcceleratorEntry object. - * - * - */ -wxAcceleratorEntry* AcceleratorEntry::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int flag = 0; - int key = 0; - int id = 0; - - if ( argc == 0 ) - return new wxAcceleratorEntry(); - - if ( argc > 3 ) - argc = 3; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], id) ) - break; - // Walk through - case 2: - if ( ! FromJS(cx, argv[1], key) ) - break; - // Walk through - case 1: - if ( ! FromJS(cx, argv[0], flag) ) - break; - // Walk through - default: - { - return new wxAcceleratorEntry(flag, key, id); - } - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(AcceleratorEntry) - WXJS_METHOD("set", set, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Indicates which modifier key is pressed. See @wxAcceleratorEntry#constants - * for the possible values. - * - * - * The keycode. See @wxKeyCode - * - * - * The menu or command id. - * - * - * - * See @wxAcceleratorEntry#ctor for the explanation of the arguments. - * - * - */ -JSBool AcceleratorEntry::set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc > 3 ) - argc = 3; - - wxAcceleratorEntry *p = GetPrivate(cx, obj); - - int flag = p->GetFlags(); - int key = p->GetKeyCode(); - int id = p->GetCommand(); - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], id) ) - break; - // Walk through - case 2: - if ( ! FromJS(cx, argv[1], key) ) - break; - // Walk through - case 1: - if ( ! FromJS(cx, argv[0], flag) ) - break; - // Walk through - default: - { - p->Set(flag, key, id); - return JS_TRUE; - } - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.h (nonexistent) @@ -1,84 +0,0 @@ -/* - * wxJavaScript - boxsizer.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: boxsizer.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSBoxSizer_H -#define _WXJSBoxSizer_H - -///////////////////////////////////////////////////////////////////////////// -// Name: boxsizer.h -// Purpose: BoxSizer ports wxBoxSizer to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 01.05.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class BoxSizer : public wxBoxSizer - , public ApiWrapper - , public Object - , public AttachedSizer - { - public: - - /** - * Constructor - */ - BoxSizer(JSContext *cx, JSObject *obj, int orient); - - /** - * Destructor - */ - virtual ~BoxSizer() - { - if ( IsAttached() ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } - } - - /** - * Callback for when a wxBoxSizer object is created - */ - static BoxSizer* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, BoxSizer *p); - - static bool GetProperty(wxBoxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_ORIENTATION - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSBoxSizer_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/size.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/size.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/size.cpp (nonexistent) @@ -1,131 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - size.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: size.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// size.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "size.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/size - * gui - * - * A wxSize is a useful data structure for graphics operations. - * It simply contains integer width and height members. - * - */ -WXJS_INIT_CLASS(Size, "wxSize", 0) - -/*** - * - * - * The height property. - * - * - * The width property. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Size) - WXJS_PROPERTY(P_WIDTH, "width") - WXJS_PROPERTY(P_HEIGHT, "height") -WXJS_END_PROPERTY_MAP() - -bool Size::GetProperty(wxSize *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_WIDTH: - *vp = ToJS(cx, p->GetHeight()); - break; - case P_HEIGHT: - *vp = ToJS(cx, p->GetWidth()); - break; - } - return true; -} - -bool Size::SetProperty(wxSize *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_WIDTH: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetWidth(value); - break; - } - case P_HEIGHT: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetHeight(value); - break; - } - } - return true; -} - -/*** - * - * - * - * The width - * - * - * The height. When not specified and Width is specified the value will be 0. - * - * - * - * Creates a new wxSize. When no arguments are given then wxSize gets the same value - * as wxDefaultSize. - * - * - */ -wxSize* Size::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int x = -1; - int y = -1; - - if ( argc > 0 - && ! FromJS(cx, argv[0], x) ) - return NULL; - - if ( argc > 1 - && ! FromJS(cx, argv[1], y) ) - return NULL; - - return new wxSize(x, y); -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/size.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.h (nonexistent) @@ -1,85 +0,0 @@ -/* - * wxJavaScript - genval.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: genval.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#include - -///////////////////////////////////////////////////////////////////////////// -// Name: genval.h -// Purpose: GenericValidator ports wxGenericValidator to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 29.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class GenericValidator : public wxGenericValidator - , public ApiWrapper - , public Object - { - DECLARE_CLASS(GenericValidator) - public: - - GenericValidator(JSContext *cx, JSObject *obj, bool val); - GenericValidator(JSContext *cx, JSObject *obj, int val); - GenericValidator(JSContext *cx, JSObject *obj, wxString val); - GenericValidator(JSContext *cx, JSObject *obj, wxArrayInt val); - - GenericValidator(const GenericValidator ©); - virtual wxObject* Clone() const; - virtual ~GenericValidator() - { - } - - /** - * Validate forwards the validation to the validate method of the JavaScript object. - */ - virtual bool Validate(wxWindow *parent); - - static bool GetProperty(wxGenericValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static GenericValidator* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_VALUE - }; - - private: - bool m_boolValue; - int m_intValue; - wxString m_stringValue; - wxArrayInt m_arrayIntValue; - }; - }; // namespace gui -}; // namespace wxjs Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/jpghdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/jpghdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/jpghdlr.cpp (nonexistent) @@ -1,52 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - jpghdlr.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: jpghdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/jpghdlr - * gui - * - * Image handler for JPEG images. - * - */ -WXJS_INIT_CLASS(JPEGHandler, "wxJPEGHandler", 0) - -ImageHandlerPrivate* JPEGHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxJPEGHandler(), true); -}; Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/jpghdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.h (nonexistent) @@ -1,44 +0,0 @@ -/* - * wxJavaScript - constant.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: constant.h 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * @if API - * (c) 2001-2002 Franky Braem (S.A.W.) - * - * This file is part of wxJS. wxJS ports wxWindows to JavaScript - * - * File : constant.h - * Desc. : Ports all wxWindow enumerations and constants to JavaScript - * Created : 06-04-2002 - * L. Update : - * @endif - */ - -namespace wxjs -{ - namespace gui - { - void InitGuiConstants(JSContext *cx, JSObject *obj); - }; // namespace gui -}; // namespace wxjs Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/validate.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/validate.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/validate.h (nonexistent) @@ -1,93 +0,0 @@ -/* - * wxJavaScript - validate.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: validate.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSValidator_H -#define _WXJSValidator_H - -///////////////////////////////////////////////////////////////////////////// -// Name: validate.h -// Purpose: Validator ports wxValidator to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Validator : public wxValidator - , public ApiWrapper - , public Object - { - public: - - Validator(JSContext *cx, JSObject *obj); - - virtual wxObject *Clone() const - { - return new Validator(GetContext(), GetObject()); - } - - virtual ~Validator() - { - } - - /** - * Validate forwards the validation to the validate method of the JavaScript object. - */ - virtual bool Validate(wxWindow *parent); - - /** - * TransferToWindow forwards this to the transferToWindow method of the JavaScript object. - */ - virtual bool TransferToWindow(); - - /** - * TransferFromWindow forwards this to the transferFromWindow method of the JavaScript object. - */ - virtual bool TransferFromWindow(); - - static bool GetProperty(wxValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxValidator* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_WINDOW - , P_BELL_ON_ERROR - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSValidator_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/validate.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.h (nonexistent) @@ -1,82 +0,0 @@ -/* - * wxJavaScript - rect.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: rect.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSRect_H -#define _WXJSRect_H - -///////////////////////////////////////////////////////////////////////////// -// Name: rect.h -// Purpose: Ports wxRect to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 25.05.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Rect : public ApiWrapper - { - public: - - static bool GetProperty(wxRect *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxRect *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxRect* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool inflate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deflate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool offset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool intersect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool inside(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool intersects(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_WIDTH - , P_HEIGHT - , P_BOTTOM - , P_LEFT - , P_POSITION - , P_RIGHT - , P_SIZE - , P_TOP - , P_X - , P_Y - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSRect_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.cpp (nonexistent) @@ -1,496 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - autoobj.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: autoobj.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSAutomationObject.cpp -#ifdef __WXMSW__ - -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "autoobj.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/autoobj - * gui - * - * The wxAutomationObject class represents an OLE automation object containing - * a single data member, an IDispatch pointer. It contains a number of functions - * that make it easy to perform automation operations, and set and get properties. - * The wxVariant class will not be ported, because wxJS translates every type to - * the corresponding JavaScript type. - * This class is only available on a Windows platform. - * - */ -WXJS_INIT_CLASS(AutomationObject, "wxAutomationObject", 0) - -/*** - * - * - * - * Constructs a new wxAutomationObject object. Unlike - * wxWidgets, this constructor can't take an - * IDispatch pointer because this type can't be used in - * JavaScript. - * - * - */ -wxAutomationObject* AutomationObject::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new wxAutomationObject(); -} - -WXJS_BEGIN_METHOD_MAP(AutomationObject) - WXJS_METHOD("callMethod", callMethod, 1) - WXJS_METHOD("createInstance", createInstance, 1) - WXJS_METHOD("getInstance", getInstance, 1) - WXJS_METHOD("getObject", getObject, 2) - WXJS_METHOD("getProperty", getProperty, 1) - WXJS_METHOD("putProperty", putProperty, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The name of the method to call. - * - * - * A variable list of arguments passed to the method. - * - * - * - * Calls an automation method for this object. When the method - * returns a value it is not returned as a wxVariant but it is converted - * to its corresponding JavaScript type. - *

- * The following example opens a workbook into Microsoft Excel: - *

- *   var objExcel = new wxAutomationObject();
- *
- *   if ( objExcel.createInstance("Excel.Application") )
- *   {
- *      objExcel.putProperty("visible", true);
- *      var objBooks = new wxAutomationObject();
- *      objExcel.getObject(objBooks, "workbooks");
- *      objBooks.callMethod("open", "c:\\temp\\wxjs.xls");
- *   }
- *  
- * The name of the method can contain dot-separated property names, - * to save the application needing to call @wxAutomationObject#getProperty - * several times using several temporary objects. - * For example: - * objExcel.callMethod("workbooks.open", "c:\\temp\\wxjs.xls"); - *
- *
- */ -JSBool AutomationObject::callMethod(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString method; - FromJS(cx, argv[0], method); - - wxVariant res; - if ( argc == 0 ) - { - res = p->CallMethod(method); - } - else - { - const wxVariant **vars = new const wxVariant*[argc - 1]; - uint i; - for(i = 1; i < argc; i++) - { - vars[i-1] = CreateVariant(cx, argv[i]); - } - - *rval = CreateJSVal(cx, p->CallMethodArray(method, argc - 1, vars)); - - for(i = 0; i < argc - 1; i++) - delete vars[i]; - delete[] vars; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Creates a new object based on the class id, returning true if the - * object was successfully created, or false if not. - *

- * The following example starts Microsoft Excel: - *

- *  var obj = new wxAutomationObject();
- *  if ( obj.createInstance("Excel.Application") )
- *  {
- *    // Excel object is created
- *  }
- *  
- *
- *
- */ -JSBool AutomationObject::createInstance(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString classId; - if ( FromJS(cx, argv[0], classId) ) - { - *rval = ToJS(cx, p->CreateInstance(classId)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Retrieves the current object associated with a class id, and attaches - * the IDispatch pointer to this object. Returns true if a pointer was - * successfully retrieved, false otherwise. - * - * - */ -JSBool AutomationObject::getInstance(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString classId; - if ( FromJS(cx, argv[0], classId) ) - { - *rval = ToJS(cx, p->GetInstance(classId)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The name of the property. - * - * - * - * - * Puts a property value into this object. - * The following example starts Microsoft Excel and makes it visible. - *

- *  var obj = new wxAutomationObject();
- *  if ( obj.createInstance("Excel.Application") )
- *  {
- *     obj.putProperty("visible", true);
- *  }
- *  
- * The name of the property can contain dot-separated property names, - * to save the application needing to call @wxAutomationObject#getProperty - * several times using several temporary objects. - *
- *
- */ -JSBool AutomationObject::putProperty(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString prop; - FromJS(cx, argv[0], prop); - - const wxVariant **vars = new const wxVariant*[argc - 1]; - uint i; - for(i = 1; i < argc; i++) - { - vars[i-1] = CreateVariant(cx, argv[i]); - } - - wxVariant res = p->PutPropertyArray(prop, argc - 1, vars); - - for(i = 0; i < argc - 1; i++) - delete vars[i]; - delete[] vars; - - return JS_TRUE; -} - -/*** - * - * - * - * The name of the property. - * - * - * - * - * Gets a property from this object. The return type depends on the type of the property. - * Use @wxAutomationObject#getObject when the property is an object. - * - * The name of the method can contain dot-separated property names, - * to save the application needing to call @wxAutomationObject#getProperty - * several times using several temporary objects. - * - * - */ -JSBool AutomationObject::getProperty(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString prop; - FromJS(cx, argv[0], prop); - - const wxVariant **vars = new const wxVariant*[argc - 1]; - uint i; - for(i = 1; i < argc; i++) - { - vars[i-1] = CreateVariant(cx, argv[i]); - } - - wxVariant res = p->GetPropertyArray(prop, argc - 1, vars); - *rval = CreateJSVal(cx, res); - - for(i = 0; i < argc - 1; i++) - delete vars[i]; - delete[] vars; - - return JS_TRUE; -} - -/*** - * - * - * - * The automation object that receives the property. - * - * - * The name of the property. - * - * - * - * - * Gets a property from this object. The type of the property is also an object. - * The following example retrieves the object Workbooks from an Excel application: - *

- *  var objExcel = new wxAutomationObject();
- *  if ( objExcel.createInstance("Excel.Application") )
- *  {
- *    objExcel.putProperty("visible", true);
- *    var objBooks = new wxAutomationObject();
- *    objExcel.getObject(objBooks, "workbooks");
- *  }
- *  
- * The name of the method can contain dot-separated property names, - * to save the application needing to call @wxAutomationObject#getProperty - * several times using several temporary objects. - *
- *
- */ -JSBool AutomationObject::getObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxAutomationObject *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxAutomationObject *autoObj = GetPrivate(cx, argv[0]); - if ( autoObj == NULL ) - return JS_FALSE; - - wxString prop; - FromJS(cx, argv[1], prop); - - if ( argc > 2 ) - { - const wxVariant **vars = new const wxVariant*[argc - 2]; - uint i; - for(i = 2; i < argc; i++) - { - vars[i-2] = CreateVariant(cx, argv[i]); - } - - *rval = ToJS(cx, p->GetObject(*autoObj, prop, argc - 2, vars)); - - for(i = 0; i < argc - 2; i++) - { - delete vars[i]; - } - delete[] vars; - } - else - *rval = ToJS(cx, p->GetObject(*autoObj, prop)); - - - return JS_TRUE; -} - -wxVariant *AutomationObject::CreateVariant(JSContext *cx, jsval v) -{ - switch(JS_TypeOfValue(cx, v)) - { - case JSTYPE_VOID: - break; - case JSTYPE_OBJECT: - { - JSObject *obj = JSVAL_TO_OBJECT(v); - if ( js_DateIsValid(cx, obj) ) - { - wxDateTime date; - FromJS(cx, v, date); - return new wxVariant(date); - } - - wxAutomationObject *o = GetPrivate(cx, obj); - if ( o != NULL ) - { - return new wxVariant((void *) o); - } - - if ( JS_IsArrayObject(cx, obj) == JS_TRUE ) - { - } - break; - } - case JSTYPE_FUNCTION: - break; - case JSTYPE_STRING: - { - wxString str; - FromJS(cx, v, str); - return new wxVariant(str); - break; - } - case JSTYPE_NUMBER: - if ( JSVAL_IS_INT(v) ) - { - long value; - FromJS(cx, v, value); - return new wxVariant(value); - } - else if ( JSVAL_IS_DOUBLE(v) ) - { - double value; - FromJS(cx, v, value); - return new wxVariant(value); - } - break; - case JSTYPE_BOOLEAN: - { - bool b; - FromJS(cx, v, b); - return new wxVariant(b); - } - } - - return new wxVariant(); -} - -jsval AutomationObject::CreateJSVal(JSContext *cx, const wxVariant &var) -{ - if ( var.IsNull() ) - return JSVAL_VOID; - - wxString type(var.GetType()); - - if ( type.CompareTo(wxT("string")) == 0 ) - { - return ToJS(cx, var.GetString()); - } - else if ( type.CompareTo(wxT("bool")) == 0 ) - { - return ToJS(cx, var.GetBool()); - } - else if ( type.CompareTo(wxT("list")) == 0 ) - { - wxLogDebug(wxT("List")); - } - else if ( type.CompareTo(wxT("long")) == 0 ) - { - return ToJS(cx, var.GetLong()); - } - else if ( type.CompareTo(wxT("double")) == 0 ) - { - return ToJS(cx, var.GetDouble()); - } - else if ( type.CompareTo(wxT("char")) == 0 ) - { - return ToJS(cx, wxString::FromAscii(var.GetChar())); - } - else if ( type.CompareTo(wxT("time")) == 0 ) - { - return ToJS(cx, var.GetDateTime()); - } - else if ( type.CompareTo(wxT("date")) == 0 ) - { - return ToJS(cx, var.GetDateTime()); - } - else if ( type.CompareTo(wxT("void*")) == 0 ) - { - // void* means an object - void* p = var.GetVoidPtr(); - if ( p != NULL ) - { - // We need to create a new wxAutomationObject because - // otherwise the object is released to early. - wxAutomationObject *o = static_cast(p); - wxAutomationObject *newObj = new wxAutomationObject(); - newObj->SetDispatchPtr(o->GetDispatchPtr()); - return CreateObject(cx, newObj); - } - } - else if ( type.CompareTo(wxT("datetime")) == 0 ) - { - return ToJS(cx, var.GetDateTime()); - } - else if ( type.CompareTo(wxT("arrstring")) == 0 ) - { - return ToJS(cx, var.GetArrayString()); - } - - return JSVAL_VOID; -} - -#endif // WXJS_FOR_UNIX Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/autoobj.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.cpp (nonexistent) @@ -1,159 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - flexgrid.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: flexgrid.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// flexgrid.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "sizer.h" -#include "flexgrid.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/flexgrid - * gui - * - * A flex grid sizer is a sizer which lays out its children in a two-dimensional - * table with all table fields in one row having the same height and all fields - * in one column having the same width. - * - */ -WXJS_INIT_CLASS(FlexGridSizer, "wxFlexGridSizer", 4) - -FlexGridSizer::FlexGridSizer( JSContext *cx - , JSObject *obj - , int cols - , int rows - , int vgap - , int hgap) - : wxFlexGridSizer(cols, rows, vgap, hgap) - , Object(obj, cx) - , AttachedSizer() -{ -} - -FlexGridSizer::FlexGridSizer(JSContext *cx, - JSObject *obj, - int cols, int vgap, int hgap) - : wxFlexGridSizer(cols, vgap, hgap) - , Object(obj, cx) - , AttachedSizer() -{ -} - -/*** - * - * - * - * The number of rows. - * - * - * The number of columns. - * - * - * The space between the columns - * - * - * The space between the rows - * - * - * - * - * The number of columns. - * - * - * The space between the columns - * - * - * The space between the rows - * - * - * - * Constructs a new wxFlexGridSizer object. - * - * - */ -FlexGridSizer* FlexGridSizer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int cols = 0; - int rows = 0; - int vgap = 0; - int hgap = 0; - - if ( argc > 4 ) - argc = 4; - - if ( argc == 4 ) - { - if ( FromJS(cx, argv[0], rows) - && FromJS(cx, argv[1], cols) - && FromJS(cx, argv[2], vgap) - && FromJS(cx, argv[3], hgap) ) - { - return new FlexGridSizer(cx, obj, rows, cols, vgap, hgap); - } - else - { - return NULL; - } - } - else if ( argc < 4 ) - { - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], hgap) ) - break; - case 2: - if ( ! FromJS(cx, argv[1], vgap) ) - break; - case 1: - if ( ! FromJS(cx, argv[0], cols) ) - break; - return new FlexGridSizer(cx, obj, cols, vgap, hgap); - } - } - - return NULL; -} - -void FlexGridSizer::Destruct(JSContext *cx, FlexGridSizer *p) -{ - AttachedSizer *attached = dynamic_cast(p); - if ( attached != NULL - && ! attached->IsAttached() ) - { - delete p; - p = NULL; - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.cpp (nonexistent) @@ -1,112 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - boxsizer.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: boxsizer.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// boxsizer.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "sizer.h" -#include "boxsizer.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/boxsizer - * gui - * - * The basic idea behind a box sizer is that windows will most often be laid out in - * rather simple basic geometry, typically in a row or a column or several hierarchies of either. - * - */ -WXJS_INIT_CLASS(BoxSizer, "wxBoxSizer", 1) - -/*** - * - * - * Gets the orientation. See @wxOrientation - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(BoxSizer) - WXJS_READONLY_PROPERTY(P_ORIENTATION, "orientation") -WXJS_END_PROPERTY_MAP() - -BoxSizer::BoxSizer( JSContext *cx - , JSObject *obj - , int orient) - : wxBoxSizer(orient) - , Object(obj, cx) - , AttachedSizer() -{ -} - -void BoxSizer::Destruct(JSContext *cx, BoxSizer *p) -{ - AttachedSizer *attached = dynamic_cast(p); - if ( attached != NULL - && ! attached->IsAttached() ) - { - delete p; - p = NULL; - } -} - -bool BoxSizer::GetProperty(wxBoxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_ORIENTATION ) - { - *vp = ToJS(cx, p->GetOrientation()); - } - return true; -} - -/*** - * - * - * - * Orientation VERTICAL or HORIZONTAL for creating either a column - * or row sizer. See @wxOrientation - * - * - * - * Creates a new wxBoxSizer object - * - * - */ -BoxSizer *BoxSizer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int orient = wxVERTICAL; - - if ( FromJS(cx, argv[0], orient) ) - return new BoxSizer(cx, obj, orient); - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/boxsizer.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/font.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/font.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/font.cpp (nonexistent) @@ -1,330 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - font.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: font.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// font.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "font.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/font - * gui - * - * A font is an object which determines the appearance of text. - * Fonts are used for drawing text to a device context, and setting the - * appearance of a window's text. - * - */ -WXJS_INIT_CLASS(Font, "wxFont", 0) - -/*** - * - * - * - * Get/Set the actual typeface to be used. - * - * - * Font family, a generic way of referring to fonts without specifying an actual facename. - * - * - * Returns true when the font is ok. - * - * - * Get/Set size in points - * - * - * Get/Set the font style - * - * - * Get/Set underline. - * - * - * Get/Set the weight of the font - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Font) - WXJS_PROPERTY(P_FACE_NAME, "faceName") - WXJS_PROPERTY(P_FAMILY, "family") - WXJS_PROPERTY(P_POINT_SIZE, "pointSize") - WXJS_PROPERTY(P_STYLE, "style") - WXJS_PROPERTY(P_UNDERLINED, "underlined") - WXJS_PROPERTY(P_WEIGHT, "weight") - WXJS_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -bool Font::GetProperty(wxFont *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_FACE_NAME: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetFaceName()); - break; - case P_FAMILY: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetFamily()); - break; - case P_POINT_SIZE: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetPointSize()); - break; - case P_STYLE: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetStyle()); - break; - case P_UNDERLINED: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetUnderlined()); - break; - case P_WEIGHT: - if ( p->Ok() ) - *vp = ToJS(cx, p->GetWeight()); - break; - case P_OK: - *vp = ToJS(cx, p->Ok()); - break; - } - return true; -} - -bool Font::SetProperty(wxFont *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_FACE_NAME: - { - wxString name; - FromJS(cx, *vp, name); - p->SetFaceName(name); - break; - } - case P_FAMILY: - { - int family; - if ( FromJS(cx, *vp, family) ) - p->SetFamily(family); - break; - } - case P_POINT_SIZE: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetPointSize(size); - break; - } - case P_STYLE: - { - int style; - if ( FromJS(cx, *vp, style) ) - p->SetStyle(style); - break; - } - case P_UNDERLINED: - { - bool underlined; - if ( FromJS(cx, *vp, underlined) ) - p->SetUnderlined(underlined); - break; - } - case P_WEIGHT: - { - int weight; - if ( FromJS(cx, *vp, weight) ) - p->SetWeight(weight); - break; - } - } - // When there's a parent, we force the parent - // to update the font property! - JSObject *parent = JS_GetParent(cx, obj); - if ( parent != NULL ) - { - jsval prop = OBJECT_TO_JSVAL(obj); - JS_SetProperty(cx, parent, "font", &prop); - } - - return true; -} - -/*** - * - * - * Get/Set the default encoding - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(Font) - WXJS_STATIC_PROPERTY(P_DEFAULT_ENCODING, "defaultEncoding") -WXJS_END_PROPERTY_MAP() - -bool Font::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - if ( id == P_DEFAULT_ENCODING ) - { - *vp = ToJS(cx, (int)wxFont::GetDefaultEncoding()); - } - return true; -} - -bool Font::SetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - if ( id == P_DEFAULT_ENCODING ) - { - int encoding; - FromJS(cx, *vp, encoding); - wxFont::SetDefaultEncoding((wxFontEncoding) encoding); - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Font) - // Family constants - WXJS_CONSTANT(wx, DEFAULT) - WXJS_CONSTANT(wx, DECORATIVE) - WXJS_CONSTANT(wx, ROMAN) - WXJS_CONSTANT(wx, SCRIPT) - WXJS_CONSTANT(wx, SWISS) - WXJS_CONSTANT(wx, MODERN) - // Style constants - WXJS_CONSTANT(wx, NORMAL) - WXJS_CONSTANT(wx, SLANT) - WXJS_CONSTANT(wx, ITALIC) - // Weight constants - WXJS_CONSTANT(wx, LIGHT) - WXJS_CONSTANT(wx, BOLD) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * - * Size in points - * - * - * Font family, a generic way of referring to fonts without specifying actual facename. - * - * - * Font style - * - * - * Font weight - * - * - * - * An optional string specifying the actual typeface to be used. - * When not specified, a default typeface will chosen based on the family. - * - * - * - * - * Constructs a new wxFont object. - * - * - */ -wxFont* Font::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - { - return new wxFont(); - } - else if ( argc > 7 ) - argc = 7; - - int pointSize = 0; - int family = 0; - int style = 0; - int weight = 0; - bool underline = false; - wxString faceName; - int encoding = wxFONTENCODING_DEFAULT; - - switch(argc) - { - case 7: - if ( ! FromJS(cx, argv[6], encoding) ) - break; - // Walk through - case 6: - FromJS(cx, argv[5], faceName); - // Walk through - case 5: - if ( ! FromJS(cx, argv[4], underline) ) - break; - // Walk through - case 4: - if ( ! FromJS(cx, argv[3], weight) ) - break; - // Walk through - case 3: - if ( ! FromJS(cx, argv[2], style) ) - break; - // Walk through - case 2: - if ( ! FromJS(cx, argv[1], family) ) - break; - // Walk through - case 1: - if ( ! FromJS(cx, argv[0], pointSize) ) - break; - return new wxFont(pointSize, family, style, - weight, underline, - faceName, (wxFontEncoding) encoding); - } - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/font.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.h (nonexistent) @@ -1,55 +0,0 @@ -/* - * wxJavaScript - fontlist.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: fontlist.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFontList_H -#define _WXJSFontList_H - -///////////////////////////////////////////////////////////////////////////// -// Name: fontlist.h -// Purpose: FontList ports wxFontList to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 08.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class FontList : public ApiWrapper - { - public: - - static JSBool findOrCreate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - static void Destruct(JSContext *cx, wxFontList *p); - - WXJS_DECLARE_METHOD_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFontList_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontlist.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.h (nonexistent) @@ -1,73 +0,0 @@ -/* - * wxJavaScript - accentry.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: accentry.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSAcceleratorEntry_H -#define _WXJSAcceleratorEntry_H - -///////////////////////////////////////////////////////////////////////////// -// Name: accentry.h -// Purpose: AcceleratorEntry ports wxAcceleratorEntry to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 06.06.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class AcceleratorEntry : public ApiWrapper - { - public: - - static bool GetProperty(wxAcceleratorEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxAcceleratorEntry *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxAcceleratorEntry object is created - */ - static wxAcceleratorEntry* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Property Ids. - */ - enum - { - P_FLAG - , P_KEYCODE - , P_COMMAND - }; - - static JSBool set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSAcceleratorEntry_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/accentry.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/xpmhdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/xpmhdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/xpmhdlr.cpp (nonexistent) @@ -1,53 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - xpmhdlr.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: xpmhdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// imghand.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/xpmhdlr - * gui - * - * Image handler for XPM images. - * - */ -WXJS_INIT_CLASS(XPMHandler, "wxXPMHandler", 0) - -ImageHandlerPrivate* XPMHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxXPMHandler(), true); -}; Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/xpmhdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.h (nonexistent) @@ -1,59 +0,0 @@ -/* - * wxJavaScript - colourdb.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: colourdb.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSColourDatabase_H -#define _WXJSColourDatabase_H - -///////////////////////////////////////////////////////////////////////////// -// Name: colourdb.h -// Purpose: ColourDatabase ports wxColourDatabase to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 26.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class ColourDatabase : public ApiWrapper - { - public: - WXJS_DECLARE_METHOD_MAP() - - // Empty, to avoid deleting the colour database. - // This is automatically done by wxWindows - static void Destruct(JSContext *cx, wxColourDatabase *p) - { - } - - static JSBool find(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSColourDatabase_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/size.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/size.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/size.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - size.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: size.h 598 2007-03-07 20:13:28Z fbraem $ - */ -///////////////////////////////////////////////////////////////////////////// -// Name: size.h -// Purpose: Ports wxSize to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 30.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WXJSSize_H -#define _WXJSSize_H - -namespace wxjs -{ - namespace gui - { - - class Size : public ApiWrapper - { - public: - - static bool GetProperty(wxSize *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxSize *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static wxSize *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - enum - { - P_WIDTH - , P_HEIGHT - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - - void DefineSizeConst(JSContext *cx, JSObject *obj); - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSSize_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/size.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/app.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/app.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/app.cpp (nonexistent) @@ -1,317 +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 598 2007-03-07 20:13:28Z fbraem $ - */ -// app.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif -#ifdef __WXMSW__ - #include -#endif -#include - -#include "../../common/main.h" -#include "../../common/jsutil.h" - -#include "../control/window.h" - -#include "app.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/app - * gui - * - * 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.

- * Remark:When the application is dialog based - * and the dialog is a modal dialog, the onInit function - * must return false. - *
- */ -WXJS_INIT_CLASS(App, "wxApp", 0) - -App::~App() -{ -} - -int App::OnExit() -{ - jsval fval; - JSContext *cx = GetContext(); - if ( GetFunctionProperty(cx, GetObject(), "onExit", &fval) == JS_TRUE ) - { - jsval rval; - JSBool result = JS_CallFunctionValue(cx, GetObject(), fval, 0, NULL, &rval); - if ( result == JS_TRUE ) - { - if ( rval == JSVAL_VOID ) - return 0; - - int rc; - if ( FromJS(cx, rval, rc) ) - return rc; - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - } - - return 0; -} - -/*** - * - * Get/Set the application name - * Get/Set the classname - * Get/Set the top window of your application. - * Get/Set the vendor name - * - */ -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() -{ - wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); - while (node) - { - wxWindow* win = node->GetData(); - if ( win->IsKindOf(CLASSINFO(wxFrame)) || - win->IsKindOf(CLASSINFO(wxDialog)) ) - { - win->Close(TRUE); - } - else - win->Destroy(); - node = node->GetNext(); - } -} - -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: - { - Object *winObject = dynamic_cast(p->GetTopWindow()); - *vp = winObject == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(winObject->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; -} - -wxApp* App::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - jsval v; - JS_GetProperty(cx, JS_GetGlobalObject(cx), "wxTheApp", &v); - if ( v != JSVAL_VOID ) - { - return GetPrivate(cx, v); - } - else - { - wxApp *app = new App(cx, obj); - - int app_argc = 0; - char **app_argv = NULL; - wxEntryStart(app_argc, app_argv); - - return app; - } -} - -// Don't delete wxApp, it's deleted by wxWindows -void App::Destruct(JSContext *cx, wxApp *p) -{ -} - -WXJS_BEGIN_METHOD_MAP(App) - WXJS_METHOD("mainLoop", mainLoop, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * 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). - * - * - */ -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(); - wxEntryCleanup(); - return retval; -} - -bool App::OnInit() -{ - // Destroy all previously created top windows that are still active. - // This must be done otherwise the mainloop is not exited. - //DestroyTopWindows(); - - jsval fval; - if ( GetFunctionProperty(GetContext(), GetObject(), "onInit", &fval) == JS_TRUE ) - { - jsval rval; - if ( JS_CallFunctionValue(GetContext(), 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(GetContext()); - return false; - } - } - - return true; -} - -BEGIN_EVENT_TABLE(App, wxApp) -END_EVENT_TABLE() - -/*** - * - * - * 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!). - * Remark:When your application is dialog based and the dialog is modal, - * you must return false, otherwise the application keeps running. - * - * - * This function is executed when the application exits. - * The function doesn't get any parameters and must return an Integer. - * - * - */ Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/app.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/image.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/image.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/image.cpp (nonexistent) @@ -1,1624 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - image.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: image.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// image.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/jsutil.h" - -#include "image.h" -#include "size.h" -#include "rect.h" -#include "point.h" -#include "colour.h" -#include "imghand.h" - -#include "../../io/jsstream.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/image - * gui - * - * This class encapsulates a platform-independent image. An image can be loaded from a - * file in a variety of formats. - * - */ -WXJS_INIT_CLASS(Image, "wxImage", 0) - -/*** - * - * - * Returns true when a mask is active. - * - * - * Returns true when a palette is used. - * - * - * Gets the height of the image in pixels. - * - * - * Specifies whether there is a mask or not. The area of the mask is determined - * by the current mask colour. - * - * - * Returns the blue value of the mask colour. - * - * - * Returns the green value of the mask colour. - * - * - * Returns the red value of the mask colour. - * - * - * Returns true when the image data is available. - * - * - * Returns the size of the image in pixels. - * - * - * Returns the width of the image in pixels. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Image) - WXJS_READONLY_PROPERTY(P_OK, "ok") - WXJS_PROPERTY(P_MASK_RED, "maskRed") - WXJS_PROPERTY(P_MASK_GREEN, "maskGreen") - WXJS_PROPERTY(P_MASK_BLUE, "maskBlue") - WXJS_PROPERTY(P_WIDTH, "width") - WXJS_PROPERTY(P_HEIGHT, "height") - WXJS_PROPERTY(P_MASK, "mask") - WXJS_READONLY_PROPERTY(P_HAS_MASK, "hasMask") - WXJS_READONLY_PROPERTY(P_HAS_PALETTE, "hasPalette") - WXJS_PROPERTY(P_PALETTE, "palette") - WXJS_READONLY_PROPERTY(P_SIZE, "size") -WXJS_END_PROPERTY_MAP() - -bool Image::GetProperty(wxImage *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_OK: - *vp = ToJS(cx, p->Ok()); - break; - case P_MASK_RED: - *vp = ToJS(cx, (int) p->GetMaskRed()); - break; - case P_MASK_GREEN: - *vp = ToJS(cx, (int) p->GetMaskGreen()); - break; - case P_MASK_BLUE: - *vp = ToJS(cx, (int) p->GetMaskBlue()); - break; - case P_WIDTH: - *vp = ToJS(cx, p->GetWidth()); - break; - case P_HEIGHT: - *vp = ToJS(cx, p->GetHeight()); - break; - case P_MASK: - case P_HAS_MASK: - *vp = ToJS(cx, p->HasMask()); - break; - case P_HAS_PALETTE: - *vp = ToJS(cx, p->HasPalette()); - break; - case P_PALETTE: - *vp = JSVAL_VOID; - break; - case P_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetWidth(), p->GetHeight())); - break; - } - return true; -} - -bool Image::SetProperty(wxImage *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MASK_RED: - { - int maskRed; - if ( FromJS(cx, *vp, maskRed) ) - { - unsigned char g = p->GetMaskGreen(); - unsigned char b = p->GetMaskBlue(); - p->SetMaskColour((unsigned char) maskRed, g, b); - } - break; - } - case P_MASK_GREEN: - { - int maskGreen; - if ( FromJS(cx, *vp, maskGreen) ) - { - unsigned char r = p->GetMaskRed(); - unsigned char b = p->GetMaskBlue(); - p->SetMaskColour(r, (unsigned char) maskGreen, b); - } - break; - } - case P_MASK_BLUE: - { - int maskBlue; - if ( FromJS(cx, *vp, maskBlue) ) - { - unsigned char r = p->GetMaskRed(); - unsigned char g = p->GetMaskGreen(); - p->SetMaskColour(r, g, (unsigned char) maskBlue); - } - break; - } - case P_MASK: - { - bool mask; - if ( FromJS(cx, *vp, mask) ) - p->SetMask(mask); - break; - } - case P_PALETTE: - break; - } - return true; -} - -/*** - * - * - * Array of @wxImageHandler elements. Get the available list of image handlers. - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(Image) - WXJS_READONLY_PROPERTY(P_HANDLERS, "handlers") -WXJS_END_PROPERTY_MAP() - -bool Image::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - if ( id == P_HANDLERS ) - { - wxList handlers = wxImage::GetHandlers(); - jsint count = handlers.GetCount(); - JSObject *objHandlers = JS_NewArrayObject(cx, count, NULL); - - *vp = OBJECT_TO_JSVAL(objHandlers); - - jsint i = 0; - for ( wxNode *node = handlers.GetFirst(); node; node = node->GetNext() ) - { - wxImageHandler *handler = (wxImageHandler*) node->GetData(); - ImageHandlerPrivate *priv = new ImageHandlerPrivate(handler, false); - jsval element = ImageHandler::CreateObject(cx, priv, NULL); - JS_SetElement(cx, objHandlers, i++, &element); - } - } - return true; -} - -/*** - * - * - * - * - * The width of the image. - * - * - * The height of the image. - * - * - * - * - * The size of the image. - * - * - * - * - * The name of a file from which to load the image. - * - * - * The type of the image. - * - * - * - * - * The name of a file from which to load the image. - * - * - * The MIME type of the image. - * - * - * - */ -wxImage* Image::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxImage(); - - if ( Size::HasPrototype(cx, argv[0]) ) - { - wxSize *size = Size::GetPrivate(cx, argv[0], false); - return new wxImage(size->GetWidth(), size->GetHeight()); - } - - if ( JSVAL_IS_INT(argv[0]) ) - { - int width; - int height; - - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - return new wxImage(width, height); - - return NULL; - } - - wxString name; - FromJS(cx, argv[0], name); - - long type = wxBITMAP_TYPE_ANY; - - if ( argc > 1 ) - { - if ( JSVAL_IS_INT(argv[1]) ) - { - if ( ! FromJS(cx, argv[1], type) ) - return NULL; - } - else - { - wxString mimetype; - FromJS(cx, argv[1], mimetype); - return new wxImage(name, mimetype); - } - } - - return new wxImage(name, type); -} - -WXJS_BEGIN_METHOD_MAP(Image) - WXJS_METHOD("create", create, 1) - WXJS_METHOD("destroy", destroy, 0) - WXJS_METHOD("copy", copy, 0) - WXJS_METHOD("getSubImage", getSubImage, 1) - WXJS_METHOD("paste", paste, 3) - WXJS_METHOD("scale", scale, 1) - WXJS_METHOD("rescale", rescale, 1) - WXJS_METHOD("rotate", rotate, 2) - WXJS_METHOD("rotate90", rotate90, 0) - WXJS_METHOD("mirror", mirror, 0) - WXJS_METHOD("replace", replace, 2) - WXJS_METHOD("convertToMono", convertToMono, 1) - WXJS_METHOD("setRGB", setRGB, 3) - WXJS_METHOD("getRed", getRed, 2) - WXJS_METHOD("getGreen", getGreen, 2) - WXJS_METHOD("getBlue", getBlue, 2) - WXJS_METHOD("getColour", getColour, 2) - WXJS_METHOD("findFirstUnusedColour", findFirstUnusedColour, 2) - WXJS_METHOD("setMaskFromImage", setMaskFromImage, 2) - WXJS_METHOD("loadFile", loadFile, 1) - WXJS_METHOD("saveFile", saveFile, 2) - WXJS_METHOD("setMaskColour", setMaskColour, 1) - WXJS_METHOD("setOption", setOption, 2) - WXJS_METHOD("getOption", getOption, 1) - WXJS_METHOD("getOptionInt", getOptionInt, 1) - WXJS_METHOD("hasOption", hasOption, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The width of the image. - * - * - * The height of the image. - * - * - * - * - * The size of the image. - * - * - * - * Creates a fresh image with the given size. - * - * - */ -JSBool Image::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Size::HasPrototype(cx, argv[0]) ) - { - wxSize *size = Size::GetPrivate(cx, argv[0], false); - p->Create(size->GetWidth(), size->GetHeight()); - return JS_TRUE; - } - else if ( argc == 2 ) - { - int width; - int height; - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - p->Create(width, height); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * Destroys the image data. - * - * - */ -JSBool Image::destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Destroy(); - return JS_TRUE; -} - -/*** - * - * - * - * Returns an identical copy of image. - * - * - */ -JSBool Image::copy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = CreateObject(cx, new wxImage(p->Copy())); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns a sub image of the current one as long as the rect belongs entirely to the image. - * - * - */ -JSBool Image::getSubImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxRect *rect = Rect::GetPrivate(cx, argv[0]); - if ( rect != NULL ) - { - *rval = CreateObject(cx, new wxImage(p->GetSubImage(*rect))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The image to paste. - * - * - * The x position. - * - * - * The y position. - * - * - * - * Pastes image into this instance and takes care of - * the mask colour and out of bounds problems. - * - * - */ -JSBool Image::paste(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxImage *img = GetPrivate(cx, argv[0]); - if ( img == NULL ) - return JS_FALSE; - - int x; - int y; - - if ( FromJS(cx, argv[1], x) - && FromJS(cx, argv[2], y) ) - { - p->Paste(*img, x, y); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The width of the new image. - * - * - * The height of the new image. - * - * - * - * - * The size of the new image. - * - * - * - * Returns a scaled version of the image with size Width * Height. - * - * - */ -JSBool Image::scale(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Size::HasPrototype(cx, argv[0]) ) - { - wxSize *size = Size::GetPrivate(cx, argv[0], false); - *rval = CreateObject(cx, new wxImage(p->Scale(size->GetWidth(), size->GetHeight()))); - return JS_TRUE; - } - else if ( argc == 2 ) - { - int width; - int height; - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - *rval = CreateObject(cx, new wxImage(p->Scale(width, height))); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * The width of the new image. - * - * - * The height of the new image. - * - * - * - * - * The size of the new image. - * - * - * - * Changes the size of the image in-place: after a call to this function, - * the image will have the given width and height. - * Returns the (modified) image itself. - * - * - */ -JSBool Image::rescale(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Size::HasPrototype(cx, argv[0]) ) - { - wxSize *size = Size::GetPrivate(cx, argv[0], false); - *rval = CreateObject(cx, new wxImage(p->Rescale(size->GetWidth(), size->GetHeight()))); - return JS_TRUE; - } - else if ( argc == 2 ) - { - int width; - int height; - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - *rval = CreateObject(cx, new wxImage(p->Rescale(width, height))); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * The rotation angle. - * - * - * The height of the new image. - * - * - * Interpolates the new image. - * - * - * - * - * Rotates the image about the given point, by angle radians. Passing true for interpolating - * results in better image quality, but is slower. If the image has a mask, then the mask colour - * is used for the uncovered pixels in the rotated image background. Else, black will be used. - * Returns the rotated image, leaving this image intact. - * - * - */ -JSBool Image::rotate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 4 ) - argc = 4; - - wxPoint *offset = NULL; - bool interpol = true; - - switch(argc) - { - case 4: - offset = Point::GetPrivate(cx, argv[3]); - if ( offset == NULL ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], interpol) ) - break; - default: - wxPoint *center = Point::GetPrivate(cx, argv[1]); - if ( center == NULL ) - break; - - double angle; - if ( ! FromJS(cx, argv[0], angle) ) - break; - - *rval = CreateObject(cx, new wxImage(p->Rotate(angle, *center, interpol, offset))); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The direction of the rotation. Default is true. - * - * - * - * Returns a copy of the image rotated 90 degrees in the direction indicated by clockwise. - * - * - */ -JSBool Image::rotate90(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool clockwise = true; - if ( argc > 0 - && ! FromJS(cx, argv[0], clockwise) ) - return JS_FALSE; - - *rval = CreateObject(cx, new wxImage(p->Rotate90(clockwise))); - return JS_TRUE; -} - -/*** - * - * - * - * The orientation. - * - * - * - * Returns a mirrored copy of the image. The parameter horizontally indicates the orientation. - * - * - */ -JSBool Image::mirror(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool hor = true; - if ( argc > 0 - && ! FromJS(cx, argv[0], hor) ) - return JS_FALSE; - - *rval = CreateObject(cx, new wxImage(p->Mirror(hor))); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Replaces the colour with another colour. - * - * - */ -JSBool Image::replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 2 ) - { - wxColour *colour1; - wxColour *colour2; - - if ( (colour1 = Colour::GetPrivate(cx, argv[0])) != NULL - && (colour2 = Colour::GetPrivate(cx, argv[1])) != NULL ) - { - p->Replace(colour1->Red(), colour1->Green(), colour1->Blue(), - colour2->Red(), colour2->Green(), colour2->Blue()); - return JS_TRUE; - } - } - else if ( argc == 6 ) - { - int r1, g1, b1, r2, g2, b2; - if ( FromJS(cx, argv[0], r1) - && FromJS(cx, argv[1], g1) - && FromJS(cx, argv[2], b1) - && FromJS(cx, argv[3], r2) - && FromJS(cx, argv[4], g2) - && FromJS(cx, argv[5], b2) ) - { - p->Replace(r1, g1, b1, r2, g2, b2); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * Converts to a monochrome image. The returned image has white colour where the original has (r,g,b) - * colour and black colour everywhere else. - * - * - */ -JSBool Image::convertToMono(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - wxColour *colour = Colour::GetPrivate(cx, argv[0]); - - if ( colour != NULL ) - { - *rval = CreateObject(cx, new wxImage(p->ConvertToMono(colour->Red(), colour->Green(), colour->Blue()))); - return JS_TRUE; - } - } - else if ( argc == 3 ) - { - int r, g, b; - if ( FromJS(cx, argv[0], r) - && FromJS(cx, argv[1], g) - && FromJS(cx, argv[2], b) ) - { - *rval = CreateObject(cx, new wxImage(p->ConvertToMono(r, g, b))); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * The x position - * The y position - * - * - * - * - * - * The x position - * The y position - * - * - * - * Sets the colour of the pixel at the given coordinate. - * This routine performs bounds-checks for the coordinate so it can be considered a safe way - * to manipulate the data, but in some cases this might be too slow. - * - * - */ -JSBool Image::setRGB(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( ! FromJS(cx, argv[0], x) - && ! FromJS(cx, argv[1], y) ) - return JS_FALSE; - - if ( Colour::HasPrototype(cx, argv[2]) ) - { - wxColour *colour = Colour::GetPrivate(cx, argv[2], false); - p->SetRGB(x, y, colour->Red(), colour->Green(), colour->Blue()); - return JS_TRUE; - } - else if ( argc == 5 ) - { - int r, g, b; - if ( FromJS(cx, argv[2], r) - && FromJS(cx, argv[3], g) - && FromJS(cx, argv[4], b) ) - { - p->SetRGB(x, y, r, g, b); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * The x position - * The y position - * - * - * Returns the red intensity at the given coordinate. - * - * - */ -JSBool Image::getRed(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( ! FromJS(cx, argv[0], x) - && ! FromJS(cx, argv[1], y) ) - return JS_FALSE; - - *rval = ToJS(cx, (int) p->GetRed(x, y)); - return JS_TRUE; -} - -/*** - * - * - * The x position - * The y position - * - * - * Returns the green intensity at the given coordinate. - * - * - */ -JSBool Image::getGreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( ! FromJS(cx, argv[0], x) - && ! FromJS(cx, argv[1], y) ) - return JS_FALSE; - - *rval = ToJS(cx, (int) p->GetGreen(x, y)); - return JS_TRUE; -} - -/*** - * - * - * The x position - * The y position - * - * - * Returns the blue intensity at the given coordinate. - * - * - */ -JSBool Image::getBlue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( ! FromJS(cx, argv[0], x) - && ! FromJS(cx, argv[1], y) ) - return JS_FALSE; - - *rval = ToJS(cx, (int) p->GetBlue(x, y)); - return JS_TRUE; -} - -/*** - * - * - * The x position - * The y position - * - * - * Returns the colour of the given coordinate. - * - * - */ -JSBool Image::getColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( ! FromJS(cx, argv[0], x) - && ! FromJS(cx, argv[1], y) ) - return JS_FALSE; - - *rval = Colour::CreateObject(cx, new wxColour(p->GetRed(x, y), p->GetGreen(x, y), p->GetBlue(x, y))); - return JS_TRUE; -} - -/*** - * - * - * - * The colour found. Only updated when a colour is found. - * - * - * The start colour. - * - * - * - * Finds the first colour that is never used in the image. The search begins at given start - * colour and continues by increasing R, G and B components (in this order) by 1 until an - * unused colour is found or the colour space exhausted. - * Returns true on success. False when there are no colours left. - * JavaScript can't pass primitive values by reference, so this method uses @wxColour - * instead of separate r, g, b arguments. - * - * - */ -JSBool Image::findFirstUnusedColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxColour *colour = Colour::GetPrivate(cx, argv[0]); - if ( colour == NULL ) - return JS_FALSE; - - wxColour *start = Colour::GetPrivate(cx, argv[1]); - if ( start == NULL ) - return JS_FALSE; - - unsigned char r, g, b; - - if ( p->FindFirstUnusedColour(&r, &g, &b, start->Red(), start->Green(), start->Blue()) ) - { - *rval = JSVAL_TRUE; - colour->Set(r, g, b); - } - else - { - *rval = JSVAL_FALSE; - } - return JS_TRUE; -} - -/*** - * - * - * - * The mask image to extract mask shape from. Must have same dimensions as the image. - * - * - * - * - * - * - * - * The mask image to extract mask shape from. Must have same dimensions as the image. - * - * - * - * - * Sets image's mask so that the pixels that have RGB value of r,g,b (or colour) in mask - * will be masked in the image. This is done by first finding an unused colour in the image, - * setting this colour as the mask colour and then using this colour to draw all pixels in - * the image whose corresponding pixel in mask has given RGB value. - * Returns false if mask does not have same dimensions as the image or if there is no unused - * colour left. Returns true if the mask was successfully applied. - * - * - */ -JSBool Image::setMaskFromImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxImage *mask = GetPrivate(cx, argv[0]); - if ( mask == NULL ) - return JS_FALSE; - - if ( argc == 2 ) - { - wxColour *colour = Colour::GetPrivate(cx, argv[1]); - if ( colour != NULL ) - { - *rval = ToJS(cx, p->SetMaskFromImage(*mask, colour->Red(), colour->Green(), colour->Blue())); - return JS_TRUE; - } - } - else if ( argc == 4 ) - { - int r, g, b; - if ( FromJS(cx, argv[1], r) - && FromJS(cx, argv[2], g) - && FromJS(cx, argv[3], b) ) - { - *rval = ToJS(cx, p->SetMaskFromImage(*mask, r, g, b)); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * The name of a file - * - * The type of the image. - * - * - * - * The name of a file - * - * The MIME type of the image. - * - * - * - * - * Opened input stream from which to load the image. Currently, the stream must support seeking. - * - * - * The type of the image. - * - * - * - * - * Opened input stream from which to load the image. Currently, the stream must support seeking. - * - * - * The MIME type of the image. - * - * - * - * Loads an image from a file. - * - * - */ -JSBool Image::loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( wxjs::HasPrototype(cx, argv[0], "wxInputStream") ) - { - if ( argc != 2 ) - return JS_FALSE; - - io::Stream *stream = (io::Stream *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(argv[0])); - if ( stream == NULL ) - return JS_FALSE; - - wxInputStream *in = dynamic_cast(stream->GetStream()); - if ( in == NULL ) - { - // TODO: error reporting - return JS_FALSE; - } - - if ( JSVAL_IS_INT(argv[1]) ) - { - long type = wxBITMAP_TYPE_ANY; - if ( ! FromJS(cx, argv[1], type) ) - return JS_FALSE; - - *rval = ToJS(cx, p->LoadFile(*in, type)); - } - else - { - wxString mimetype; - FromJS(cx, argv[1], mimetype); - *rval = ToJS(cx, p->LoadFile(*in, mimetype)); - } - } - else - { - wxString name; - FromJS(cx, argv[0], name); - - if ( argc > 1 ) - { - if ( JSVAL_IS_INT(argv[1]) ) - { - long type = wxBITMAP_TYPE_ANY; - if ( ! FromJS(cx, argv[1], type) ) - return JS_FALSE; - *rval = ToJS(cx, p->LoadFile(name, type)); - } - else - { - wxString mimetype; - FromJS(cx, argv[1], mimetype); - *rval = ToJS(cx, p->LoadFile(name, mimetype)); - } - } - else - *rval = ToJS(cx, p->LoadFile(name)); - } - return JS_TRUE; -} - -/*** - * - * - * The name of a file - * - * The type of the image. - * - * - * - * The name of a file - * - * The MIME type of the image. - * - * - * - * - * Opened input stream from which to load the image. Currently, the stream must support seeking. - * - * - * The type of the image. - * - * - * - * - * Opened input stream from which to load the image. Currently, the stream must support seeking. - * - * - * The MIME type of the image. - * - * - * - * Saves an image to a file. - * - * - */ -JSBool Image::saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( wxjs::HasPrototype(cx, argv[0], "wxOutputStream") ) - { - if ( argc != 2 ) - return JS_FALSE; - - io::Stream *stream = (io::Stream *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(argv[0])); - if ( stream == NULL ) - return JS_FALSE; - - wxOutputStream *out = dynamic_cast(stream->GetStream()); - if ( out == NULL ) - { - // TODO: error reporting - return JS_FALSE; - } - - if ( JSVAL_IS_INT(argv[1]) ) - { - long type = wxBITMAP_TYPE_ANY; - if ( ! FromJS(cx, argv[1], type) ) - return JS_FALSE; - - *rval = ToJS(cx, p->SaveFile(*out, type)); - } - else - { - wxString mimetype; - FromJS(cx, argv[1], mimetype); - *rval = ToJS(cx, p->SaveFile(*out, mimetype)); - } - } - else - { - wxString name; - FromJS(cx, argv[0], name); - - if ( JSVAL_IS_INT(argv[1]) ) - { - long type; - if ( ! FromJS(cx, argv[1], type) ) - return JS_FALSE; - *rval = ToJS(cx, p->SaveFile(name, type)); - } - else - { - wxString mimetype; - FromJS(cx, argv[1], mimetype); - *rval = ToJS(cx, p->SaveFile(name, mimetype)); - } - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * Sets the mask colour for this image (and tells the image to use the mask). - * - * - */ -JSBool Image::setMaskColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Colour::HasPrototype(cx, argv[0]) ) - { - wxColour *colour = Colour::GetPrivate(cx, argv[0], false); - p->SetMaskColour(colour->Red(), colour->Green(), colour->Blue()); - return JS_TRUE; - } - else if ( argc == 3 ) - { - int r, g, b; - if ( FromJS(cx, argv[0], r) - && FromJS(cx, argv[1], g) - && FromJS(cx, argv[2], b) ) - { - p->SetMaskColour(r, g, b); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * Name of the option - * Value of the option - * - * - * Name of the option - * Value of the option - * - * - * Sets a user-defined option. The function is case-insensitive to name. - * For example, when saving as a JPEG file, the option quality is used, - * which is a number between 0 and 100 (0 is terrible, 100 is very good). - * See @wxImage#getOption, @wxImage#getOptionInt, @wxImage#hasOption. - * - * - */ -JSBool Image::setOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - - if ( JSVAL_IS_INT(argv[1]) ) - { - int value; - FromJS(cx, argv[1], value); - p->SetOption(name, value); - return JS_TRUE; - } - - wxString value; - FromJS(cx, argv[1], value); - p->SetOption(name, value); - - return JS_TRUE; -} - -/*** - * - * - * - * The name of the option. - * - * - * - * Gets a user-defined option. The function is case-insensitive to name. - * See @wxImage#setOption, @wxImage#getOptionInt, @wxImage#hasOption - * - * - */ -JSBool Image::getOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - - *rval = ToJS(cx, p->GetOption(name)); - return JS_TRUE; -} - -/*** - * - * - * - * The name of the option. - * - * - * - * Gets a user-defined option. The function is case-insensitive to name. - * See @wxImage#setOption, @wxImage#getOptionString, @wxImage#hasOption - * - * - */ -JSBool Image::getOptionInt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - - *rval = ToJS(cx, p->GetOptionInt(name)); - return JS_TRUE; -} - -/*** - * - * - * - * The name of the option. - * - * - * - * Returns true if the given option is present. The function is case-insensitive to name. - * See @wxImage#setOption, @wxImage#getOptionInt, @wxImage#hasOption - * - * - */ -JSBool Image::hasOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - - *rval = ToJS(cx, p->HasOption(name)); - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(Image) - WXJS_METHOD("canRead", canRead, 1) - WXJS_METHOD("addHandler", addHandler, 1) - WXJS_METHOD("cleanUpHandlers", cleanUpHandlers, 0) - WXJS_METHOD("removeHandler", removeHandler, 1) - WXJS_METHOD("findHandler", findHandler, 1) - WXJS_METHOD("findHandlerMime", findHandlerMime, 1) - WXJS_METHOD("insertHandler", insertHandler, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Adds a handler to the end of the static list of format handlers. - * There is usually only one instance of a given handler class in an application session. - * See @wxImage#handlers and @wxInitAllImageHandlers - * - * - */ -JSBool Image::addHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - ImageHandlerPrivate *p = ImageHandler::GetPrivate(cx, argv[0]); - if ( p == NULL ) - return JS_FALSE; - - p->SetOurs(false); - wxImage::AddHandler(p->GetHandler()); - - return JS_TRUE; -} - -/*** - * - * - * - * A filename. - * - * - * - * Returns true when the file can be read. - * - * - */ -JSBool Image::canRead(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString name; - FromJS(cx, argv[0], name); - *rval = ToJS(cx, wxImage::CanRead(name)); - return JS_TRUE; -} - -/*** - * - * - * - * Removes all handlers. Is called automatically by wxWindows. - * - * - */ -JSBool Image::cleanUpHandlers(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImage::CleanUpHandlers(); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * Searches a handler - * - * - */ -JSBool Image::findHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxImageHandler *handler = NULL; - if ( JSVAL_IS_STRING(argv[0]) ) - { - wxString str; - FromJS(cx, argv[0], str); - - if ( argc == 2 ) - { - long type; - if ( FromJS(cx, argv[1], type) ) - { - handler = wxImage::FindHandler(str, type); - } - else - return JS_FALSE; - } - else - handler = wxImage::FindHandler(str); - } - else - { - long type; - if ( FromJS(cx, argv[1], type) ) - { - handler = wxImage::FindHandler(type); - } - else - return JS_FALSE; - } - - if ( handler == NULL ) - *rval = JSVAL_VOID; - else - { - *rval = ImageHandler::CreateObject(cx, new ImageHandlerPrivate(handler, false)); - } - - return JS_TRUE; -} - -/*** - * - * - * - * A mime type. - * - * - * - * Finds the handler associated with the given MIME type. - * - * - */ -JSBool Image::findHandlerMime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString mime; - FromJS(cx, argv[0], mime); - - wxImageHandler *handler = wxImage::FindHandlerMime(mime); - if ( handler == NULL ) - *rval = JSVAL_VOID; - else - { - *rval = ImageHandler::CreateObject(cx, new ImageHandlerPrivate(handler, false)); - } - return JS_TRUE; -} - -/*** - * - * - * - * The name of the handler. - * - * - * - * Remove the given handler. - * - * - */ -JSBool Image::removeHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxString name; - FromJS(cx, argv[0], name); - - *rval = ToJS(cx, wxImage::RemoveHandler(name)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Adds a handler at the start of the static list of format handlers. - * There is usually only one instance of a given handler class in an application session. - * See @wxImage#handlers - * - * - */ -JSBool Image::insertHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - ImageHandlerPrivate *p = ImageHandler::GetPrivate(cx, argv[0]); - if ( p == NULL ) - return JS_FALSE; - - p->SetOurs(false); - wxImage::InsertHandler(p->GetHandler()); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/image.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.cpp (nonexistent) @@ -1,154 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - gridszr.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: gridszr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// gridszr.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "sizer.h" -#include "gridszr.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/gridszr - * gui - * - * A grid sizer is a sizer which lays out its children in a two-dimensional table with - * all table fields having the same size, i.e. the width of each field is the width of - * the widest child, the height of each field is the height of the tallest child. - * - */ -WXJS_INIT_CLASS(GridSizer, "wxGridSizer", 4) - -GridSizer::GridSizer(JSContext *cx, JSObject *obj, - int cols, int rows, int vgap, int hgap) - : wxGridSizer(cols, rows, vgap, hgap) - , Object(obj, cx) - , AttachedSizer() -{ -} - -GridSizer::GridSizer(JSContext *cx, JSObject *obj, - int cols, int vgap, int hgap) - : wxGridSizer(cols, vgap, hgap) - , Object(obj, cx) - , AttachedSizer() -{ -} - -/*** - * - * - * - * The number of rows. - * - * - * The number of columns. - * - * - * The space between the columns - * - * - * The space between the rows - * - * - * - * - * The number of columns. - * - * - * The space between the columns - * - * - * The space between the rows - * - * - * - * Constructs a new wxGridSizer object. - * - * - */ -GridSizer *GridSizer::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - int cols = 0; - int rows = 0; - int vgap = 0; - int hgap = 0; - - if ( argc > 4 ) - argc = 4; - - if ( argc == 4 ) - { - if ( FromJS(cx, argv[0], rows) - && FromJS(cx, argv[1], cols) - && FromJS(cx, argv[2], vgap) - && FromJS(cx, argv[3], hgap) ) - { - return new GridSizer(cx, obj, rows, cols, vgap, hgap); - } - else - { - return NULL; - } - } - else if ( argc < 4 ) - { - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], hgap) ) - break; - case 2: - if ( ! FromJS(cx, argv[1], vgap) ) - break; - case 1: - if ( ! FromJS(cx, argv[0], cols) ) - break; - return new GridSizer(cx, obj, cols, vgap, hgap); - } - } - - return NULL; -} - -void GridSizer::Destruct(JSContext *cx, GridSizer *p) -{ - AttachedSizer *attached = dynamic_cast(p); - if ( attached != NULL - && ! attached->IsAttached() ) - { - delete p; - p = NULL; - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/icohdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/icohdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/icohdlr.cpp (nonexistent) @@ -1,51 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - icohdlr.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: icohdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/icohdlr - * gui - * - * Image handler for icons. - * - */ -WXJS_INIT_CLASS(ICOHandler, "wxICOHandler", 0) - -ImageHandlerPrivate* ICOHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxICOHandler(), true); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/icohdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.cpp (nonexistent) @@ -1,71 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - cmnconst.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: cmnconst.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// cmnconst.cpp - -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" -#include "cmnconst.h" - -/*** - * misc/cmnconst - * gui - * - * - * - * - * wxTreeItemIcon is used to associated different kind of images - * to a treectrl item. wxTreeItemIcon contains the following constants: - * See @wxTreeCtrl and @wxTreeItem. - * - * Not selected, Not expanded - * Selected, Not expanded - * Not selected, Expanded - * Selected, Expanded - * - * - */ -JSConstDoubleSpec wxTreeItemIconMap[] = -{ - WXJS_CONSTANT(wxTreeItemIcon_, Normal) - WXJS_CONSTANT(wxTreeItemIcon_, Selected) - WXJS_CONSTANT(wxTreeItemIcon_, Expanded) - WXJS_CONSTANT(wxTreeItemIcon_, SelectedExpanded) - { 0 } -}; - -void InitCommonConst(JSContext *cx, JSObject *obj) -{ - JSObject *constObj = JS_DefineObject(cx, obj, "wxTreeItemIcon", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxTreeItemIconMap); -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/validator.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/validator.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/validator.cpp (nonexistent) @@ -1,220 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - validator.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: validator.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// validator.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/jsutil.h" - -#include "../control/window.h" - -#include "validate.h" -#include "app.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Validator::Validator(JSContext *cx, JSObject *obj) : wxValidator() - , Object(obj, cx) -{ -} - -bool Validator::TransferToWindow() -{ - JSContext *cx = GetContext(); - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "transferToWindow", &fval) == JS_TRUE ) - { - jsval rval; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 0, NULL, &rval) == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - { - return ( JSVAL_IS_BOOLEAN(rval) ) ? JSVAL_TO_BOOLEAN(rval) == JS_TRUE : false; - } - } - - return true; -} - -bool Validator::TransferFromWindow() -{ - JSContext *cx = GetContext(); - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "transferFromWindow", &fval) == JS_TRUE ) - { - jsval rval; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 0, NULL, &rval) == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - return ( JSVAL_IS_BOOLEAN(rval) ) ? JSVAL_TO_BOOLEAN(rval) == JS_TRUE : false; - } - return true; -} - -bool Validator::Validate(wxWindow *parent) -{ - JSContext *cx = GetContext(); - wxASSERT_MSG(cx != NULL, wxT("No application object available")); - - Object *winParentObj = dynamic_cast(parent); - - Object *winObj = dynamic_cast(GetWindow()); - if ( winObj == (Object*) NULL ) - return false; - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "validate", &fval) == JS_TRUE ) - { - jsval argv[] = - { - winParentObj == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(winParentObj->GetObject()) - }; - - jsval rval; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval) == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - return JSVAL_IS_BOOLEAN(rval) ? JSVAL_TO_BOOLEAN(rval) == JS_TRUE : false; - } - - return false; -} - -/*** - * misc/validator - * gui - * - * Use wxValidator to create your own validators. - * - */ - -WXJS_INIT_CLASS(Validator, "wxValidator", 0) - -/*** - * - * - * - * Assign a function to this property that transfers the content of the window - * to a variable. You must return true on success, false on failure. - * - * - * Assign a function to this property that transfers the variable to the window. - * You must return true on success, false on failure. - * - * - * Assign a function to this property that checks the content of the associated window. The function - * can have one argument: the parent of the associated window. This function should return false - * when the content is invalid, true when it is valid. - * - * - * The window associated with this validator. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Validator) - WXJS_PROPERTY(P_WINDOW, "window") - WXJS_PROPERTY(P_BELL_ON_ERROR, "bellOnError") -WXJS_END_PROPERTY_MAP() - -bool Validator::GetProperty(wxValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BELL_ON_ERROR: - *vp = ToJS(cx, p->IsSilent()); - break; - case P_WINDOW: - { - Object *win = dynamic_cast(p->GetWindow()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - break; - } - } - return true; -} - -bool Validator::SetProperty(wxValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BELL_ON_ERROR: - { - bool bell; - if ( FromJS(cx, *vp, bell) ) - p->SetBellOnError(bell); - break; - } - case P_WINDOW: - { - wxWindow *win = Window::GetPrivate(cx, *vp); - if ( win != NULL ) - p->SetWindow(win); - } - break; - } - - return true; -} - -/** - * - * - * - * Constructs a new wxValidator object - * - * - */ -wxValidator *Validator::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new Validator(cx, obj); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/validator.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/bmphdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/bmphdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/bmphdlr.cpp (nonexistent) @@ -1,52 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - bmphdlr.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: bmphdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/bmphdlr - * gui - * - * Image handler for bitmaps. - * - */ -WXJS_INIT_CLASS(BMPHandler, "wxBMPHandler", 0) - -ImageHandlerPrivate* BMPHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxBMPHandler(), true); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/bmphdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.cpp (nonexistent) @@ -1,867 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - constant.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: constant.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// constant.cpp - -#ifndef WX_PRECOMP - #include -#endif -#include -#include -#include - -#include "../../common/main.h" - -#include "constant.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/constants - * gui - * - * The following list shows all the constants that are defined on the Global object. - * - */ - -JSConstDoubleSpec wxGlobalMap[] = -{ - WXJS_SIMPLE_CONSTANT(wxNOT_FOUND) - WXJS_SIMPLE_CONSTANT(wxInvalidOffset) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * See @wxSizer, @wxBoxSizer, @wxFlexGridSizer, @wxGridSizer - * - * - */ -JSConstDoubleSpec wxDirectionMap[] = -{ - WXJS_CONSTANT(wx, TOP) - WXJS_CONSTANT(wx, BOTTOM) - WXJS_CONSTANT(wx, LEFT) - WXJS_CONSTANT(wx, TOP) - WXJS_CONSTANT(wx, UP) - WXJS_CONSTANT(wx, DOWN) - WXJS_CONSTANT(wx, RIGHT) - WXJS_CONSTANT(wx, NORTH) - WXJS_CONSTANT(wx, SOUTH) - WXJS_CONSTANT(wx, WEST) - WXJS_CONSTANT(wx, EAST) - WXJS_CONSTANT(wx, ALL) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * See @wxSizer, @wxBoxSizer, @wxFlexGridSizer, @wxGridSizer - * - * - */ -JSConstDoubleSpec wxStretchMap[] = -{ - WXJS_CONSTANT(wxSTRETCH_, NOT) - WXJS_CONSTANT(wx, SHRINK) - WXJS_CONSTANT(wx, GROW) - WXJS_CONSTANT(wx, EXPAND) - WXJS_CONSTANT(wx, SHAPED) - { 0 } -}; - -/*** - * - * - * - * - * - * See @wxSizer, @wxBoxSizer, @wxFlexGridSizer, @wxGridSizer, - * wxWindow @wxWindow#centre, wxWindow @wxWindow#centreOnParent, - * wxWindow @wxWindow#centreOnScreen - * - * - */ -JSConstDoubleSpec wxOrientationMap[] = -{ - WXJS_CONSTANT(wx, HORIZONTAL) - WXJS_CONSTANT(wx, VERTICAL) - WXJS_CONSTANT(wx, BOTH) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * See @wxSizer, @wxBoxSizer, @wxFlexGridSizer, @wxGridSizer - * - * - */ -JSConstDoubleSpec wxAlignmentMap[] = -{ - WXJS_CONSTANT(wxALIGN_, NOT) - WXJS_CONSTANT(wxALIGN_, CENTER_HORIZONTAL) - WXJS_CONSTANT(wxALIGN_, CENTRE_HORIZONTAL) - WXJS_CONSTANT(wxALIGN_, LEFT) - WXJS_CONSTANT(wxALIGN_, TOP) - WXJS_CONSTANT(wxALIGN_, RIGHT) - WXJS_CONSTANT(wxALIGN_, BOTTOM) - WXJS_CONSTANT(wxALIGN_, CENTER_VERTICAL) - WXJS_CONSTANT(wxALIGN_, CENTRE_VERTICAL) - WXJS_CONSTANT(wxALIGN_, CENTER) - WXJS_CONSTANT(wxALIGN_, CENTRE) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -JSConstDoubleSpec wxIdMap[] = -{ - WXJS_CONSTANT(wxID_, LOWEST) - WXJS_CONSTANT(wxID_, HIGHEST) - - WXJS_CONSTANT(wxID_, SEPARATOR) - WXJS_CONSTANT(wxID_, OPEN) - WXJS_CONSTANT(wxID_, CLOSE) - WXJS_CONSTANT(wxID_, NEW) - WXJS_CONSTANT(wxID_, SAVE) - WXJS_CONSTANT(wxID_, SAVEAS) - WXJS_CONSTANT(wxID_, REVERT) - WXJS_CONSTANT(wxID_, EXIT) - WXJS_CONSTANT(wxID_, UNDO) - WXJS_CONSTANT(wxID_, REDO) - WXJS_CONSTANT(wxID_, HELP) - WXJS_CONSTANT(wxID_, PRINT) - WXJS_CONSTANT(wxID_, PRINT_SETUP) - WXJS_CONSTANT(wxID_, PREVIEW) - WXJS_CONSTANT(wxID_, ABOUT) - WXJS_CONSTANT(wxID_, HELP_CONTENTS) - WXJS_CONSTANT(wxID_, HELP_COMMANDS) - WXJS_CONSTANT(wxID_, HELP_PROCEDURES) - WXJS_CONSTANT(wxID_, HELP_CONTEXT) - - WXJS_CONSTANT(wxID_, CUT) - WXJS_CONSTANT(wxID_, COPY) - WXJS_CONSTANT(wxID_, PASTE) - WXJS_CONSTANT(wxID_, CLEAR) - WXJS_CONSTANT(wxID_, FIND) - WXJS_CONSTANT(wxID_, DUPLICATE) - WXJS_CONSTANT(wxID_, SELECTALL) - - WXJS_CONSTANT(wxID_, FILE1) - WXJS_CONSTANT(wxID_, FILE2) - WXJS_CONSTANT(wxID_, FILE3) - WXJS_CONSTANT(wxID_, FILE4) - WXJS_CONSTANT(wxID_, FILE5) - WXJS_CONSTANT(wxID_, FILE6) - WXJS_CONSTANT(wxID_, FILE7) - WXJS_CONSTANT(wxID_, FILE8) - WXJS_CONSTANT(wxID_, FILE9) - -// Standard button IDs - WXJS_CONSTANT(wxID_, OK) - WXJS_CONSTANT(wxID_, CANCEL) - WXJS_CONSTANT(wxID_, APPLY) - WXJS_CONSTANT(wxID_, YES) - WXJS_CONSTANT(wxID_, NO) - WXJS_CONSTANT(wxID_, STATIC) - WXJS_CONSTANT(wxID_, FORWARD) - WXJS_CONSTANT(wxID_, BACKWARD) - WXJS_CONSTANT(wxID_, DEFAULT) - WXJS_CONSTANT(wxID_, MORE) - WXJS_CONSTANT(wxID_, SETUP) - WXJS_CONSTANT(wxID_, RESET) - WXJS_CONSTANT(wxID_, CONTEXT_HELP) - WXJS_CONSTANT(wxID_, YESTOALL) - WXJS_CONSTANT(wxID_, NOTOALL) - WXJS_CONSTANT(wxID_, ABORT) - WXJS_CONSTANT(wxID_, RETRY) - WXJS_CONSTANT(wxID_, IGNORE) - - WXJS_CONSTANT(wxID_, FILEDLGG) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * See @wxKeyEvent - * - * - * @endif - */ -JSConstDoubleSpec wxKeyCodeMap[] = -{ - WXJS_CONSTANT(WXK_, BACK) - WXJS_CONSTANT(WXK_, TAB) - WXJS_CONSTANT(WXK_, RETURN) - WXJS_CONSTANT(WXK_, ESCAPE) - WXJS_CONSTANT(WXK_, SPACE) - WXJS_CONSTANT(WXK_, DELETE) - WXJS_CONSTANT(WXK_, START) - WXJS_CONSTANT(WXK_, LBUTTON) - WXJS_CONSTANT(WXK_, RBUTTON) - WXJS_CONSTANT(WXK_, CANCEL) - WXJS_CONSTANT(WXK_, MBUTTON) - WXJS_CONSTANT(WXK_, CLEAR) - WXJS_CONSTANT(WXK_, SHIFT) - WXJS_CONSTANT(WXK_, ALT) - WXJS_CONSTANT(WXK_, CONTROL) - WXJS_CONSTANT(WXK_, MENU) - WXJS_CONSTANT(WXK_, PAUSE) - WXJS_CONSTANT(WXK_, CAPITAL) - WXJS_CONSTANT(WXK_, PRIOR) - WXJS_CONSTANT(WXK_, NEXT) - WXJS_CONSTANT(WXK_, END) - WXJS_CONSTANT(WXK_, HOME) - WXJS_CONSTANT(WXK_, LEFT) - WXJS_CONSTANT(WXK_, UP) - WXJS_CONSTANT(WXK_, RIGHT) - WXJS_CONSTANT(WXK_, DOWN) - WXJS_CONSTANT(WXK_, SELECT) - WXJS_CONSTANT(WXK_, PRINT) - WXJS_CONSTANT(WXK_, EXECUTE) - WXJS_CONSTANT(WXK_, SNAPSHOT) - WXJS_CONSTANT(WXK_, INSERT) - WXJS_CONSTANT(WXK_, HELP) - WXJS_CONSTANT(WXK_, NUMPAD0) - WXJS_CONSTANT(WXK_, NUMPAD1) - WXJS_CONSTANT(WXK_, NUMPAD2) - WXJS_CONSTANT(WXK_, NUMPAD3) - WXJS_CONSTANT(WXK_, NUMPAD4) - WXJS_CONSTANT(WXK_, NUMPAD5) - WXJS_CONSTANT(WXK_, NUMPAD6) - WXJS_CONSTANT(WXK_, NUMPAD7) - WXJS_CONSTANT(WXK_, NUMPAD8) - WXJS_CONSTANT(WXK_, NUMPAD9) - WXJS_CONSTANT(WXK_, MULTIPLY) - WXJS_CONSTANT(WXK_, ADD) - WXJS_CONSTANT(WXK_, SEPARATOR) - WXJS_CONSTANT(WXK_, SUBTRACT) - WXJS_CONSTANT(WXK_, DECIMAL) - WXJS_CONSTANT(WXK_, DIVIDE) - WXJS_CONSTANT(WXK_, F1) - WXJS_CONSTANT(WXK_, F2) - WXJS_CONSTANT(WXK_, F3) - WXJS_CONSTANT(WXK_, F4) - WXJS_CONSTANT(WXK_, F5) - WXJS_CONSTANT(WXK_, F6) - WXJS_CONSTANT(WXK_, F7) - WXJS_CONSTANT(WXK_, F8) - WXJS_CONSTANT(WXK_, F9) - WXJS_CONSTANT(WXK_, F10) - WXJS_CONSTANT(WXK_, F11) - WXJS_CONSTANT(WXK_, F12) - WXJS_CONSTANT(WXK_, F13) - WXJS_CONSTANT(WXK_, F14) - WXJS_CONSTANT(WXK_, F15) - WXJS_CONSTANT(WXK_, F16) - WXJS_CONSTANT(WXK_, F17) - WXJS_CONSTANT(WXK_, F18) - WXJS_CONSTANT(WXK_, F19) - WXJS_CONSTANT(WXK_, F20) - WXJS_CONSTANT(WXK_, F21) - WXJS_CONSTANT(WXK_, F22) - WXJS_CONSTANT(WXK_, F23) - WXJS_CONSTANT(WXK_, F24) - WXJS_CONSTANT(WXK_, NUMLOCK) - WXJS_CONSTANT(WXK_, SCROLL) - WXJS_CONSTANT(WXK_, PAGEUP) - WXJS_CONSTANT(WXK_, PAGEDOWN) - WXJS_CONSTANT(WXK_, NUMPAD_SPACE) - WXJS_CONSTANT(WXK_, NUMPAD_TAB) - WXJS_CONSTANT(WXK_, NUMPAD_ENTER) - WXJS_CONSTANT(WXK_, NUMPAD_F1) - WXJS_CONSTANT(WXK_, NUMPAD_F2) - WXJS_CONSTANT(WXK_, NUMPAD_F3) - WXJS_CONSTANT(WXK_, NUMPAD_F4) - WXJS_CONSTANT(WXK_, NUMPAD_HOME) - WXJS_CONSTANT(WXK_, NUMPAD_LEFT) - WXJS_CONSTANT(WXK_, NUMPAD_UP) - WXJS_CONSTANT(WXK_, NUMPAD_RIGHT) - WXJS_CONSTANT(WXK_, NUMPAD_DOWN) - WXJS_CONSTANT(WXK_, NUMPAD_PRIOR) - WXJS_CONSTANT(WXK_, NUMPAD_PAGEUP) - WXJS_CONSTANT(WXK_, NUMPAD_NEXT) - WXJS_CONSTANT(WXK_, NUMPAD_PAGEDOWN) - WXJS_CONSTANT(WXK_, NUMPAD_END) - WXJS_CONSTANT(WXK_, NUMPAD_BEGIN) - WXJS_CONSTANT(WXK_, NUMPAD_INSERT) - WXJS_CONSTANT(WXK_, NUMPAD_DELETE) - WXJS_CONSTANT(WXK_, NUMPAD_EQUAL) - WXJS_CONSTANT(WXK_, NUMPAD_MULTIPLY) - WXJS_CONSTANT(WXK_, NUMPAD_ADD) - WXJS_CONSTANT(WXK_, NUMPAD_SEPARATOR) - WXJS_CONSTANT(WXK_, NUMPAD_SUBTRACT) - WXJS_CONSTANT(WXK_, NUMPAD_DECIMAL) - WXJS_CONSTANT(WXK_, NUMPAD_DIVIDE) - { 0 } -}; - -/*** - * - * - * - * - * - * See @wxCalendarDateAttr, @wxCalendarCtrl - * - * - */ -JSConstDoubleSpec wxCalendarDateBorderMap[] = -{ - WXJS_CONSTANT(wxCAL_BORDER_, NONE) - WXJS_CONSTANT(wxCAL_BORDER_, SQUARE) - WXJS_CONSTANT(wxCAL_BORDER_, ROUND) - { 0 } -}; - -/*** - * - * system default - * current default encoding - * West European (Latin1) - * Central and East European (Latin2) - * Esperanto (Latin3) - * Baltic (old) (Latin4) - * Cyrillic - * Arabic - * Greek - * Hebrew - * Turkish (Latin5) - * Variation of Latin4 (Latin6) - * Thai - * Doesn't exist currently, but put it - * here anyhow to make all ISO8859 - * consecutive numbers - * Baltic (Latin7) - * Latin8 - * Latin9 (a.k.a. Latin0, includes euro) - * - * We don't support any of KOI8 variants - * same as MS-DOS CP866 - * used under Linux in Bulgaria - * original MS-DOS codepage - * CP437 merged with Latin1 - * CP437 merged with Latin2 - * another cyrillic encoding - * and another one and for Windows - * WinThai - * Japanese (shift-JIS) - * Chinese simplified (GB) - * Korean (Hangul charset) - * Chinese (traditional - Big5) - * WinLatin2 - * WinCyrillic - * WinLatin1 - * WinGreek (8859-7) - * WinTurkish - * WinHebrew - * WinArabic - * WinBaltic (same as Latin 7) - * - * UTF-7 Unicode encoding - * UTF-8 Unicode encoding - * Unicode - currently used only by wxEncodingConverter class - * - * - */ -JSConstDoubleSpec wxFontEncodingMap[] = -{ - WXJS_CONSTANT(wxFONTENCODING_, SYSTEM) - WXJS_CONSTANT(wxFONTENCODING_, DEFAULT) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_1) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_2) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_3) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_4) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_5) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_6) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_7) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_8) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_9) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_10) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_11) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_12) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_13) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_14) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_15) - WXJS_CONSTANT(wxFONTENCODING_, ISO8859_MAX) - WXJS_CONSTANT(wxFONTENCODING_, KOI8) - WXJS_CONSTANT(wxFONTENCODING_, ALTERNATIVE) - WXJS_CONSTANT(wxFONTENCODING_, BULGARIAN) - WXJS_CONSTANT(wxFONTENCODING_, CP437) - WXJS_CONSTANT(wxFONTENCODING_, CP850) - WXJS_CONSTANT(wxFONTENCODING_, CP852) - WXJS_CONSTANT(wxFONTENCODING_, CP855) - WXJS_CONSTANT(wxFONTENCODING_, CP866) - WXJS_CONSTANT(wxFONTENCODING_, CP874) - WXJS_CONSTANT(wxFONTENCODING_, CP932) - WXJS_CONSTANT(wxFONTENCODING_, CP936) - WXJS_CONSTANT(wxFONTENCODING_, CP949) - WXJS_CONSTANT(wxFONTENCODING_, CP950) - WXJS_CONSTANT(wxFONTENCODING_, CP1250) - WXJS_CONSTANT(wxFONTENCODING_, CP1251) - WXJS_CONSTANT(wxFONTENCODING_, CP1252) - WXJS_CONSTANT(wxFONTENCODING_, CP1253) - WXJS_CONSTANT(wxFONTENCODING_, CP1254) - WXJS_CONSTANT(wxFONTENCODING_, CP1255) - WXJS_CONSTANT(wxFONTENCODING_, CP1256) - WXJS_CONSTANT(wxFONTENCODING_, CP1257) - WXJS_CONSTANT(wxFONTENCODING_, CP12_MAX) - WXJS_CONSTANT(wxFONTENCODING_, UTF7) - WXJS_CONSTANT(wxFONTENCODING_, UTF8) - WXJS_CONSTANT(wxFONTENCODING_, UNICODE) - WXJS_CONSTANT(wxFONTENCODING_, MAX) - { 0 } -}; - -/*** - * - * - * The validity of these flags depends on the platform and wxWidgets configuration. - * If all possible wxWidgets settings are used, the Windows platform supports BMP file, - * BMP resource, XPM data, and XPM. Under wxGTK, the available formats are BMP file, - * XPM data, XPM file, and PNG file. Under wxMotif, the available formats are XBM data, - * XBM file, XPM data, XPM file. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -JSConstDoubleSpec wxBitmapTypeMap[] = -{ - WXJS_CONSTANT(wxBITMAP_TYPE_, INVALID) - WXJS_CONSTANT(wxBITMAP_TYPE_, BMP) - WXJS_CONSTANT(wxBITMAP_TYPE_, BMP_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, ICO) - WXJS_CONSTANT(wxBITMAP_TYPE_, ICO_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, CUR) - WXJS_CONSTANT(wxBITMAP_TYPE_, CUR_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, XBM) - WXJS_CONSTANT(wxBITMAP_TYPE_, XBM_DATA) - WXJS_CONSTANT(wxBITMAP_TYPE_, XPM) - WXJS_CONSTANT(wxBITMAP_TYPE_, XPM_DATA) - WXJS_CONSTANT(wxBITMAP_TYPE_, TIF) - WXJS_CONSTANT(wxBITMAP_TYPE_, TIF_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, GIF) - WXJS_CONSTANT(wxBITMAP_TYPE_, GIF_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, PNG) - WXJS_CONSTANT(wxBITMAP_TYPE_, PNG_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, JPEG) - WXJS_CONSTANT(wxBITMAP_TYPE_, JPEG_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, PNM) - WXJS_CONSTANT(wxBITMAP_TYPE_, PNM_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, PCX) - WXJS_CONSTANT(wxBITMAP_TYPE_, PCX_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, PICT) - WXJS_CONSTANT(wxBITMAP_TYPE_, PICT_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, ICON) - WXJS_CONSTANT(wxBITMAP_TYPE_, ICON_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, MACCURSOR) - WXJS_CONSTANT(wxBITMAP_TYPE_, MACCURSOR_RESOURCE) - WXJS_CONSTANT(wxBITMAP_TYPE_, ANY) - { 0 } -}; - -/*** - * - * - * No filtering - * - * - * Non-ASCII characters are filtered out. - * - * - * Non-alpha characters are filtered out. - * - * - * Non-alphanumeric characters are filtered out. - * - * - * Non-numeric characters are filtered out. - * - * - * Use an include list. The validator checks if the user input is on the list, - * complaining if not. - * - * - * Use an exclude list. The validator checks if the user input is on the list, - * complaining if it is. - * - * - * Use an include list. The validator checks if each input character is in - * the list (one character per list element), complaining if not. - * - * - * Use an include list. The validator checks if each input character is - * in the list (one character per list element), complaining if it is. - * - * - * See @wxTextValidator - * - * - */ -JSConstDoubleSpec wxFilterMap[] = -{ - WXJS_CONSTANT(wxFILTER_, NONE) - WXJS_CONSTANT(wxFILTER_, ASCII) - WXJS_CONSTANT(wxFILTER_, ALPHA) - WXJS_CONSTANT(wxFILTER_, ALPHANUMERIC) - WXJS_CONSTANT(wxFILTER_, NUMERIC) - WXJS_CONSTANT(wxFILTER_, INCLUDE_LIST) - WXJS_CONSTANT(wxFILTER_, EXCLUDE_LIST) - WXJS_CONSTANT(wxFILTER_, INCLUDE_CHAR_LIST) - WXJS_CONSTANT(wxFILTER_, EXCLUDE_CHAR_LIST) - { 0 } -}; - -/*** - * - * - * - * - * - * - * - * See @wxMenuBar, @wxMenu, @wxToolBar - * - * - * - */ -JSConstDoubleSpec wxItemKindMap[] = -{ - WXJS_CONSTANT(wxITEM_, SEPARATOR) - WXJS_CONSTANT(wxITEM_, NORMAL) - WXJS_CONSTANT(wxITEM_, CHECK) - WXJS_CONSTANT(wxITEM_, RADIO) - WXJS_CONSTANT(wxITEM_, MAX) - { 0 } -}; - -JSConstDoubleSpec wxBorderMap[] = -{ - WXJS_CONSTANT(wxBORDER_, DEFAULT) - WXJS_CONSTANT(wxBORDER_, NONE) - WXJS_CONSTANT(wxBORDER_, STATIC) - WXJS_CONSTANT(wxBORDER_, SIMPLE) - WXJS_CONSTANT(wxBORDER_, RAISED) - WXJS_CONSTANT(wxBORDER_, SUNKEN) - WXJS_CONSTANT(wxBORDER_, DOUBLE) - WXJS_CONSTANT(wxBORDER_, MASK) - { 0 } -}; - -void wxjs::gui::InitGuiConstants(JSContext *cx, JSObject *obj) -{ - // Define the global constants - - JS_DefineConstDoubles(cx, obj, wxGlobalMap); - - // Create all the separate constant objects. - - JSObject *constObj = JS_DefineObject(cx, obj, "wxDirection", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxDirectionMap); - - constObj = JS_DefineObject(cx, obj, "wxStretch", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxStretchMap); - - constObj = JS_DefineObject(cx, obj, "wxOrientation", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxOrientationMap); - - constObj = JS_DefineObject(cx, obj, "wxAlignment", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxAlignmentMap); - - constObj = JS_DefineObject(cx, obj, "wxId", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxIdMap); - - constObj = JS_DefineObject(cx, obj, "wxKeyCode", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxKeyCodeMap); - - constObj = JS_DefineObject(cx, obj, "wxCalendarDateBorder", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxCalendarDateBorderMap); - - constObj = JS_DefineObject(cx, obj, "wxFontEncoding", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxCalendarDateBorderMap); - - constObj = JS_DefineObject(cx, obj, "wxBitmapType", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxBitmapTypeMap); - - constObj = JS_DefineObject(cx, obj, "wxFilter", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - - JS_DefineConstDoubles(cx, constObj, wxFilterMap); - - constObj = JS_DefineObject(cx, obj, "wxItemKind", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxItemKindMap); - - constObj = JS_DefineObject(cx, obj, "wxBorder", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxBorderMap); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/constant.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.cpp (nonexistent) @@ -1,127 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - globfun.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: globfun.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// globfun.cpp -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" -#include "globfun.h" -#include "point.h" -#include "colour.h" -#include "size.h" -#include "fontlist.h" -#include "colourdb.h" - -/*** - * misc/globfun - * gui - * - * On this page you can find all the functions that are defined on the global object. - * - */ -static JSFunctionSpec Functions[] = -{ - { "wxMessageBox", wxjs::gui::MessageBox, 1 }, - { "wxInitAllImageHandlers", wxjs::gui::InitAllImageHandlers, 0 }, - { 0 } -}; - -/*** - * - * - * - * - * - * Shows a modal message box with the given text. - * - * - */ -JSBool wxjs::gui::MessageBox(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc == 1 ) - { - wxString msg; - FromJS(cx, argv[0], msg); - wxMessageBox(msg); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * Initializes all available image handlers. When wxJS is started, - * only @wxBMPHandler is instantiated. When you only need one - * image handler you can also use @wxImage#addHandler. - *

- * See @wxImage, @wxBMPHandler, @wxGIFHandler, @wxICOHandler, - * @wxJPEGHandler, @wxPCXHandler, @wxPNGHandler, @wxPNMHandler, - * @wxTIFFHandler, @wxXPMHandler - *
- *
- */ -JSBool wxjs::gui::InitAllImageHandlers(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxInitAllImageHandlers(); - return JS_TRUE; -} - -bool wxjs::gui::InitFunctions(JSContext *cx, JSObject *global) -{ - JS_DefineFunctions(cx, global, Functions); - return true; -} - -/*** - * - * - * The default position - * - * - * The default size - * - * - * The one and only font list object. - * - * - * The one and only colour database. - * - * - */ -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); - - wxjs::gui::DefineGlobalColours(cx, global); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.cpp (nonexistent) @@ -1,514 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - rect.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: rect.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// rect.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "rect.h" -#include "point.h" -#include "size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/rect - * gui - * - * A class for manipulating rectangles - * - */ -WXJS_INIT_CLASS(Rect, "wxRect", 0) - -/*** - * - * - * The width of the rectangle - * - * - * The height of the rectangle - * - * - * The bottom - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Rect) - WXJS_PROPERTY(P_WIDTH, "width") - WXJS_PROPERTY(P_HEIGHT, "height") - WXJS_PROPERTY(P_BOTTOM, "bottom") - WXJS_READONLY_PROPERTY(P_LEFT, "left") - WXJS_PROPERTY(P_POSITION, "position") - WXJS_PROPERTY(P_RIGHT, "right") - WXJS_READONLY_PROPERTY(P_SIZE, "size") - WXJS_PROPERTY(P_TOP, "top") - WXJS_PROPERTY(P_X, "x") - WXJS_PROPERTY(P_Y, "y") -WXJS_END_PROPERTY_MAP() - -bool Rect::GetProperty(wxRect *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_WIDTH: - *vp = ToJS(cx, p->GetWidth()); - break; - case P_HEIGHT: - *vp = ToJS(cx, p->GetHeight()); - break; - case P_BOTTOM: - *vp = ToJS(cx, p->GetBottom()); - break; - case P_LEFT: - *vp = ToJS(cx, p->GetLeft()); - break; - case P_POSITION: - *vp = Point::CreateObject(cx, new wxPoint(p->GetPosition())); - break; - case P_RIGHT: - *vp = ToJS(cx, p->GetRight()); - break; - case P_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetSize())); - break; - case P_TOP: - *vp = ToJS(cx, p->GetTop()); - break; - case P_X: - *vp = ToJS(cx, p->GetX()); - break; - case P_Y: - *vp = ToJS(cx, p->GetY()); - break; - } - return true; -} - -bool Rect::SetProperty(wxRect *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_WIDTH: - { - int width; - if ( FromJS(cx, *vp, width) ) - p->SetWidth(width); - break; - } - case P_HEIGHT: - { - int height; - if ( FromJS(cx, *vp, height) ) - p->SetHeight(height); - break; - } - case P_BOTTOM: - { - int bottom; - if ( FromJS(cx, *vp, bottom) ) - p->SetBottom(bottom); - break; - } - case P_LEFT: - { - int left; - if ( FromJS(cx, *vp, left) ) - p->SetLeft(left); - break; - } - case P_RIGHT: - { - int right; - if ( FromJS(cx, *vp, right) ) - p->SetRight(right); - break; - } - case P_TOP: - { - int top; - if ( FromJS(cx, *vp, top) ) - p->SetTop(top); - break; - } - case P_X: - { - int x; - if ( FromJS(cx, *vp, x ) ) - p->SetX(x); - break; - } - case P_Y: - { - int y; - if ( FromJS(cx, *vp, y) ) - p->SetY(y); - break; - } - } - return true; -} - -/*** - * - * - * - * X-coordinate of the top level corner - * - * - * Y-coordinate of the top level corner - * - * - * The width of the rectangle - * - * - * The height of the rectangle - * - * - * - * - * The top-left corner - * - * - * The bottom-right corner - * - * - * - * - * - * - * - * Constructs a new wxRect object. - * - * - */ -wxRect* Rect::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxRect(); - - if ( argc >= 4 ) - { - int x; - int y; - int width; - int height; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) - && FromJS(cx, argv[2], width) - && FromJS(cx, argv[3], height) ) - { - return new wxRect(x, y, width, height); - } - } - else if ( argc == 2 ) - { - wxPoint *pt1 = Point::GetPrivate(cx, argv[0]); - if ( pt1 != NULL ) - { - wxPoint *pt2 = Point::GetPrivate(cx, argv[1]); - if ( pt2 != NULL ) - { - return new wxRect(*pt1, *pt2); - } - else - { - wxSize *size = Size::GetPrivate(cx, argv[1]); - if ( size != NULL ) - return new wxRect(*pt1, *size); - } - } - } - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(Rect) - WXJS_METHOD("inflate", inflate, 1) - WXJS_METHOD("deflate", deflate, 1) - WXJS_METHOD("offset", offset, 1) - WXJS_METHOD("intersect", intersect, 1) - WXJS_METHOD("inside", inside, 1) - WXJS_METHOD("intersects", intersects, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * Increases the rectangle size by X in x direction and by Y in y direction. - * When Y is not specified then the value of X is used. You can use negative - * values to decrease the size. - * - * - */ -JSBool Rect::inflate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc > 2 ) - argc = 2; - - wxCoord x = 0; - wxCoord y = 0; - - if ( FromJS(cx, argv[0], x) ) - { - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], y) ) - { - return JS_FALSE; - } - } - else - { - y = x; - } - } - else - { - return JS_FALSE; - } - - wxRect *p = Rect::GetPrivate(cx, obj); - p->Inflate(x, y); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Decreases the rectangle size by X in x direction and by Y in y direction. - * When Y is not specified then the value of X is used. You can use negative - * values to decrease the size. - * - * - */ -JSBool Rect::deflate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - if ( argc > 2 ) - argc = 2; - - wxCoord x = 0; - wxCoord y = 0; - - if ( FromJS(cx, argv[0], x) ) - { - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], y) ) - { - return JS_FALSE; - } - } - else - { - y = x; - } - } - else - { - return JS_FALSE; - } - - wxRect *p = Rect::GetPrivate(cx, obj); - p->Deflate(x, y); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Moves the rectangle. - * - * - */ -JSBool Rect::offset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRect *p = GetPrivate(cx, obj); - - switch (argc) - { - case 2: - { - int x; - int y; - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->Offset(x, y); - } - else - { - return JS_FALSE; - } - break; - } - case 1: - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - p->Offset(*pt); - } - else - { - return JS_FALSE; - } - break; - } - default: - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * - * - */ -JSBool Rect::intersect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRect *p = GetPrivate(cx, obj); - - wxRect *argRect = GetPrivate(cx, argv[0]); - if ( argRect != NULL ) - { - *rval = CreateObject(cx, new wxRect(p->Intersect(*argRect))); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Returns true when the given coordinates are in the rectangle area. - * - * - */ -JSBool Rect::inside(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRect *p = GetPrivate(cx, obj); - - switch(argc) - { - case 2: - { - int x; - int y; - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - *rval = ToJS(cx, p->Inside(x, y)); - } - else - { - return JS_FALSE; - } - break; - } - case 1: - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - *rval = ToJS(cx, p->Inside(*pt)); - } - else - { - return JS_FALSE; - } - break; - } - default: - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns true when the rectangles have a non empty intersection - * - * - */ -JSBool Rect::intersects(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRect *p = GetPrivate(cx, obj); - - wxRect *argRect = GetPrivate(cx, argv[0]); - if ( argRect != NULL ) - { - *rval = ToJS(cx, p->Intersects(*argRect)); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/rect.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.cpp (nonexistent) @@ -1,151 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - acctable.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: acctable.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// acctable.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "acctable.h" -#include "accentry.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/acctable - * gui - * - * An accelerator table allows the application to specify a table - * of keyboard shortcuts for menus or other commands. On Windows, - * menu or button commands are supported; on GTK, - * only menu commands are supported. - * The following example adds an accelerator to a frame. When CTRL-F1 is pressed - * the menu action associated with id 1 is executed. - *

- *    wxTheApp.onInit = init;
- *    wxTheApp.mainLoop();
- *
- *    function init()
- *    {
- *      var frame = new wxFrame(null, -1, "Accelerator Test");
- *      var menuBar = new wxMenuBar();
- *      var menu = new wxMenu();
- *      var idInfoAbout = 1;
- *
- *      menu = new wxMenu();
- *      menu.append(idInfoAbout, "About", infoAboutMenu);
- *      menuBar.append(menu, "Info");
- *
- *      frame.menuBar = menuBar;
- *
- *      var entries = new Array();
- *      entries[0] = new wxAcceleratorEntry(wxAcceleratorEntry.CTRL,
- *                                          wxKeyCode.F1,
- *                                          idInfoAbout);
- *      frame.acceleratorTable = new wxAcceleratorTable(entries);
- *
- *      menu.getItem(idInfoAbout).accel = entries[0];
- *
- *      topWindow = frame;
- *      frame.visible = true;
- *
- *      return true;
- *    }
- *
- *    function infoAboutMenu(event)
- *    {
- *      wxMessageBox("Accelerator Test Version 1.0");
- *    }
- *   
- *
- */ -WXJS_INIT_CLASS(AcceleratorTable, "wxAcceleratorTable", 1) - -/*** - * - * - * Returns true when the accelerator table is valid - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(AcceleratorTable) - WXJS_READONLY_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -bool AcceleratorTable::GetProperty(wxAcceleratorTable *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_OK ) - { - *vp = ToJS(cx, p->Ok()); - } - return true; -} - -/*** - * - * - * - * An array of @wxAcceleratorEntry objects - * - * - * - * Constructs a new wxAcceleratorTable object. - * - * - */ -wxAcceleratorTable *AcceleratorTable::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - JSObject *objEntries = JSVAL_TO_OBJECT(argv[0]); - if ( JS_IsArrayObject(cx, objEntries) ) - { - jsuint length = 0; - JS_GetArrayLength(cx, objEntries, &length); - int n = length; - wxAcceleratorEntry **items = new wxAcceleratorEntry*[n]; - for(jsint i =0; i < n; i++) - { - jsval element; - JS_GetElement(cx, objEntries, i, &element); - items[i] = AcceleratorEntry::GetPrivate(cx, element); - } - - wxAcceleratorTable *p = new wxAcceleratorTable(n, *items); - - delete[] items; - - return p; - } - } - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.h (nonexistent) @@ -1,88 +0,0 @@ -/* - * wxJavaScript - fontenum.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: fontenum.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFontEnumerator_H -#define _WXJSFontEnumerator_H - -//////////////////////////////////////////////////////////////////////////// -// Name: fontenum.h -// Purpose: FontEnumerator ports wxFontEnumerator to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - class Object; - - namespace gui - { - - class FontEnumerator : public wxFontEnumerator - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - FontEnumerator(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~FontEnumerator(); - - static bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - - static FontEnumerator *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool enumerateFacenames(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enumerateEncodings(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - bool OnFacename(const wxString &faceName); - - bool OnFontencoding(const wxString &faceName, const wxString &encoding); - - WXJS_DECLARE_STATIC_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_FACENAMES - , P_ENCODINGS - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFontEnumerator_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * wxJavaScript - flexgrid.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: flexgrid.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFlexGridSizer_H -#define _WXJSFlexGridSizer_H - -///////////////////////////////////////////////////////////////////////////// -// Name: flexgrid.h -// Purpose: FlexGridSizer ports wxFlexGridSizer to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 18.04.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - class Object; - namespace gui - { - class FlexGridSizer : public wxFlexGridSizer - , public ApiWrapper - , public Object - , public AttachedSizer - { - public: - /** - * Constructor - */ - FlexGridSizer(JSContext *cx, JSObject *obj, int cols, int rows, int vgap, int hgap); - FlexGridSizer(JSContext *cx, JSObject *obj, int cols, int vgap = 0, int hgap = 0); - - /** - * Destructor - */ - virtual ~FlexGridSizer() - { - if ( IsAttached() ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } - } - - /** - * Callback for when a wxFlexGridSizer object is created - */ - static FlexGridSizer* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static void Destruct(JSContext *cx, FlexGridSizer *p); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFlexGridSizer_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/flexgrid.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.cpp (nonexistent) @@ -1,110 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - colourdb.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: colourdb.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// colourdb.cpp - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "../../common/main.h" - -#include "colourdb.h" -#include "colour.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * file/colourdb - * gui - * - * wxWindows maintains a database of standard RGB colours for a predefined set - * of named colours (such as "BLACK", "LIGHT GREY"). wxColourDatabase is a singleton - * and is instantiated when the application starts: wxTheColourDatabase. - * An example: - * - * var colour = wxTheColourDatabase.findColour("RED"); - * - */ -WXJS_INIT_CLASS(ColourDatabase, "wxColourDatabase", 0) - -WXJS_BEGIN_METHOD_MAP(ColourDatabase) - WXJS_METHOD("find", find, 1) - WXJS_METHOD("findName", findName, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The name of a colour. - * - * - * Returns the colour with the given name. undefined is returned - * when the colour does not exist. - * - * - */ -JSBool ColourDatabase::find(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxColourDatabase *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - - // Create a copy of the colour, because the colour pointer is owned by wxWindows. - *rval = Colour::CreateObject(cx, new wxColour(p->Find(name))); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Returns the name of the colour. undefined is returned when the colour has no name. - * - * - */ -JSBool ColourDatabase::findName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxColourDatabase *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxColour *colour = Colour::GetPrivate(cx, argv[0]); - if ( colour == NULL ) - return JS_FALSE; - - wxString name = p->FindName(*colour); - *rval = ( name.Length() == 0 ) ? JSVAL_VOID : ToJS(cx, name); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/colourdb.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/font.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/font.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/font.h (nonexistent) @@ -1,74 +0,0 @@ -/* - * wxJavaScript - font.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: font.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFont_H -#define _WXJSFont_H - -///////////////////////////////////////////////////////////////////////////// -// Name: font.h -// Purpose: Font ports wxFont to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 05.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class Font : public ApiWrapper - { - public: - static bool GetProperty(wxFont *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxFont *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - static bool SetStaticProperty(JSContext *cx, int id, jsval *vp); - - static wxFont* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_STATIC_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Property Ids. - */ - enum - { - P_DEFAULT_ENCODING - , P_FACE_NAME - , P_FAMILY - , P_POINT_SIZE - , P_STYLE - , P_UNDERLINED - , P_WEIGHT - , P_OK - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFont_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/font.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.h (nonexistent) @@ -1,170 +0,0 @@ -/* - * wxJavaScript - imghand.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: imghand.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSImageHandler_H -#define _WXJSImageHandler_H - -///////////////////////////////////////////////////////////////////////////// -// Name: imghand.h -// Purpose: ImageHandler ports wxImageHandler to JavaScript -// BmpHandler ports wxBmpHandler to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 08-10-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - // A class that handles the destruction of an imagehandler. - // Ounce the handler is added to the image handler list, wxWindows destroys - // the handler for us. So when the handler is not in a list, wxJS must destroy - // the handler. - class ImageHandlerPrivate - { - public: - ImageHandlerPrivate(wxImageHandler *handler, bool ours) : m_handler(handler), m_ours(ours) - { - } - - ~ImageHandlerPrivate() - { - if ( IsOurs() ) - delete m_handler; - } - - bool IsOurs() const - { - return m_ours; - } - - void SetOurs(bool ours) - { - m_ours = ours; - } - - wxImageHandler* GetHandler() const - { - return m_handler; - } - - private: - wxImageHandler *m_handler; - bool m_ours; - }; - - class ImageHandler : public ApiWrapper - { - public: - - /** - * Callback for retrieving properties of wxImageHandler - */ - static bool GetProperty(ImageHandlerPrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(ImageHandlerPrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_NAME - , P_EXTENSION - , P_TYPE - , P_MIME_TYPE - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool getImageCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - - class BMPHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class ICOHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class GIFHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class JPEGHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class PCXHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class PNGHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class PNMHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class TIFFHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - - class XPMHandler : public ApiWrapper - { - public: - static ImageHandlerPrivate* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSImageHandler_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.cpp (nonexistent) @@ -1,233 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - bitmap.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: bitmap.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// bitmap.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "bitmap.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/bitmap - * gui - * - * This class encapsulates the concept of a platform-dependent bitmap, either monochrome or colour. - * See @wxIcon and @wxBitmapType - * - */ -WXJS_INIT_CLASS(Bitmap, "wxBitmap", 0) - -/*** - * - * - * Get/Set the colour depth of the bitmap. A value of 1 indicates a monochrome bitmap. - * - * - * Get/Set the height of the bitmap in pixels. - * - * - * Returns true when the bitmap data is available. - * - * - * Get/Set the width of the bitmap in pixels. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Bitmap) - WXJS_PROPERTY(P_DEPTH, "depth") - WXJS_PROPERTY(P_HEIGHT, "height") - WXJS_READONLY_PROPERTY(P_OK, "ok") - WXJS_PROPERTY(P_WIDTH, "width") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(Bitmap) - WXJS_METHOD("create", create, 2) - WXJS_METHOD("loadFile", loadFile, 2) -WXJS_END_METHOD_MAP() - -bool Bitmap::GetProperty(wxBitmap *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_DEPTH: - *vp = ToJS(cx, p->GetDepth()); - break; - case P_HEIGHT: - *vp = ToJS(cx, p->GetHeight()); - break; - case P_WIDTH: - *vp = ToJS(cx, p->GetWidth()); - break; - case P_OK: - *vp = ToJS(cx, p->Ok()); - break; - } - return true; -} - -bool Bitmap::SetProperty(wxBitmap *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DEPTH: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetDepth(value); - break; - } - case P_HEIGHT: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetHeight(value); - break; - } - case P_WIDTH: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetWidth(value); - break; - } - } - return true; -} - -/*** - * - * - * - * Filename - * The type of the bitmap. - * - * - * Constructs a new wxBitmap object. - * See @wxBitmapType - * - * - */ -wxBitmap* Bitmap::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 0: - return new wxBitmap(); - case 2: - { - wxString name; - int type; - FromJS(cx, argv[0], name); - if ( FromJS(cx, argv[1], type) ) - return new wxBitmap(name, (wxBitmapType) type); - } - } - return NULL; -} - -/*** - * - * - * - * The width of the bitmap in pixels. - * - * - * The height of the bitmap in pixels. - * - * - * The depth of the bitmap in pixels. When omitted (or a value -1) , the screen depth is used. - * - * - * - * Creates a fresh bitmap. - * - * - */ -JSBool Bitmap::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxBitmap *p = GetPrivate(cx, obj); - - int width = 0; - int height = 0; - int depth = -1; - - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - if ( argc > 2 ) - { - if ( ! FromJS(cx, argv[2], depth) ) - { - return JS_FALSE; - } - } - - *rval = ToJS(cx, p->Create(width, height, depth)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The name of the file. - * - * - * The type of the bitmap. - * - * - * - * Loads a bitmap from a file. - * - * - */ -JSBool Bitmap::loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxBitmap *p = GetPrivate(cx, obj); - - wxString name; - int type; - FromJS(cx, argv[0], name); - if ( FromJS(cx, argv[1], type) ) - { - *rval = ToJS(cx, p->LoadFile(name, (wxBitmapType) type)); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.cpp (nonexistent) @@ -1,154 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - cshelp.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: cshelp.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// cshelp.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../control/window.h" - -#include "cshelp.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/cshelp - * gui - * - * This class changes the cursor to a query and puts the application into a - * 'context-sensitive help mode'. When the user left-clicks on a window within - * the specified window, a wxEVT_HELP event is sent to that control, and the - * application may respond to it by popping up some help. - * - */ -WXJS_INIT_CLASS(ContextHelp, "wxContextHelp", 0) - -/*** - * - * - * - * The window that will get the @wxHelpEvent . When the object - * is null, the top level window will be used. - * - * - * When true (= default), the application will enter the 'context-sensitive help mode' - * immediately. Otherwise @wxContextHelp#beginContextHelp needs to be called. - * - * - * - * Constructs a new wxContextHelp object. - * - * - */ -wxContextHelp* ContextHelp::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - wxWindow *win = NULL; - bool now = true; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], now) ) - return NULL; - // Fall through - case 1: - if ( ! JSVAL_IS_VOID(argv[0]) ) - { - win = Window::GetPrivate(cx, argv[0]); - if ( win == NULL ) - return NULL; - } - } - - return new wxContextHelp(win, now); -} - -WXJS_BEGIN_METHOD_MAP(ContextHelp) - WXJS_METHOD("beginContextHelp", beginContextHelp, 0) - WXJS_METHOD("endContextHelp", endContextHelp, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The window that will get the @wxHelpEvent. When the object - * is null, the top level window will be used. - * - * - * - * Puts the application into context-sensitive help mode. - * Returns true, when the application was put successfully into context-sensitive help mode. - * This function only returns when the event loop has finished. - * - * - */ -JSBool ContextHelp::beginContextHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxContextHelp *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 1 ) - argc = 1; - - wxWindow *win = NULL; - if ( argc == 1 ) - { - win = Window::GetPrivate(cx, argv[0]); - if ( win == NULL ) - return JS_FALSE; - } - - *rval = ToJS(cx, p->BeginContextHelp(win)); - return JS_TRUE; -} - -/*** - * - * - * - * Ends context-sensitive help mode. Not normally called by the application. - * - * - */ -JSBool ContextHelp::endContextHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxContextHelp *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->EndContextHelp(); - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/app.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/app.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/app.h (nonexistent) @@ -1,109 +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 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSApp_H -#define _WXJSApp_H - -///////////////////////////////////////////////////////////////////////////// -// Name: app.h -// Purpose: App ports wxApp to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - class Object; - - namespace gui - { - class App : public wxApp - , public ApiWrapper - , public Object - { - public: - - /** - * Constructor - */ - App(JSContext *cx, JSObject *obj) : wxApp(), Object(obj, cx) - { - } - - /** - * 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); - - static wxApp* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - /** - * Callback for when a wxApp object is destroyed - */ - static void Destruct(JSContext *cx, wxApp *p); - - /** - * 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(); - - protected: - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSApp_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/app.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/image.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/image.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/image.h (nonexistent) @@ -1,126 +0,0 @@ -/* - * wxJavaScript - image.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: image.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSImage_H -#define _WXJSImage_H - -///////////////////////////////////////////////////////////////////////////// -// Name: image.h -// Purpose: Image ports wxImage to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 07-10-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class Image : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxImage - */ - static bool GetProperty(wxImage *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxImage *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxImage object is created - */ - static wxImage* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_OK - , P_MASK_RED - , P_MASK_GREEN - , P_MASK_BLUE - , P_WIDTH - , P_HEIGHT - , P_MASK - , P_HAS_PALETTE - , P_HAS_MASK - , P_PALETTE - , P_SIZE - , P_HANDLERS - }; - - WXJS_DECLARE_STATIC_PROPERTY_MAP() - bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - - WXJS_DECLARE_METHOD_MAP() - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool copy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getSubImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool paste(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool scale(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool rescale(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool rotate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool rotate90(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool mirror(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool convertToMono(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setRGB(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getRed(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getGreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getBlue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findFirstUnusedColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setMaskFromImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setMaskColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getOptionInt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool hasOption(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_STATIC_METHOD_MAP() - static JSBool canRead(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool cleanUpHandlers(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool removeHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findHandlerMime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertHandler(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSImage_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/image.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.cpp (nonexistent) @@ -1,144 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - icon.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: icon.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// icon.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "icon.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/icon - * gui - * - * An icon is a small rectangular bitmap usually used for denoting a minimized application. - * It differs from a wxBitmap in always having a mask associated with it for transparent drawing. - * On some platforms, icons and bitmaps are implemented identically, - * since there is no real distinction between a wxBitmap with a mask and an icon; - * and there is no specific icon format on some platforms - * (X-based applications usually standardize on XPMs for small bitmaps and icons). - * However, some platforms (such as Windows) make the distinction, so a separate class is provided. - * See @wxBitmap, wxFrame @wxFrame#icon property and @wxBitmapType - * - */ -WXJS_INIT_CLASS(Icon, "wxIcon", 0) - -WXJS_BEGIN_METHOD_MAP(Icon) - WXJS_METHOD("loadFile", loadFile, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * Filename - * - * - * The type of the Icon. Use the bitmap types. - * - * - * - * - * - * Constructs a new wxIcon object. The first constructor creates - * an icon without data. Use @wxIcon#loadFile to load an icon. - * - * - */ -wxIcon* Icon::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxIcon(); - - if ( JSVAL_IS_STRING(argv[0]) ) - { - if ( argc > 4 ) - argc = 4; - - int desiredWidth = -1; - int desiredHeight = -1; - - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], desiredHeight) ) - return NULL; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], desiredWidth) ) - return NULL; - // Fall through - default: - wxString name; - int type; - - if ( FromJS(cx, argv[1], type) ) - { - FromJS(cx, argv[0], name); - return new wxIcon(name, (wxBitmapType) type, desiredWidth, desiredHeight); - } - } - } - - return NULL; -} - -/*** - * - * - * - * The name of the file. - * - * - * The type of the Icon. - * - * - * - * Loads an icon from a file. - * - * - */ -JSBool Icon::loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxIcon *p = GetPrivate(cx, obj); - - wxString name; - int type; - FromJS(cx, argv[0], name); - if ( FromJS(cx, argv[1], type) ) - { - *rval = ToJS(cx, p->LoadFile(name, (wxBitmapType) type)); - return JS_TRUE; - } - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.h (nonexistent) @@ -1,40 +0,0 @@ -/* - * wxJavaScript - cmnconst.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: cmnconst.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCmnConst_H -#define _WXJSCmnConst_H - -///////////////////////////////////////////////////////////////////////////// -// Name: cmnconst.h -// Purpose: Defines constants for common controls (like wxListCtrl) -// Author: Franky Braem -// Modified by: -// Created: 30.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -void InitCommonConst(JSContext *cx, JSObject *obj); - -#endif //_WXJSCmnConst_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/cmnconst.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.h (nonexistent) @@ -1,78 +0,0 @@ -/* - * wxJavaScript - gridszr.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: gridszr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSGridSizer_H -#define _WXJSGridSizer_H - -///////////////////////////////////////////////////////////////////////////// -// Name: gridszr.h -// Purpose: GridSizer ports wxGridSizer to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 18.04.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - class Object; - - namespace gui - { - - class GridSizer : public wxGridSizer - , public ApiWrapper - , public Object - , public AttachedSizer - { - public: - /** - * Constructor - */ - GridSizer(JSContext *cx, JSObject *obj, int cols, int rows, int vgap, int hgap); - GridSizer(JSContext *cx, JSObject *obj, int cols, int vgap = 0, int hgap = 0); - - /** - * Destructor - */ - virtual ~GridSizer() - { - if ( IsAttached() ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } - } - - /** - * Callback for when a wxGridSizer object is created - */ - static GridSizer* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static void Destruct(JSContext *cx, GridSizer *p); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSGridSizer_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/gridszr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.cpp (nonexistent) @@ -1,295 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fontenum.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: fontenum.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// fontenum.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/jsutil.h" - -#include "fontenum.h" -#include "app.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/fontenum - * gui - * - * Use wxFontEnumerator to enumerate all available fonts. - * See @wxFont, @wxFontEncoding - *

- * The following example shows a dialog which contains a listbox with the names of all the available fonts. - *

- *   var dlg = new wxDialog(null,
- *                          -1,
- *                         "Font Enumerating example");
- *
- *   // Create a wxFontEnumerator
- *   var enumerator = new wxFontEnumerator();
- *   // Set a funtion to onFacename. To get all available fonts return true. 
- *   // No arguments need to be specified, because they are not used.
- *
- *   enumerator.onFacename = function()
- *   {
- *     return true;
- *   };
- *
- *   // Use enumerateFaceNames to start the enumeration.
- *   enumerator.enumerateFacenames();
- *
- *   // Now the property facenames contains all the font names.
- *   var listbox = new wxListBox(dlg, -1, wxDefaultPosition, wxDefaultSize, enumerator.facenames);
- *  
- *
- */ - -WXJS_INIT_CLASS(FontEnumerator, "wxFontEnumerator", 0) - -/*** - * - * - * Array of strings containing all encodings found by @wxFontEnumerator#enumerateEncodings. - * Returns undefined when this function is not called. - * - * - * Array of strings containing all facenames found by @wxFontEnumerator#enumerateFacenames. - * Returns undefined when this function is not called. - * - * - * A function which receives the encoding as argument. The encoding is added - * to @wxFontEnumerator#encodings when the function returns true. - * - * - * A function which receives the font and encoding as arguments. - * When the function returns true, the font is added to @wxFontEnumerator#facenames. - * When no function is set, all available fonts are added. - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(FontEnumerator) - WXJS_READONLY_STATIC_PROPERTY(P_FACENAMES, "facenames") - WXJS_READONLY_STATIC_PROPERTY(P_ENCODINGS, "encodings") -WXJS_END_PROPERTY_MAP() - -FontEnumerator::FontEnumerator(JSContext *cx, JSObject *obj) - : Object(obj, cx) -{ -} - -FontEnumerator::~FontEnumerator() -{ -} - -bool FontEnumerator::OnFacename(const wxString& faceName) -{ - JSObject *enumObj = GetObject(); - - jsval fval; - JSContext *cx = GetContext(); - if ( GetFunctionProperty(cx, GetObject(), "onFacename", &fval) == JS_TRUE ) - { - jsval rval; - jsval argv[] = { ToJS(cx, faceName) }; - JSBool result = JS_CallFunctionValue(cx, enumObj, fval, 1, argv, &rval); - if ( result == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - { - bool ret; - if ( ! FromJS(cx, rval, ret) - || ! ret ) - return false; - } - } - - return wxFontEnumerator::OnFacename(faceName); -} - -bool FontEnumerator::OnFontencoding(const wxString& faceName, const wxString &encoding) -{ - JSObject *enumObj = GetObject(); - JSContext *cx = GetContext(); - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onFontEncoding", &fval) == JS_TRUE ) - { - jsval rval; - jsval argv[] = { ToJS(cx, faceName) - , ToJS(cx, encoding) }; - JSBool result = JS_CallFunctionValue(cx, enumObj, fval, 2, argv, &rval); - if ( result == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - { - bool ret; - if ( ! FromJS(cx, rval, ret) - || ! ret ) - return false; - } - } - - return wxFontEnumerator::OnFontEncoding(faceName, encoding); -} - -bool FontEnumerator::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - switch (id) - { - case P_FACENAMES: - { - wxArrayString faceNames = wxFontEnumerator::GetFacenames(); - *vp = ( faceNames == NULL ) ? JSVAL_VOID : ToJS(cx, faceNames); - } - break; - case P_ENCODINGS: - { - wxArrayString encodings = wxFontEnumerator::GetEncodings(); - *vp = ( encodings == NULL ) ? JSVAL_VOID : ToJS(cx, encodings); - } - break; - } - return true; -} - -/*** - * - * - * - * Creates a wxFontEnumerator object. - * - * - */ -FontEnumerator* FontEnumerator::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new FontEnumerator(cx, obj); -} - -WXJS_BEGIN_METHOD_MAP(FontEnumerator) - WXJS_METHOD("enumerateFacenames", enumerateFacenames, 2) - WXJS_METHOD("enumerateEncodings", enumerateEncodings, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The encoding. - * - * - * Only report fonts with fixed width or not. - * - * - * - * This will call the function which is set to the @wxFontEnumerator#onFacename property - * for each font which supports the given encoding. When this function returns true for the - * the given font, it will be added to @wxFontEnumerator#facenames. - * When no function is specified, all fonts will be added to @wxFontEnumerator#facenames. - * See also @wxFontEncoding, @wxFontEnumerator#facenames, @wxFontEnumerator#onFacename - * - * - */ -JSBool FontEnumerator::enumerateFacenames(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - FontEnumerator *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data for wxFontEnumerator")); - - if ( argc == 0 ) - { - p->EnumerateFacenames(); - return JS_TRUE; - } - - int encoding; - if ( FromJS(cx, argv[0], encoding) ) - { - if ( argc > 1 ) - { - bool fixedWidth; - if ( FromJS(cx, argv[1], fixedWidth) ) - { - p->EnumerateFacenames((wxFontEncoding)encoding, fixedWidth); - return JS_TRUE; - } - } - else - { - p->EnumerateFacenames((wxFontEncoding)encoding); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * A font name. - * - * - * - * The function set on the @wxFontEnumerator#onFontEncoding is called for each - * encoding supported by the given font. - * When no function is set all encodings are reported. - * See @wxFontEnumerator#onFontEncoding, @wxFontEnumerator#encodings - * - * - */ -JSBool FontEnumerator::enumerateEncodings(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - FontEnumerator *p = GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data for wxFontEnumerator")); - - if ( argc == 0 ) - { - p->EnumerateEncodings(); - return JS_TRUE; - } - - wxString font; - FromJS(cx, argv[0], font); - p->EnumerateEncodings(font); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/fontenum.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.h (nonexistent) @@ -1,85 +0,0 @@ -/* - * wxJavaScript - textval.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: textval.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTextValidator_H -#define _WXJSTextValidator_H - -///////////////////////////////////////////////////////////////////////////// -// Name: .h -// Purpose: TextValidator ports wxTextValidator to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 27-12-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - - -namespace wxjs -{ - namespace gui - { - class TextValidator : public wxTextValidator - , public ApiWrapper - { - public: - - TextValidator(long style = wxFILTER_NONE, - const wxString &value = wxEmptyString); - - /** - * Callback for retrieving properties of wxTextValidator - */ - static bool GetProperty(wxTextValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxTextValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxTextValidator object is created - */ - static wxTextValidator* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_EXCLUDE_LIST - , P_INCLUDE_LIST - , P_STYLE - , P_VALUE - }; - - private: - wxString m_value; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTextValidator_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.cpp (nonexistent) @@ -1,668 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sizer.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: sizer.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// sizer.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "../control/window.h" - -#include "sizer.h" -#include "size.h" -#include "point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/sizer - * gui - * - * wxSizer is the prototype for all sizer objects : - * @wxBoxSizer, @wxFlexGridSizer, @wxGridSizer and @wxStaticBoxSizer. - * See also following wxWindow properties: @wxWindow#sizer, and @wxWindow#autoLayout. - *

- * The example will show a dialog box that asks the user to enter a name and a password. - * The labels, text controls and buttons are placed dynamically on the dialog using sizers. - *

- *    // The wxSizer example
- *    wxTheApp.onInit = init;
- *    wxTheApp.mainLoop();
- *   
- *    function init()
- *    {
- *      //Create a dialog box
- *
- *      var dlg = new wxDialog(null, -1, "wxSizer Example",
- *                             wxDefaultPosition, new wxSize(200, 150));
- *      // Create a wxBoxSizer for the dialog. 
- *      // The main direction of this sizer is vertical. 
- *      // This means that when an item is added to this sizer, it will be added below the previous item.
- *
- *      dlg.sizer = new wxBoxSizer(wxOrientation.VERTICAL);
- *  
- *      // Use a wxFlexGridSizer to layout the labels with their corresponding text controls.
- *      // The sizer is created with 2 rows and 2 columns. The first column is used for the label, 
- *      // while the second column is used for the text controls. The space between the rows and 
- *      // columns is set to 10.
- *
- *      var sizer1 = new wxFlexGridSizer(2, 2, 10, 10);
- *
- *      // Add the labels and text controls to sizer1. A label is centered vertically. 
- *      // A grid sizer is filled from left to right, top to bottom.
- *
- *      sizer1.add(new wxStaticText(dlg, -1, "Username"), 0, wxAlignment.CENTER_VERTICAL);
- *      sizer1.add(new wxTextCtrl(dlg, -1, "<user>"));
- *      sizer1.add(new wxStaticText(dlg, -1, "Password"), 0, wxAlignment.CENTER_VERTICAL);
- *      sizer1.add(new wxTextCtrl(dlg, -1, "<pwd>"));
- *
- *      // Add this sizer to the sizer of the dialog. The flag argument is 0 which means 
- *      // that this item is not allowed to grow in the main direction (which is vertically).
- *      // The item is centered. Above (wxDirection.TOP) and below (wxDirection.BOTTOM) the item, 
- *      // a border is created with a size of 10.
- *
- *      dlg.sizer.add(sizer1, 0, wxAlignment.CENTER | wxDirection.TOP | wxDirection.BOTTOM, 10);
- *
- *      // Create a new wxBoxSizer and assign it to sizer1. The main direction of this sizer 
- *      // is horizontally. This means that when an item is added it will be shown on the same row.
- *
- *      sizer1 = new wxBoxSizer(wxOrientation.HORIZONTAL);
- *
- *      // Add the Ok button to the sizer and make sure that it has a right border of size 10. 
- *      // This way there's a space between the ok button and the cancel button.
- *
- *      sizer1.add(new wxButton(dlg, wxId.OK, "Ok"), 0, wxDirection.RIGHT, 10);
- *
- *      // Add the Cancel button to the sizer.
- *
- *      sizer1.add(new wxButton(dlg, wxId.CANCEL, "Cancel"));
- *
- *      // Add the sizer to the sizer of the dialog. The item is centered.
- *
- *      dlg.sizer.add(sizer1, 0, wxAlignment.CENTER);
- *
- *      // Before showing the dialog, set the autoLayout property to true and call 
- *      // layout to layout the controls. When the dialog is resized, the controls
- *      // will be automaticcally resized.
- *
- *      dlg.autoLayout = true;
- *      dlg.layout();
- *      dlg.showModal();
- *      return false;
- *    }
- *  
- *
- */ -WXJS_INIT_CLASS(Sizer, "wxSizer", 0) - -/*** - * - * - * Get/Set the minimal size of the sizer. - * See @wxSizer#setMinSize - * - * - * Gets the position of the sizer. - * - * - * Gets the current size of the sizer. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Sizer) - WXJS_PROPERTY(P_MIN_SIZE, "minSize") - WXJS_READONLY_PROPERTY(P_POSITION, "position") - WXJS_READONLY_PROPERTY(P_SIZE, "size") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(Sizer) - WXJS_METHOD("add", add, 1) - WXJS_METHOD("layout", layout, 0) - WXJS_METHOD("prepend", prepend, 5) - WXJS_METHOD("remove", remove, 1) - WXJS_METHOD("setDimension", setDimension, 4) - WXJS_METHOD("setMinSize", setMinSize, 4) - WXJS_METHOD("setItemMinSize", setItemMinSize, 3) -WXJS_END_METHOD_MAP() - -bool Sizer::GetProperty(wxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_MIN_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetMinSize())); - break; - case P_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetSize())); - break; - case P_POSITION: - *vp = Point::CreateObject(cx, new wxPoint(p->GetPosition())); - break; - } - return true; -} - -bool Sizer::SetProperty(wxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_MIN_SIZE ) - { - wxSize *size = Size::GetPrivate(cx, *vp); - if ( size != NULL ) - { - p->SetMinSize(*size); - } - } - return true; -} - -/*** - * - * - * - * An object with a @wxWindow as its prototype. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * - * An object with a @wxWindow as its prototype. - * An object which prototype is wxSizer. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * - * The width of the spacer. - * - * - * The height of the spacer. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * Adds a window, another sizer or a spacer to the sizer. - * - * - */ -JSBool Sizer::add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int option = 0; - int flag = 0; - int border = 0; - - if ( Window::HasPrototype(cx, argv[0]) ) - { - wxWindow *win = Window::GetPrivate(cx, argv[0], false); - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 2: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - p->Add(win, option, flag, border); - } - else if (HasPrototype(cx, argv[0]) ) - { - wxSizer *sizer = GetPrivate(cx, argv[0], false); - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 2: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - p->Add(sizer, option, flag, border); - AttachedSizer *attachedSizer = dynamic_cast(sizer); - attachedSizer->SetAttached(true); - } - else - { - if ( argc < 2 ) - return JS_FALSE; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 4: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - - int height; - if ( ! FromJS(cx, argv[1], height) ) - return JS_FALSE; - - int width; - if ( ! FromJS(cx, argv[0], width) ) - return JS_FALSE; - - p->Add(width, height, option, flag, border); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Call this to force layout of the children. - * - * - */ -JSBool Sizer::layout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = (wxSizer *) GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Layout(); - - return JS_TRUE; -} - -/*** - * - * - * - * An object with a @wxWindow as its prototype. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * - * An object with a @wxWindow as its prototype. - * An object which prototype is wxSizer. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * - * The width of the spacer. - * - * - * The height of the spacer. - * - * - * Option is used together with @wxBoxSizer. 0 means that the size of the control - * is not allowed to change in the main orientation of the sizer. 1 means that the - * size of the control may grow or shrink in the main orientation of the sizer - * - * - * This parameter is used to set a number of flags. One main behaviour of a flag is to - * set a border around the window. Another behaviour is to determine the child window's - * behaviour when the size of the sizer changes. You can use the constants of @wxDirection - * and @wxStretch. - * - * - * The border width. Use this when you used a border(@wxDirection) flag. - * - * - * - * Prepends a window, another sizer or a spacer to the beginning of the list of items - * owned by this sizer. See @wxSizer#add. - * - * - */ -JSBool Sizer::prepend(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int option = 0; - int flag = 0; - int border = 0; - - if ( Window::HasPrototype(cx, argv[0]) ) - { - wxWindow *win = Window::GetPrivate(cx, argv[0], false); - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 2: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - p->Prepend(win, option, flag, border); - } - else if (HasPrototype(cx, argv[0]) ) - { - wxSizer *sizer = GetPrivate(cx, argv[0], false); - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 2: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - p->Prepend(sizer, option, flag, border); - } - else - { - if ( argc < 2 ) - return JS_FALSE; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[3], border) ) - return JS_FALSE; - case 4: - if ( ! FromJS(cx, argv[2], flag) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[1], option) ) - return JS_FALSE; - } - - int height; - if ( ! FromJS(cx, argv[1], height) ) - return JS_FALSE; - - int width; - if ( ! FromJS(cx, argv[0], width) ) - return JS_FALSE; - - p->Prepend(width, height, option, flag, border); - } - - return JS_TRUE; -} - -/*** - * - * - * - * The index of the item to remove from the sizer. - * - * - * - * - * Window to remove from the sizer. - * - * - * - * - * Sizer to remove from this sizer. - * - * - * - * Removes the item from the sizer. Call @wxSizer#layout to update the screen. - * - * - */ -JSBool Sizer::remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( Window::HasPrototype(cx, argv[0]) ) - { - wxWindow *win = Window::GetPrivate(cx, argv[0], false); - p->Remove(win); - } - else if ( HasPrototype(cx, argv[0]) ) - { - wxSizer *sizer = GetPrivate(cx, argv[0], false); - p->Remove(sizer); - } - else - { - int idx; - if ( ! FromJS(cx, argv[0], idx) ) - return JS_FALSE; - p->Remove(idx); - } - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * Call this to force the sizer to take the given dimension and thus force the items - * owned by the sizer to resize themselves according to the rules defined by the parameters - * in the @wxSizer#add and @wxSizer#prepend methods. - * - * - */ -JSBool Sizer::setDimension(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x; - int y; - int width; - int height; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) - && FromJS(cx, argv[2], width) - && FromJS(cx, argv[3], height) ) - { - p->SetDimension(x, y, width, height); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Sets the minimal size of the sizer. - * See @wxSizer#minSize. - * - * - */ -JSBool Sizer::setMinSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int width; - int height; - - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - p->SetMinSize(width, height); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Sets an item minimal size. - * - * - */ -JSBool Sizer::setItemMinSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSizer *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int width = 0; - int height = 0; - - if ( FromJS(cx, argv[1], width) - && FromJS(cx, argv[2], height) ) - { - if ( Window::HasPrototype(cx, argv[0]) ) - { - p->SetItemMinSize(Window::GetPrivate(cx, argv[0], false), width, height); - } - else if ( HasPrototype(cx, argv[1]) ) - { - p->SetItemMinSize(GetPrivate(cx, argv[0], false), width, height); - } - else - { - int idx; - if ( FromJS(cx, argv[0], idx) ) - p->SetItemMinSize(idx, width, height); - else - return JS_FALSE; - } - } - else - return JS_FALSE; - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/sizer.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/point.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/point.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/point.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - point.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: 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 - { - class Point : public ApiWrapper - { - public: - - static bool GetProperty(wxPoint *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static bool SetProperty(wxPoint *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxPoint *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - enum - { - P_X - , P_Y - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSPoint_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/point.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/pnghdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/pnghdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/pnghdlr.cpp (nonexistent) @@ -1,52 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - pnghdlr.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: pnghdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/pnghdlr - * gui - * - * Image handler for PNG images. - * - */ -WXJS_INIT_CLASS(PNGHandler, "wxPNGHandler", 0) - -ImageHandlerPrivate* PNGHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxPNGHandler(), true); -}; - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/pnghdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.h (nonexistent) @@ -1,54 +0,0 @@ -/* - * wxJavaScript - globfun.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: globfun.h 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * (c) 2001-2002 Franky Braem (S.A.W.) - * - * This file is part of wxJS. wxJS ports wxWindows to JavaScript - * - * File : wxJSGlobFun.h - * Desc. : This file defines all the global functions. - * Created : 24-05-2001 - * L. Update : - * - */ - -namespace wxjs -{ - namespace gui - { - /** - * Initializes the global functions - */ - bool InitFunctions(JSContext *cx, JSObject *global); - - /** - * Implements wxMessageBox - */ - JSBool MessageBox(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - JSBool InitAllImageHandlers(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - void DefineGlobals(JSContext *cx, JSObject *global); - }; // namespace gui -}; // namespace wxjs Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/globfun.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.h (nonexistent) @@ -1,66 +0,0 @@ -/* - * wxJavaScript - acctable.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: acctable.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSAcceleratorTable_H -#define _WXJSAcceleratorTable_H - -///////////////////////////////////////////////////////////////////////////// -// Name: acctable.h -// Purpose: AcceleratorTable ports wxAcceleratorTable to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 06.06.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class AcceleratorTable : public ApiWrapper - { - public: - - static bool GetProperty(wxAcceleratorTable *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxAcceleratorTable object is created - */ - static wxAcceleratorTable* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_OK - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSAcceleratorTable_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/acctable.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/pnmhdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/pnmhdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/pnmhdlr.cpp (nonexistent) @@ -1,54 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - pnmhdlr.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: pnmhdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/pnmhdlr - * gui - * - * Image handler for PNM images. - * Loading PNMs only works for ASCII or raw RGB images. When saving in PNM format, - * wxPNMHandler will always save as raw RGB. - * - */ -WXJS_INIT_CLASS(PNMHandler, "wxPNMHandler", 0) - -ImageHandlerPrivate* PNMHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxPNMHandler(), true); -}; - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/pnmhdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.cpp (nonexistent) @@ -1,304 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - imghand.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: imghand.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// imghand.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "../../io/jsstream.h" - -#include "image.h" -#include "imghand.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/imghand - * gui - * - * wxImageHandler is the prototype for several image handlers. - * See @wxImage, @wxBMPHandler, @wxGIFHandler, @wxICOHandler, - * @wxJPEGHandler, @wxPCXHandler, @wxPNGHandler, @wxPNMHandler, - * @wxTIFFHandler, @wxXPMHandler - * - */ -WXJS_INIT_CLASS(ImageHandler, "wxImageHandler", 0) - -/*** - * - * - * Get/Set the handler extension. - * - * - * Get/Set the handler MIME type. - * - * - * Get/Set the handler name. - * - * - * Get/Set the handler type. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ImageHandler) - WXJS_PROPERTY(P_NAME, "name") - WXJS_PROPERTY(P_EXTENSION, "extension") - WXJS_PROPERTY(P_TYPE, "type") - WXJS_PROPERTY(P_MIME_TYPE, "mimeType") -WXJS_END_PROPERTY_MAP() - -bool ImageHandler::GetProperty(ImageHandlerPrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxImageHandler *handler = p->GetHandler(); - switch (id) - { - case P_NAME: - *vp = ToJS(cx, handler->GetName()); - break; - case P_EXTENSION: - *vp = ToJS(cx, handler->GetExtension()); - break; - case P_TYPE: - *vp = ToJS(cx, handler->GetType()); - break; - case P_MIME_TYPE: - *vp = ToJS(cx, handler->GetMimeType()); - break; - } - return true; -} - -bool ImageHandler::SetProperty(ImageHandlerPrivate *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxImageHandler *handler = p->GetHandler(); - - switch (id) - { - case P_NAME: - { - wxString name; - FromJS(cx, *vp, name); - handler->SetName(name); - break; - } - case P_EXTENSION: - { - wxString ext; - FromJS(cx, *vp, ext); - handler->SetName(ext); - break; - } - case P_TYPE: - { - long type; - if ( FromJS(cx, *vp, type) ) - handler->SetType(type); - break; - } - case P_MIME_TYPE: - { - wxString mime; - FromJS(cx, *vp, mime); - handler->SetName(mime); - break; - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(ImageHandler) - WXJS_METHOD("getImageCount", getImageCount, 1) - WXJS_METHOD("loadFile", loadFile, 2) - WXJS_METHOD("saveFile", saveFile, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Opened input stream for reading image data. Currently, the stream must support seeking. - * - * - * - * If the image file contains more than one image and the image handler is capable - * of retrieving these individually, this function will return the number of available images. - * Most imagehandlers return 1. - * - * - */ -JSBool ImageHandler::getImageCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - ImageHandlerPrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - io::Stream *stream = NULL; - if ( wxjs::HasPrototype(cx, argv[0], "wxInputStream") ) - stream = (io::Stream *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(argv[0])); - else - return JS_FALSE; - - wxInputStream *in = dynamic_cast(stream->GetStream()); - if ( in == NULL ) - { - // TODO: error reporting - return JS_FALSE; - } - - *rval = ToJS(cx, p->GetHandler()->GetImageCount(*in)); - - return JS_FALSE; -} - -/*** - * - * - * - * The object that gets the loaded image. - * - * - * Opened input stream for reading image data. - * - * - * When true the image handler will report errors using wxLog - * - * - * The index of the image in the file (zero-based). - * - * - * - * Loads a image from a stream, putting the resulting data into image. - * If the image file contains more than one image and the image handler is capable - * of retrieving these individually, index indicates which image to read from the stream. - * Returns true when successful, false otherwise. - * - * - */ -JSBool ImageHandler::loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - ImageHandlerPrivate *p = ImageHandler::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx = 0; - bool verbose = true; - - switch(argc) - { - case 4: - if ( ! FromJS(cx, argv[3], idx) ) - return JS_FALSE; - case 3: - if ( ! FromJS(cx, argv[2], verbose) ) - return JS_FALSE; - default: - wxImage *img = Image::GetPrivate(cx, argv[0]); - if ( img == NULL ) - return JS_FALSE; - - io::Stream *stream = NULL; - if ( wxjs::HasPrototype(cx, argv[0], "wxInputStream") ) - stream = (io::Stream *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(argv[0])); - else - return JS_FALSE; - - wxInputStream *in = dynamic_cast(stream->GetStream()); - if ( in == NULL ) - { - // TODO: error reporting - return JS_FALSE; - } - - *rval = ToJS(cx, p->GetHandler()->LoadFile(img, *in, verbose, idx)); - } - - return JS_TRUE; -} - -/*** - * - * - * - * The object that gets the loaded image. - * - * - * Opened output stream for writing the image data. - * - * - * When true the image handler will report errors using wxLog - * - * - * - * Saves a image in the output stream. Returns true on success, false otherwise. - * - * - */ -JSBool ImageHandler::saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - ImageHandlerPrivate *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 3 ) - argc = 3; - - bool verbose = true; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], verbose) ) - return JS_FALSE; - default: - wxImage *img = Image::GetPrivate(cx, argv[0]); - if ( img == NULL ) - return JS_FALSE; - - io::Stream *stream = NULL; - if ( wxjs::HasPrototype(cx, argv[0], "wxOutputStream") ) - stream = (io::Stream *) JS_GetPrivate(cx, JSVAL_TO_OBJECT(argv[0])); - else - return JS_FALSE; - - wxOutputStream *out = dynamic_cast(stream->GetStream()); - if ( out == NULL ) - { - // TODO: error reporting - return JS_FALSE; - } - - *rval = ToJS(cx, p->GetHandler()->SaveFile(img, *out, verbose)); - } - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/imghand.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.h (nonexistent) @@ -1,70 +0,0 @@ -/* - * wxJavaScript - colour.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: colour.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSColour_H -#define _WXJSColour_H - -///////////////////////////////////////////////////////////////////////////// -// Name: colour.h -// Purpose: Ports wxColour to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 04.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - - -namespace wxjs -{ - namespace gui - { - class Colour : public ApiWrapper - { - public: - - static bool GetProperty(wxColour *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static wxColour *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - enum - { - P_RED - , P_GREEN - , P_BLUE - , P_OK - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static JSBool set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - - void DefineGlobalColours(JSContext *cx, JSObject *obj); - void DefineGlobalColour(JSContext *cx, JSObject *obj, - const char *name, const wxColour *colour); - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSColour_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/colour.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.h (nonexistent) @@ -1,79 +0,0 @@ -/* - * wxJavaScript - stsizer.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: stsizer.h 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * (c) 2001-2002 Franky Braem (S.A.W.) - * - * This file is part of wxJS. wxJS ports wxWindows to JavaScript - * - */ - -#ifndef _wxJSStaticBoxSizer_H -#define _wxJSStaticBoxSizer_H - -namespace wxjs -{ - class Object; - - namespace gui - { - class StaticBoxSizer : public wxStaticBoxSizer - , public ApiWrapper - , public Object - , public AttachedSizer - { - public: - /** - * Constructor - */ - StaticBoxSizer(JSContext *cx, JSObject *obj, wxStaticBox *box, int orient); - - /** - * Destructor - */ - virtual ~StaticBoxSizer() - { - if ( IsAttached() ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } - } - - static StaticBoxSizer* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, StaticBoxSizer *p); - - static bool GetProperty(wxStaticBoxSizer *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_STATIC_BOX - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_wxJSStaticBoxSizer_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/stsizer.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.h (nonexistent) @@ -1,90 +0,0 @@ -/* - * wxJavaScript - imagelst.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: imagelst.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSImageList_H -#define _WXJSImageList_H - -///////////////////////////////////////////////////////////////////////////// -// Name: imagelst.h -// Purpose: ImageList ports wxImageList to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 06-10-2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class ImageList : public wxImageList - , public ApiWrapper - , public Object - { - public: - - ImageList(JSContext *cx, JSObject *obj); - - virtual ~ImageList() - { - } - - /** - * Callback for retrieving properties of wxImageList - */ - static bool GetProperty(wxImageList *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxImageList object is created - */ - static wxImageList* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_IMAGE_COUNT - }; - - static JSBool add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool draw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool removeAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSImageList_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/imagelst.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.cpp (nonexistent) @@ -1,269 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - genval.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: genval.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// validator.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/jsutil.h" - -#include "../control/window.h" - -#include "genval.h" -#include "app.h" - -using namespace wxjs; -using namespace wxjs::gui; - -IMPLEMENT_CLASS(GenericValidator, wxGenericValidator) - -/*** - * misc/genval - * gui - * - * wxGenericValidator performs data transfer (but not validation or filtering) - * for the following basic controls: @wxButton, @wxCheckBox, @wxListBox, - * @wxStaticText, @wxRadioButton, @wxRadioBox, @wxChoice, @wxComboBox, - * @wxGauge, @wxSlider, @wxScrollBar, @wxSpinButton, @wxTextCtrl, - * @wxCheckListBox. - *

- * There's a difference between the wxWidgets implementation and the wxJS implementation: - * wxWidgets automatically transfer the data to the given pointer variable when validation - * succeeds. In JavaScript this is not possible. wxJS solves this with the - * @wxGenericValidator#value property. This property returns the value of the control. - * The type of this value is the same as the type of the argument of the constructor. - *

- * The following example shows how to use this class: - *

- *   var user = "Demo";
- *   var pwd = "";
- *
- *   function Application()
- *   {
- *      var dlg = new wxDialog(null, -1, "wxValidator Example",
- *                            wxDefaultPosition, new wxSize(200, 150));
- *
- *      var userText = new wxTextCtrl(dlg, -1);
- *      var pwdText = new wxTextCtrl(dlg, -1);
- *      var okButton = new wxButton(dlg, wxId.OK, "Ok");
- *      var cancelButton = new wxButton(dlg, wxId.CANCEL, "Cancel");
- *
- *      dlg.sizer = new wxFlexGridSizer(4, 2, 10, 10);
- *      dlg.sizer.add(new wxStaticText(dlg, -1, "Username"));
- *      dlg.sizer.add(userText);
- *      dlg.sizer.add(new wxStaticText(dlg, -1, "Password"));
- *      dlg.sizer.add(pwdText);
- *      dlg.sizer.add(okButton);
- *      dlg.sizer.add(cancelButton);
- *
- *      // Create validator
- *      var validator = new wxGenericValidator(user);
- *
- *      validator.validate = function()
- *      {
- *        if ( this.window.value.length == 0 )
- *        {
- *          wxMessageBox("Please give a username");
- *          return false;
- *      }
- *      return true;
- *   }
- *   userText.validator = validator; 
- *
- *   dlg.autoLayout = true;
- *   dlg.layout();
- *   dlg.showModal();
- * 
- *   user = validator.value;
- *
- *   return false;
- *  }
- *
- *  wxTheApp.onInit = Application;
- *  wxTheApp.mainLoop();
- *  
- *
- */ -GenericValidator::GenericValidator(JSContext *cx, JSObject *obj, bool val) : m_boolValue(val) - , wxGenericValidator(&m_boolValue) - , Object(obj, cx) -{ -} - -GenericValidator::GenericValidator(JSContext *cx, JSObject *obj, int val) : m_intValue(val) - , wxGenericValidator(&m_intValue) - , Object(obj, cx) -{ -} - -GenericValidator::GenericValidator(JSContext *cx, JSObject *obj, wxString val) : m_stringValue(val) - , wxGenericValidator(&m_stringValue) - , Object(obj, cx) -{ -} - -GenericValidator::GenericValidator(JSContext *cx, JSObject *obj, wxArrayInt val) : m_arrayIntValue(val) - , wxGenericValidator(&m_arrayIntValue) - , Object(obj, cx) -{ -} - -GenericValidator::GenericValidator(const GenericValidator ©) : wxGenericValidator(copy), Object(copy) -{ -// SetObject(copy.GetObject()); -} - -wxObject* GenericValidator::Clone() const -{ - return new GenericValidator(*this); -} - -bool GenericValidator::Validate(wxWindow *parent) -{ - JSContext *cx = GetContext(); - wxASSERT_MSG(cx != NULL, wxT("No application object available")); - - Object *winParentObj = dynamic_cast(parent); - - Object *winObj = dynamic_cast(GetWindow()); - if ( winObj == (Object*) NULL ) - return false; - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "validate", &fval) == JS_TRUE ) - { - jsval argv[] = - { - winParentObj == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(winParentObj->GetObject()) - }; - - jsval rval; - JSBool result = JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval); - if ( result == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - return false; - } - else - return JSVAL_IS_BOOLEAN(rval) ? JSVAL_TO_BOOLEAN(rval) == JS_TRUE : false; - } - - return false; -} - -WXJS_INIT_CLASS(GenericValidator, "wxGenericValidator", 1) - -/*** - * - * - * Gets the value. The same type as the argument of the @wxGenericValidator#ctor. - * - * - * Assign a function to this property that checks the content of the associated window. The function - * can have one argument: the parent of the associated window. This function should return false - * when the content is invalid, true when it is valid. To get the associated window, - * use this.window. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(GenericValidator) - WXJS_READONLY_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -bool GenericValidator::GetProperty(wxGenericValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - GenericValidator *val = dynamic_cast(p); - - if ( val != NULL - && id == P_VALUE ) - { - if ( val->m_pBool != NULL ) - { - *vp = ToJS(cx, val->m_boolValue); - } - else if ( val->m_pInt != NULL ) - { - *vp = ToJS(cx, val->m_intValue); - } - else if ( val->m_pString != NULL ) - { - *vp = ToJS(cx, val->m_stringValue); - } - else if ( val->m_pArrayInt != NULL ) - { - // TODO - } - else - *vp = JSVAL_VOID; - } - return true; -} - -/*** - * - * - * - * This value is used to transfer to the control. - * The type of value is important. - *
  • Boolean: used for @wxCheckBox and @wxRadioBox.
  • - *
  • String: used for @wxButton, @wxComboBox, @wxStaticText and @wxTextCtrl.
  • - *
  • Integer: used for @wxGauge, @wxScrollBar, @wxRadioBox, @wxSpinButton and @wxChoice.
  • - *
  • Array of Integers: used for @wxListBox and @wxCheckListBox.
  • - *
- *
- *
- * - * Constructs a new wxGenericValidator object - * - *
- */ -GenericValidator *GenericValidator::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( JSVAL_IS_BOOLEAN(argv[0]) ) - { - bool value; - FromJS(cx, argv[0], value); - return new GenericValidator(cx, obj, value); - } - else if ( JSVAL_IS_INT(argv[0]) ) - { - int value; - FromJS(cx, argv[0], value); - return new GenericValidator(cx, obj, value); - } - - // Default: assume a string value - wxString value; - FromJS(cx, argv[0], value); - return new GenericValidator(cx, obj, value); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/genval.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/gifhdlr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/gifhdlr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/gifhdlr.cpp (nonexistent) @@ -1,54 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - gifhdlr.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: gifhdlr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/jsutil.h" - -#include "imghand.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/gifhdlr - * gui - * - * Image handler for PNG images. - * Image handler for GIF images. Due to legal issues, writing a gif image is not available. - * - */ -WXJS_INIT_CLASS(GIFHandler, "wxGIFHandler", 0) - -ImageHandlerPrivate* GIFHandler::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new ImageHandlerPrivate(new wxGIFHandler(), true); -}; - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/gifhdlr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - bitmap.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: bitmap.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSBitmap_H -#define _WXJSBitmap_H - -///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.h -// Purpose: Ports wxBitmap to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 09.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -// Since: version 0.4 -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Bitmap : public ApiWrapper - { - public: - - static bool GetProperty(wxBitmap *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxBitmap *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static wxBitmap *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - enum - { - P_DEPTH - , P_HEIGHT - , P_OK - , P_WIDTH - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSBitmap_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/bitmap.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.h (nonexistent) @@ -1,58 +0,0 @@ -/* - * wxJavaScript - cshelp.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: cshelp.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSContextHelp_H -#define _WXJSContextHelp_H - -///////////////////////////////////////////////////////////////////////////// -// Name: cshelp.h -// Purpose: ContextHelp ports wxContextHelp to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 27.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -#include - -namespace wxjs -{ - namespace gui - { - class ContextHelp : public ApiWrapper - { - public: - /** - * Callback for when a wxContextHelp object is created - */ - static wxContextHelp* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_METHOD_MAP() - static JSBool beginContextHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool endContextHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSContextHelp_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/cshelp.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.cpp (nonexistent) @@ -1,194 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - textval.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: textval.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// TextValidator.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" - -#include "validate.h" -#include "textval.h" -using namespace wxjs; -using namespace wxjs::gui; - -TextValidator::TextValidator(long style, - const wxString &value) : wxTextValidator(style) -{ - m_value = value; - m_stringValue = &m_value; -} - -/*** - * misc/textval - * gui - * - * wxTextValidator validates text controls, providing a variety of filtering behaviours. - * The following example shows a dialog with a textfield. It's only allowed to enter numeric - * characters. The textfield is initialised using the validator. - *

- *   function init()
- *   {
- *     var dlg = new wxDialog(null, -1);
- *     var txtField = new wxTextCtrl(dlg, -1);
- *
- *     txtField.validator = new wxTextValidator(wxFilter.NUMERIC, "10");
- *
- *     dlg.fit();
- *     dlg.showModal();
- *
- *     wxMessageBox("You have entered: " + txtField.value);
- *
- *     return false;
- *   }
- *
- *   wxTheApp.onInit = init;
- *   wxTheApp.mainLoop();
- *  
- *
- */ -WXJS_INIT_CLASS(TextValidator, "wxTextValidator", 0) - -/*** - * - * - * Get/Set an array of invalid values. - * - * - * Get/Set an array of valid values. - * - * - * Get/Set the filter style. See @wxFilter - * - * - * Get the value entered in the textfield. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextValidator) - WXJS_PROPERTY(P_EXCLUDE_LIST, "excludes") - WXJS_PROPERTY(P_INCLUDE_LIST, "includes") - WXJS_PROPERTY(P_STYLE, "style") - WXJS_READONLY_PROPERTY(P_STYLE, "value") -WXJS_END_PROPERTY_MAP() - -bool TextValidator::GetProperty(wxTextValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_EXCLUDE_LIST: - *vp = ToJS(cx, p->GetExcludes()); - break; - case P_INCLUDE_LIST: - *vp = ToJS(cx, p->GetIncludes()); - break; - case P_STYLE: - *vp = ToJS(cx, p->GetStyle()); - break; - case P_VALUE: - { - TextValidator *val = dynamic_cast(p); - if ( val ) - *vp = ToJS(cx, val->m_value); - } - break; - } - return true; -} - -bool TextValidator::SetProperty(wxTextValidator *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_EXCLUDE_LIST: - { - wxArrayString list; - if ( FromJS(cx, *vp, list) ) - p->SetExcludes(list); - } - break; - case P_INCLUDE_LIST: - { - wxArrayString list; - if ( FromJS(cx, *vp, list) ) - p->SetIncludes(list); - } - break; - case P_STYLE: - { - long style; - if ( FromJS(cx, *vp, style) ) - p->SetStyle(style); - } - break; - } - return true; -} - -/*** - * - * - * - * - * Value used to initialize the textfield. - * - * - * - * Constructs a new wxTextValidator object. - * - * - */ -wxTextValidator* TextValidator::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - long filter = wxFILTER_NONE; - - wxTextValidator *p = NULL; - switch(argc) - { - case 0: - p = new TextValidator(); - break; - case 1: - if ( FromJS(cx, argv[0], filter) ) - { - p = new TextValidator(filter); - } - break; - case 2: - if ( FromJS(cx, argv[0], filter) ) - { - wxString value; - FromJS(cx, argv[1], value); - p = new TextValidator(filter, value); - } - break; - } - - return p; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/textval.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/point.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/point.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/point.cpp (nonexistent) @@ -1,129 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - point.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: point.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// point.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "point.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * misc/point - * gui - * - * A wxPoint is a useful data structure for graphics operations. - * It simply contains integer x and y members. - * - */ -WXJS_INIT_CLASS(Point, "wxPoint", 0) - -/*** - * - * - * The x-coordinate. - * - * - * The y-coordinate. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Point) - WXJS_PROPERTY(P_X, "x") - WXJS_PROPERTY(P_Y, "y") -WXJS_END_PROPERTY_MAP() - -bool Point::GetProperty(wxPoint *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_X: - *vp = ToJS(cx, p->x); - break; - case P_Y: - *vp = ToJS(cx, p->y); - break; - } - return true; -} - -bool Point::SetProperty(wxPoint *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_X: - FromJS(cx, *vp, p->x); - break; - case P_Y: - FromJS(cx, *vp, p->y); - break; - } - return true; -} - -/*** - * - * - * - * The X-coordinate - * - * - * The Y-coordinate. - * - * - * - * Creates a new wxPoint. When no arguments are given then wxPoint gets the same value - * as wxDefaultPosition. - * - * - */ -wxPoint* Point::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - { - return new wxPoint(); - } - else - { - int x = 0; - int y = 0; - if ( argc > 0 ) - { - FromJS(cx, argv[0], x); - } - - if ( argc > 1 ) - { - FromJS(cx, argv[1], y); - } - return new wxPoint(x, y); - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/point.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.h (nonexistent) @@ -1,58 +0,0 @@ -/* - * wxJavaScript - icon.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: icon.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSIcon_H -#define _WXJSIcon_H - -///////////////////////////////////////////////////////////////////////////// -// Name: icon.h -// Purpose: Icon ports wxIcon to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 09.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Icon : public ApiWrapper - { - public: - - /** - * Callback for when a wxIcon object is created - */ - static wxIcon* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_METHOD_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSIcon_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/misc/icon.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/item.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/item.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/item.h (nonexistent) @@ -1,52 +0,0 @@ -/* - * wxJavaScript - item.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: item.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSControlItem_H -#define _WXJSControlItem_H - -namespace wxjs -{ - namespace gui - { - class ControlItem : public ApiWrapper - { - public: - - static bool GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool select(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_VALUE = WXJS_START_PROPERTY_ID - }; - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSControlItem_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/item.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.cpp (nonexistent) @@ -1,137 +0,0 @@ -#include "precompiled.h" - -// radioboxit.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "radiobox.h" -#include "radioboxit.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/radioboxit - * gui - * - * wxRadioBoxItem is a helper class for working with items of @wxRadioBox. - * There's no corresponding class in wxWidgets. - * See wxRadioBox @wxRadioBox#item property. - * - */ -WXJS_INIT_CLASS(RadioBoxItem, "wxRadioBoxItem", 0) - -/*** - * - * - * Enables/Disables the button. - * - * - * Returns true when the item is selected or sets the selection - * - * - * Hides or shows the item. - * - * - * Get/Set the label of the button. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(RadioBoxItem) - WXJS_PROPERTY(P_ENABLE, "enable") - WXJS_PROPERTY(P_STRING, "string") - WXJS_PROPERTY(P_SELECTED, "selected") - WXJS_PROPERTY(P_SHOW, "show") -WXJS_END_PROPERTY_MAP() - -bool RadioBoxItem::GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for RadioBoxItem")); - - wxRadioBox *radiobox = RadioBox::GetPrivate(cx, parent); - if ( radiobox == NULL ) - return false; - - // When id is greater then 0, then we have an array index. - if ( id >= 0 ) - { - if ( id < radiobox->GetCount() ) - { - // Set the item index and don't forget to return ourselves. - p->SetIndex(id); - *vp = OBJECT_TO_JSVAL(obj); - } - } - else - { - // A negative index means a defined property. - int idx = p->GetIndex(); - if ( idx < radiobox->GetCount() ) // To be sure - { - switch (id) - { - case P_STRING: - *vp = ToJS(cx, radiobox->wxControl::GetLabel()); - break; - case P_SELECTED: - *vp = ToJS(cx, radiobox->GetSelection() == idx); - break; - } - } - } - return true; -} - -bool RadioBoxItem::SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for RadioBoxItem")); - - wxRadioBox *radiobox = RadioBox::GetPrivate(cx, parent); - if ( radiobox == NULL ) - return false; - - int idx = p->GetIndex(); - if ( idx < radiobox->GetCount() ) // To be sure - { - switch (id) - { - case P_STRING: - { - wxString str; - FromJS(cx, *vp, str); - radiobox->SetString(idx, str); - break; - } - case P_SELECTED: - { - bool value; - if ( FromJS(cx, *vp, value) - && value ) - radiobox->SetSelection(idx); - break; - } - case P_ENABLE: - { - bool value; - if ( FromJS(cx, *vp, value) ) - radiobox->Enable(idx, value); - break; - } - case P_SHOW: - { - bool value; - if ( FromJS(cx, *vp, value) ) - radiobox->Show(idx, value); - break; - } - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menu.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menu.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menu.cpp (nonexistent) @@ -1,830 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - menu.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: menu.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// menu.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" - -#include "menu.h" -#include "menuitem.h" - -#include "../misc/app.h" - -#include "../event/jsevent.h" -#include "../event/evthand.h" -#include "../event/command.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Menu::Menu(JSContext *cx, JSObject *obj, const wxString& title, long style) - : wxMenu(title, style) - , Object(obj, cx) -{ -} - -Menu::Menu(JSContext *cx, JSObject *obj, long style) - : wxMenu(style) - , Object(obj, cx) -{ -} - -Menu::~Menu() -{ - // When the menu is attached, it's destroyed by wxWindows - // Setting the private data to NULL, will prevent an access-violation. - if ( IsAttached() ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } -} - -/*** - * control/menu - * gui - * - * A menu is a popup (or pull down) list of items, - * one of which may be selected before the menu goes away - * (clicking elsewhere dismisses the menu). Menus may - * be used to construct either menu bars or popup menus. - * See @wxMenuBar and @wxFrame#menuBar property. - * - */ -WXJS_INIT_CLASS(Menu, "wxMenu", 0) - -/*** - * - * - * An array containing the function callbacks. A function will be called when a menu item is selected. - * Use @wxMenuItem#id id as index of the array. It is possible to change the function - * after the menu item is appended to the menu. - * - * - * Returns the number of menu items. - * - * - * Returns all the menu items. - * - * - * Get/Set the title of the menu - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Menu) - WXJS_READONLY_PROPERTY(P_MENU_ITEM_COUNT, "menuItemCount") - WXJS_READONLY_PROPERTY(P_MENU_ITEMS, "menuItems") - WXJS_PROPERTY(P_TITLE, "title") -WXJS_END_PROPERTY_MAP() - -bool Menu::GetProperty(wxMenu *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MENU_ITEM_COUNT: - { - *vp = ToJS(cx, p->GetMenuItemCount()); - break; - } - case P_MENU_ITEMS: - { - wxMenuItemList &list = p->GetMenuItems(); - jsint count = list.GetCount(); - - JSObject *objItems = JS_NewArrayObject(cx, count, NULL); - *vp = OBJECT_TO_JSVAL(objItems); - - jsint i = 0; - for (wxMenuItemList::Node *node = list.GetFirst(); node; node = node->GetNext() ) - { - jsval element = MenuItem::CreateObject(cx, node->GetData()); - JS_SetElement(cx, objItems, i++, &element); - } - - break; - } - case P_TITLE: - *vp = ToJS(cx, p->GetTitle()); - break; - } - return true; -} - -bool Menu::SetProperty(wxMenu *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_TITLE ) - { - wxString title; - FromJS(cx, *vp, title); - p->SetTitle(title); - } - - return true; -} - -/*** - * - * - * (wxGTK only) - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Menu) - // Style constants - WXJS_CONSTANT(wxMENU_, TEAROFF) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * A title for the popup menu - * - * - * A menu style - * - * - * - * - * A menu style - * - * - * - * Creates a new wxMenu object - * - * - */ -wxMenu* Menu::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - Menu *p = NULL; - - switch(argc) - { - case 2: - { - wxString title; - int style; - - FromJS(cx, argv[0], title); - if ( FromJS(cx, argv[1], style) ) - p = new Menu(cx, obj, title, style); - break; - } - case 1: - if ( JSVAL_IS_INT(argv[0]) ) - { - int style = 0; - if ( FromJS(cx, argv[0], style) ) - p = new Menu(cx, obj, style); - } - else - { - wxString title; - FromJS(cx, argv[0], title); - p = new Menu(cx, obj, title); - } - break; - default: - p = new Menu(cx, obj); - } - - if ( p != NULL ) - { - JSObject *objActionArray = JS_NewArrayObject(cx, 0, NULL); - JS_DefineProperty(cx, obj, "actions", OBJECT_TO_JSVAL(objActionArray), - NULL, NULL, JSPROP_ENUMERATE |JSPROP_PERMANENT); - } - - return p; -} - -void Menu::Destruct(JSContext *cx, wxMenu *p) -{ - if ( p != NULL ) - { - delete p; - p = NULL; - } -} - -WXJS_BEGIN_METHOD_MAP(Menu) - WXJS_METHOD("append", append, 3) - WXJS_METHOD("appendSeparator", append_separator, 0) - WXJS_METHOD("deleteItem", delete_item, 1) - WXJS_METHOD("destroy", destroy, 0) - WXJS_METHOD("findItem", find_item, 1) - WXJS_METHOD("getHelpString", getHelpString, 1) - WXJS_METHOD("getLabel", getLabel, 1) - WXJS_METHOD("newColumn", new_column, 0) - WXJS_METHOD("check", check, 2) - WXJS_METHOD("enable", enable, 2) - WXJS_METHOD("getItem", getItem, 1) - WXJS_METHOD("insert", insert, 2) - WXJS_METHOD("isChecked", isChecked, 1) - WXJS_METHOD("isEnabled", isEnabled, 1) - WXJS_METHOD("remove", remove, 1) - WXJS_METHOD("setHelpString", setHelpString, 2) - WXJS_METHOD("setLabel", setLabel, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The id of the menu item. - * - * - * The name of the menu item. - * - * - * The function that is called when the menu item is selected. The argument to the - * function will be @wxCommandEvent. - * - * - * Message which is shown in the statusbar. - * - * - * Indicates if the menu item can be checked or not. - * - * - * - * Appends a new menu item to the menu. - * - * - */ -JSBool Menu::append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString help = wxEmptyString; - bool checkable = false; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], checkable) ) - break; - // Fall through - case 4: - FromJS(cx, argv[3], help); - // Fall through - default: - wxString name; - FromJS(cx, argv[1], name); - - int id = 0; - - if ( ! FromJS(cx, argv[0], id) ) - break; - - p->Append(id, name, help, checkable); - - jsval actions; - if ( JS_GetProperty(cx, obj, "actions", &actions) == JS_TRUE ) - { - JS_SetElement(cx, JSVAL_TO_OBJECT(actions), id, &argv[2]); - } - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item. - * - * - * Check (true) or uncheck (false) the item - * - * - * - * Checks or unchecks the menu item. - * - * - */ -JSBool Menu::check(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id = 0; - bool check = false; - - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], check) ) - { - p->Check(id, check); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item. - * - * - * Enables (true) or disables (false) the item - * - * - * - * Enables or disables the menu item. - * - * - */ -JSBool Menu::enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id = 0; - bool flag = false; - - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], flag) ) - { - p->Enable(id, flag); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item. - * - * - * - * - * A menu item. - * - * - * - * Deletes the menu item from the menu. If the item is a submenu, - * it will not be deleted. Use @wxMenu#destroy if you want to delete a submenu. - * - * - */ -JSBool Menu::delete_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - p->Delete(id); - return JS_TRUE; - } - else - { - wxMenuItem *item = MenuItem::GetPrivate(cx, argv[0]); - if ( item != NULL ) - { - p->Delete(item); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * The search string - * - * - * - * Searches the menu item with the given search string and - * returns its identifier. -1 is returned when the item is not found. - * Any special menu codes are stripped out of source and target strings before matching. - * - * - */ -JSBool Menu::find_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString search; - FromJS(cx, argv[0], search); - *rval = ToJS(cx, p->FindItem(search)); - - return JS_TRUE; -} - -/*** - * - * - * - * Adds a new column - * - * - */ -JSBool Menu::new_column(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Break(); - - return JS_TRUE; -} - -/*** - * - * - * - * Adds a separator - * - * - */ -JSBool Menu::append_separator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = Menu::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->AppendSeparator(); - - return JS_TRUE; -} - -/*** - * - * - * - * The id of the menu item - * - * - * - * Returns the helpstring of the menu item with the given id. - * See @wxMenu#setHelpString and @wxMenuItem#help property - * - * - */ -JSBool Menu::getHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetHelpString(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item - * - * - * - * Returns the label of the menu item with the given id. - * See @wxMenu#setLabel and @wxMenuItem#label property. - * - * - */ -JSBool Menu::getLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetLabel(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item - * - * - * - * Returns the @wxMenuItem object of the menu item with the given id. - * - * - */ -JSBool Menu::getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - wxMenuItem *item = p->FindItem(id); - *rval = ( item == NULL ) ? JSVAL_NULL : MenuItem::CreateObject(cx, item); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The id of the menu item - * - * - * - * - * - * - * Deletes the menu item from the menu. If the item is a submenu, it will be deleted. - * Use @wxMenu#remove if you want to keep the submenu (for example, to reuse it later). - * - * - */ -JSBool Menu::destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - p->Destroy(id); - return JS_TRUE; - } - else if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMenuItem *item = MenuItem::GetPrivate(cx, argv[0]); - if ( item != NULL ) - { - p->Destroy(item); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Inserts the given item before the position pos. - * Inserting the item at the position @wxMenu#menuItemCount - * is the same as appending it. - * - * - */ -JSBool Menu::insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( FromJS(cx, argv[0], pos) - && JSVAL_IS_OBJECT(argv[1]) ) - { - wxMenuItem *item = MenuItem::GetPrivate(cx, argv[1]); - if ( item != NULL ) - { - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns true when the menu item is checked. - * - * - */ -JSBool Menu::isChecked(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->IsChecked(idx)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns true when the menu item is enabled. - * - * - */ -JSBool Menu::isEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->IsEnabled(idx)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * An identifier of a menu item. - * - * - * - * - * - * - * Removes the menu item from the menu but doesn't delete the object. - * This allows to reuse the same item later by adding it back to the menu - * (especially useful with submenus). - * - * - */ -JSBool Menu::remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxMenuItem *item = NULL; - int id; - - if ( FromJS(cx, argv[0], id) ) - { - item = p->Remove(id); - } - else if ( JSVAL_IS_OBJECT(argv[0]) ) - { - wxMenuItem *removeItem = MenuItem::GetPrivate(cx, argv[1]); - if ( removeItem != NULL ) - item = p->Remove(removeItem); - } - else - { - return JS_FALSE; - } - - *rval = ( item == NULL ) ? JSVAL_VOID : MenuItem::CreateObject(cx, item); - return JS_TRUE; - -} - -/*** - * - * - * - * A menu item identifier. - * - * - * The help text - * - * - * - * Sets the help associated with a menu item. - * See @wxMenuItem#help property and @wxMenuBar#setHelpString method. - * - * - */ -JSBool Menu::setHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - wxString help; - - if ( FromJS(cx, argv[0], id) ) - { - FromJS(cx, argv[1], help); - p->SetHelpString(id, help); - } - - return JS_FALSE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * A new label - * - * - * - * Sets the label of a menu item. - * See @wxMenuItem#label property and @wxMenuBar#setLabel method - * - * - */ -JSBool Menu::setLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenu *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - wxString label; - - if ( FromJS(cx, argv[0], id) ) - { - FromJS(cx, argv[1], label); - p->SetLabel(id, label); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menu.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * wxJavaScript - dialog.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: dialog.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDialog_H -#define _WXJSDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: dialog.h -// Purpose: Dialog ports wxDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 28.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Dialog : public wxDialog - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - Dialog(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Dialog(); - - static bool GetProperty(wxDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static void Destruct(JSContext *cx, wxDialog *p); - - static JSBool end_modal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool show_modal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - enum - { - P_RETURN_CODE - , P_TITLE - , P_MODAL - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - DECLARE_EVENT_TABLE() - void OnClose(wxCloseEvent &event); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.cpp (nonexistent) @@ -1,112 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - treehit.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: treehit.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "treectrl.h" -#include "treeid.h" -#include "treeitem.h" -#include "treehit.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/treehit - * gui - * - * Helper class for returning information from wxTreeCtrl @wxTreeCtrl#hitTest. - * This class is specific for wxJavaScript. It doesn't exist in wxWindows. - * - */ -WXJS_INIT_CLASS(TreeHitTest, "wxTreeHitTest", 0) - -/*** - * - * - * Get the item. - * - * - * Get the flags. These flags give details about the position and the tree control item. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TreeHitTest) - WXJS_READONLY_PROPERTY(P_ITEM, "item") - WXJS_READONLY_PROPERTY(P_FLAGS, "flags") -WXJS_END_PROPERTY_MAP() - -bool TreeHitTest::GetProperty(wxTreeHitTest *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ITEM: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetItem())); - break; - case P_FLAGS: - *vp = ToJS(cx, p->GetFlags()); - break; - } - return true; -} - -/*** - * - * - * Above the client area. - * Below the client area. - * In the client area but below the last item. - * On the button associated with an item. - * On the bitmap associated with an item. - * In the indentation associated with an item. - * On the label (string) associated with an item. - * In the area to the right of an item. - * On the state icon for a tree view item that is in a user-defined state. - * To the left of the client area. - * To the right of the client area. - * (ONITEMICON | ONITEMLABEL) - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(TreeHitTest) - WXJS_CONSTANT(wxTREE_HITTEST_, ABOVE) - WXJS_CONSTANT(wxTREE_HITTEST_, BELOW) - WXJS_CONSTANT(wxTREE_HITTEST_, NOWHERE) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMBUTTON) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMICON) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMINDENT) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMLABEL) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMRIGHT) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMSTATEICON) - WXJS_CONSTANT(wxTREE_HITTEST_, TOLEFT) - WXJS_CONSTANT(wxTREE_HITTEST_, TORIGHT) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMUPPERPART) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEMLOWERPART) - WXJS_CONSTANT(wxTREE_HITTEST_, ONITEM) -WXJS_END_CONSTANT_MAP() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.cpp (nonexistent) @@ -1,135 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - coldlg.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: coldlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// coldlg.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" -#include "coldlg.h" -#include "coldata.h" -#include "window.h" - -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/coldlg - * gui - * - * The wxColourDialog presents a colour selector to the user. - * See also @wxColourData. The following sample shows this - * dialog: - *

- *    wxTheApp.onInit = function()
- *    {
- *      clrData = new wxColourData();
- *      // Set the selected colour
- *      clrData.colour = new wxColour(0, 0, 0);
- *
- *      // Set a custom colour
- *      clrData.customColour[0]  = wxRED;
- *    
- *      dlg = new wxColourDialog(null, clrData);
- *      dlg.title = "Select a colour";
- *      dlg.showModal();
- *
- *      // Return false to exit the mainloop
- *      return false;
- *    }
- *    wxTheApp.mainLoop();
- *  
- *
- */ -WXJS_INIT_CLASS(ColourDialog, "wxColourDialog", 1) - -/*** - * - * - * Gets the colour data. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ColourDialog) - WXJS_READONLY_PROPERTY(P_COLOUR_DATA, "colourData") -WXJS_END_PROPERTY_MAP() - -bool ColourDialog::GetProperty(wxColourDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_COLOUR_DATA ) - { - *vp = ColourData::CreateObject(cx, new wxColourData(p->GetColourData())); - } - return true; -} - -/*** - * - * - * - * The parent of wxColourDialog. - * - * - * The colour data. - * - * - * - * Constructs a new wxColourDialog object - * - * - */ -wxColourDialog* ColourDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - argc = 2; - - wxColourData *data = NULL; - if ( argc == 2 ) - { - data = ColourData::GetPrivate(cx, argv[1]); - if ( data == NULL ) - return NULL; - } - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - return new wxColourDialog(parent, data); -} - -void ColourDialog::Destruct(JSContext *cx, wxColourDialog *p) -{ - p->Destroy(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.h (nonexistent) @@ -1,91 +0,0 @@ -/* - * wxJavaScript - statbar.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: statbar.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSStatusBar_H -#define _WXJSStatusBar_H - -///////////////////////////////////////////////////////////////////////////// -// Name: statbar.h -// Purpose: StatusBar ports wxStatusBar to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 31-01-2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class StatusBar : public wxStatusBar - , public ApiWrapper - , public Object - { - public: - - StatusBar(JSContext *cx, JSObject *obj); - virtual ~StatusBar(); - - /** - * Callback for retrieving properties of wxStatusBar - */ - static bool GetProperty(wxStatusBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxStatusBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxStatusBar object is created - */ - static wxStatusBar* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - /** - * Callback for when a wxStatusBar object is destroyed - */ - static void Destruct(JSContext *cx, wxStatusBar *p); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - WXJS_DECLARE_METHOD_MAP() - static JSBool getFieldRect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setFieldsCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - /** - * Property Ids. - */ - enum - { - P_FIELDS_COUNT - , P_STATUS_WIDTHS - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSStatusBar_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.cpp (nonexistent) @@ -1,163 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - coldata.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: coldata.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// coldata.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../misc/colour.h" - -#include "coldata.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/colourdata - * gui - * - * This class holds a variety of information related to colour dialogs. - * See @wxColourDialog. - * - */ -WXJS_INIT_CLASS(ColourData, "wxColourData", 0) - -/*** - * - * - * Under Windows, determines whether the Windows colour dialog will display the full - * dialog with custom colour selection controls. Has no meaning under other platforms. - * - * - * Get/Set the current colour associated with the colour dialog. - * - * - * Get/Set the ith custom colour associated with the colour dialog. - * The index must be between 0 and 15. The element is a @wxColour. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ColourData) - WXJS_PROPERTY(P_CUSTOM_COLOUR, "customColour") - WXJS_PROPERTY(P_CHOOSE_FULL, "chooseFull") - WXJS_PROPERTY(P_COLOUR, "colour") -WXJS_END_PROPERTY_MAP() - -bool ColourData::GetProperty(wxColourData *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_CHOOSE_FULL: - *vp = ToJS(cx, p->GetChooseFull()); - break; - case P_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(p->GetColour())); - break; - case P_CUSTOM_COLOUR: - *vp = CustomColour::CreateObject(cx, new Index(0), obj); - break; - } - return true; -} - -bool ColourData::SetProperty(wxColourData* p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_CHOOSE_FULL: - { - bool full; - if ( FromJS(cx, *vp, full) ) - p->SetChooseFull(full); - break; - } - case P_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetColour(*colour); - break; - } - } - return true; -} - -/*** - * - * - * - * Constructs a new wxColourData object. - * The selected colour is black. And @wxColourData#chooseFull is true. - * - * - */ -wxColourData* ColourData::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new wxColourData(); -} - -WXJS_INIT_CLASS(CustomColour, "wxCustomColour", 0) - -bool CustomColour::GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id >= 0 ) - { - p->SetIndex(id); - - JSObject *objColourData = JS_GetParent(cx, obj); - wxASSERT_MSG(objColourData != NULL, wxT("wxCustomColour has no parent !")); - - wxColourData *colourData = ColourData::GetPrivate(cx, objColourData); - if ( colourData == NULL ) - return false; - - *vp = Colour::CreateObject(cx, new wxColour(colourData->GetCustomColour(id))); - } - return true; -} - -bool CustomColour::SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id >= 0 ) - { - JSObject *objColourData = JS_GetParent(cx, obj); - wxASSERT_MSG(objColourData != NULL, wxT("wxCustomColour has no parent !")); - - wxColourData *colourData = ColourData::GetPrivate(cx, objColourData); - if ( colourData == NULL ) - return false; - - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - colourData->SetCustomColour(id, *colour); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.cpp (nonexistent) @@ -1,700 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - textctrl.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: textctrl.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// textctrl.cpp - -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "textctrl.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -TextCtrl::TextCtrl(JSContext *cx, JSObject *obj) - : wxTextCtrl() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -TextCtrl::~TextCtrl() -{ - PopEventHandler(true); -} - -/*** - * control/textctrl - * gui - * - * A text control allows text to be displayed and edited. It may be single line or multi-line. - * @section wxTextCtrl_proto Prototype - * - */ -WXJS_INIT_CLASS(TextCtrl, "wxTextCtrl", 2) - -/*** - * - * - * Returns true if the selection can be copied to the clipboard. - * - * - * Returns true when the selection can be cut to the clipboard. - * - * - * Returns true when the contents of clipboard can be pasted into the text control. - * - * - * Returns true if there is a redo facility available and the last operation can be redone. - * - * - * Returns true if there is an undo facility available and the last operation can be undone. - * - * - * Get/Sets the insertion point - * - * - * Get the number of lines - * - * - * Get the start position of the selection - * - * - * Get the end position of the selection - * - * - * Get/Set the text - * - * - * Returns true when the text is changed - * - * - * Get the position of the last character in the text control - * - * - * Enables/Disables the text control - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextCtrl) - WXJS_READONLY_PROPERTY(P_CAN_COPY, "canCopy") - WXJS_READONLY_PROPERTY(P_CAN_CUT, "canCut") - WXJS_READONLY_PROPERTY(P_CAN_PASTE, "canPaste") - WXJS_READONLY_PROPERTY(P_CAN_REDO, "canRedo") - WXJS_READONLY_PROPERTY(P_CAN_UNDO, "canUndo") - WXJS_PROPERTY(P_INSERTION_POINT, "insertionPoint") - WXJS_READONLY_PROPERTY(P_NUMBER_OF_LINES, "numberOfLines") - WXJS_READONLY_PROPERTY(P_SELECTION_FROM, "selectionFrom") - WXJS_READONLY_PROPERTY(P_SELECTION_TO, "selectionTo") - WXJS_PROPERTY(P_VALUE, "value") - WXJS_READONLY_PROPERTY(P_MODIFIED, "modified") - WXJS_READONLY_PROPERTY(P_LAST_POSITION, "lastPosition") - WXJS_PROPERTY(P_EDITABLE, "editable") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(TextCtrl) - WXJS_METHOD("appendText", appendText, 1) - WXJS_METHOD("clear", clear, 0) - WXJS_METHOD("cut", cut, 0) - WXJS_METHOD("discardEdits", discardEdits, 0) - WXJS_METHOD("getLineLength", getLineLength, 1) - WXJS_METHOD("getLineText", getLineText, 1) - WXJS_METHOD("loadFile", loadFile, 1) - WXJS_METHOD("paste", paste, 0) - WXJS_METHOD("setSelection", setSelection, 2) - WXJS_METHOD("redo", redo, 0) - WXJS_METHOD("replace", replace, 3) - WXJS_METHOD("remove", remove, 2) - WXJS_METHOD("saveFile", saveFile, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(TextCtrl) - WXJS_CONSTANT(wxTE_, PROCESS_ENTER) - WXJS_CONSTANT(wxTE_, PROCESS_TAB) - WXJS_CONSTANT(wxTE_, MULTILINE) - WXJS_CONSTANT(wxTE_, PASSWORD) - WXJS_CONSTANT(wxTE_, READONLY) - WXJS_CONSTANT(wxTE_, RICH) -WXJS_END_CONSTANT_MAP() - -bool TextCtrl::GetProperty(wxTextCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_CAN_COPY: - *vp = ToJS(cx, p->CanCopy()); - break; - case P_CAN_PASTE: - *vp = ToJS(cx, p->CanPaste()); - break; - case P_CAN_CUT: - *vp = ToJS(cx, p->CanCut()); - break; - case P_CAN_REDO: - *vp = ToJS(cx, p->CanRedo()); - break; - case P_CAN_UNDO: - *vp = ToJS(cx, p->CanUndo()); - break; - case P_INSERTION_POINT: - *vp = ToJS(cx, p->GetInsertionPoint()); - break; - case P_NUMBER_OF_LINES: - *vp = ToJS(cx, p->GetNumberOfLines()); - break; - case P_SELECTION_FROM: - { - long from = 0L; - long to = 0L; - p->GetSelection(&from, &to); - *vp = ToJS(cx, from); - break; - } - case P_SELECTION_TO: - { - long from = 0L; - long to = 0L; - p->GetSelection(&from, &to); - *vp = ToJS(cx, to); - break; - } - case P_VALUE: - *vp = ToJS(cx, p->GetValue()); - break; - case P_MODIFIED: - *vp = ToJS(cx, p->IsModified()); - break; - case P_LAST_POSITION: - *vp = ToJS(cx, p->GetLastPosition()); - break; - case P_EDITABLE: - { - // Need some testing !!!!!! - long style = p->GetWindowStyleFlag(); - *vp = ToJS(cx, (style & wxTE_READONLY) != wxTE_READONLY); - break; - } - } - return true; -} - -bool TextCtrl::SetProperty(wxTextCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_INSERTION_POINT: - { - int pos; - if ( FromJS(cx, *vp, pos) ) - p->SetInsertionPoint(pos); - break; - } - case P_VALUE: - { - wxString value; - FromJS(cx, *vp, value); - p->SetValue(value); - break; - } - case P_EDITABLE: - { - bool editable; - if ( FromJS(cx, *vp, editable) ) - { - p->SetEditable(editable); - } - break; - } - } - return true; -} - -/*** - * - * - * - * The parent of the text control. - * - * - * The unique id - * - * - * The default text - * - * - * The position of the control. - * - * - * The size of the control. - * - * - * - * - * Constructs a new wxTextCtrl object - * - * - */ -wxTextCtrl* TextCtrl::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 7 ) - argc = 7; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - wxString text = wxEmptyString; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - case 3: - FromJS(cx, argv[2], text); - // Fall through - default: - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxTextCtrl *p = new TextCtrl(cx, obj); - p->Create(parent, id, text, *pt, *size, style, *val); - return p; - } - - return NULL; -} - -/*** - * - * - * - * Text to append - * - * - * - * Appends the text to the text of the control. - * - * - */ -JSBool TextCtrl::appendText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString text; - FromJS(cx, argv[0], text); - p->AppendText(text); - - return JS_TRUE; -} - -/*** - * - * - * - * Removes the text. - * - * - */ -JSBool TextCtrl::clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Clear(); - - return JS_TRUE; -} - -/*** - * - * - * - * Removes the selected text and copies it to the clipboard. - * - * - */ -JSBool TextCtrl::cut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Cut(); - - return JS_TRUE; -} - -/*** - * - * - * - * Resets the modified flag - * - * - */ -JSBool TextCtrl::discardEdits(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->DiscardEdits(); - - return JS_TRUE; -} - -/*** - * - * - * - * The line number - * - * - * - * Returns the length of the given line - * - * - */ -JSBool TextCtrl::getLineLength(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int line; - if ( FromJS(cx, argv[0], line) ) - { - *rval = ToJS(cx, p->GetLineLength(line)); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * The line number - * - * - * - * Returns the text of the given line - * - * - */ -JSBool TextCtrl::getLineText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int line; - if ( FromJS(cx, argv[0], line) ) - { - *rval = ToJS(cx, p->GetLineText(line)); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * When not specified, 0 is used. - * - * - * When not specified, the end position is used. - * - * - * - * Selects the text between From and To. - * - * - */ -JSBool TextCtrl::setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long from = 0L; - long to = p->GetLastPosition(); - - if (argc > 0) - { - FromJS(cx, argv[0], from); - if ( argc > 1 ) - { - FromJS(cx, argv[1], to); - } - } - p->SetSelection(from, to); - - return JS_TRUE; -} - -/*** - * - * - * - * The name of a file - * - * - * - * Loads a file into the text control - * - * - */ -JSBool TextCtrl::loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString filename; - FromJS(cx, argv[0], filename); - if ( wxFile::Exists(filename) ) - { - p->LoadFile(filename); - } - else - { - return JS_FALSE; - } - return JS_TRUE; -} - -/*** - * - * - * - * Pastes the content of the clipboard in the selection of the text control. - * - * - */ -JSBool TextCtrl::paste(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Paste(); - - return JS_TRUE; -} - -/*** - * - * - * - * Tries to redo the last operation - * - * - */ -JSBool TextCtrl::redo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Redo(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * Replaces the text between From and To with the new text - * - * - */ -JSBool TextCtrl::replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long from = 0L; - long to = 0L; - wxString text; - - if ( FromJS(cx, argv[0], from) - && FromJS(cx, argv[1], to) ) - { - FromJS(cx, argv[2], text); - p->Replace(from, to, text); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Removes the text between From and To. - * - * - */ -JSBool TextCtrl::remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long from = 0L; - long to = 0L; - if ( FromJS(cx, argv[0], from) - && FromJS(cx, argv[1], to) ) - { - p->Remove(from, to); - } - else - { - return JS_FALSE; - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Saves the content of the text control to the given file - * - * - */ -JSBool TextCtrl::saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTextCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString filename; - FromJS(cx, argv[0], filename); - *rval = ToJS(cx, p->SaveFile(filename)); - - return JS_TRUE; -} - -/*** - * - * - * Triggered when the text is changed. The argument of the function is @wxCommandEvent - * - * - * Triggered when the enter key is pressed in a single-line text control. - * The argument of the function is @wxCommandEvent - * - * - */ -void TextCtrl::OnText(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onText"); -} - -void TextCtrl::OnTextEnter(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onTextEnter"); -} - -BEGIN_EVENT_TABLE(TextCtrl, wxTextCtrl) - EVT_TEXT(-1, TextCtrl::OnText) - EVT_TEXT_ENTER(-1, TextCtrl::OnTextEnter) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.h (nonexistent) @@ -1,66 +0,0 @@ -/* - * wxJavaScript - dirdlg.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: dirdlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSDirDialog_H -#define _WXJSDirDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: dirdlg.h -// Purpose: DirDialog ports wxDirDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 30.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class DirDialog : public ApiWrapper - { - public: - - static bool GetProperty(wxDirDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxDirDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxDirDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxDirDialog *p); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_MESSAGE - , P_PATH - , P_STYLE - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSDirDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.h (nonexistent) @@ -1,69 +0,0 @@ -/* - * wxJavaScript - filedlg.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: filedlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFileDialog_H -#define _WXJSFileDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: filedlg.h -// Purpose: FileDialog ports wxFileDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 02.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class FileDialog : public ApiWrapper - { - public: - static bool GetProperty(wxFileDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxFileDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFileDialog *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxFileDialog *p); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_DIRECTORY - , P_FILENAME - , P_FILENAMES - , P_FILTER_INDEX - , P_MESSAGE - , P_PATH - , P_PATHS - , P_WILDCARD - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFileDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * wxJavaScript - scrollwnd.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: scrollwnd.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSScrolledWindow_H -#define _WXJSScrolledWindow_H - -#include - -namespace wxjs -{ - namespace gui - { - class ScrolledWindow : public wxScrolledWindow - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - ScrolledWindow(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~ScrolledWindow(); - - static bool GetProperty(wxScrolledWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxScrolledWindow* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - // Empty to avoid deleting. (It will be deleted by wxWidgets). - static void Destruct(JSContext* WXUNUSED(cx), wxScrolledWindow* WXUNUSED(p)) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_SCROLL_PIXELS_PER_UNIT = WXJS_START_PROPERTY_ID - , P_VIEW_START - , P_VIRTUAL_SIZE - , P_RETAINED - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool calcScrolledPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool calcUnscrolledPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enableScrolling(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getScrollPixelsPerUnit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool scroll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setScrollbars(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setScrollRate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setTargetWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; //namespace wxjs -#endif //_WXJSScrolledWindow_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * wxJavaScript - chklstbxchk.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: chklstbxchk.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_gui_chklstbxchk_h -#define _wxjs_gui_chklstbxchk_h - -namespace wxjs -{ - namespace gui - { - class CheckListBoxChecked : public ApiWrapper - { - public: - static bool GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _wxjs_gui_chklstbxchk_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.h (nonexistent) @@ -1,107 +0,0 @@ -/* - * wxJavaScript - calendar.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: calendar.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCalendarCtrl_H -#define _WXJSCalendarCtrl_H - -///////////////////////////////////////////////////////////////////////////// -// Name: calendar.h -// Purpose: CalendarCtrl ports wxCalendar to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 02.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class CalendarCtrl : public wxCalendarCtrl - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - CalendarCtrl(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~CalendarCtrl(); - - static bool GetProperty(wxCalendarCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxCalendarCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxCalendarCtrl* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxCalendarCtrl *p) - { - } - - static JSBool setDateRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setHeaderColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setHighlightColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setHolidayColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_DATE = WXJS_START_PROPERTY_ID - , P_LOWER_DATE_LIMIT - , P_UPPER_DATE_LIMIT - , P_ENABLE_HOLIDAY_DISPLAY - , P_ENABLE_YEAR_CHANGE - , P_ENABLE_MONTH_CHANGE - , P_HEADER_COLOUR_BG - , P_HEADER_COLOUR_FG - , P_HIGHLIGHT_COLOUR_BG - , P_HIGHLIGHT_COLOUR_FG - , P_HOLIDAY_COLOUR_BG - , P_HOLIDAY_COLOUR_FG - , P_ATTR - }; - - DECLARE_EVENT_TABLE() - - void OnCalendar(wxCalendarEvent &event); - void OnCalendarSelChanged(wxCalendarEvent &event); - void OnCalendarDay(wxCalendarEvent &event); - void OnCalendarMonth(wxCalendarEvent &event); - void OnCalendarYear(wxCalendarEvent &event); - void OnCalendarWeekDayClicked(wxCalendarEvent &event); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCalendarCtrl_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.h (nonexistent) @@ -1,100 +0,0 @@ -/* - * wxJavaScript - splitwin.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: splitwin.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSSplitterWindow_H -#define _WXJSSplitterWindow_H - -///////////////////////////////////////////////////////////////////////////// -// Name: splitwin.h -// Purpose: SplitterWindow ports wxSplitterWindow to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 22-01-2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include -namespace wxjs -{ - namespace gui - { - class SplitterWindow : public wxSplitterWindow - , public ApiWrapper - , public Object - { - public: - - SplitterWindow(JSContext *cx, JSObject *obj); - virtual ~SplitterWindow(); - - /** - * Callback for retrieving properties of wxSplitterWindow - */ - static bool GetProperty(wxSplitterWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxSplitterWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxSplitterWindow object is created - */ - static wxSplitterWindow* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - /** - * Callback for when a wxSplitterWindow object is destroyed - */ - static void Destruct(JSContext *cx, wxSplitterWindow *p); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - WXJS_DECLARE_METHOD_MAP() - static JSBool setSashPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool initialize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replaceWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool splitHorizontally(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool splitVertically(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool unsplit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - /** - * Property Ids. - */ - enum - { - P_MIN_PANE_SIZE - , P_SASH_POS - , P_WINDOW1 - , P_WINDOW2 - , P_SPLIT_MODE - , P_IS_SPLIT - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSSplitterWindow_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - finddata.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: finddata.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFindReplaceData_H -#define _WXJSFindReplaceData_H - -///////////////////////////////////////////////////////////////////////////// -// Name: finddata.h -// Purpose: FindReplaceData ports wxFindReplaceData to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 31.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class FindReplaceData : public ApiWrapper - { - public: - static bool GetProperty(wxFindReplaceData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxFindReplaceData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFindReplaceData* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Property Ids. - */ - enum - { - P_FINDSTRING - , P_REPLACESTRING - , P_FLAGS - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFindReplaceData_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/button.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/button.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/button.h (nonexistent) @@ -1,96 +0,0 @@ -/* - * wxJavaScript - button.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: button.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSButton_H -#define _WXJSButton_H - -///////////////////////////////////////////////////////////////////////////// -// Name: button.h -// Purpose: wxJSButton ports wxButton to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - - class Button : public wxButton - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - Button(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Button(); - - /** - * Callback for retrieving properties - */ - static bool GetProperty(wxButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for retrieving static properties - */ - static bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - - /** - * Callback for when a wxButton object is created - */ - static wxButton *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxButton *p) - { - } - - static JSBool setDefault(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_STATIC_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_LABEL - , P_DEFAULT_SIZE - }; - - void OnClicked(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSButton_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/button.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.cpp (nonexistent) @@ -1,106 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listhit.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: listhit.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#include -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "listhit.h" -#include "../misc/constant.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/listhit - * gui - * - * Helper class for returning information from @wxListCtrl#hitTest. - * This class is specific for wxJavaScript. It doesn't exist in wxWidgets. - * - */ -WXJS_INIT_CLASS(ListHitTest, "wxListHitTest", 0) - -/*** - * - * - * Get the item. - * - * - * Get the flags. These flags give details about the position and the list control item. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListHitTest) - WXJS_READONLY_PROPERTY(P_ITEM, "item") - WXJS_READONLY_PROPERTY(P_FLAGS, "flags") -WXJS_END_PROPERTY_MAP() - -bool ListHitTest::GetProperty(wxListHitTest *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ITEM: - *vp = ToJS(cx, p->GetItem()); - break; - case P_FLAGS: - *vp = ToJS(cx, p->GetFlags()); - break; - } - return true; -} - -/*** - * - * - * Above the client area. - * Below the client area. - * In the client area but below the last item. - * On the bitmap associated with an item. - * On the label (string) associated with an item. - * In the area to the right of an item. - * On the state icon for a tree view item that is in a user-defined state. - * To the left of the client area. - * To the right of the client area. - * (ONITEMICON | ONITEMLABEL | ONITEMSTATEICON) - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(ListHitTest) - WXJS_CONSTANT(wxLIST_HITTEST_, ABOVE) - WXJS_CONSTANT(wxLIST_HITTEST_, BELOW) - WXJS_CONSTANT(wxLIST_HITTEST_, NOWHERE) - WXJS_CONSTANT(wxLIST_HITTEST_, ONITEMICON) - WXJS_CONSTANT(wxLIST_HITTEST_, ONITEMLABEL) - WXJS_CONSTANT(wxLIST_HITTEST_, ONITEMRIGHT) - WXJS_CONSTANT(wxLIST_HITTEST_, ONITEMSTATEICON) - WXJS_CONSTANT(wxLIST_HITTEST_, TOLEFT) - WXJS_CONSTANT(wxLIST_HITTEST_, TORIGHT) - WXJS_CONSTANT(wxLIST_HITTEST_, ONITEM) -WXJS_END_CONSTANT_MAP() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/slider.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/slider.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/slider.cpp (nonexistent) @@ -1,603 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - slider.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: slider.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// slider.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.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" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Slider::Slider(JSContext *cx, JSObject *obj) - : wxSlider() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Slider::~Slider() -{ - PopEventHandler(true); -} - -/*** - * control/slider - * gui - * - * A slider is a control with a handle which can be pulled back and forth to change the value. - * In Windows versions below Windows 95, a scrollbar is used to simulate the slider. - * In Windows 95, the track bar control is used. - * See also @wxScrollEvent. - * - */ -WXJS_INIT_CLASS(Slider, "wxSlider", 5) - -/*** - * - * - * Get/Set the line size - * - * - * Get/Set the maximum value - * - * - * Get/Set the minimum value - * - * - * Get/Set the pagesize - * - * - * Get/Set the end selection point - * - * - * Get/Set the start selection point - * - * - * Get/Set the current value - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Slider) - WXJS_PROPERTY(P_LINESIZE, "lineSize") - WXJS_PROPERTY(P_MAX, "max") - WXJS_PROPERTY(P_MIN, "min") - WXJS_PROPERTY(P_PAGESIZE, "pageSize") - WXJS_PROPERTY(P_SEL_END, "selEnd") - WXJS_PROPERTY(P_SEL_START, "selStart") - WXJS_PROPERTY(P_THUMB_LENGTH, "thumbLength") - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(Slider) - WXJS_METHOD("clearSel", clearSel, 0) - WXJS_METHOD("setRange", setRange, 2) - WXJS_METHOD("setSelection", setSelection, 2) - WXJS_METHOD("setTickFreq", setTickFreq, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Displays the slider horizontally. - * - * - * Displays the slider vertically. - * - * - * Displays tick marks. - * - * - * Displays minimum, maximum and value labels. (NB: only displays the current value label under wxGTK) - * - * - * Displays ticks on the left, if a vertical slider. - * - * - * Displays ticks on the right, if a vertical slider. - * - * - * Displays ticks on the top, if a horizontal slider. - * - * - * Allows the user to select a range on the slider. Windows 95 only. - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Slider) - WXJS_CONSTANT(wxSL_, HORIZONTAL) - WXJS_CONSTANT(wxSL_, VERTICAL) - WXJS_CONSTANT(wxSL_, TICKS) - WXJS_CONSTANT(wxSL_, AUTOTICKS) - WXJS_CONSTANT(wxSL_, LABELS) - WXJS_CONSTANT(wxSL_, LEFT) - WXJS_CONSTANT(wxSL_, TOP) - WXJS_CONSTANT(wxSL_, RIGHT) - WXJS_CONSTANT(wxSL_, BOTTOM) - WXJS_CONSTANT(wxSL_, BOTH) - WXJS_CONSTANT(wxSL_, SELRANGE) -WXJS_END_CONSTANT_MAP() - -bool Slider::GetProperty(wxSlider *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_LINESIZE: - *vp = ToJS(cx, p->GetLineSize()); - break; - case P_MAX: - *vp = ToJS(cx, p->GetMax()); - break; - case P_MIN: - *vp = ToJS(cx, p->GetMin()); - break; - case P_PAGESIZE: - *vp = ToJS(cx, p->GetPageSize()); - break; - case P_SEL_END: - *vp = ToJS(cx, p->GetSelEnd()); - break; - case P_SEL_START: - *vp = ToJS(cx, p->GetSelStart()); - break; - case P_THUMB_LENGTH: - *vp = ToJS(cx ,p->GetThumbLength()); - break; - case P_VALUE: - *vp = ToJS(cx, p->GetValue()); - break; - } - return true; -} - -bool Slider::SetProperty(wxSlider *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_LINESIZE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetLineSize(value); - break; - } - case P_MAX: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetRange(p->GetMin(), value); - break; - } - case P_MIN: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetRange(value, p->GetMax()); - break; - } - case P_PAGESIZE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetPageSize(value); - break; - } - case P_SEL_END: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetSelection(p->GetSelStart(), value); - break; - } - case P_SEL_START: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetSelection(value, p->GetSelEnd()); - break; - } - case P_THUMB_LENGTH: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetThumbLength(value); - break; - } - case P_TICK: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetTick(value); - break; - } - case P_VALUE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetValue(value); - break; - } - } - return true; -} - -/*** - * - * - * - * The parent of wxSlider. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * Initial position of the slider - * - * - * Minimum slider position. - * - * - * Maximum slider position. - * - * - * The position of the Slider control on the given parent. - * - * - * The size of the Slider control. - * - * - * The wxSlider style. - * - * - * - * - * Constructs a new wxSlider object. - * - * - */ -wxSlider* Slider::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 9 ) - argc = 9; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 9: - val = Validator::GetPrivate(cx, argv[8]); - if ( val == NULL ) - break; - case 8: - if ( ! FromJS(cx, argv[7], style) ) - break; - // Fall through - case 7: - size = Size::GetPrivate(cx, argv[6]); - if ( size == NULL ) - break; - // Fall through - case 6: - pt = Point::GetPrivate(cx, argv[5]); - if ( pt == NULL ) - break; - // Fall through - default: - int max; - if ( ! FromJS(cx, argv[4], max) ) - break; - - int min; - if ( ! FromJS(cx, argv[3], min) ) - break; - - int value; - if ( ! FromJS(cx, argv[2], value) ) - break; - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxSlider *p = new Slider(cx, obj); - p->Create(parent, id, value, min, max, *pt, *size, style, *val); - return p; - } - - return NULL; -} - -/*** - * - * - * - * Clears the selection, for a slider with the SELRANGE style. - * - * - */ -JSBool Slider::clearSel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSlider *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->ClearSel(); - - return JS_TRUE; -} - -/*** - * - * - * - * Clears the ticks. - * - * - */ -JSBool Slider::clearTicks(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSlider *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->ClearTicks(); - - return JS_TRUE; -} - -/*** - * - * - * - * The minimum value - * - * - * The maximum value - * - * - * - * Sets the minimum and maximum slider values. - * - * - */ -JSBool Slider::setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSlider *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int mini; - int maxi; - - if ( FromJS(cx, argv[0], mini) - && FromJS(cx, argv[1], maxi) ) - { - p->SetRange(mini, maxi); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * The selection start position - * - * - * The selection end position - * - * - * - * Sets the selection - * - * - */ -JSBool Slider::setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSlider *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int start; - int end; - - if ( FromJS(cx, argv[0], start) - && FromJS(cx, argv[1], end) ) - { - p->SetSelection(start, end); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * Frequency - * - * - * Position - * - * - * - * Sets the tick mark frequency and position. - * - * - */ -JSBool Slider::setTickFreq(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSlider *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int n; - int pos; - - if ( FromJS(cx, argv[0], n) - && FromJS(cx, argv[1], pos) ) - { - p->SetTickFreq(n, pos); - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * Catch all scroll commands. The argument of the function is a @wxScrollEvent. - * - * - * Catch a command to put the scroll thumb at the maximum position. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a command to put the scroll thumb at the maximum position. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a line up command. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a line down command. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a page up command. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a page down command. - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a thumbtrack command (continuous movement of the scroll thumb). - * The argument of the function is a @wxScrollEvent. - * - * - * Catch a thumbtrack release command. - * The argument of the function is a @wxScrollEvent. - * - * - */ -void Slider::OnScroll(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScroll"); -} - -void Slider::OnScrollTop(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollTop"); -} - -void Slider::OnScrollBottom(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollBottom"); -} - -void Slider::OnScrollLineUp(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollLineUp"); -} - -void Slider::OnScrollLineDown(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollLineDown"); -} - -void Slider::OnScrollPageUp(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollPageUp"); -} - -void Slider::OnScrollPageDown(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollPageDown"); -} - -void Slider::OnScrollThumbTrack(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollThumbTrack"); -} - -void Slider::OnScrollThumbRelease(wxScrollEvent& event) -{ - PrivScrollEvent::Fire(this, event, "onScrollThumbRelease"); -} - -BEGIN_EVENT_TABLE(Slider, wxSlider) - EVT_SCROLL(Slider::OnScroll) - EVT_SCROLL_TOP(Slider::OnScrollTop) - EVT_SCROLL_BOTTOM(Slider::OnScrollBottom) - EVT_SCROLL_LINEUP(Slider::OnScrollLineUp) - EVT_SCROLL_LINEDOWN(Slider::OnScrollLineDown) - EVT_SCROLL_PAGEUP(Slider::OnScrollPageUp) - EVT_SCROLL_PAGEDOWN(Slider::OnScrollPageDown) - EVT_SCROLL_THUMBTRACK(Slider::OnScrollThumbTrack) - EVT_SCROLL_THUMBRELEASE(Slider::OnScrollThumbRelease) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/slider.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.h (nonexistent) @@ -1,65 +0,0 @@ -/* - * wxJavaScript - staticbx.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: staticbx.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSStaticBox_H -#define _WXJSStaticBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: staticbx.h -// Purpose: StaticBox ports wxStaticBox to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 07.05.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class StaticBox : public wxStaticBox - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - StaticBox(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~StaticBox(); - - static wxStaticBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxStaticBox *p) - { - } - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSStaticBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.h (nonexistent) @@ -1,109 +0,0 @@ -/* - * wxJavaScript - htmlwin.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: htmlwin.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSHtmlWindow_H -#define _WXJSHtmlWindow_H - -#include - -#include "../../common/evtconn.h" - -namespace wxjs -{ - namespace gui - { - class HtmlWindow : public wxHtmlWindow - , public ApiWrapper - , public EventConnector - , public Object - { - public: - /** - * Constructor - */ - HtmlWindow(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~HtmlWindow(); - - static void InitClass(JSContext* cx, JSObject* obj, JSObject* proto); - - static bool AddProperty(wxHtmlWindow *p, JSContext *cx, JSObject *obj, const wxString &prop, jsval *vp); - static bool GetProperty(wxHtmlWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxHtmlWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxHtmlWindow* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - // Empty to avoid deleting. (It will be deleted by wxWidgets). - static void Destruct(JSContext* WXUNUSED(cx), wxHtmlWindow* WXUNUSED(p)) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_OPENED_ANCHOR - , P_OPENED_PAGE - , P_OPENED_PAGE_TITLE - , P_RELATED_FRAME - , P_HISTORY_CAN_BACK - , P_HISTORY_CAN_FORWARD - , P_TEXT - , P_SELECTION_TEXT - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool appendToPage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool historyBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool historyForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool historyClear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadPage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setPage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setRelatedFrame(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setRelatedStatusBar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool selectAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool selectLine(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool selectWord(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setBorders(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setFonts(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_CONSTANT_MAP() - - // Events - void OnLinkClicked(wxHtmlLinkEvent &event); - - private: - static void ConnectLinkClicked(wxHtmlWindow *p); - static void InitConnectEventMap(); - }; - }; // namespace gui -}; //namespace wxjs -#endif //_WXJSHtmlWindow_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.h (nonexistent) @@ -1,80 +0,0 @@ -/* - * wxJavaScript - chklstbx.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: chklstbx.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCheckListBox_H -#define _WXJSCheckListBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: chklstbx.h -// Purpose: CheckListBox ports wxCheckListBox to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 24.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class CheckListBox : public wxCheckListBox - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - CheckListBox(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~CheckListBox(); - - static bool GetProperty(wxCheckListBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxCheckListBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxCheckListBox *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_CHECKED = WXJS_START_PROPERTY_ID - }; - - void OnCheckListBox(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSCheckListBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.cpp (nonexistent) @@ -1,243 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - gauge.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: gauge.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// gauge.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -#include "gauge.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Gauge::Gauge(JSContext *cx, JSObject *obj) - : Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Gauge::~Gauge() -{ - PopEventHandler(true); -} - -/*** - * control/gauge - * gui - * - * A gauge is a horizontal or vertical bar which shows a quantity (often time). - * - */ -WXJS_INIT_CLASS(Gauge, "wxGauge", 3) - -/*** - * - * - * Get/Set the width of the 3D bezel face. Windows only - * - * - * Get/Set the maximum position of the gauge. - * - * - * Get/Set the 3D shadow margin width. Windows only - * - * - * Get/Set the current value of the gauge. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Gauge) - WXJS_PROPERTY(P_BEZEL_FACE, "bezelFace") - WXJS_PROPERTY(P_RANGE, "range") - WXJS_PROPERTY(P_SHADOW_WIDTH, "shadowWidth") - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -bool Gauge::GetProperty(wxGauge *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BEZEL_FACE: - *vp = ToJS(cx, p->GetBezelFace()); - break; - case P_RANGE: - *vp = ToJS(cx, p->GetRange()); - break; - case P_SHADOW_WIDTH: - *vp = ToJS(cx, p->GetShadowWidth()); - break; - case P_VALUE: - *vp = ToJS(cx, p->GetValue()); - break; - } - return true; -} - -bool Gauge::SetProperty(wxGauge *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BEZEL_FACE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetBezelFace(value); - break; - } - case P_RANGE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetRange(value); - break; - } - case P_SHADOW_WIDTH: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetShadowWidth(value); - break; - } - case P_VALUE: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetValue(value); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Gauge) - WXJS_CONSTANT(wxGA_, HORIZONTAL) - WXJS_CONSTANT(wxGA_, VERTICAL) - WXJS_CONSTANT(wxGA_, PROGRESSBAR) - WXJS_CONSTANT(wxGA_, SMOOTH) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxGauge. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The maximum value of the gauge - * - * - * The position of the Gauge control on the given parent. - * - * - * The size of the Gauge control. - * - * - * The wxGauge style. - * - * - * - * - * Constructs a new wxGauge object. - * - * - */ -wxGauge *Gauge::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 7 ) - argc = 7; - - int style = 0; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - int range; - if ( ! FromJS(cx, argv[2], range) ) - break; - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxGauge *p = new Gauge(cx, obj); - p->Create(parent, id, range, *pt, *size, style, *val); - return p; - } - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.cpp (nonexistent) @@ -1,796 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - menubar.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: menubar.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// menubar.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "menubar.h" -#include "menu.h" - -#include "../misc/app.h" - -using namespace wxjs; -using namespace wxjs::gui; - -MenuBar::MenuBar(JSContext *cx, JSObject *obj) - : wxMenuBar() - , Object(obj, cx) -{ -} - -MenuBar::MenuBar(JSContext *cx, JSObject *obj, long style) - : wxMenuBar(style) - , Object(obj, cx) -{ -} - -MenuBar::~MenuBar() -{ - // A menubar attached to a frame is destroyed by wxWindows. - // The private data is set to null, so that an access violation is prevented - // in the js object finalizer. - if ( GetFrame() != NULL ) - { - JS_SetPrivate(GetContext(), GetObject(), NULL); - } -} - -/*** - * control/menubar - * gui - * - * A menu bar is a series of menus accessible from the top of a frame. - * See @wxFrame#menuBar property, @wxMenu and @wxMenuItem. - * - */ -WXJS_INIT_CLASS(MenuBar, "wxMenuBar", 0) - -/*** - * - * - * The number of menus - * - * - * Returns all the menus belonging to the menubar. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(MenuBar) - WXJS_READONLY_PROPERTY(P_MENUCOUNT, "menuCount") - WXJS_READONLY_PROPERTY(P_MENUS, "menus") -WXJS_END_PROPERTY_MAP() - -bool MenuBar::GetProperty(wxMenuBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_MENUCOUNT: - { - *vp = ToJS(cx, p->GetMenuCount()); - break; - } - case P_MENUS: - { - jsint count = p->GetMenuCount(); - - JSObject *objMenus = JS_NewArrayObject(cx, count, NULL); - *vp = OBJECT_TO_JSVAL(objMenus); - - for (jsint i = 0; i < count; i++ ) - { - Object *menuObject = dynamic_cast(p->GetMenu(i)); - if ( menuObject != NULL ) - { - jsval element = OBJECT_TO_JSVAL(menuObject->GetObject()); - JS_SetElement(cx, objMenus, i++, &element); - } - } - break; - } - } - return true; -} - -/*** - * - * - * (wxGTK only) - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(MenuBar) - // Style constants - WXJS_CONSTANT(wxMB_, DOCKABLE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * - * - * Constructs a new wxMenuBar object. - * - * - */ -wxMenuBar* MenuBar::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new MenuBar(cx, obj); - - int style = 0; - if ( argc == 1 - && ! FromJS(cx, argv[0], style) ) - return NULL; - - return new MenuBar(cx, obj, style); -} - -void MenuBar::Destruct(JSContext *cx, wxMenuBar *p) -{ - if ( p != NULL ) - { - delete p; - p = NULL; - } -} - -WXJS_BEGIN_METHOD_MAP(MenuBar) - WXJS_METHOD("append", append, 2) - WXJS_METHOD("check", check, 2) - WXJS_METHOD("enable", enable, 2) - WXJS_METHOD("enableTop", enableTop, 2) - WXJS_METHOD("getMenu", get_menu, 1) - WXJS_METHOD("insert", insert, 3) - WXJS_METHOD("findMenu", findMenu, 1) - WXJS_METHOD("findMenuItem", findMenuItem, 2) - WXJS_METHOD("getHelpString", getHelpString, 1) - WXJS_METHOD("getLabel", getLabel, 1) - WXJS_METHOD("getLabelTop", getLabelTop, 1) - WXJS_METHOD("refresh", refresh, 0) - WXJS_METHOD("remove", remove, 1) - WXJS_METHOD("replace", replace, 3) - WXJS_METHOD("setHelpString", setHelpString, 2) - WXJS_METHOD("setLabel", setLabel, 2) - WXJS_METHOD("setLabelTop", setLabelTop, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * Adds the menu to the menubar - * - * - */ -JSBool MenuBar::append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxMenu *menu = Menu::GetPrivate(cx, argv[0]); - if ( menu == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[1], name); - - *rval = ToJS(cx, p->Append(menu, name)); - return JS_TRUE; -} - -/*** - * - * - * - * The menu item identifier - * - * - * If true, checks the menu item, otherwise the item is unchecked - * - * - * - * Checks/Unchecks the menu with the given id. Only use this when the - * menu bar has been associated with a @wxFrame; otherwise, use the @wxMenu equivalent call. - * - * - */ -JSBool MenuBar::check(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - bool checked; - - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], checked) ) - { - p->Check(id, checked); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The menu item identifier - * - * - * If true, enables the menu item, otherwise the item is disabled - * - * - * - * Enables/Disables the menu with the given id. - * Only use this when the menu bar has been associated with a - * @wxFrame; otherwise, use the @wxMenu equivalent call. - * - * - */ -JSBool MenuBar::enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - bool sw; - - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], sw) ) - { - p->Enable(id, sw); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The position of the menu, starting from zero - * - * - * If true, enables the menu, otherwise the menu is disabled - * - * - * - * Enables or disables a whole menu. - * Only use this when the menu bar has been associated with a @wxFrame. - * - * - */ -JSBool MenuBar::enableTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - bool sw; - - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], sw) ) - { - p->EnableTop(id, sw); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The name of the menu - * - * - * - * Returns the index of the menu with the given name. -1 - * is returned when the menu is not found. - * - * - */ -JSBool MenuBar::findMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString name; - FromJS(cx, argv[0], name); - *rval = ToJS(cx, p->FindMenu(name)); - return JS_TRUE; -} - -/*** - * - * - * - * The name of the menu - * - * - * The name of the menuitem. - * - * - * - * Finds the menu item id for a menu name/menu item string pair. - * -1 is returned when nothing is found. - * - * - */ -JSBool MenuBar::findMenuItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString menuName; - wxString itemName; - - FromJS(cx, argv[0], menuName); - FromJS(cx, argv[1], itemName); - *rval = ToJS(cx, p->FindMenuItem(menuName, itemName)); - return JS_TRUE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns the helpstring associated with the menu item or an empty - * String when the menu item is not found. See @wxMenuItem#help property - * and @wxMenu#getHelpString method. - * - * - */ -JSBool MenuBar::getHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetHelpString(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns the label associated with the menu item or an empty - * String when the menu item is not found. - * Use only after the menubar has been associated with a @wxFrame. - * - * - */ -JSBool MenuBar::getLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetLabel(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Position of the menu on the menu bar, starting from zero. - * - * - * - * Returns the menu label, or the empty string if the menu was not found. - * Use only after the menubar has been associated with a @wxFrame. - * See also @wxMenu#title and @wxMenuBar#setLabelTop - * - * - */ -JSBool MenuBar::getLabelTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->GetLabelTop(idx)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Returns the @wxMenu at the given index (zero-indexed). - * - * - */ -JSBool MenuBar::get_menu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - wxMenu *menu = (wxMenu*) p->GetMenu(idx); - Object *menuObject = dynamic_cast(menu); - *rval = ( menuObject == NULL ) ? JSVAL_NULL : OBJECT_TO_JSVAL(menuObject->GetObject()); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The position of the new menu in the menu bar - * - * - * The menu to add. - * - * - * The title of the menu. - * - * - * - * Inserts the menu at the given position into the menu bar. - * Inserting menu at position 0 will insert it in the very beginning of it, - * inserting at position @wxMenuBar#menuCount is the same as calling - * @wxMenuBar#append. - * - * - */ -JSBool MenuBar::insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - - if ( ! FromJS(cx, argv[0], pos) ) - return JS_FALSE; - - wxMenu *menu = Menu::GetPrivate(cx, argv[1]); - if ( menu == NULL ) - return JS_FALSE; - - wxString title; - FromJS(cx, argv[2], title); - - p->Insert(pos, menu, title); - return JS_TRUE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns true when the menu item is checked. - * See @wxMenu#check method, @wxMenu#isChecked and @wxMenuItem#check property. - * - * - */ -JSBool MenuBar::isChecked(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->IsChecked(idx)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * - * Returns true when the menu item is enabled. - * @wxMenu#enable method, @wxMenuItem#enable property and @wxMenuBar#enable - * - * - */ -JSBool MenuBar::isEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->IsEnabled(idx)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Redraw the menu bar. - * - * - */ -JSBool MenuBar::refresh(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Refresh(); - - return JS_TRUE; -} - -/*** - * - * - * - * The index of the menu to remove (zero-indexed). - * - * - * - * Removes the menu from the menu bar and returns the @wxMenu object. - * This function may be used together with @wxMenuBar#insert to change - * the menubar dynamically. - * - * - */ -JSBool MenuBar::remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - wxMenu *menu = p->Remove(idx); - Object *menuObject = dynamic_cast(menu); - *rval = ( menu == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(menuObject->GetObject()); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The index of the menu to replace (zero-indexed). - * - * - * The new menu - * - * - * The title of the menu - * - * - * - * Replaces the menu at the given position with the new one. - * - * - */ -JSBool MenuBar::replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( ! FromJS(cx, argv[0], pos) ) - return JS_FALSE; - - wxMenu *menu = Menu::GetPrivate(cx, argv[1]); - if ( menu == NULL ) - return JS_FALSE; - - wxString title; - FromJS(cx, argv[2], title); - - wxMenu *oldMenu = p->Replace(pos, menu, title); - if ( oldMenu == NULL ) - { - *rval = JSVAL_VOID; - } - else - { - Object *menuObject = dynamic_cast(oldMenu); - *rval = ( menuObject == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(menuObject->GetObject()); - } - return JS_TRUE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * The help text - * - * - * - * Sets the help associated with a menu item. - * See @wxMenuItem#help property, @wxMenu#setHelpString method - * - * - */ -JSBool MenuBar::setHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - - if ( ! FromJS(cx, argv[0], id) ) - return JS_FALSE; - - wxString str; - FromJS(cx, argv[1], str); - p->SetHelpString(id, str); - return JS_TRUE; -} - -/*** - * - * - * - * A menu item identifier. - * - * - * A new label - * - * - * - * Sets the label of a menu item. - * Only use this when the menubar is associated with a @wxFrame - * @wxMenuItem#label property, @wxMenu#setLabel method - * - * - */ -JSBool MenuBar::setLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - - if ( ! FromJS(cx, argv[0], id) ) - return JS_FALSE; - - wxString str; - FromJS(cx, argv[1], str); - - p->SetLabel(id, str); - - return JS_TRUE; -} - -/*** - * - * - * - * A menu index (zero-indexed) - * - * - * A label for a menu - * - * - * - * Sets the label of a menu. - * Only use this when the menubar is associated with a @wxFrame - * See @wxMenu#title property - * - * - */ -JSBool MenuBar::setLabelTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - wxString str; - - if ( FromJS(cx, argv[0], idx) ) - { - FromJS(cx, argv[1], str); - p->SetLabelTop(idx, str); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.cpp (nonexistent) @@ -1,261 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - toplevel.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: toplevel.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// toplevel.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../misc/icon.h" -#include "toplevel.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/toplevel - * gui - * - * wxTopLevelWindow is the prototype class for @wxDialog and @wxFrame. - * - */ -WXJS_INIT_CLASS(TopLevelWindow, "wxTopLevelWindow", 0) - -/*** - * - * - * - * - * - * - * - * - * - * wxFullScreen is ported to wxJS as a separate class - * - * - * - */ -void TopLevelWindow::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxFullScreenMap[] = - { - WXJS_CONSTANT(wxFULLSCREEN_, NOMENUBAR) - WXJS_CONSTANT(wxFULLSCREEN_, NOTOOLBAR) - WXJS_CONSTANT(wxFULLSCREEN_, NOSTATUSBAR) - WXJS_CONSTANT(wxFULLSCREEN_, NOBORDER) - WXJS_CONSTANT(wxFULLSCREEN_, NOCAPTION) - WXJS_CONSTANT(wxFULLSCREEN_, ALL) - { 0 } - }; - JSObject *constObj = JS_DefineObject(cx, obj, "wxFullScreen", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxFullScreenMap); -} - -/*** - * - * - * Get/Set fullscreen mode - * - * - * Get/Set icon - * - * - * Not yet implemented - * - * - * Is the window active? - * - * - * - * Get/Set iconized mode - * - * - * Get/Set maximized mode - * - * - * Get/Set the title - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TopLevelWindow) - WXJS_PROPERTY(P_DEFAULT_ITEM, "defaultItem") - WXJS_PROPERTY(P_FULL_SCREEN, "fullScreen") - WXJS_PROPERTY(P_ICON, "icon") - WXJS_PROPERTY(P_ICONS, "icons") - WXJS_READONLY_PROPERTY(P_ACTIVE, "active") - WXJS_PROPERTY(P_ICONIZED, "iconized") - WXJS_PROPERTY(P_MAXIMIZED, "maximized") - WXJS_PROPERTY(P_TITLE, "title") -WXJS_END_PROPERTY_MAP() - -bool TopLevelWindow::GetProperty(wxTopLevelWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ICON: - *vp = Icon::CreateObject(cx, new wxIcon(p->GetIcon())); - break; - case P_FULL_SCREEN: - *vp = ToJS(cx, p->IsFullScreen()); - break; - case P_ICONS: - //TODO - break; - case P_ICONIZED: - *vp = ToJS(cx, p->IsIconized()); - break; - case P_MAXIMIZED: - *vp = ToJS(cx, p->IsMaximized()); - break; - case P_TITLE: - *vp = ToJS(cx, p->GetTitle()); - break; - case P_DEFAULT_ITEM: - Object *win = dynamic_cast(p->GetDefaultItem()); - *vp = OBJECT_TO_JSVAL(win->GetObject()); - break; - } - - return true; -} - -bool TopLevelWindow::SetProperty(wxTopLevelWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ICONS: - //TODO - break; - case P_ICON: - { - wxIcon *ico = Icon::GetPrivate(cx, *vp); - if ( ico ) - p->SetIcon(*ico); - break; - } - case P_ICONIZED: - { - bool iconize; - if ( FromJS(cx, *vp, iconize) ) - p->Iconize(iconize); - break; - } - case P_FULL_SCREEN: - { - bool full; - if ( FromJS(cx, *vp, full) ) - p->ShowFullScreen(full, wxFULLSCREEN_ALL); - break; - } - case P_MAXIMIZED: - { - bool maximize; - if ( FromJS(cx, *vp, maximize) ) - p->Maximize(maximize); - break; - } - case P_TITLE: - { - wxString title; - FromJS(cx, *vp, title); - p->SetTitle(title); - break; - } - case P_DEFAULT_ITEM: - wxWindow *win = Window::GetPrivate(cx, *vp); - if ( win != NULL ) - { - p->SetDefaultItem(win); - } - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(TopLevelWindow) - WXJS_METHOD("requestUserAttention", requestUserAttention, 0) - WXJS_METHOD("setLeftMenu", setLeftMenu, 0) - WXJS_METHOD("setRightMenu", setRightMenu, 0) -WXJS_END_METHOD_MAP() - -JSBool TopLevelWindow::requestUserAttention(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - //TODO - return JS_TRUE; -} - -JSBool TopLevelWindow::setLeftMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - //TODO - return JS_TRUE; -} - -JSBool TopLevelWindow::setRightMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - //TODO - return JS_TRUE; -} -/*** - * - * - * - * Show the frame in full screen when true, restore when false. - * - * - * Use one of @wxTopLevelWindow#wxFullScreen. - * - * - * - * Shows the frame in full screen or restores the frame. - * - * - */ -JSBool TopLevelWindow::showFullScreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTopLevelWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool show; - if ( ! FromJS(cx, argv[0], show) ) - return JS_FALSE; - - int style = wxFULLSCREEN_ALL; - if ( argc > 1 - && ! FromJS(cx, argv[1], style) ) - return JS_FALSE; - - *rval = ToJS(cx, p->ShowFullScreen(show, style)); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.cpp (nonexistent) @@ -1,116 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fontdlg.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: fontdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// fontdlg.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "fontdlg.h" -#include "fontdata.h" -#include "window.h" - -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/fontdlg - * gui - * - * The wxFontDialog presents a Font selector to the user. - * - */ -WXJS_INIT_CLASS(FontDialog, "wxFontDialog", 1) - -/*** - * - * - * Gets the Font data. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FontDialog) - WXJS_READONLY_PROPERTY(P_FONT_DATA, "FontData") -WXJS_END_PROPERTY_MAP() - -bool FontDialog::GetProperty(wxFontDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_FONT_DATA ) - *vp = FontData::CreateObject(cx, new wxFontData(p->GetFontData())); - return true; -} - -/*** - * - * - * - * The parent of wxFontDialog. - * - * - * The Font data. - * - * - * - * Constructs a new wxFontDialog object - * - * - */ -wxFontDialog* FontDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 2 ) - return NULL; - - wxFontData *data = NULL; - if ( argc == 2 ) - { - if ( (data = FontData::GetPrivate(cx, argv[1])) == NULL ) - return NULL; - } - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - -#if wxCHECK_VERSION(2,7,0) - wxFontDialog *p = new wxFontDialog(parent, *data); -#else - wxFontDialog *p = new wxFontDialog(parent, data); -#endif - return p; -} - -void FontDialog::Destruct(JSContext *cx, wxFontDialog *p) -{ - p->Destroy(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/item.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/item.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/item.cpp (nonexistent) @@ -1,176 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - item.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: item.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "item.h" -#include "ctrlitem.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/item - * gui - * - * wxControlItem represents an item in a @wxControlWithItems control. - *

Remark: This class is a helper class to make - * it possible to use the items of a @wxControlWithItems as an array. - * It has no corresponding class in wxWidgets. - *
- */ -WXJS_INIT_CLASS(ControlItem, "wxControlItem", 0) - -/*** - * - * - * Get/Set the value of the item. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ControlItem) - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -WXJS_BEGIN_METHOD_MAP(ControlItem) - WXJS_METHOD("remove", remove, 0) - WXJS_METHOD("select", select, 0) -WXJS_END_METHOD_MAP() - -bool ControlItem::GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for ControlItem")); - - wxControlWithItems *ctrl = ControlWithItems::GetPrivate(cx, parent); - wxASSERT_MSG(ctrl != NULL, wxT("No private data associated with ControlWithItems")); - - // When propId is greater then 0, then we have an array index. - if ( id >= 0 ) - { - SetPrivate(cx, obj, new Index(id)); - *vp = OBJECT_TO_JSVAL(obj); - } - else - { - if ( p->GetIndex() < ctrl->GetCount() ) // To be sure - { - switch(id) - { - case P_VALUE: - *vp = ToJS(cx, ctrl->GetString(p->GetIndex())); - break; - } - } - } - return true; -} - -bool ControlItem::SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( p == NULL ) - return true; - - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for ControlItem")); - - wxControlWithItems *ctrl = ControlWithItems::GetPrivate(cx, parent); - wxASSERT_MSG(ctrl != NULL, wxT("No private data associated with ControlWithItems")); - - if ( p->GetIndex() < ctrl->GetCount() ) // To be sure - { - switch (id) - { - case P_VALUE: - { - wxString value; - FromJS(cx, *vp, value); - ctrl->SetString(p->GetIndex(), value); - break; - } - } - } - return true; -} - -/*** - * - * - * - * removes the item from the control. - * - * - */ -JSBool ControlItem::remove(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for ControlItem")); - - wxControlWithItems *ctrl = ControlWithItems::GetPrivate(cx, parent); - if ( ctrl == NULL ) - return JS_FALSE; - - Index *item = ControlItem::GetPrivate(cx, obj); - wxASSERT_MSG(item != NULL, wxT("No private data associated with ChoiceItem")); - - if ( item->GetIndex() < ctrl->GetCount() ) // To be sure. - ctrl->Delete(item->GetIndex()); - - return JS_TRUE; -} - -/*** - * - * - * - * Selects/unselects the item. - * - * - */ -JSBool ControlItem::select(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for ControlItem")); - - wxControlWithItems *ctrl = ControlWithItems::GetPrivate(cx, parent); - if ( ctrl == NULL ) - return JS_FALSE; - - Index *item = ControlItem::GetPrivate(cx, obj); - wxASSERT_MSG(item != NULL, wxT("No private data associated with ChoiceItem")); - - if ( item->GetIndex() < ctrl->GetCount() ) // To be sure. - ctrl->Select(item->GetIndex()); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/item.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/panel.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/panel.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/panel.cpp (nonexistent) @@ -1,207 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - panel.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: panel.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// panel.cpp - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "../../common/main.h" - -#include "../event/jsevent.h" -#include "../event/evthand.h" - -#include "../misc/size.h" -#include "../misc/point.h" - -#include "button.h" -#include "panel.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Panel::Panel(JSContext *cx, JSObject *obj) - : wxPanel() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Panel::~Panel() -{ - PopEventHandler(true); -} - -/*** - * control/panel - * gui - * - * A panel is a window on which controls are placed. It is usually placed within a frame. - * Its main purpose is to be similar in appearance and functionality to a dialog, - * but with the flexibility of having any window as a parent. - * See @wxDialog and @wxFrame - * - */ -WXJS_INIT_CLASS(Panel, "wxPanel", 2) - -/*** - * - * - * Get/Set the default button. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Panel) - WXJS_PROPERTY(P_DEFAULT_ITEM, "defaultItem") -WXJS_END_PROPERTY_MAP() - -bool Panel::GetProperty(wxPanel *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_DEFAULT_ITEM ) - { - wxWindow *win = NULL; - - #if wxCHECK_VERSION(2,7,0) - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(p), wxTopLevelWindow); - if ( tlw ) - win = tlw->GetDefaultItem(); - #else - win = p->GetDefaultItem(); - #endif - - Object *winObject = dynamic_cast(win); - *vp = winObject == NULL ? JSVAL_VOID : OBJECT_TO_JSVAL(winObject->GetObject()); - } - return true; -} - -bool Panel::SetProperty(wxPanel *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_DEFAULT_ITEM ) - { - wxWindow *win = Window::GetPrivate(cx, *vp); - if ( win != NULL ) - { - #if wxCHECK_VERSION(2,7,0) - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(p), wxTopLevelWindow); - if ( tlw ) - tlw->SetDefaultItem(win); - #else - p->SetDefaultItem(win); - #endif - } - } - return true; -} - -/*** - * - * - * - * The parent of wxPanel. - * - * - * A window identifier. Use -1 when you don't need it. - * - * - * The position of the Panel control on the given parent. - * - * - * The size of the Panel control. - * - * - * The wxPanel style. - * - * - * - * Constructs a new wxPanel object. - * - * - */ -wxPanel* Panel::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 5 ) - argc = 5; - - int style = 0; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxPanel *p = new Panel(cx, obj); - p->Create(parent, id, *pt, *size, style); - - return p; - } - - return NULL; -} - -/*** - * - * - * To process a system colour changed event, use this property to set - * an event handler function. The function takes a @wxSysColourChangedEvent argument. - * - * - */ -void Panel::OnSysColourChanged(wxSysColourChangedEvent &event) -{ - PrivSysColourChangedEvent::Fire(this, event, "onSysColourChanged"); -} - -BEGIN_EVENT_TABLE(Panel, wxPanel) - EVT_SYS_COLOUR_CHANGED(Panel::OnSysColourChanged) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/panel.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/choice.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/choice.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/choice.h (nonexistent) @@ -1,78 +0,0 @@ -/* - * wxJavaScript - choice.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: choice.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSChoice_H -#define _WXJSChoice_H - -///////////////////////////////////////////////////////////////////////////// -// Name: choice.h -// Purpose: Choice ports wxChoice to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 24.02.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Choice : public wxChoice - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - Choice(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Choice(); - - static bool GetProperty(wxChoice *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxChoice *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxChoice* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxChoice *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_COLUMNS - }; - - void OnChoice(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSChoice_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/choice.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/frame.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/frame.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/frame.h (nonexistent) @@ -1,107 +0,0 @@ -/* - * wxJavaScript - frame.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: frame.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFRAME_H -#define _WXJSFRAME_H - -///////////////////////////////////////////////////////////////////////////// -// Name: frame.h -// Purpose: Frame ports wxFrame to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 16.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Frame : public wxFrame - , public ApiWrapper - , public Object - { - public: - - /** - * Constructor - */ - Frame(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Frame(); - - static bool GetProperty(wxFrame *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxFrame *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFrame* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext* WXUNUSED(cx), wxFrame* WXUNUSED(p) ) - { - } - - static JSBool setStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setStatusWidths(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool createStatusBar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool processCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool createToolBar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - void OnIconize(wxIconizeEvent &event); - void OnMaximize(wxMaximizeEvent &event); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_MENUBAR - , P_STATUSBAR_FIELDS - , P_STATUS_WIDTHS - , P_TOOLBAR - , P_STATUSBAR - , P_STATUSBAR_PANE - }; - - DECLARE_EVENT_TABLE() - void OnClose(wxCloseEvent &event); - void OnMenu(wxCommandEvent &event); - void OnTool(wxCommandEvent &event); - - // Overrided because wxJS needs a StatusBar - virtual wxStatusBar* OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name); - virtual wxToolBar* OnCreateToolBar(long style, - wxWindowID id, - const wxString& name); - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _WXJSFRAME_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/frame.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * wxJavaScript - sttext.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: sttext.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSStaticText_H -#define _WXJSStaticText_H - -///////////////////////////////////////////////////////////////////////////// -// Name: sttext.h -// Purpose: StaticText ports wxStaticText to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 04.02.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class StaticText : public wxStaticText - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - StaticText(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~StaticText(); - - static bool GetProperty(wxStaticText *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxStaticText *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxStaticText* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxStaticText *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_LABEL - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSStaticText_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.cpp (nonexistent) @@ -1,425 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - statbar.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: statbar.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSStatusBar.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "statbar.h" -#include "window.h" - -#include "../event/evthand.h" - -#include "../misc/rect.h" - -using namespace wxjs; -using namespace wxjs::gui; - -StatusBar::StatusBar(JSContext *cx, JSObject *obj) - : wxStatusBar() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -StatusBar::~StatusBar() -{ - PopEventHandler(true); -} - -/*** - * control/statbar - * gui - * - * A status bar is a narrow window that can be placed along the bottom of a frame - * to give small amounts of status information. It can contain one or more fields, - * one or more of which can be variable length according to the size of the window - *

The example shows a frame with a statusbar that contains a wxBitmapButton. - * When you click the button the bitmap is changed. - *

- *   wxTheApp.onInit = init;
- *   wxTheApp.mainLoop();
- *   
- *   function init()
- *   {
- *     wxImage.addHandler(new wxGIFHandler());
- *   
- *     var frame = new wxFrame(null, -1, "A Statusbar Example");
- *   
- *     var statusbar = frame.createStatusBar(2);
- *     statusbar.bitmapOn = new wxBitmap("green.gif", wxBitmapType.GIF);
- *     statusbar.bitmapOff = new wxBitmap("red.gif", wxBitmapType.GIF);
- *     statusbar.sw = true;
- *   
- *     statusbar.button = new wxBitmapButton(statusbar, 1, statusbar.bitmapOn);
- *     statusbar.button.onClicked = switched;
- *   
- *     frame.visible = true;
- *     topWindow = frame;
- *   
- *     return true;
- *   }
- *   
- *   function switched()
- *   {
- *     sw = ! sw;
- *     if ( sw )
- *        bitmapLabel = bitmapOn;
- *     else
- *        bitmapLabel = bitmapOff;
- *   
- *     refresh();
- *   }
- *  
- *
- */ -WXJS_INIT_CLASS(StatusBar, "wxStatusBar", 2) - -/*** - * - * - * Get/Set the number of fields in the statusbar. - * See also @wxStatusBar#setFieldsCount - * - * - * Get/Set the width for each field. At least one element must be -1 (meaning variable width). - * See also @wxFrame#setStatusWidths - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(StatusBar) - WXJS_PROPERTY(P_FIELDS_COUNT, "fieldsCount") - WXJS_PROPERTY(P_STATUS_WIDTHS, "statusWidths") -WXJS_END_PROPERTY_MAP() - -bool StatusBar::GetProperty(wxStatusBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_FIELDS_COUNT: - *vp = ToJS(cx, p->GetFieldsCount()); - break; - case P_STATUS_WIDTHS: - { - int count = p->GetFieldsCount(); - if ( count == 0 ) - *vp = JSVAL_VOID; - else - { - JSObject *objArr = JS_NewArrayObject(cx, count, NULL); - *vp = OBJECT_TO_JSVAL(objArr); - for(jsint i = 0; i < count; i++) - { - wxRect rect; - p->GetFieldRect(i, rect); - jsval element = INT_TO_JSVAL(rect.GetWidth()); - JS_SetElement(cx, objArr, i, &element); - } - } - break; - } - } - return true; -} - -bool StatusBar::SetProperty(wxStatusBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_FIELDS_COUNT: - { - int count; - if ( FromJS(cx, *vp, count) ) - p->SetFieldsCount(count); - break; - } - case P_STATUS_WIDTHS: - { - if ( JSVAL_IS_OBJECT(*vp) ) - { - JSObject *arrObj = JSVAL_TO_OBJECT(*vp); - if ( JS_IsArrayObject(cx, arrObj) == JS_TRUE ) - { - jsuint length = 0; - JS_GetArrayLength(cx, arrObj, &length); - uint fields = p->GetFieldsCount(); - if ( length > fields ) - length = fields; - int *widths = new int[length]; - for(jsuint i = 0; i < length; i++) - { - jsval element; - JS_GetElement(cx, arrObj, i, &element); - if ( ! FromJS(cx, element, widths[i]) ) - { - delete[] widths; - return JS_FALSE; - } - } - p->SetStatusWidths(length, widths); - delete[] widths; - } - break; - } - } - } - return true; -} - -/*** - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(StatusBar) - WXJS_CONSTANT(wxST_, SIZEGRIP) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxStatusBar. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The wxStatusBar style. - * - * - * - * Constructs a new wxStatusBar object. - * - * - */ -wxStatusBar* StatusBar::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 3 ) - argc = 3; - - int style = wxST_SIZEGRIP; - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], style) ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxStatusBar *p = new StatusBar(cx, obj); - p->Create(parent, id, style); - - return p; - } - - return NULL; -} - -void StatusBar::Destruct(JSContext *cx, wxStatusBar* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(StatusBar) - WXJS_METHOD("getFieldRect", getFieldRect, 2) - WXJS_METHOD("getStatusText", getStatusText, 0) - WXJS_METHOD("setStatusText", setStatusText, 1) - WXJS_METHOD("setFieldsCount", setFieldsCount, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The field of the statusbar. - * - * - * The object that will get the rectangle information. - * - * - * - * Puts the size and position of a fields internal - * bounding rectangle into the Rect object. Returns false on failure, true on success. - * Rect is only changed on success. - * - * - */ -JSBool StatusBar::getFieldRect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxStatusBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int field; - if ( ! FromJS(cx, argv[0], field) ) - return JS_FALSE; - - wxRect *rect = Rect::GetPrivate(cx, argv[1]); - if ( rect == NULL ) - return JS_FALSE; - - wxRect result; - if ( p->GetFieldRect(field, result) ) - { - *rect = result; - *rval = JSVAL_TRUE; - } - else - *rval = JSVAL_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * The field of the statusbar. - * - * - * - * Gets the status text of the given field - * - * - */ -JSBool StatusBar::getStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxStatusBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int field = 0; - if ( ! FromJS(cx, argv[0], field) ) - return JS_FALSE; - - *rval = ToJS(cx, p->GetStatusText(field)); - return JS_TRUE; -} - -/*** - * - * - * - * The number of fields. - * - * - * - * - * Sets the number of fields, and optionally the field widths. - * - * - */ -JSBool StatusBar::setFieldsCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxStatusBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int count; - if ( ! FromJS(cx, argv[0], count) ) - return JS_FALSE; - - int *widths = NULL; - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - JSObject *obj = JSVAL_TO_OBJECT(argv[0]); - if ( JS_IsArrayObject(cx, obj) == JS_TRUE ) - { - jsuint length = 0; - JS_GetArrayLength(cx, obj, &length); - uint fields = p->GetFieldsCount(); - if ( length > fields ) - length = fields; - - widths = new int[length]; - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, obj, i, &element); - if ( ! FromJS(cx, element, widths[i]) ) - { - delete[] widths; - return JS_FALSE; - } - } - } - } - - p->SetFieldsCount(count, widths); - delete[] widths; - - return JS_TRUE; -} - - -/*** - * - * - * - * The new text for the field. - * - * - * The field to change. Default is 0. - * - * - * - * Sets the text of the field. - * - * - */ -JSBool StatusBar::setStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxStatusBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int field = 0; - if ( argc > 1 - && ! FromJS(cx, argv[0], field) ) - return JS_FALSE; - - wxString text; - FromJS(cx, argv[0], text); - p->SetStatusText(text, field); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/statbar.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.cpp (nonexistent) @@ -1,165 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listitattr.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: listitattr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// listitem.cpp -#include -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "../misc/app.h" -#include "../misc/font.h" -#include "../misc/colour.h" - -#include "listitattr.h" -#include "listctrl.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/listitattr - * gui - * - * wxListItemAttr is used in virtual list controls. - * See @wxListCtrl#onGetItemAttr property - * - */ -WXJS_INIT_CLASS(ListItemAttr, "wxListItemAttr", 0) - -/*** - * - * - * The colour used for displaying text. - * - * - * The colour used as background. - * - * - * The font used for displaying text. - * - * - * Indicates that this attribute defines the text colour. - * - * - * Indicates that this attribute defines the background colour. - * - * - * Indicates that this attributes defines a font. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListItemAttr) - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_PROPERTY(P_BG_COLOUR, "backgroundColour") - WXJS_PROPERTY(P_FONT, "font") - WXJS_READONLY_PROPERTY(P_HAS_TEXT_COLOUR, "hasTextColour") - WXJS_READONLY_PROPERTY(P_HAS_BG_COLOUR, "hasBackgroundColour") - WXJS_READONLY_PROPERTY(P_HAS_FONT, "hasFont") -WXJS_END_PROPERTY_MAP() - -bool ListItemAttr::GetProperty(wxListItemAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_TEXT_COLOUR: - { - wxColour colour = p->GetTextColour(); - *vp = ( colour == wxNullColour ) ? JSVAL_VOID - : Colour::CreateObject(cx, new wxColour(colour)); - break; - } - case P_BG_COLOUR: - { - wxColour colour = p->GetBackgroundColour(); - *vp = ( colour == wxNullColour ) ? JSVAL_VOID - : Colour::CreateObject(cx, new wxColour(colour)); - break; - } - case P_FONT: - { - wxFont font = p->GetFont(); - *vp = ( font == wxNullFont ) ? JSVAL_VOID - : Font::CreateObject(cx, new wxFont(font)); - break; - } - case P_HAS_TEXT_COLOUR: - *vp = ToJS(cx, p->HasTextColour()); - break; - case P_HAS_BG_COLOUR: - *vp = ToJS(cx, p->HasBackgroundColour()); - break; - case P_HAS_FONT: - *vp = ToJS(cx, p->HasFont()); - break; - } - return true; -} - -bool ListItemAttr::SetProperty(wxListItemAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_TEXT_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, obj); - if ( colour != NULL ) - p->SetTextColour(*colour); - break; - } - case P_BG_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, obj); - if ( colour != NULL ) - p->SetBackgroundColour(*colour); - break; - } - case P_FONT: - { - wxFont *font = Font::GetPrivate(cx, obj); - if ( font != NULL ) - p->SetFont(*font); - break; - } - } - return true; -} - -/*** - * - * - * - * Creates a new wxListItem object. - * - * - */ -wxListItemAttr *ListItemAttr::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new wxListItemAttr(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - fontdata.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: fontdata.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFontData_H -#define _WXJSFontData_H - -///////////////////////////////////////////////////////////////////////////// -// Name: fontdata.h -// Purpose: FontData ports wxFontData to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 05.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class FontData : public ApiWrapper - { - public: - static bool GetProperty(wxFontData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxFontData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFontData* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_ALLOW_SYMBOLS - , P_ENABLE_EFFECTS - , P_CHOSEN_FONT - , P_COLOUR - , P_INITIAL_FONT - , P_SHOW_HELP - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFontData_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.cpp (nonexistent) @@ -1,284 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - filedlg.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: filedlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// filedlg.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "filedlg.h" -#include "window.h" - -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/filedlg - * gui - * - * A dialog for saving or opening a file. The following shows a save dialog: - *

- *   var dlg = new wxFileDialog(frame, "Save a file");
- *   dlg.style = wxFileDialog.SAVE;
- *   dlg.showModal();
- *  
- *
- */ -WXJS_INIT_CLASS(FileDialog, "wxFileDialog", 1) - -/*** - * - * - * Get/Set the default directory - * - * - * Get/Set the default filename - * - * - * Get an array of the selected file names - * - * - * Get/Set the filter index (wildcards) - * - * - * Get/Set the message of the dialog - * - * - * Get/Set the full path of the selected file - * - * - * Gets the full path of all selected files - * - * - * Gets/Sets the wildcard such as "*.*" or - * "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FileDialog) - WXJS_PROPERTY(P_DIRECTORY, "directory") - WXJS_PROPERTY(P_FILENAME, "filename") - WXJS_READONLY_PROPERTY(P_FILENAMES, "filenames") - WXJS_PROPERTY(P_FILTER_INDEX, "filterIndex") - WXJS_PROPERTY(P_MESSAGE, "message") - WXJS_PROPERTY(P_PATH, "path") - WXJS_READONLY_PROPERTY(P_PATHS, "paths") - WXJS_PROPERTY(P_WILDCARD, "wildcard") -WXJS_END_PROPERTY_MAP() - -bool FileDialog::GetProperty(wxFileDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_DIRECTORY: - *vp = ToJS(cx, p->GetDirectory()); - break; - case P_FILENAME: - *vp = ToJS(cx, p->GetFilename()); - break; - case P_FILENAMES: - { - wxArrayString filenames; - p->GetFilenames(filenames); - *vp = ToJS(cx, filenames); - break; - } - case P_FILTER_INDEX: - *vp = ToJS(cx, p->GetFilterIndex()); - break; - case P_MESSAGE: - *vp = ToJS(cx, p->GetMessage()); - break; - case P_PATH: - *vp = ToJS(cx, p->GetPath()); - break; - case P_PATHS: - { - wxArrayString paths; - p->GetPaths(paths); - *vp = ToJS(cx, paths); - break; - } - case P_WILDCARD: - *vp = ToJS(cx, p->GetWildcard()); - break; - } - return true; -} - -bool FileDialog::SetProperty(wxFileDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DIRECTORY: - { - wxString dir; - FromJS(cx, *vp, dir); - p->SetDirectory(dir); - break; - } - case P_FILENAME: - { - wxString f; - FromJS(cx, *vp, f); - p->SetFilename(f); - break; - } - case P_FILTER_INDEX: - { - int idx; - if ( FromJS(cx, *vp, idx) ) - p->SetFilterIndex(idx); - break; - } - case P_MESSAGE: - { - wxString msg; - FromJS(cx, *vp, msg); - p->SetMessage(msg); - break; - } - case P_PATH: - { - wxString path; - FromJS(cx, *vp, path); - p->SetPath(path); - break; - } - case P_WILDCARD: - { - wxString wildcard; - FromJS(cx, *vp, wildcard); - p->SetWildcard(wildcard); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(FileDialog) - WXJS_CONSTANT(wx, OPEN) - WXJS_CONSTANT(wx, SAVE) - WXJS_CONSTANT(wx, OVERWRITE_PROMPT) - WXJS_CONSTANT(wx, MULTIPLE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxFileDialog. - * - * - * The title of the dialog - * - * - * The default directory - * - * - * The default file - * - * - * A wildcard, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". - * - * - * The style - * - * - * The position of the dialog. - * - * - * - * Constructs a new wxFileDialog object - * - * - */ -wxFileDialog* FileDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 7 ) - argc = 7; - - const wxPoint *pt = &wxDefaultPosition; - int style = 0; - wxString message = wxFileSelectorPromptStr; - wxString wildcard = wxFileSelectorDefaultWildcardStr; - wxString defaultFile = wxEmptyString; - wxString defaultDir = wxEmptyString; - - switch(argc) - { - case 7: - pt = Point::GetPrivate(cx, argv[6]); - if ( pt == NULL ) - break; - // Fall through - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - case 5: - FromJS(cx, argv[4], wildcard); - // Fall through - case 4: - FromJS(cx, argv[3], defaultFile); - // Fall through - case 3: - FromJS(cx, argv[2], defaultDir); - // Fall through - case 2: - FromJS(cx, argv[1], message); - // Fall through - default: - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - return new wxFileDialog(parent, message, defaultDir, defaultFile, - wildcard, style, *pt); - } - return NULL; -} - -void FileDialog::Destruct(JSContext *cx, wxFileDialog *p) -{ - p->Destroy(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/filedlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.h (nonexistent) @@ -1,140 +0,0 @@ -/* - * wxJavaScript - toolbar.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: toolbar.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSToolBar_H -#define _WXJSToolBar_H - -///////////////////////////////////////////////////////////////////////////// -// Name: toolbar.h -// Purpose: ToolBar ports wxToolBar to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 31-01-2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class ToolBar : public wxToolBar - , public ApiWrapper - , public Object - { - public: - - ToolBar(JSContext *cx, JSObject *obj); - virtual ~ToolBar(); - - /** - * Callback for retrieving properties of wxToolBar - */ - static bool GetProperty(wxToolBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxToolBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxToolBar object is created - */ - static wxToolBar* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - /** - * Callback for when a wxToolBar object is destroyed - */ - static void Destruct(JSContext *cx, wxToolBar *p); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - static JSBool addControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addCheckTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addRadioTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteToolByPos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enableTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getToolClientData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getToolEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getToolLongHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getToolShortHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getToolState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool realize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setToolClientData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setToolLongHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setToolShortHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool toggleTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - /** - * Property Ids. - */ - enum - { - P_TOOL_SIZE - , P_TOOL_BITMAP_SIZE - , P_MARGINS - , P_TOOL_PACKING - , P_TOOL_SEPARATION - }; - }; - - class ToolData : public wxObject - { - public: - ToolData(JSContext *cx, jsval v) : m_cx(cx), m_val(v) - { - if ( JSVAL_IS_GCTHING(m_val) ) - { - JS_AddRoot(m_cx, &m_val); - } - } - - virtual ~ToolData() - { - if ( JSVAL_IS_GCTHING(m_val) ) - { - JS_RemoveRoot(m_cx, &m_val); - } - } - - jsval GetJSVal() - { - return m_val; - } - private: - JSContext *m_cx; - jsval m_val; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSToolBar_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.cpp (nonexistent) @@ -1,96 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - chklstbxchk.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: chklstbxchk.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// chklstbx.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "chklstbxchk.h" -#include "chklstbx.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/chklstbxchk - * gui - * - * wxCheckListBoxItem is a helper class used by wxJS to - * provide the use of an array to check or uncheck an item - * of a @wxCheckListBox. The following sample shows a @wxCheckListBox with the first item checked. - *

- *   dlg = new wxDialog(null, -1, "Test", new wxPoint(0, 0), new wxSize(200, 200));
- *   items = new Array();
- *   items[0] = "item 1";
- *   items[1] = "item 2";
- *   items[2] = "item 3";
- *   choice = new wxCheckListBox(dlg, -1, wxDefaultPosition, new wxSize(150, 150), items);
- *   choice.checked[0] = true;
- *   dlg.showModal();
- *  
- *
- */ -WXJS_INIT_CLASS(CheckListBoxChecked, "wxCheckListBoxChecked", 0) - -bool CheckListBoxChecked::GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for CheckListBoxChecked")); - - if ( id >= 0 ) - { - p->SetIndex(id); - wxCheckListBox *box = CheckListBox::GetPrivate(cx, parent); - if ( box == NULL ) - return false; - - *vp = ToJS(cx, box->IsChecked(id)); - } - return true; -} - -bool CheckListBoxChecked::SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for CheckListBoxChecked")); - - if ( id >= 0 ) - { - wxCheckListBox *box = CheckListBox::GetPrivate(cx, parent); - if ( box == NULL ) - return false; - - bool check; - if ( FromJS(cx, *vp, check) ) - box->Check(id, check); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbxchk.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.cpp (nonexistent) @@ -1,156 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - finddata.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: finddata.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// finddata.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "finddata.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/finddata - * gui - * - * wxFindReplaceData holds the data for @wxFindReplaceDialog. - * It is used to initialize the dialog with the default values and - * will keep the last values from the dialog when it is closed. - * It is also updated each time a @wxFindDialogEvent is generated so - * instead of using the @wxFindDialogEvent methods - * you can also directly query this object. - * - */ -WXJS_INIT_CLASS(FindReplaceData, "wxFindReplaceData", 0) - -/*** - * - * - * Get/Set the string to find - * - * - * Get/Set the flags. - * - * - * Get/Set the replacement string - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FindReplaceData) - WXJS_PROPERTY(P_FINDSTRING, "findString") - WXJS_PROPERTY(P_REPLACESTRING, "replaceString") - WXJS_PROPERTY(P_FLAGS, "flags") -WXJS_END_PROPERTY_MAP() - -bool FindReplaceData::GetProperty(wxFindReplaceData *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_FLAGS: - *vp = ToJS(cx, p->GetFlags()); - break; - case P_FINDSTRING: - *vp = ToJS(cx, p->GetFindString()); - break; - case P_REPLACESTRING: - *vp = ToJS(cx, p->GetReplaceString()); - break; - } - return true; -} - -bool FindReplaceData::SetProperty(wxFindReplaceData *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_FLAGS: - { - int flag; - if ( FromJS(cx, *vp, flag) ) - p->SetFlags(flag); - break; - } - case P_FINDSTRING: - { - wxString str; - FromJS(cx, *vp, str); - p->SetFindString(str); - break; - } - case P_REPLACESTRING: - { - wxString str; - FromJS(cx, *vp, str); - p->SetReplaceString(str); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(FindReplaceData) - WXJS_CONSTANT(wx, FR_DOWN) - WXJS_CONSTANT(wx, FR_WHOLEWORD) - WXJS_CONSTANT(wx, FR_MATCHCASE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * - * - * Constructs a new wxFindReplaceData object. - * - * - */ -wxFindReplaceData* FindReplaceData::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxFindReplaceData(); - else - { - int flags = 0; - if ( FromJS(cx, argv[0], flags) ) - return new wxFindReplaceData(flags); - } - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/finddata.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.h (nonexistent) @@ -1,80 +0,0 @@ -/* - * wxJavaScript - txtdlg.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: txtdlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTextEntryDialog_H -#define _WXJSTextEntryDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: txtdlg.h -// Purpose: TextEntryDialog ports wxTextEntryDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 04.11.05 -// Copyright: (c) Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class TextEntryDialog : public wxTextEntryDialog - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - TextEntryDialog( JSContext *cx - , JSObject *obj - , wxWindow* parent - , const wxString& message - , const wxString& caption - , const wxString& defaultValue - , long style - , const wxPoint& pos); - - /** - * Destructor - */ - virtual ~TextEntryDialog(); - - static bool GetProperty(wxTextEntryDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxTextEntryDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxTextEntryDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxTextEntryDialog *p); - - WXJS_DECLARE_PROPERTY_MAP() - - DECLARE_EVENT_TABLE() - - enum - { - P_VALUE - }; - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSTextEntryDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.h (nonexistent) @@ -1,73 +0,0 @@ -/* - * wxJavaScript - coldata.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: coldata.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSColourData_H -#define _WXJSColourData_H - -///////////////////////////////////////////////////////////////////////////// -// Name: coldata.h -// Purpose: ColourData ports wxColourData to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class ColourData : public ApiWrapper - { - public: - - static bool GetProperty(wxColourData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxColourData *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxColourData* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_CHOOSE_FULL - , P_COLOUR - , P_CUSTOM_COLOUR - }; - }; - - class CustomColour : public ApiWrapper - { - public: - - static bool GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSColourData_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/coldata.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.h (nonexistent) @@ -1,97 +0,0 @@ -/* - * wxJavaScript - combobox.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: combobox.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSComboBox_H -#define _WXJSComboBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: combobox.h -// Purpose: ComboBox ports wxComboBox to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 23.02.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class ComboBox : public wxComboBox - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - ComboBox(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~ComboBox(); - - static bool GetProperty(wxComboBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxComboBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxComboBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxComboBox *p) - { - } - - static JSBool copy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool cut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool paste(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool redo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool undo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_VALUE - , P_INSERTION_POINT - , P_LAST_POSITION - , P_CAN_COPY - , P_CAN_CUT - , P_CAN_PASTE - , P_CAN_REDO - , P_CAN_UNDO - }; - - DECLARE_EVENT_TABLE() - void OnText(wxCommandEvent &event); - void OnComboBox(wxCommandEvent &event); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSComboBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.h (nonexistent) @@ -1,101 +0,0 @@ -/* - * wxJavaScript - textctrl.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: textctrl.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTEXTCTRL_H -#define _WXJSTEXTCTRL_H - -///////////////////////////////////////////////////////////////////////////// -// Name: textctrl.h -// Purpose: TextCtrl ports wxTextCtrl to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 16.12.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class TextCtrl : public wxTextCtrl - , public ApiWrapper - , public Object - { - public: - - TextCtrl(JSContext *cx, JSObject *obj); - virtual ~TextCtrl(); - - static bool GetProperty(wxTextCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxTextCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxTextCtrl* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxTextCtrl *p) - { - } - - static JSBool appendText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool cut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool discardEdits(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getLineLength(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getLineText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool loadFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool paste(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool redo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool saveFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_CAN_COPY - , P_CAN_PASTE - , P_CAN_CUT - , P_CAN_REDO - , P_CAN_UNDO - , P_INSERTION_POINT - , P_NUMBER_OF_LINES - , P_SELECTION_FROM - , P_SELECTION_TO - , P_VALUE - , P_MODIFIED - , P_LAST_POSITION - , P_EDITABLE - }; - - void OnText(wxCommandEvent &event); - void OnTextEnter(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTEXTCTRL_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/textctrl.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.cpp (nonexistent) @@ -1,185 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - chklstbx.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: chklstbx.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// chklstbx.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/strsptr.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "chklstbx.h" -#include "chklstbxchk.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -CheckListBox::CheckListBox(JSContext *cx, JSObject *obj) - : wxCheckListBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -CheckListBox::~CheckListBox() -{ - PopEventHandler(true); -} - - -/*** - * control/chklstbx - * gui - * - * A checklistbox is like a listbox, but allows items to be checked or unchecked. - * - */ -WXJS_INIT_CLASS(CheckListBox, "wxCheckListBox", 2) - -/*** - * - * - * Array with @wxCheckListBoxChecked elements. Use it to check/uncheck a specific item. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(CheckListBox) - WXJS_PROPERTY(P_CHECKED, "checked") -WXJS_END_PROPERTY_MAP() - -bool CheckListBox::GetProperty(wxCheckListBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_CHECKED ) - { - *vp = CheckListBoxChecked::CreateObject(cx, new Index(0), obj); - } - return true; -} - -/*** - * - * - * The parent of this control - * A window identifier. Use -1 when you don't need it. - * - * The position of the CheckListBox control on the given parent. - * - * - * The size of the CheckListBox control. - * - * An array of Strings to initialize the control - * The wxCheckListBox style. - * A validator - * - * - * Constructs a new wxCheckListBox object. - * - * - */ -wxCheckListBox* CheckListBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - StringsPtr items; - const wxValidator *val = &wxDefaultValidator; - - if ( argc > 7 ) - argc = 7; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], items) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - CheckListBox *p = new CheckListBox(cx, obj); - // Don't forget the wxLB_OWNERDRAW, because Create is called on wxListBox - p->Create(parent, id, *pt, *size, items.GetCount(), items.GetStrings(), style | wxLB_OWNERDRAW, *val); - - return p; - } - - return NULL; -} - -/*** - * - * - * Called when an item is checked or unchecked. The function that is called gets a @CommandEvent - * object. - * - */ -void CheckListBox::OnCheckListBox(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onCheckListBox"); -} - -BEGIN_EVENT_TABLE(CheckListBox, wxCheckListBox) - EVT_CHECKLISTBOX(-1, CheckListBox::OnCheckListBox) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/chklstbx.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.cpp (nonexistent) @@ -1,658 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - htmlwin.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: htmlwin.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif -#include - -/*** - * control/htmlwin - * gui - * - * The purpose of this class is to display HTML pages (either local file or downloaded via HTTP protocol) - * in a window. The width of the window is constant - given in the constructor - and virtual height is changed - * dynamically depending on page size. - * - */ - -#include "../../common/main.h" - -#include "../event/evthand.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" - -using namespace wxjs; -using namespace wxjs::gui; - -WXJS_INIT_CLASS(HtmlWindow, "wxHtmlWindow", 1) - -HtmlWindow::HtmlWindow(JSContext *cx, JSObject *obj) - : wxHtmlWindow() - , Object(obj, cx) -{ -} - -HtmlWindow::~HtmlWindow() -{ -} - -void HtmlWindow::InitClass(JSContext* WXUNUSED(cx), JSObject* WXUNUSED(obj), JSObject* WXUNUSED(proto)) -{ - InitConnectEventMap(); -} - -/*** - * - * - * Never display scrollbars, not even when the page is larger than the window. - * Display scrollbars only if page's size exceeds window's size. - * Don't allow the user to select text. - * - * - * - */ - -WXJS_BEGIN_CONSTANT_MAP(HtmlWindow) - WXJS_CONSTANT(wxHW_, SCROLLBAR_NEVER) - WXJS_CONSTANT(wxHW_, SCROLLBAR_AUTO) - WXJS_CONSTANT(wxHW_, NO_SELECTION) - WXJS_CONSTANT(wxHW_, DEFAULT_STYLE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * Returns true if it is possible to go back in the history (i.e. @wxHtmlWindow#historyBack won't fail). - * - * - * Returns true if it is possible to go forward in the history (i.e. @wxHtmlWindow#historyForward won't fail). - * - * - * Returns anchor within currently opened page (see @wxHtmlWindow#openedPage). - * If no page is opened or if the displayed page wasn't produced by call to @wxHtmlWindow#loadPage, - * empty string is returned. - * - * - * Returns full location of the opened page. If no page is opened or if the displayed page wasn't - * produced by call to @wxHtmlWindow#loadPage, empty string is returned. - * - * - * Returns title of the opened page or wxEmptyString if current page does not contain <title> tag. - * - * - * Gets/Sets the frame in which page title will be displayed. - * - * - * Returns content of currently displayed page as plain text. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(HtmlWindow) - WXJS_READONLY_PROPERTY(P_HISTORY_CAN_BACK, "historyCanBack") - WXJS_READONLY_PROPERTY(P_HISTORY_CAN_FORWARD, "historyCanForward") - WXJS_READONLY_PROPERTY(P_OPENED_ANCHOR, "openedAnchor") - WXJS_READONLY_PROPERTY(P_OPENED_PAGE, "openedPage") - WXJS_READONLY_PROPERTY(P_OPENED_PAGE_TITLE, "openedPageTitle") - WXJS_PROPERTY(P_RELATED_FRAME, "relatedFrame") - WXJS_READONLY_PROPERTY(P_TEXT, "text") - WXJS_READONLY_PROPERTY(P_SELECTION_TEXT, "selectionText") -WXJS_END_PROPERTY_MAP() - -bool HtmlWindow::GetProperty(wxHtmlWindow *p, JSContext *cx, JSObject* WXUNUSED(obj), int id, jsval *vp) -{ - switch (id) - { - case P_HISTORY_CAN_BACK: - *vp = ToJS(cx, p->HistoryCanBack()); - break; - case P_HISTORY_CAN_FORWARD: - *vp = ToJS(cx, p->HistoryCanForward()); - break; - case P_OPENED_ANCHOR: - *vp = ToJS(cx, p->GetOpenedAnchor()); - break; - case P_OPENED_PAGE: - *vp = ToJS(cx, p->GetOpenedPage()); - break; - case P_OPENED_PAGE_TITLE: - *vp = ToJS(cx, p->GetOpenedPageTitle()); - break; - case P_RELATED_FRAME: - *vp = Frame::CreateObject(cx, p->GetRelatedFrame(), NULL); - break; - case P_TEXT: - *vp = ToJS(cx, p->ToText()); - break; - case P_SELECTION_TEXT: - *vp = ToJS(cx, p->SelectionToText()); - break; - } - return true; -} - -bool HtmlWindow::SetProperty(wxHtmlWindow *p, JSContext *cx, JSObject* WXUNUSED(obj), int id, jsval *vp) -{ - switch (id) - { - case P_RELATED_FRAME: - { - wxFrame *frame = Frame::GetPrivate(cx, *vp); - if ( frame != NULL ) - p->SetRelatedFrame(frame, wxT("%s")); - break; - } - } - return true; -} - -bool HtmlWindow::AddProperty(wxHtmlWindow *p, JSContext* WXUNUSED(cx), JSObject* WXUNUSED(obj), const wxString &prop, jsval* WXUNUSED(vp)) -{ - EventConnector::ConnectEvent(p, prop); - return true; -} - -/*** - * - * - * The parent window - * A windows identifier. Use -1 when you don't need it. - * The position of the control on the given parent - * The size of the control - * The style of the control - * - * - * Constructs a new wxHtmlWindow object. - * - * - */ -wxHtmlWindow* HtmlWindow::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool WXUNUSED(constructing)) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = wxHW_DEFAULT_STYLE; - int id = -1; - - if ( argc > 5 ) - argc = 5; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Walk through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Walk through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Walk through - case 2: - if ( ! FromJS(cx, argv[1], id) ) - break; - // Walk through - default: - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - HtmlWindow *p = new HtmlWindow(cx, obj); - p->Create(parent, id, *pt, *size, style); - return p; - } - - return NULL; -} - -WXJS_INIT_EVT_CONNECTOR_MAP(wxHtmlWindow) -WXJS_BEGIN_EVT_CONNECTOR_MAP(HtmlWindow) - WXJS_EVT_CONNECTOR(wxT("onLinkClicked"), ConnectLinkClicked) -WXJS_END_EVT_CONNECTOR_MAP() - -void HtmlWindow::ConnectLinkClicked(wxHtmlWindow *p) -{ - p->Connect(wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler(HtmlWindow::OnLinkClicked)); -} - -/*** - * - * - * This event is triggered when a hyperlinck is clicked. The function receives - * a @wxHtmlLinkEvent as argument. - * - * - */ -void HtmlWindow::OnLinkClicked(wxHtmlLinkEvent &event) -{ - PrivHtmlLinkEvent::Fire(this, event, "onLinkClicked"); -} - -WXJS_BEGIN_METHOD_MAP(HtmlWindow) - WXJS_METHOD("appendToPage", appendToPage, 1) - WXJS_METHOD("historyBack", historyBack, 0) - WXJS_METHOD("historyClear", historyClear, 0) - WXJS_METHOD("historyBack", historyBack, 0) - WXJS_METHOD("historyBack", historyBack, 0) - WXJS_METHOD("loadFile", loadFile, 1) - WXJS_METHOD("loadPage", loadPage, 1) - WXJS_METHOD("setPage", setPage, 1) - WXJS_METHOD("setRelatedFrame", setRelatedFrame, 2) - WXJS_METHOD("setRelatedStatusBar", setRelatedStatusBar, 0) - WXJS_METHOD("selectAll", selectAll, 0) - WXJS_METHOD("selectLine", selectWord, 1) - WXJS_METHOD("selectWord", selectWord, 1) - WXJS_METHOD("setBorders", setBorders, 1) - WXJS_METHOD("setFonts", setFonts, 2) -WXJS_END_METHOD_MAP() - -//TODO: AddFilter - -/*** - * - * - * HTML fragment - * - * - * Appends HTML fragment to currently displayed text and refreshes the window. - * False is returned on failure. - * - * - */ -JSBool HtmlWindow::appendToPage(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval *rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString html; - FromJS(cx, argv[0], html); - *rval = ToJS(cx, p->AppendToPage(html)); - return JS_TRUE; -} - -/*** - * - * - * - * Moves back to the previous page. (each page displayed using @wxHtmlWindow#loadPage is stored in history list.) - * - * - */ -JSBool HtmlWindow::historyBack(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* WXUNUSED(argv), jsval *rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->HistoryBack()); - return JS_TRUE; -} - -/*** - * - * - * - * Clears the history. - * - * - */ -JSBool HtmlWindow::historyClear(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* WXUNUSED(argv), jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->HistoryClear(); - return JS_TRUE; -} - -/*** - * - * - * - * Moves forward to the next page. (each page displayed using @wxHtmlWindow#loadPage is stored in history list.) - * - * - */ -JSBool HtmlWindow::historyForward(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* WXUNUSED(argv), jsval* rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->HistoryForward()); - return JS_TRUE; -} - -/*** - * - * - * The file to load - * - * - * The file to load - * - * - * Loads HTML page from file and displays it. Returns false on failure. - * - * - */ -JSBool HtmlWindow::loadFile(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - JSClass *clazz = wxjs::GetClass(cx, "wxFileName"); - if ( clazz != NULL ) - { - wxFileName *filename = (wxFileName *) JS_GetInstancePrivate(cx, JSVAL_TO_OBJECT(argv[0]), clazz, NULL); - if ( filename != NULL ) - { - *rval = ToJS(cx, p->LoadFile(*filename)); - return JS_TRUE; - } - } - } - - wxString filename; - FromJS(cx, argv[0], filename); - *rval = ToJS(cx, p->LoadFile(filename)); - - return JS_TRUE; -} - -/*** - * - * - * The address of document - * - * - * Unlike @wxHtmlWindow#setPage this function first loads HTML page from location and then displays it. - * - * - */ -JSBool HtmlWindow::loadPage(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString location; - FromJS(cx, argv[0], location); - *rval = ToJS(cx, p->LoadPage(location)); - - return JS_TRUE; -} - -//TODO: readCustomization - -/*** - * - * - * - * Selects all text in the window. - * - * - */ -JSBool HtmlWindow::selectAll(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* WXUNUSED(argv), jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->SelectAll(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Selects the line of text that pos points at. Note that pos is relative to the top of displayed page, - * not to window's origin, use @wxScrolledWindow#calcUnscrolledPosition to convert physical coordinate. - * - * - */ -JSBool HtmlWindow::selectLine(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxPoint *pos = Point::GetPrivate(cx, argv[0]); - if ( pos != NULL ) - { - p->SelectLine(*pos); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Selects the word at position pos. Note that pos is relative to the top of displayed page, - * not to window's origin, use @wxScrolledWindow#calcUnscrolledPosition to convert physical coordinate. - * - * - */ -JSBool HtmlWindow::selectWord(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxPoint *pos = Point::GetPrivate(cx, argv[0]); - if ( pos != NULL ) - { - p->SelectWord(*pos); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * This function sets the space between border of window and HTML contents. - * - * - */ -JSBool HtmlWindow::setBorders(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int border; - if ( FromJS(cx, argv[0], border) ) - { - p->SetBorders(border); - } - return JS_TRUE; -} - -/*** - * - * - * - * This is face name for normal (i.e. non-fixed) font. It can be either empty string - * (then the default face is chosen) or platform-specific face name. Examples are - * "helvetica" under Unix or "Times New Roman" under Windows. - * - * - * The same thing for fixed face - * - * - * This is an array of 7 items of Integer type. The values represent size of font with HTML size - * from -2 to +4 ( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if sizes is null. - * - * - * - * This function sets font sizes and faces - * - * - */ -JSBool HtmlWindow::setFonts(JSContext *cx, JSObject *obj, uintN argc, jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString normalFace; - wxString fixedFace; - int *sizes = NULL; - if ( argc > 2 - && JSVAL_IS_OBJECT(argv[2]) ) - { - JSObject *objArr = JSVAL_TO_OBJECT(argv[2]); - if ( JS_IsArrayObject(cx, objArr) ) - { - jsuint length = 0; - JS_GetArrayLength(cx, objArr, &length); - sizes = new int[length]; - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, objArr, i, &element); - FromJS(cx, element, sizes[i]); - } - } - } - - p->SetFonts(normalFace, fixedFace, sizes); - delete[] sizes; - - return JS_TRUE; -} - -/*** - * - * - * The HTML source - * - * - * Sets HTML page and display it. This won't load the page!! It will display the source - * - * - */ -JSBool HtmlWindow::setPage(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* rval) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString source; - FromJS(cx, argv[0], source); - *rval = ToJS(cx, p->SetPage(source)); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Sets the frame in which page title will be displayed. - * format is format of frame title, e.g. "HtmlHelp : %s". - * It must contain exactly one %s. This %s is substituted with HTML page title. - * - * - */ -JSBool HtmlWindow::setRelatedFrame(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxFrame *frame = Frame::GetPrivate(cx, argv[0]); - if ( frame == NULL ) - { - JS_ReportError(cx, "Argument %d must be a %s in %s", 1, "wxFrame", "setRelatedFrame"); - return JS_FALSE; - } - - wxString format; - FromJS(cx, argv[1], format); - p->SetRelatedFrame(frame, format); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * After calling @wxHtmlWindow#setRelatedFrame, this sets statusbar slot where messages - * will be displayed. (Default is -1 = no messages.) - * - * - */ -JSBool HtmlWindow::setRelatedStatusBar(JSContext *cx, JSObject *obj, uintN argc, jsval* argv, jsval* WXUNUSED(rval)) -{ - wxHtmlWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int bar = -1; - if ( argc > 0 ) - FromJS(cx, argv[0], bar); - p->SetRelatedStatusBar(bar); - - return JS_TRUE; -} - -//TODO: WriteCustomization Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/htmlwin.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.cpp (nonexistent) @@ -1,408 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - menuitem.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: menuitem.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// menuitem.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "menu.h" -#include "menuitem.h" - -#include "../misc/accentry.h" -#include "../misc/font.h" -#include "../misc/bitmap.h" -#include "../misc/colour.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/menuitem - * gui - * - * A menu item represents an item in a popup menu. - * Note that the majority of this class is only implemented under Windows so far, - * but everything except fonts, colours and bitmaps can be achieved via wxMenu on all platforms. - * - */ -WXJS_INIT_CLASS(MenuItem, "wxMenuItem", 1) - -/*** - * - * - * Get/Set the accelerator. - * - * - * Get/Set the background colour of the item (Windows only) - * - * - * Get/Set the checked bitmap. (Windows only) - * - * - * Check or uncheck the menu item. - * - * - * Returns true if the item is checkable. - * - * - * Enables or disables the menu item. - * - * - * Get/Set the font. (Windows only) - * - * - * Get/Set the helpstring shown in the statusbar. - * - * - * Get/Set the id of the menu item - * - * - * Gets the text associated with the menu item without any accelerator - * characters it might contain. - * - * - * Get/Set the width of the menu item checkmark bitmap (Windows only). - * - * - * Gets the menu that owns this item. - * - * - * Returns true if the item is a separator. - * - * - * Gets the submenu associated with the menu item - * - * - * Get/Set the text associated with the menu item with any accelerator characters it may contain. - * - * - * Get/Set the text colour. (Windows Only) - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(MenuItem) - WXJS_READONLY_PROPERTY(P_LABEL, "label") - WXJS_PROPERTY(P_ACCEL, "accel") - WXJS_PROPERTY(P_TEXT, "text") - WXJS_PROPERTY(P_CHECK, "check") - WXJS_READONLY_PROPERTY(P_CHECKABLE, "checkable") - WXJS_PROPERTY(P_ENABLE, "enable") - WXJS_PROPERTY(P_HELP, "help") - WXJS_PROPERTY(P_ID, "id") - WXJS_PROPERTY(P_FONT, "font") - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_PROPERTY(P_BITMAP, "bitmap") - WXJS_PROPERTY(P_MARGIN_WIDTH, "marginWidth") - WXJS_READONLY_PROPERTY(P_SUB_MENU, "subMenu") - WXJS_PROPERTY(P_BG_COLOUR, "backgroundColour") - WXJS_READONLY_PROPERTY(P_MENU, "menu") - WXJS_READONLY_PROPERTY(P_SEPARATOR, "separator") -WXJS_END_PROPERTY_MAP() - -bool MenuItem::GetProperty(wxMenuItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ACCEL: - *vp = AcceleratorEntry::CreateObject(cx, p->GetAccel()); - break; - case P_BG_COLOUR: - #ifdef __WXMSW__ - *vp = Colour::CreateObject(cx, new wxColour(p->GetBackgroundColour())); - #endif - break; - case P_LABEL: - *vp = ToJS(cx, p->GetLabel()); - break; - case P_TEXT: - *vp = ToJS(cx, p->GetText()); - break; - case P_CHECK: - *vp = ToJS(cx, p->IsChecked()); - break; - case P_CHECKABLE: - *vp = ToJS(cx, p->IsCheckable()); - break; - case P_ENABLE: - *vp = ToJS(cx, p->IsEnabled()); - break; - case P_HELP: - *vp = ToJS(cx, p->GetHelp()); - break; - case P_ID: - *vp = ToJS(cx, p->GetId()); - break; - case P_MARGIN_WIDTH: - #ifdef __WXMSW__ - *vp = ToJS(cx, p->GetMarginWidth()); - #endif - break; - case P_SUB_MENU: - { - wxMenu *subMenu = p->GetSubMenu(); - Object *objMenu = dynamic_cast(subMenu); - *vp = (objMenu == NULL) ? JSVAL_NULL : OBJECT_TO_JSVAL(objMenu->GetObject()); - break; - } - case P_MENU: - { - wxMenu *menu = p->GetMenu(); - Object *objMenu = dynamic_cast(menu); - *vp = (objMenu == NULL) ? JSVAL_NULL : OBJECT_TO_JSVAL(objMenu->GetObject()); - break; - } - case P_FONT: - #ifdef __WXMSW__ - *vp = Font::CreateObject(cx, new wxFont(p->GetFont()), obj); - #endif - break; - case P_BITMAP: - *vp = Bitmap::CreateObject(cx, new wxBitmap(p->GetBitmap())); - break; - case P_TEXT_COLOUR: - #ifdef __WXMSW__ - *vp = Colour::CreateObject(cx, new wxColour(p->GetTextColour())); - #endif - break; - case P_SEPARATOR: - *vp = ToJS(cx, p->IsSeparator()); - break; - } - return true; -} - -bool MenuItem::SetProperty(wxMenuItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ACCEL: - { - wxAcceleratorEntry *entry = AcceleratorEntry::GetPrivate(cx, *vp); - if ( entry != NULL ) - p->SetAccel(entry); - break; - } - case P_BG_COLOUR: - { - #ifdef __WXMSW__ - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetBackgroundColour(*colour); - #endif - break; - } - case P_TEXT: - { - wxString str; - FromJS(cx, *vp, str); - p->SetText(str); - break; - } - case P_CHECK: - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->Check(value); - break; - } - case P_ENABLE: - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->Enable(value); - break; - } - case P_HELP: - { - wxString str; - FromJS(cx, *vp, str); - p->SetHelp(str); - break; - } - case P_MARGIN_WIDTH: - { - #ifdef __WXMSW__ - int value; - if ( FromJS(cx, *vp, value) ) - p->SetMarginWidth(value); - #endif - break; - } - case P_FONT: - { - #ifdef __WXMSW__ - wxFont *font = Font::GetPrivate(cx, *vp); - if ( font ) - p->SetFont(*font); - #endif - break; - } - case P_BITMAP: - { - #ifdef __WXMSW__ - wxBitmap *bmp = Bitmap::GetPrivate(cx, *vp); - if ( bmp ) - p->SetBitmaps(*bmp, wxNullBitmap); - #endif - break; - } - case P_TEXT_COLOUR: - { - #ifdef __WXMSW__ - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetTextColour(*colour); - #endif - break; - } - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(MenuItem) - WXJS_METHOD("setBitmaps", setBitmaps, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * Menu that owns the item - * Identifier for this item - * The text for the menu item - * The help message shown in the statusbar - * Indicates if the menu item can be checked or not. - * Indicates that the menu item is a submenu - * - * - * Constructs a new wxMenuItem object - * - * - */ -wxMenuItem* MenuItem::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int id = 0; - wxString text = wxEmptyString; - wxString help = wxEmptyString; - bool checkable = false; - wxMenu *subMenu = NULL; - - switch(argc) - { - case 6: - if ( (subMenu = Menu::GetPrivate(cx, argv[5])) == NULL ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], checkable) ) - break; - // Fall through - case 4: - FromJS(cx, argv[3], help); - // Fall through - case 3: - FromJS(cx, argv[2], text); - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], id) ) - break; - // Fall through - default: - wxMenu *menu = Menu::GetPrivate(cx, argv[0]); - if ( menu != NULL ) - { - wxItemKind itemkind = wxITEM_NORMAL; - if ( checkable ) - itemkind = wxITEM_CHECK; - #if wxCHECK_VERSION(2,7,0) - return new wxMenuItem(menu, id, text, help, itemkind, subMenu); - #else - return new wxMenuItem(menu, id, text, help, checkable, subMenu); - #endif - } - } - - return NULL; -} - -void MenuItem::Destruct(JSContext *cx, wxMenuItem *p) -{ -/* if ( p->GetMenu() == NULL ) - { - delete p; - p = NULL; - } -*/ -} - -/*** - * - * - * - * - * - * - * Sets the checked/unchecked bitmaps for the menu item (Windows only). - * The first bitmap is also used as the single bitmap for uncheckable menu items. - * - * - */ -JSBool MenuItem::setBitmaps(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxMenuItem *p = MenuItem::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - #ifdef __WXMSW__ - - wxBitmap *bmp1 = Bitmap::GetPrivate(cx, argv[0]); - if ( bmp1 != NULL ) - { - const wxBitmap *bmp2 = &wxNullBitmap; - if ( argc > 1 ) - { - bmp2 = Bitmap::GetPrivate(cx, argv[1]); - if ( bmp2 == NULL ) - { - return JS_FALSE; - } - } - - p->SetBitmaps(*bmp1, *bmp2); - return JS_TRUE; - } - #else - return JS_TRUE; - #endif - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.cpp (nonexistent) @@ -1,275 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - ctrlitem.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: ctrlitem.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" -#include "ctrlitem.h" -#include "item.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/ctrlitem - * gui - * - * This class is a prototype for some wxWidgets controls which contain several items, - * such as @wxListBox, @wxCheckListBox, @wxChoice and @wxComboBox. - *

- * It defines the methods for accessing the controls items. - *
- */ -WXJS_INIT_CLASS(ControlWithItems, "wxControlWithItems", 0) - -/*** - * - * - * The number of items - * - * - * Returns true when the control has no items - * - * - * This is an 'array' property. This means that you have to specify an index - * to retrieve the actual item. An example: - * - * choice.item[0].value = "BMW"; - * - * - * - * Get/Set the selected item - * - * - * Get the label of the selected item or an empty string when no item is selected. - * Or select the item with the given string. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ControlWithItems) - WXJS_PROPERTY(P_COUNT, "count") - WXJS_PROPERTY(P_SELECTION, "selection") - WXJS_READONLY_PROPERTY(P_ITEM, "item") - WXJS_PROPERTY(P_STRING_SELECTION, "stringSelection") - WXJS_READONLY_PROPERTY(P_EMPTY, "empty") -WXJS_END_PROPERTY_MAP() - -bool ControlWithItems::GetProperty(wxControlWithItems *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_COUNT: - *vp = ToJS(cx, p->GetCount()); - break; - case P_SELECTION: - *vp = ToJS(cx, p->GetSelection()); - break; - case P_ITEM: - *vp = ControlItem::CreateObject(cx, NULL, obj); - break; - case P_STRING_SELECTION: - *vp = ToJS(cx, p->GetStringSelection()); - break; - case P_EMPTY: - *vp = ToJS(cx, p->IsEmpty()); - break; - } - return true; -} - -bool ControlWithItems::SetProperty(wxControlWithItems *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_SELECTION: - { - int selection; - if ( FromJS(cx, *vp, selection) ) - p->SetSelection(selection); - } - break; - case P_STRING_SELECTION: - { - wxString selection; - FromJS(cx, *vp, selection); - p->SetStringSelection(selection); - } - } - return true; -} - -void ControlWithItems::Destruct(JSContext *cx, wxControlWithItems* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(ControlWithItems) - WXJS_METHOD("append", append, 1) - WXJS_METHOD("clear", clear, 0) - WXJS_METHOD("deleteItem", delete_item, 1) - WXJS_METHOD("findString", findString, 1) - WXJS_METHOD("insert", insert, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * - * - * Adds the item or all elements of the array to the end of the control. - * When only one item is appended, the return value is the index - * of the newly added item. - * - * - */ - JSBool ControlWithItems::append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxControlWithItems *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( JSVAL_IS_OBJECT(argv[0]) - && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(argv[0])) ) - { - wxArrayString strings; - if ( FromJS(cx, argv[0], strings) ) - { - p->Append(strings); - } - } - else - { - wxString item; - FromJS(cx, argv[0], item); - *rval = ToJS(cx, p->Append(item)); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Removes all items from the control. - * - * - */ - JSBool ControlWithItems::clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxControlWithItems *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Clear(); - return JS_TRUE; - } - -/*** - * - * - * - * - * - * Removes the item with the given index (zero-based). - * - * - */ -JSBool ControlWithItems::delete_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxControlWithItems *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - p->Delete(idx); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Returns the zero-based index of the item with the given search text. - * -1 is returned when the string was not found. - * - * - */ -JSBool ControlWithItems::findString(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxControlWithItems *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString search; - FromJS(cx, argv[0], search); - *rval = ToJS(cx, p->FindString(search)); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Inserts the item into the list before pos. Not valid - * for wxListBox.SORT or wxComboBox.SORT styles, use Append instead. - * The returned value is the index of the new inserted item. - * - * - */ - JSBool ControlWithItems::insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxControlWithItems *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( ! FromJS(cx, argv[1], pos) ) - return JS_FALSE; - - wxString item; - FromJS(cx, argv[0], item); - *rval = ToJS(cx, p->Insert(item, pos)); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/control.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/control.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/control.h (nonexistent) @@ -1,75 +0,0 @@ -/* - * wxJavaScript - control.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: control.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSControl_H -#define _WXJSControl_H - -///////////////////////////////////////////////////////////////////////////// -// Name: control.h -// Purpose: Control ports wxControl to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 31-01-2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Control : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxControl - */ - static bool GetProperty(wxControl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxControl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxControl object is destroyed - */ - static void Destruct(JSContext *cx, wxControl *p); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - static JSBool command(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - /** - * Property Ids. - */ - enum - { - P_LABEL - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSControl_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/control.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.cpp (nonexistent) @@ -1,251 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - findrdlg.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: findrdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// findrdlg.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/jsevent.h" -#include "../event/findr.h" - -#include "findrdlg.h" -#include "finddata.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -FindReplaceDialog::FindReplaceDialog(JSContext *cx, JSObject *obj) - : wxFindReplaceDialog() - , Object(obj, cx) -{ -} - -/*** - * control/findrdlg - * gui - * - * wxFindReplaceDialog is a standard modeless dialog which is used to allow the user to search - * for some text (and possible replace it with something else). The actual searching is supposed - * to be done in the owner window which is the parent of this dialog. Note that it means that - * unlike for the other standard dialogs this one must have a parent window. - * Also note that there is no way to use this dialog in a modal way, it is always, - * by design and implementation, modeless. - * - */ -//TODO: add a sample! -WXJS_INIT_CLASS(FindReplaceDialog, "wxFindReplaceDialog", 0) - -/*** - * - * - * Get/Set the data - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FindReplaceDialog) - WXJS_PROPERTY(P_DATA, "data") -WXJS_END_PROPERTY_MAP() - -bool FindReplaceDialog::GetProperty(wxFindReplaceDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if (id == P_DATA ) - *vp = FindReplaceData::CreateObject(cx, new wxFindReplaceData(*p->GetData())); - return true; -} - -/*** - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(FindReplaceDialog) - WXJS_CONSTANT(wxFR_, REPLACEDIALOG) - WXJS_CONSTANT(wxFR_, NOUPDOWN) - WXJS_CONSTANT(wxFR_, NOMATCHCASE) - WXJS_CONSTANT(wxFR_, NOWHOLEWORD) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxFindReplaceDialog. Can't be null. - * - * - * - * The title of the dialog - * - * - * - * - * - * Constructs a new wxFindReplaceDialog object - * - * - */ -wxFindReplaceDialog *FindReplaceDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 4 ) - argc = 4; - - if ( argc == 0 ) - return new FindReplaceDialog(cx, obj); - - if ( argc < 3 ) - return NULL; - - int style = 0; - if ( argc == 4 - && ! FromJS(cx, argv[3], style) ) - return NULL; - - wxString message; - FromJS(cx, argv[2], message); - - wxFindReplaceData *data = FindReplaceData::GetPrivate(cx, argv[1]); - if ( data == NULL ) - return NULL; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - FindReplaceDialog *p = new FindReplaceDialog(cx, obj); - - // Copy the data. - p->m_data.SetFlags(data->GetFlags()); - p->m_data.SetFindString(data->GetFindString()); - p->m_data.SetReplaceString(data->GetReplaceString()); - - p->Create(parent, &p->m_data, message, style); - - return p; -} - -WXJS_BEGIN_METHOD_MAP(FindReplaceDialog) - WXJS_METHOD("create", create, 4) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The parent of wxFindReplaceDialog. Can't be null. - * - * - * - * The title of the dialog - * - * - * - * - * Creates a wxFindReplaceDialog. - * - * - */ -JSBool FindReplaceDialog::create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFindReplaceDialog *p = FindReplaceDialog::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int style = 0; - if ( ! FromJS(cx, argv[3], style) ) - return JS_FALSE; - - wxString title; - FromJS(cx, argv[2], title); - - wxFindReplaceData *data = FindReplaceData::GetPrivate(cx, argv[1]); - if ( data == NULL ) - return JS_FALSE; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - p->Create(parent, data, title, style); - return JS_TRUE; -} - -/*** - * - * The find button was pressed. The argument passed to the function is a @wxFindDialogEvent - * The find next button was pressed. The argument passed to the function is a @wxFindDialogEvent - * The replace button was pressed. The argument passed to the function is a @wxFindDialogEvent - * The replace all button was pressed. The argument passed to the function is a @wxFindDialogEvent - * The dialog is being destroyed. The argument passed to the function is a @wxFindDialogEvent - * - */ -void FindReplaceDialog::OnFind(wxFindDialogEvent& event) -{ - PrivFindDialogEvent::Fire(this, event, "onFind"); -} - -void FindReplaceDialog::OnFindNext(wxFindDialogEvent& event) -{ - PrivFindDialogEvent::Fire(this, event, "onFindNext"); -} - -void FindReplaceDialog::OnReplace(wxFindDialogEvent& event) -{ - PrivFindDialogEvent::Fire(this, event, "onFindReplace"); -} - -void FindReplaceDialog::OnReplaceAll(wxFindDialogEvent& event) -{ - PrivFindDialogEvent::Fire(this, event, "onFindReplaceAll"); -} - -void FindReplaceDialog::OnFindClose(wxFindDialogEvent& event) -{ - PrivFindDialogEvent::Fire(this, event, "onFindClose"); - Destroy(); -} - -BEGIN_EVENT_TABLE(FindReplaceDialog, wxFindReplaceDialog) - EVT_FIND(-1, FindReplaceDialog::OnFind) - EVT_FIND_NEXT(-1, FindReplaceDialog::OnFindNext) - EVT_FIND_REPLACE(-1, FindReplaceDialog::OnReplace) - EVT_FIND_REPLACE_ALL(-1, FindReplaceDialog::OnReplaceAll) - EVT_FIND_CLOSE(-1, FindReplaceDialog::OnFindClose) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.h (nonexistent) @@ -1,79 +0,0 @@ -/* - * wxJavaScript - listbox.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: listbox.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSListBox_H -#define _WXJSListBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: listbox.h -// Purpose: ListBox ports wxListBox to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 01.05.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class ListBox : public wxListBox - , public ApiWrapper - , public Object - { - public: - - ListBox(JSContext *cx, JSObject *obj); - - virtual ~ListBox(); - - static bool GetProperty(wxListBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static wxListBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxListBox *p) - { - } - - static JSBool insert_items(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool set_first_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_SELECTIONS - }; - - void OnListBox(wxCommandEvent &event); - void OnDoubleClick(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSListBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.h (nonexistent) @@ -1,198 +0,0 @@ -/* - * wxJavaScript - treectrl.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: treectrl.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTreeCtrl_H -#define _WXJSTreeCtrl_H - -///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.h -// Purpose: TreeCtrl ports wxTreeCtrl to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 03.01.2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include -namespace wxjs -{ - namespace gui - { - class TreeCtrl : public wxTreeCtrl - , public ApiWrapper - , public Object - { - public: - TreeCtrl(JSContext *cx, JSObject *obj); - - virtual ~TreeCtrl(); - - virtual int OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2); - /** - * Callback for retrieving properties of wxTreeCtrl - */ - static bool GetProperty(wxTreeCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxTreeCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxTreeCtrl object is created - */ - static wxTreeCtrl* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - /** - * Callback for when a wxTreeCtrl object is destroyed - */ - static void Destruct(JSContext *cx, wxTreeCtrl *p); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_COUNT - , P_INDENT - , P_IMAGE_LIST - , P_STATE_IMAGE_LIST - , P_ROOT_ITEM - , P_SELECTION - , P_SELECTIONS - , P_FIRST_VISIBLE - , P_EDIT_CONTROL - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemTextColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemTextColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemBackgroundColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemBackgroundColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemFont(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemFont(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemHasChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isBold(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemBold(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemDropHighlight(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isExpanded(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isSelected(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getChildrenCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getFirstChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNextChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getPrevSibling(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNextSibling(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getPrevVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNextVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool addRoot(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool appendItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool prependItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteAllItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool expand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool collapse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool collapseAndReset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool toggle(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool unselect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool unselectAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool selectItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool ensureVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool scrollTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool editLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool endEditLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool sortChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool hitTest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_CONSTANT_MAP() - - DECLARE_EVENT_TABLE() - - protected: - void onBeginDrag(wxTreeEvent &event); - void onBeginRDrag(wxTreeEvent &event); - void onBeginLabelEdit(wxTreeEvent &event); - void onEndLabelEdit(wxTreeEvent &event); - void onDeleteItem(wxTreeEvent &event); - void onGetInfo(wxTreeEvent &event); - void onSetInfo(wxTreeEvent &event); - void onItemExpanded(wxTreeEvent &event); - void onItemExpanding(wxTreeEvent &event); - void onItemCollapsed(wxTreeEvent &event); - void onItemCollapsing(wxTreeEvent &event); - void onSelChanged(wxTreeEvent &event); - void onSelChanging(wxTreeEvent &event); - void onKeyDown(wxTreeEvent &event); - void onItemActivated(wxTreeEvent &event); - void onItemRightClick(wxTreeEvent &event); - void onItemMiddleClick(wxTreeEvent &event); - void onEndDrag(wxTreeEvent &event); - }; - - /** - * Wrapper class for a treeitem. This is necessary - * to protect the JavaScript objects from garbage collection - */ - class ObjectTreeData : public wxTreeItemData - { - public: - ObjectTreeData(JSContext *cx, jsval v) : wxTreeItemData(), m_cx(cx), m_val(v) - { - if ( JSVAL_IS_GCTHING(m_val) ) - JS_AddRoot(m_cx, &m_val); - } - - virtual ~ObjectTreeData() - { - if ( JSVAL_IS_GCTHING(m_val) ) - JS_RemoveRoot(m_cx, &m_val); - } - - inline jsval GetJSVal() - { - return m_val; - } - protected: - private: - JSContext *m_cx; - jsval m_val; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTreeCtrl_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/frame.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/frame.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/frame.cpp (nonexistent) @@ -1,733 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - frame.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: frame.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// frame.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/jsevent.h" -#include "../event/evthand.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 "menubar.h" -#include "menu.h" -#include "frame.h" -#include "window.h" -#include "statbar.h" -#include "toolbar.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Frame::Frame(JSContext *cx, JSObject *obj) - : wxFrame() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Frame::~Frame() -{ - PopEventHandler(true); -} - -/*** - * control/frame - * gui - * - * A frame is a window whose size and position can (usually) be changed by the user. - * It usually has thick borders and a title bar, and can optionally contain a menu bar, - * toolbar and status bar. A frame can contain any window that is not a frame or dialog. - * - */ -WXJS_INIT_CLASS(Frame, "wxFrame", 3) - -/*** - * - * - * Set/Get the menubar - * - * - * Set/Get the statusbar - * - * - * Set/Get the number of statusbar fields. A statusbar - * is created when there isn't a statusbar created yet. - * - * - * Set/Get the pane used to display menu and toolbar help. -1 disables help display. - * - * - * Set/Get the toolbar - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Frame) - WXJS_PROPERTY(P_STATUSBAR, "statusBar") - WXJS_PROPERTY(P_TOOLBAR, "toolBar") - WXJS_PROPERTY(P_MENUBAR, "menuBar") - WXJS_PROPERTY(P_STATUSBAR_FIELDS, "statusBarFields") - WXJS_PROPERTY(P_STATUSBAR_PANE, "statusBarPane") -WXJS_END_PROPERTY_MAP() - -bool Frame::GetProperty(wxFrame *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_MENUBAR: - { - Object *menuBar = dynamic_cast(p->GetMenuBar()); - *vp = ( menuBar == NULL ) - ? JSVAL_VOID : OBJECT_TO_JSVAL(menuBar->GetObject()); - break; - } - case P_STATUSBAR: - { - Object *statBar = dynamic_cast(p->GetStatusBar()); - *vp = ( statBar == NULL ) - ? JSVAL_VOID : OBJECT_TO_JSVAL(statBar->GetObject()); - break; - } - case P_TOOLBAR: - { - Object *toolBar = dynamic_cast(p->GetToolBar()); - *vp = ( toolBar == NULL ) - ? JSVAL_VOID : OBJECT_TO_JSVAL(toolBar->GetObject()); - break; - } - case P_STATUSBAR_FIELDS: - { - wxStatusBar *statusBar = p->GetStatusBar(); - if ( statusBar == NULL ) - { - *vp = ToJS(cx, 0); - } - else - { - *vp = ToJS(cx, statusBar->GetFieldsCount()); - } - } - break; - case P_STATUSBAR_PANE: - *vp = ToJS(cx, p->GetStatusBarPane()); - break; - } - - return true; -} - -bool Frame::SetProperty(wxFrame *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_MENUBAR: - { - wxMenuBar *menuBar = MenuBar::GetPrivate(cx, *vp); - if ( menuBar != NULL ) - p->SetMenuBar(menuBar); - break; - } - case P_STATUSBAR: - { - wxStatusBar *bar = StatusBar::GetPrivate(cx, *vp); - if ( bar != NULL ) - p->SetStatusBar(bar); - break; - } - case P_TOOLBAR: - { - wxToolBar *bar = ToolBar::GetPrivate(cx, *vp); - if ( bar != NULL ) - p->SetToolBar(bar); - break; - } - case P_STATUSBAR_FIELDS: - { - wxStatusBar *statusBar = p->GetStatusBar(); - int fields; - if ( FromJS(cx, *vp, fields) - && fields > 0 ) - { - if ( statusBar == (wxStatusBar*) NULL ) - { - p->CreateStatusBar(fields); - } - else - { - statusBar->SetFieldsCount(fields); - } - } - break; - } - case P_STATUSBAR_PANE: - { - int pane; - if ( FromJS(cx, *vp, pane) ) - p->SetStatusBarPane(pane); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Frame) - // Style constants - WXJS_CONSTANT(wx, DEFAULT_FRAME_STYLE) - WXJS_CONSTANT(wx, ICONIZE) - WXJS_CONSTANT(wx, CAPTION) - WXJS_CONSTANT(wx, MINIMIZE) - WXJS_CONSTANT(wx, MINIMIZE_BOX) - WXJS_CONSTANT(wx, MAXIMIZE) - WXJS_CONSTANT(wx, MAXIMIZE_BOX) - WXJS_CONSTANT(wx, STAY_ON_TOP) - WXJS_CONSTANT(wx, SYSTEM_MENU) - WXJS_CONSTANT(wx, SIMPLE_BORDER) - WXJS_CONSTANT(wx, RESIZE_BORDER) - WXJS_CONSTANT(wx, FRAME_FLOAT_ON_PARENT) - WXJS_CONSTANT(wx, FRAME_TOOL_WINDOW) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of the wxFrame. Pass null, when you don't have a parent. - * - * - * The windows identifier. -1 can be used when you don't need a unique id. - * - * - * The caption of the frame. - * - * - * The position of the frame. - * - * - * The size of the frame. - * - * - * The style of the frame. - * - * - * - * The caption of the frame - * - * - * Creates a new wxFrame object - * - * - */ -wxFrame* Frame::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 1 ) - { - wxString title; - FromJS(cx, argv[0], title); - wxFrame *p = new Frame(cx, obj); - p->Create(NULL, -1, title); - return p; - } - - if ( argc > 6 ) - argc = 6; - - int style = wxDEFAULT_FRAME_STYLE; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - - switch(argc) - { - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString title; - FromJS(cx, argv[2], title); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = NULL; - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - } - wxFrame *p = new Frame(cx, obj); - p->Create((wxWindow *) parent, id, title, *pt, *size, style); - return p; - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(Frame) - WXJS_METHOD("processCommand", processCommand, 1) - WXJS_METHOD("createStatusBar", createStatusBar, 0) - WXJS_METHOD("setStatusText", setStatusText, 1) - WXJS_METHOD("setStatusWidths", setStatusWidths, 1) - WXJS_METHOD("createToolBar", createToolBar, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Identifier of a menu. - * - * - * - * Simulates a menu command. - * - * - */ -JSBool Frame::processCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFrame *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( ! FromJS(cx, argv[0], id) ) - return JS_FALSE; - - p->ProcessCommand(id); - - return JS_TRUE; -} - -/*** - * - * - * - * The number of fields. Default is 1. - * - * - * The style of the statusbar. - * - * - * A unique id for the statusbar. - * - * - * - * Creates a status bar at the bottom of the frame. - *
Remark: - * The width of the status bar is the whole width of the frame - * (adjusted automatically when resizing), and the height and text size - * are chosen by the host windowing system - *
- *
- */ -JSBool Frame::createStatusBar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFrame *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int fields = 1; - long style = 0; - int id = -1; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], id) ) - return JS_FALSE; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], style) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], fields) ) - return JS_FALSE; - // Fall through - } - - StatusBar *bar = dynamic_cast(p->CreateStatusBar(fields, style, id)); - *rval = ( p == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(bar->GetObject()); - - return JS_TRUE; -} - -/*** - * - * - * - * The toolbar style - * - * - * A unique id for the toolbar - * - * - * - * Creates a toolbar at the top or left of the frame. - * - * - */ -JSBool Frame::createToolBar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFrame *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long style = wxNO_BORDER | wxTB_HORIZONTAL; - int id = -1; - - switch(argc) - { - case 2: - if ( ! FromJS(cx, argv[1], id) ) - return JS_FALSE; - // Fall through - case 1: - if ( ! FromJS(cx, argv[0], style) ) - return JS_FALSE; - // Fall through - } - - ToolBar *bar = dynamic_cast(p->CreateToolBar(style, id)); - *rval = ( p == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(bar->GetObject()); - - return JS_TRUE; -} - -/*** - * - * - * - * The text to set in the status field - * - * - * The number of the field (zero indexed) - * - * - * - * Sets the text of the given status field. When no field is specified, the first one is used. - * - * - */ -JSBool Frame::setStatusText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFrame *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxStatusBar *statusBar = p->GetStatusBar(); - if ( statusBar != (wxStatusBar*) NULL ) - { - wxString text; - FromJS(cx, argv[0], text); - - int field = 0; - if ( argc == 2 - && ! FromJS(cx, argv[1], field) ) - return JS_FALSE; - - if ( field >= 0 - && field < statusBar->GetFieldsCount() ) - { - p->SetStatusText(text, field); - } - } - - return JS_TRUE; -} - -/*** - * - * - * - * Contains an array of status field width in pixels. - * A value of -1 indicates that the field is variable width. - * At least one field must be -1. - * - * - * - * Sets the widths of the fields in the status bar. - * When the array contains more elements then fields, - * those elements are discarded. See also @wxStatusBar#statusWidths. - * - * - */ -JSBool Frame::setStatusWidths(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxFrame *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxStatusBar *statusBar = p->GetStatusBar(); - if ( statusBar == (wxStatusBar*) NULL ) - return JS_TRUE; - - if ( JSVAL_IS_OBJECT(argv[0]) ) - { - JSObject *obj = JSVAL_TO_OBJECT(argv[0]); - if ( JS_IsArrayObject(cx, obj) == JS_TRUE ) - { - jsuint length = 0; - JS_GetArrayLength(cx, obj, &length); - uint fields = statusBar->GetFieldsCount(); - if ( length > fields ) - length = fields; - int *widths = new int[length]; - for(jsuint i =0; i < length; i++) - { - jsval element; - JS_GetElement(cx, obj, i, &element); - if ( ! FromJS(cx, element, widths[i]) ) - { - delete[] widths; - return JS_FALSE; - } - } - p->SetStatusWidths(length, widths); - delete[] widths; - } - } - return JS_TRUE; -} - -wxToolBar* Frame::OnCreateToolBar(long style, - wxWindowID id, - const wxString& name) -{ - JSContext *cx = GetContext(); - jsval argv[] = - { - OBJECT_TO_JSVAL(GetObject()), - ToJS(cx, id), - Point::CreateObject(cx, new wxPoint(wxDefaultPosition)), - Size::CreateObject(cx, new wxSize(wxDefaultSize)), - ToJS(cx, style) - }; - JSObject *obj = JS_ConstructObjectWithArguments(cx, - ToolBar::GetClass(), - NULL, - GetObject(), 5, argv); - return ToolBar::GetPrivate(cx, obj, false); -} - -wxStatusBar* Frame::OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name) -{ - JSContext *cx = GetContext(); - jsval argv[] = - { - OBJECT_TO_JSVAL(GetObject()), - ToJS(cx, id), - ToJS(cx, style) - }; - JSObject *obj = JS_ConstructObjectWithArguments(GetContext(), - StatusBar::GetClass(), - NULL, - GetObject(), 3, argv); - wxStatusBar *bar = StatusBar::GetPrivate(cx, obj, false); - bar->SetFieldsCount(number); - return bar; -} - -void Frame::OnMenu(wxCommandEvent &event) -{ - wxMenuItem *item = GetMenuBar()->FindItem(event.GetId()); - if ( item == NULL ) - return; - - Menu *menu = (Menu *) item->GetMenu(); - Object *menuObject = dynamic_cast(menu); - if ( menuObject == NULL ) - return; - - JSContext *cx = menuObject->GetContext(); - - jsval actions; - if ( JS_GetProperty(cx, menuObject->GetObject(), "actions", &actions) == JS_TRUE - && JSVAL_IS_OBJECT(actions) - && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(actions)) == JS_TRUE ) - { - jsval element; - if ( JS_GetElement(cx, JSVAL_TO_OBJECT(actions), event.GetId(), &element) == JS_TRUE ) - { - JSFunction *action = JS_ValueToFunction(cx, element); - if ( action != NULL ) - { - PrivCommandEvent *wxjsEvent = new PrivCommandEvent(event); - jsval argv[] = { CommandEvent::CreateObject(cx, wxjsEvent) }; - - jsval rval; - JSBool result = JS_CallFunction(cx, GetObject(), action, 1, argv, &rval); - if ( result == JS_FALSE ) - { - JS_ReportPendingException(cx); - } - } - } - else - { - event.Skip(); - } - } -} - -void Frame::OnTool(wxCommandEvent &event) -{ - ToolBar *bar = dynamic_cast(GetToolBar()); - if ( bar == NULL ) - return; - - JSObject *toolObject = bar->GetObject(); - JSContext *cx = bar->GetContext(); - - jsval actions; - if ( JS_GetProperty(cx, toolObject, "actions", &actions) == JS_TRUE - && JSVAL_IS_OBJECT(actions) - && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(actions)) == JS_TRUE ) - { - jsval element; - if ( JS_GetElement(cx, JSVAL_TO_OBJECT(actions), event.GetId(), &element) == JS_TRUE ) - { - JSFunction *action = JS_ValueToFunction(cx, element); - if ( action != NULL ) - { - PrivCommandEvent *wxjsEvent = new PrivCommandEvent(event); - jsval argv[] = { CommandEvent::CreateObject(cx, wxjsEvent) }; - - jsval rval; - JSBool result = JS_CallFunction(cx, GetObject(), action, 1, argv, &rval); - if ( result == JS_FALSE ) - { - JS_ReportPendingException(cx); - } - } - } - } -} - -/*** - * - * - * Called when the frame is closed. The type of the argument that your handler receives - * is @wxCloseEvent. - * - * - * An event being sent when the frame is iconized (minimized). - * Currently only wxMSW and wxGTK generate such events. - * The type of the argument that your handler receives - * is @wxIconizeEvent. When you handle this event, - * don't forget to set @wxEvent#skip to true. - * Otherwise the frame will not be iconized. - * - * - * An event being sent when the frame is maximized. - * The type of the argument that your handler receives - * is @wxMaximizeEvent. When you handle this event, - * don't forget to set @wxEvent#skip to true. - * Otherwise the frame will not be maximized. - * - * - */ -void Frame::OnClose(wxCloseEvent &event) -{ - bool destroy = true; - - if ( PrivCloseEvent::Fire(this, event, "onClose") ) - { - destroy = ! event.GetVeto(); - } - - // When the close event is not handled by JavaScript, - // wxJS destroys the frame. - if ( destroy ) - { - Destroy(); - } -} - -void Frame::OnIconize(wxIconizeEvent &event) -{ - PrivIconizeEvent::Fire(this, event, "onIconize"); -} - -void Frame::OnMaximize(wxMaximizeEvent &event) -{ - PrivMaximizeEvent::Fire(this, event, "onMaximize"); -} - -BEGIN_EVENT_TABLE(Frame, wxFrame) - EVT_MENU_RANGE(-1, -1, Frame::OnMenu) - EVT_TOOL_RANGE(-1, -1, Frame::OnTool) - EVT_CLOSE(Frame::OnClose) - EVT_ICONIZE(Frame::OnIconize) - EVT_MAXIMIZE(Frame::OnMaximize) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/frame.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/choice.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/choice.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/choice.cpp (nonexistent) @@ -1,221 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - choice.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: choice.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -//choice.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "window.h" -#include "choice.h" -#include "item.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/choice - * gui - * - * A choice item is used to select one of a list of strings. - * Unlike a listbox, only the selection is visible until the - * user pulls down the menu of choices. An example: - *

- *	 var items = new Array();
- *	 items[0] = "Opel";
- *	 items[1] = "Ford";
- *	 items[2] = "BMW";
- *	 // dlg is a wxDialog
- *	 var choice = new wxChoice(dlg, -1, wxDefaultPosition, wxDefaultSize, items);
- *   
- *
- */ -WXJS_INIT_CLASS(Choice, "wxChoice", 2) - -/*** - * - * - * Gets/Sets the number of columns - * - * - */ - -WXJS_BEGIN_PROPERTY_MAP(Choice) - WXJS_PROPERTY(P_COLUMNS, "columns") -WXJS_END_PROPERTY_MAP() - -Choice::Choice(JSContext *cx, - JSObject *obj) : wxChoice() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Choice::~Choice() -{ - PopEventHandler(true); -} - -bool Choice::GetProperty(wxChoice *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_COLUMNS: - *vp = ToJS(cx, p->GetColumns()); - break; - } - return true; -} - -bool Choice::SetProperty(wxChoice *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_COLUMNS: - { - int columns; - if ( FromJS(cx, *vp, columns) ) - p->SetColumns(columns); - break; - } - } - return true; -} - -/*** - * - * - * - * The parent of the control - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The position of the choice control on the given parent. - * - * - * The size of the choice control. - * - * - * An array of Strings to initialize the control. - * - * - * The style of the control - * - * - * A validator - * - * - * - * Constructs a new wxChoice object. - * - * - */ -wxChoice *Choice::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - StringsPtr items; - const wxValidator *val = &wxDefaultValidator; - - if ( argc > 7 ) - argc = 7; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], items) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - Choice *p = new Choice(cx, obj); - p->Create(parent, id, *pt, *size, items.GetCount(), items.GetStrings(), style, *val); - - return p; - } - - return NULL; -} - -/*** - * - * - * Called when an item is selected. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - */ -void Choice::OnChoice(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onChoice"); -} - -BEGIN_EVENT_TABLE(Choice, wxChoice) - EVT_CHOICE(-1, Choice::OnChoice) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/choice.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.cpp (nonexistent) @@ -1,284 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - caldate.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: caldate.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// caldate.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include - -/*** - * control/caldate - * gui - * - * wxCalendarDateAttr contains all attributes for a calendar date. - * See @wxCalendarCtrl. - * - */ - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../misc/colour.h" -#include "../misc/font.h" - -#include "calendar.h" -#include "caldate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -WXJS_INIT_CLASS(CalendarDateAttr, "wxCalendarDateAttr", 0) - -/*** - * - * The background colour - * Type of the border. See @wxCalendarDateBorder. - * The colour of the border - * The font of the text - * Is the day a holiday? - * The colour of the text - * - */ -WXJS_BEGIN_PROPERTY_MAP(CalendarDateAttr) - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_PROPERTY(P_BG_COLOUR, "backgroundColour") - WXJS_PROPERTY(P_BORDER_COLOUR, "borderColour") - WXJS_PROPERTY(P_FONT, "font") - WXJS_PROPERTY(P_BORDER, "border") - WXJS_PROPERTY(P_HOLIDAY, "holiday") -WXJS_END_PROPERTY_MAP() - -bool CalendarDateAttr::GetProperty(wxCalendarDateAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id > 0 && id < 32 ) // Check the day property - { - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for CalendarDateAttr")); - - wxCalendarCtrl *calendar = CalendarCtrl::GetPrivate(cx, parent); - if ( calendar == NULL ) - return false; - - wxCalendarDateAttr *attr = calendar->GetAttr(id); - SetPrivate(cx, obj, (attr == NULL) ? new wxCalendarDateAttr() - : CalendarDateAttr::Clone(attr)); - } - else - { - switch (id) - { - case P_TEXT_COLOUR: - if ( p->HasTextColour() ) - { - *vp = Colour::CreateObject(cx, new wxColour(p->GetTextColour())); - } - break; - case P_BG_COLOUR: - if ( p->HasBackgroundColour() ) - { - *vp = Colour::CreateObject(cx, new wxColour(p->GetBackgroundColour())); - } - break; - case P_BORDER_COLOUR: - if ( p->HasBorderColour() ) - { - *vp = Colour::CreateObject(cx, new wxColour(p->GetBorderColour())); - } - break; - case P_FONT: - if ( p->HasFont() ) - { - *vp = Font::CreateObject(cx, new wxFont(p->GetFont()), obj); - } - break; - case P_BORDER: - if ( p->HasBorder() ) - { - *vp = ToJS(cx, static_cast(p->GetBorder())); - } - break; - case P_HOLIDAY: - *vp = ToJS(cx, p->IsHoliday()); - break; - } - } - return true; -} - -bool CalendarDateAttr::SetProperty(wxCalendarDateAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id > 0 && id < 32 ) - { - JSObject *parent = JS_GetParent(cx, obj); - wxASSERT_MSG(parent != NULL, wxT("No parent found for CalendarAttrItem")); - - wxCalendarCtrl *calendar = CalendarCtrl::GetPrivate(cx, parent); - if ( calendar == NULL ) - return false; - - wxCalendarDateAttr *attr = GetPrivate(cx, *vp); - // Clone the attribute because it is owned and destroyed by wxWindows - // which can give problems. For example: when the calendar object is - // garbage collected and the attr object is not, the attr object - // would have an invalid pointer. - calendar->SetAttr(id, CalendarDateAttr::Clone(attr)); - } - else - { - switch (id) - { - case P_TEXT_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetTextColour(*colour); - } - break; - case P_BG_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetBackgroundColour(*colour); - } - break; - case P_BORDER_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetBorderColour(*colour); - } - break; - case P_FONT: - { - wxFont *font = Font::GetPrivate(cx, *vp); - if ( font != NULL ) - p->SetFont(*font); - } - break; - case P_BORDER: - { - int border; - if ( FromJS(cx, *vp, border) ) - p->SetBorder((wxCalendarDateBorder)border); - break; - } - case P_HOLIDAY: - { - bool holiday; - if ( FromJS(cx, *vp, holiday) ) - p->SetHoliday(holiday); - break; - } - } - } - return true; -} - -/*** - * - * - * - * Colour of the text - * Backgroundcolour - * BorderColour - * The font - * The border type - * - * - * The border type - * BorderColour - * - * - * Constructs a new wxCalendarDateAttr object. - * - * - */ -wxCalendarDateAttr* CalendarDateAttr::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxCalendarDateAttr(); - - if ( Colour::HasPrototype(cx, argv[0]) ) - { - if ( argc > 5 ) - return NULL; - - int border = wxCAL_BORDER_NONE; - const wxColour *textColour = &wxNullColour; - const wxColour *bgColour = &wxNullColour; - const wxColour *borderColour = &wxNullColour; - const wxFont *font = &wxNullFont; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], border) ) - break; - // Fall through - case 4: - font = Font::GetPrivate(cx, argv[3]); - if ( font == NULL ) - break; - // Fall through - case 3: - borderColour = Colour::GetPrivate(cx, argv[2]); - if ( borderColour == NULL ) - break; - // Fall through - case 2: - bgColour = Colour::GetPrivate(cx, argv[1]); - if ( bgColour == NULL ) - break; - // Fall through - default: - textColour = Colour::GetPrivate(cx, argv[0]); - if ( textColour == NULL ) - break; - - return new wxCalendarDateAttr(*textColour, *bgColour, - *borderColour, *font, - (wxCalendarDateBorder) border); - } - - return NULL; - } - else - { - int border; - if ( ! FromJS(cx, argv[0], border) ) - return NULL; - - const wxColour *colour = &wxNullColour; - if ( argc > 1 - && (colour = Colour::GetPrivate(cx, argv[1])) == NULL ) - return NULL; - - return new wxCalendarDateAttr((wxCalendarDateBorder) border, *colour); - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.h (nonexistent) @@ -1,94 +0,0 @@ -/* - * wxJavaScript - menubar.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: menubar.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMENUBAR_H -#define _WXJSMENUBAR_H - -///////////////////////////////////////////////////////////////////////////// -// Name: menubar.h -// Purpose: MenuBar ports wxMenuBar to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 19.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class MenuBar : public wxMenuBar - , public ApiWrapper - , public Object - { - public: - - /** - * Constructor - */ - MenuBar(JSContext *cx, JSObject *obj); - MenuBar(JSContext *cx, JSObject *obj, long style); - - virtual ~MenuBar(); - - static bool GetProperty(wxMenuBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxMenuBar* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxMenuBar *p); - - static JSBool append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool get_menu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool check(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enableTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findMenuItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getLabelTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isChecked(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool refresh(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setLabelTop(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_MENUCOUNT - , P_MENUS - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _WXJSMENUBAR_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menubar.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.cpp (nonexistent) @@ -1,171 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - fontdata.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: fontdata.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// fontdata.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "fontdata.h" - -#include "../misc/font.h" -#include "../misc/colour.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/fontdata - * gui - * - * This class holds a variety of information related to font dialogs. - * See @wxFontDialog - * - */ -WXJS_INIT_CLASS(FontData, "wxFontData", 0) - -/*** - * - * - * Under MS Windows, get/set a flag determining whether symbol fonts can be selected. - * Has no effect on other platforms - * - * - * Get/Set whether 'effects' are enabled under Windows. This refers to the controls for - * manipulating colour, strikeout and underline properties. - * - * - * Get the selected font - * - * - * - * Get/Set the font that will be initially used by the font dialog - * - * - * Show the help button? Windows only. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FontData) - WXJS_PROPERTY(P_ALLOW_SYMBOLS, "allowSymbols") - WXJS_PROPERTY(P_ENABLE_EFFECTS, "enableEffects") - WXJS_PROPERTY(P_CHOSEN_FONT, "chosenFont") - WXJS_PROPERTY(P_COLOUR, "colour") - WXJS_PROPERTY(P_INITIAL_FONT, "initialFont") - WXJS_PROPERTY(P_SHOW_HELP, "showHelp") -WXJS_END_PROPERTY_MAP() - -bool FontData::GetProperty(wxFontData *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ALLOW_SYMBOLS: - *vp = ToJS(cx, p->GetAllowSymbols()); - break; - case P_ENABLE_EFFECTS: - *vp = ToJS(cx, p->GetEnableEffects()); - break; - case P_CHOSEN_FONT: - *vp = Font::CreateObject(cx, new wxFont(p->GetChosenFont()), obj); - break; - case P_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(p->GetColour())); - break; - case P_INITIAL_FONT: - *vp = Font::CreateObject(cx, new wxFont(p->GetInitialFont()), obj); - break; - case P_SHOW_HELP: - *vp = ToJS(cx, p->GetShowHelp()); - break; - } - return true; -} - -bool FontData::SetProperty(wxFontData *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ALLOW_SYMBOLS: - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->SetAllowSymbols(value); - break; - } - case P_ENABLE_EFFECTS: - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->EnableEffects(value); - break; - } - case P_CHOSEN_FONT: - { - wxFont *value = Font::GetPrivate(cx, *vp); - if ( value != NULL ) - p->SetChosenFont(*value); - break; - } - case P_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetColour(*colour); - break; - } - case P_INITIAL_FONT: - { - wxFont *value = Font::GetPrivate(cx, *vp); - if ( value != NULL ) - p->SetInitialFont(*value); - break; - } - case P_SHOW_HELP: - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->SetShowHelp(value); - break; - } - } - return true; -} - -/*** - * - * - * - * Constructs a new wxFontData object. - * - * - */ -wxFontData* FontData::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - return new wxFontData(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdata.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - helpbtn.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: helpbtn.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSContextHelpButton_H -#define _WXJSContextHelpButton_H - -///////////////////////////////////////////////////////////////////////////// -// Name: helpbtn.h -// Purpose: ContextHelpButton ports wxContextHelpButton to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 27.09.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class ContextHelpButton : public wxContextHelpButton - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - ContextHelpButton(wxWindow *parent, JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~ContextHelpButton(); - - static wxContextHelpButton* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxContextHelpButton *p) - { - } - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSContextHelpButton_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.cpp (nonexistent) @@ -1,1193 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - toolbar.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: toolbar.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// toolbar.cpp - -#include -#ifndef WX_PRECOMP - #include -#endif - -#include - -#include "../../common/main.h" - -#include "../misc/app.h" - -#include "../event/jsevent.h" -#include "../event/evthand.h" -#include "../event/command.h" - -#include "window.h" -#include "control.h" -#include "toolbar.h" - -#include "../misc/point.h" -#include "../misc/bitmap.h" -#include "../misc/size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -ToolBar::ToolBar(JSContext *cx, JSObject *obj) - : wxToolBar() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -ToolBar::~ToolBar() -{ - PopEventHandler(true); -} - -/*** - * control/toolbar - * gui - * - * A toolbar.

- * Event handling is done as follows: - * When a menu exists with the same id of the selected tool, the menu action is executed. - * When there is no menu, the action associated with the toolbar is executed. - * See @wxToolBar#actions and @wxMenu#actions - *

- * See also @wxFrame#createToolBar - *
- */ -WXJS_INIT_CLASS(ToolBar, "wxToolBar", 2) - -/*** - * - * - * An array containing the function callbacks. A function will be called when a tool is selected. - * Use the id as index of the array. - * - * - * Gets/Sets the left/right and top/bottom margins, which are also used for inter-toolspacing. - * - * - * Gets/Sets the size of bitmap that the toolbar expects to have. - * The default bitmap size is 16 by 15 pixels. - * - * - * Gets/Sets the value used for spacing tools. The default value is 1. - * The packing is used for spacing in the vertical direction if the toolbar is horizontal, - * and for spacing in the horizontal direction if the toolbar is vertical. - * - * - * Gets/Sets the separator size. The default value is 5. - * - * - * Gets the size of a whole button, which is usually larger than a tool bitmap - * because of added 3D effects. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ToolBar) - WXJS_PROPERTY(P_TOOL_SIZE, "margins") - WXJS_READONLY_PROPERTY(P_TOOL_SIZE, "toolSize") - WXJS_PROPERTY(P_TOOL_BITMAP_SIZE, "toolBitmapSize") - WXJS_PROPERTY(P_TOOL_PACKING, "toolPacking") - WXJS_PROPERTY(P_TOOL_SEPARATION, "toolSeparation") -WXJS_END_PROPERTY_MAP() - -bool ToolBar::GetProperty(wxToolBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_TOOL_SIZE: - { - const wxSize &size = p->GetToolSize(); - *vp = Size::CreateObject(cx, new wxSize(size)); - break; - } - case P_TOOL_BITMAP_SIZE: - { - const wxSize &size = p->GetToolBitmapSize(); - *vp = Size::CreateObject(cx, new wxSize(size)); - break; - } - case P_MARGINS: - *vp = Size::CreateObject(cx, new wxSize(p->GetMargins())); - break; - case P_TOOL_PACKING: - *vp = ToJS(cx, p->GetToolPacking()); - break; - case P_TOOL_SEPARATION: - *vp = ToJS(cx, p->GetToolSeparation()); - break; - } - return true; -} - -bool ToolBar::SetProperty(wxToolBar *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_TOOL_BITMAP_SIZE: - { - wxSize *size = Size::GetPrivate(cx, *vp); - if ( size != NULL ) - p->SetToolBitmapSize(*size); - break; - } - case P_MARGINS: - { - wxSize *size = Size::GetPrivate(cx, *vp); - if ( size != NULL ) - p->SetMargins(size->GetWidth(), size->GetHeight()); - break; - } - case P_TOOL_PACKING: - { - int pack; - if ( FromJS(cx, *vp, pack) ) - p->SetToolPacking(pack); - break; - } - case P_TOOL_SEPARATION: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetToolSeparation(size); - break; - } - } - return true; -} - -/*** - * - * - * Gives the toolbar a flat look ('coolbar' or 'flatbar' style). Windows 95 and GTK 1.2 only. - * Makes the toolbar floatable and dockable. GTK only. - * Specifies horizontal layout. - * Specifies vertical layout (not available for the GTK and Windows 95 toolbar). - * Gives wxToolBarSimple a mild 3D look to its buttons. - * Show the text in the toolbar buttons; by default only icons are shown. - * Specifies no icons in the toolbar buttons; by default they are shown. - * Specifies no divider above the toolbar; by default it is shown. Windows only. - * Specifies no alignment with the parent window. Windows only. - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(ToolBar) - WXJS_CONSTANT(wxTB_, FLAT) - WXJS_CONSTANT(wxTB_, DOCKABLE) - WXJS_CONSTANT(wxTB_, HORIZONTAL) - WXJS_CONSTANT(wxTB_, VERTICAL) - WXJS_CONSTANT(wxTB_, 3DBUTTONS) - WXJS_CONSTANT(wxTB_, TEXT) - WXJS_CONSTANT(wxTB_, NOICONS) - WXJS_CONSTANT(wxTB_, NODIVIDER) - WXJS_CONSTANT(wxTB_, NOALIGN) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxToolBar. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The position of the ToolBar control on the given parent. - * - * - * The size of the ToolBar control. - * - * - * The wxToolBar style. - * - * - * - * Constructs a new wxToolBar object. - * - * - */ -wxToolBar* ToolBar::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 5 ) - argc = 5; - - int style = wxTB_HORIZONTAL | wxNO_BORDER; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxToolBar *p = new ToolBar(cx, obj); - p->Create(parent, id, *pt, *size, style); - - JSObject *objActionArray = JS_NewArrayObject(cx, 0, NULL); - JS_DefineProperty(cx, obj, "actions", OBJECT_TO_JSVAL(objActionArray), - NULL, NULL, JSPROP_ENUMERATE |JSPROP_PERMANENT); - - return p; - } - - return NULL; -} - -void ToolBar::Destruct(JSContext *cx, wxToolBar* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(ToolBar) - WXJS_METHOD("addControl", addControl, 1) - WXJS_METHOD("addSeparator", addSeparator, 0) - WXJS_METHOD("addTool", addTool, 3) - WXJS_METHOD("addCheckTool", addCheckTool, 4) - WXJS_METHOD("addRadioTool", addRadioTool, 4) - WXJS_METHOD("deleteTool", deleteTool, 1) - WXJS_METHOD("deleteToolByPos", deleteToolByPos, 1) - WXJS_METHOD("enableTool", enableTool, 2) - WXJS_METHOD("findControl", findControl, 1) - WXJS_METHOD("getToolClientData", getToolClientData, 1) - WXJS_METHOD("getToolEnabled", getToolEnabled, 1) - WXJS_METHOD("getToolLongHelp", getToolLongHelp, 1) - WXJS_METHOD("getToolShortHelp", getToolShortHelp, 1) - WXJS_METHOD("getToolState", getToolState, 1) - WXJS_METHOD("insertControl", insertControl, 2) - WXJS_METHOD("insertSeparator", insertSeparator, 1) - WXJS_METHOD("insertTool", insertTool, 3) - WXJS_METHOD("realize", realize, 0) - WXJS_METHOD("setToolClientData", setToolClientData, 2) - WXJS_METHOD("setToolLongHelp", setToolLongHelp, 2) - WXJS_METHOD("setToolShortHelp", setToolShortHelp, 2) - WXJS_METHOD("toggleTool", toggleTool, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * Adds a control to the toolbar. - * - * - */ -JSBool ToolBar::addControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = ToolBar::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxControl *control = Control::GetPrivate(cx, argv[0]); - if ( control != NULL ) - { - p->AddControl(control); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Adds a separator for spacing groups of tools. - * - * - */ -JSBool ToolBar::addSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->AddSeparator(); - return JS_TRUE; -} - -/*** - * - * - * - * An integer that may be used to identify this tool - * - * - * - * The primary tool bitmap for toggle and button tools. - * - * - * Used for tooltips - * - * - * May be wxItemKind.NORMAL for a normal button (default), - * wxItemKind.CHECK for a checkable tool (such tool stays pressed after it had been toggled) - * or wxItemKind.RADIO for a checkable tool which makes part of a radio group of tools each - * of which is automatically unchecked whenever another button in the group is checked. - * - * - * - * - * An integer that may be used to identify this tool - * - * - * - * The primary tool bitmap for toggle and button tools. - * - * - * The second bitmap specifies the on-state bitmap for a toggle tool - * - * - * May be wxItemKind.NORMAL for a normal button (default), - * wxItemKind.CHECK for a checkable tool (such tool stays pressed after it had been toggled) - * or wxItemKind.RADIO for a checkable tool which makes part of a radio group of tools each - * of which is automatically unchecked whenever another button in the group is checked. - * - * - * Used for tooltips - * - * - * String shown in the statusbar. - * - * - * Data associated with this tool. - * - * - * - * Adds a tool to the toolbar. - * - * - */ -JSBool ToolBar::addTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( ! FromJS(cx, argv[0], id) ) - return JS_FALSE; - - wxString label; - FromJS(cx, argv[1], label); - wxBitmap *bmp1 = Bitmap::GetPrivate(cx, argv[2]); - if ( bmp1 == NULL ) - return JS_FALSE; - - wxToolBarToolBase *tool = NULL; - if ( argc > 3 ) - { - wxString shortHelp = wxEmptyString; - int kind = wxITEM_NORMAL; - wxBitmap *bmp2 = Bitmap::GetPrivate(cx, argv[3], false); - if ( bmp2 == NULL ) - { - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], kind) ) - return JS_FALSE; - case 4: - FromJS(cx, argv[3], shortHelp); - } - tool = p->AddTool(id, label, *bmp1, shortHelp, (wxItemKind) kind); - } - else - { - wxString longHelp = wxEmptyString; - ToolData *data = NULL; - - switch(argc) - { - case 8: // Data - data = new ToolData(cx, argv[7]); - case 7: - FromJS(cx, argv[6], longHelp); - case 6: - FromJS(cx, argv[5], shortHelp); - case 5: - if ( ! FromJS(cx, argv[4], kind) ) - { - if ( data != NULL ) - delete data; - return JS_FALSE; - } - } - tool = p->AddTool(id, label, *bmp1, *bmp2, (wxItemKind) kind, - shortHelp, longHelp, data); - } - } - else - tool = p->AddTool(id, label, *bmp1); - return JS_TRUE; -} - -/*** - * - * - * - * An integer that may be used to identify this tool - * - * - * - * The primary tool bitmap for toggle and button tools. - * - * - * The second bitmap specifies the on-state bitmap for a toggle tool - * - * - * Used for tooltips - * - * - * String shown in the statusbar. - * - * - * Data associated with this tool. - * - * - * - * Adds a new check (or toggle) tool to the toolbar. - * - * - */ -JSBool ToolBar::addCheckTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - ToolData *data = NULL; - wxString longHelp = wxEmptyString; - wxString shortHelp = wxEmptyString; - - switch(argc) - { - case 7: - data = new ToolData(cx, argv[6]); - case 6: - FromJS(cx, argv[5], longHelp); - case 5: - FromJS(cx, argv[4], shortHelp); - default: - { - int id; - if ( ! FromJS(cx, argv[0], id) ) - { - delete data; - return JS_FALSE; - } - - wxString label; - FromJS(cx, argv[1], label); - wxBitmap *bmp1 = Bitmap::GetPrivate(cx, argv[2]); - if ( bmp1 == NULL ) - { - delete data; - return JS_FALSE; - } - wxBitmap *bmp2 = Bitmap::GetPrivate(cx, argv[3]); - if ( bmp2 == NULL ) - { - delete data; - return JS_FALSE; - } - p->AddCheckTool(id, label, *bmp1, *bmp2, shortHelp, longHelp, data); - } - } - return JS_TRUE; -} - -/*** - * - * - * - * An integer that may be used to identify this tool - * - * - * - * The primary tool bitmap for toggle and button tools. - * - * - * The second bitmap specifies the on-state bitmap for a toggle tool - * - * - * Used for tooltips - * - * - * String shown in the statusbar. - * - * - * Data associated with this tool. - * - * - * - * Adds a new radio tool to the toolbar. Consecutive radio tools form a radio group - * such that exactly one button in the group is pressed at any moment, in other words - * whenever a button in the group is pressed the previously pressed button is - * automatically released. You should avoid having the radio groups of only one - * element as it would be impossible for the user to use such button. - *

- * By default, the first button in the radio group is initially pressed, the others are not. - *
- *
- */ -JSBool ToolBar::addRadioTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - ToolData *data = NULL; - wxString longHelp = wxEmptyString; - wxString shortHelp = wxEmptyString; - - switch(argc) - { - case 7: - data = new ToolData(cx, argv[6]); - case 6: - FromJS(cx, argv[5], longHelp); - case 5: - FromJS(cx, argv[4], shortHelp); - default: - { - int id; - if ( ! FromJS(cx, argv[0], id) ) - { - delete data; - return JS_FALSE; - } - - wxString label; - FromJS(cx, argv[1], label); - wxBitmap *bmp1 = Bitmap::GetPrivate(cx, argv[2]); - if ( bmp1 == NULL ) - { - delete data; - return JS_FALSE; - } - wxBitmap *bmp2 = Bitmap::GetPrivate(cx, argv[3]); - if ( bmp2 == NULL ) - { - delete data; - return JS_FALSE; - } - p->AddRadioTool(id, label, *bmp1, *bmp2, shortHelp, longHelp, data); - } - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Deletes the tool with the given id. - * - * - */ -JSBool ToolBar::deleteTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->DeleteTool(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Deletes the tool on the given position. - * - * - */ -JSBool ToolBar::deleteToolByPos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->DeleteToolByPos(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * Enable/disable the tool - * - * - * - * Enables/disables the tool with the given id. - * - * - */ -JSBool ToolBar::enableTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - bool enable; - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], enable) ) - { - p->EnableTool(id, enable); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns the control identified by Id or null when not found. - * - * - */ -JSBool ToolBar::findControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - wxControl *ctrl = p->FindControl(id); - if ( ctrl == NULL ) - { - *rval = JSVAL_VOID; - } - else - { - Object *wxjsObj = dynamic_cast(ctrl); - *rval = wxjsObj == NULL ? JSVAL_VOID : OBJECT_TO_JSVAL(wxjsObj->GetObject()); - } - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns the data associated with the tool. - * - * - */ -JSBool ToolBar::getToolClientData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - ToolData *data = (ToolData*) p->GetToolClientData(id); - *rval = ( data == NULL ) ? JSVAL_VOID : data->GetJSVal(); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns true when the tool with the given id is enabled. - * See @wxToolBar#enableTool - * - * - */ -JSBool ToolBar::getToolEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetToolEnabled(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns the long help from the tool with the given id. - * - * - */ -JSBool ToolBar::getToolLongHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetToolLongHelp(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns the short help from the tool with the given id. - * - * - */ -JSBool ToolBar::getToolShortHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetToolShortHelp(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * Returns true when the tool with the given id is toggled on. - * - * - */ -JSBool ToolBar::getToolState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - *rval = ToJS(cx, p->GetToolState(id)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Inserts the control into the toolbar at the given position. - * You must call @wxToolBar#realize for the change to take place. - * - * - */ -JSBool ToolBar::insertControl(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( FromJS(cx, argv[0], pos ) ) - { - wxControl *control = Control::GetPrivate(cx, argv[1]); - if ( control != NULL ) - { - p->InsertControl(pos, control); - return JS_TRUE; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Inserts a separator into the toolbar at the given position. - * You must call @wxToolBar#realize for the change to take place. - * - * - */ -JSBool ToolBar::insertSeparator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( FromJS(cx, argv[0], pos ) ) - { - p->InsertSeparator(pos); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * An integer that may be used to identify this tool - * - * - * - * The primary tool bitmap for toggle and button tools. - * - * - * The second bitmap specifies the on-state bitmap for a toggle tool - * - * - * Is the tool a toggle tool? - * - * - * Data associated with this tool. - * - * - * Used for tooltips - * - * - * String shown in the statusbar. - * - * - * - * Inserts the tool to the toolbar at the given position. - * - * - */ -JSBool ToolBar::insertTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString longHelp = wxEmptyString; - wxString shortHelp = wxEmptyString; - ToolData *data = NULL; - bool toggle = false; - wxBitmap *bmp2 = NULL; - - switch(argc) - { - case 8: - FromJS(cx, argv[7], longHelp); - // Fall through - case 7: - FromJS(cx, argv[6], shortHelp); - // Fall through - case 6: - data = new ToolData(cx, argv[5]); - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], toggle) ) - { - if ( data != NULL ) - delete data; - break; - } - // Fall through - case 4: - bmp2 = Bitmap::GetPrivate(cx, argv[3]); - if ( bmp2 == NULL ) - { - if ( data != NULL ) - delete data; - break; - } - // Fall through - default: - wxBitmap *bmp1 = Bitmap::GetPrivate(cx, argv[2]); - if ( bmp1 == NULL ) - { - if ( data != NULL ) - delete data; - break; - } - int id; - int pos; - if ( FromJS(cx, argv[1], id) - && FromJS(cx, argv[0], pos) ) - { - p->InsertTool(pos, id, *bmp1, - bmp2 == NULL ? wxNullBitmap : *bmp2, - toggle, data, shortHelp, longHelp); - return JS_TRUE; - } - else - { - if ( data != NULL ) - delete data; - } - } - return JS_FALSE; -} - -/*** - * - * - * - * Call this method after you have added tools. - * - * - */ -JSBool ToolBar::realize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->Realize()); - return JS_TRUE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * - * Sets the data associated with the tool. - * - * - */ -JSBool ToolBar::setToolClientData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - ToolData *data = (ToolData*) p->GetToolClientData(id); - if ( data != NULL ) - delete data; - data = new ToolData(cx, argv[1]); - p->SetToolClientData(id, data); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * - * Sets the long help from the tool with the given id. - * - * - */ -JSBool ToolBar::setToolLongHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - wxString longHelp; - FromJS(cx, argv[1], longHelp); - p->SetToolLongHelp(id, longHelp); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * - * Sets the short help for the tool with the given id. The short help will be used - * to show a tooltip. - * - * - */ -JSBool ToolBar::setToolShortHelp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - if ( FromJS(cx, argv[0], id) ) - { - wxString longHelp; - FromJS(cx, argv[1], longHelp); - p->SetToolShortHelp(id, longHelp); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The tool identifier - * - * - * - * - * Toggles a tool on or off. - * See @wxToolBar#getToolState. - * - * - */ -JSBool ToolBar::toggleTool(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxToolBar *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int id; - bool toggle; - if ( FromJS(cx, argv[0], id) - && FromJS(cx, argv[1], toggle) ) - { - p->ToggleTool(id, toggle); - return JS_TRUE; - } - - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/toolbar.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - fontdlg.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: fontdlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFontDialog_H -#define _WXJSFontDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: fontdlg.h -// Purpose: FontDialog ports wxFontDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 06.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class FontDialog : public ApiWrapper - { - public: - - static bool GetProperty(wxFontDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFontDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxFontDialog *p); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_FONT_DATA - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFontDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/fontdlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/panel.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/panel.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/panel.h (nonexistent) @@ -1,78 +0,0 @@ -/* - * wxJavaScript - panel.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: panel.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSPanel_H -#define _WXJSPanel_H - -///////////////////////////////////////////////////////////////////////////// -// Name: panel.h -// Purpose: Panel ports wxPanel to JavaScript -// Author: Franky Braem -// Modified by: -// Created: -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Panel : public wxPanel - , public ApiWrapper - , public Object - { - public: - Panel(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Panel(); - - static bool GetProperty(wxPanel *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxPanel *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxPanel* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxPanel *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_DEFAULT_ITEM - }; - - DECLARE_EVENT_TABLE() - void OnSysColourChanged(wxSysColourChangedEvent &event); - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSPanel_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/panel.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.h (nonexistent) @@ -1,221 +0,0 @@ -/* - * wxJavaScript - listctrl.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: listctrl.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSListCtrl_H -#define _WXJSListCtrl_H - -///////////////////////////////////////////////////////////////////////////// -// Name: listctrl.h -// Purpose: ListCtrl ports wxListCtrl to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 28.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class ListCtrl : public wxListCtrl - , public ApiWrapper - , public Object - { - public: - ListCtrl(JSContext *cx, JSObject *obj); - - virtual ~ListCtrl(); - - // Callback used for sorting. - static int wxCALLBACK SortFn(long item1, long item2, long data); - - // Fn's for virtual list controls. - wxString OnGetItemText(long item, long column) const; - int OnGetItemImage(long item) const; - wxListItemAttr *OnGetItemAttr(long item) const; - - /** - * Callback for retrieving properties of wxListCtrl - */ - static bool GetProperty(wxListCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxListCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for when a wxListCtrl object is created - */ - static wxListCtrl* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - /** - * Callback for when a wxListCtrl object is destroyed - */ - static void Destruct(JSContext *cx, wxListCtrl *p); - - WXJS_DECLARE_PROPERTY_MAP() - /** - * Property Ids. - */ - enum - { - P_COUNT_PER_PAGE - , P_EDIT_CONTROL - , P_COLUMN_COUNT - , P_ITEM_COUNT - , P_SELECTED_ITEM_COUNT - , P_TEXT_COLOUR - , P_TOP_ITEM - , P_WINDOW_STYLE - , P_IS_VIRTUAL - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool getColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getColumnWidth(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setColumnWidth(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemRect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setItemPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItemSpacing(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setSingleStyle(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNextItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getImageList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setImageList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool refreshItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool refreshItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool arrange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteAllItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool deleteAllColumns(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clearAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insertItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool editLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool endEditLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool ensureVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool hitTest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool scrollList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool sortItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_CONSTANT_MAP() - - DECLARE_EVENT_TABLE() - - void OnBeginDrag(wxListEvent &event); - void OnBeginRDrag(wxListEvent &event); - void OnBeginLabelEdit(wxListEvent &event); - void OnEndLabelEdit(wxListEvent &event); - void onDeleteItem(wxListEvent &event); - void onDeleteAllItems(wxListEvent &event); - void onItemSelected(wxListEvent &event); - void onItemDeselected(wxListEvent &event); - void onItemActivated(wxListEvent &event); - void onItemFocused(wxListEvent &event); - void onItemRightClick(wxListEvent &event); - void onListKeyDown(wxListEvent &event); - void onInsertItem(wxListEvent &event); - void onColClick(wxListEvent &event); - void onColRightClick(wxListEvent &event); - void onColBeginDrag(wxListEvent &event); - void onColDragging(wxListEvent &event); - void onColEndDrag(wxListEvent &event); - void onCacheHint(wxListEvent &event); - }; - - /** - * Helper class used for sorting items in wxListCtrl - */ - class ListSort - { - public: - ListSort(JSContext *cx, JSFunction *fun, long data) : m_cx(cx), m_fun(fun), m_data(data) - { - } - - JSFunction *GetFn() const - { - return m_fun; - } - - long GetData() const - { - return m_data; - } - - JSContext *GetContext() const - { - return m_cx; - } - - private: - JSContext *m_cx; - JSFunction *m_fun; - long m_data; - }; - - class ListObjectData - { - public: - ListObjectData(JSContext *cx, jsval v) : m_cx(cx), m_val(v) - { - if ( JSVAL_IS_GCTHING(m_val) ) {} - JS_AddRoot(m_cx, &m_val); - } - - virtual ~ListObjectData() - { - if ( JSVAL_IS_GCTHING(m_val) ) {} - JS_RemoveRoot(m_cx, &m_val); - } - - jsval GetJSVal() - { - return m_val; - } - private: - JSContext *m_cx; - jsval m_val; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSListCtrl_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.cpp (nonexistent) @@ -1,178 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - txtdlg.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: txtdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// txtdlg.cpp - -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "../misc/point.h" -#include "../event/jsevent.h" -#include "../event/evthand.h" - -#include "txtdlg.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -TextEntryDialog::TextEntryDialog( JSContext *cx - , JSObject *obj - , wxWindow* parent - , const wxString& message - , const wxString& caption - , const wxString& defaultValue - , long style - , const wxPoint& pos) - : wxTextEntryDialog(parent, message, caption, defaultValue, style, pos) - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -TextEntryDialog::~TextEntryDialog() -{ - PopEventHandler(true); -} - -/*** - * control/txtdlg - * gui - * - * This class represents a dialog that requests a one-line text string from the user. - * See also @wxPasswordEntryDialog. - * - */ -WXJS_INIT_CLASS(TextEntryDialog, "wxTextEntryDialog", 2) - -/*** - * - * The value entered in the dialog - * - */ -WXJS_BEGIN_PROPERTY_MAP(TextEntryDialog) - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -bool TextEntryDialog::GetProperty(wxTextEntryDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_VALUE: - *vp = ToJS(cx, p->GetValue()); - break; - } - return true; -} - -bool TextEntryDialog::SetProperty(wxTextEntryDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_VALUE: - { - wxString value; - if ( FromJS(cx, *vp, value) ) - p->SetValue(value); - break; - } - } - return true; -} - -/*** - * - * - * The parent of the dialog. null is Allowed. - * Message to show on the dialog. - * The title of the dialog. - * The default value of the text control. - * The position of the dialog. - * A dialog style, the buttons (wxId.OK and wxId.CANCEL) and wxCENTRE can be used. - * - * - * Constructs a new wxTextEntryDialog object. - * - * - */ -wxTextEntryDialog* TextEntryDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = wxOK | wxCANCEL | wxCENTRE; - const wxPoint *pt = &wxDefaultPosition; - wxString defaultValue = wxEmptyString; - wxString caption = wxEmptyString; - - switch(argc) - { - case 6: - pt = Point::GetPrivate(cx, argv[5]); - if ( pt == NULL ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], defaultValue) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], caption) ) - break; - // Fall through - default: - wxString message; - if ( ! FromJS(cx, argv[1], message) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - TextEntryDialog *p = new TextEntryDialog(cx, obj, parent, message, caption, defaultValue, style, *pt); - return p; - } - - return NULL; -} - -void TextEntryDialog::Destruct(JSContext *cx, wxTextEntryDialog *p) -{ -} - -BEGIN_EVENT_TABLE(TextEntryDialog, wxTextEntryDialog) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/txtdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.cpp (nonexistent) @@ -1,418 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - radiobox.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: radiobox.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// radiobox.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/size.h" -#include "../misc/point.h" -#include "../misc/validate.h" - -#include "radiobox.h" -#include "radioboxit.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -RadioBox::RadioBox(JSContext *cx, JSObject *obj) - : wxRadioBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -RadioBox::~RadioBox() -{ - PopEventHandler(true); -} - -/*** - * control/radiobox - * gui - * - * A radio box item is used to select one of number of mutually exclusive choices. - * It is displayed as a vertical column or horizontal row of labelled buttons. - * - */ -WXJS_INIT_CLASS(RadioBox, "wxRadioBox", 3) - -/*** - * - * - * Get the number of items - * - * - * Get an array of with @wxRadioBoxItem items. - * - * - * Get/Set the selected button. (zero-indexed) - * - * - * Get/Set the selected string. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(RadioBox) - WXJS_PROPERTY(P_SELECTION, "selection") - WXJS_PROPERTY(P_STRING_SELECTION, "stringSelection") - WXJS_READONLY_PROPERTY(P_COUNT, "count") - WXJS_READONLY_PROPERTY(P_ITEM, "item") -WXJS_END_PROPERTY_MAP() - -bool RadioBox::GetProperty(wxRadioBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_COUNT: - *vp = ToJS(cx, p->GetCount()); - break; - case P_SELECTION: - *vp = ToJS(cx, p->GetSelection()); - break; - case P_STRING_SELECTION: - *vp = ToJS(cx, p->GetStringSelection()); - break; - case P_ITEM: - *vp = RadioBoxItem::CreateObject(cx, new Index(0)); - break; - } - return true; -} - -bool RadioBox::SetProperty(wxRadioBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_SELECTION: - { - int value; - if ( FromJS(cx, *vp, value) ) - p->SetSelection(value); - break; - } - case P_STRING_SELECTION: - { - wxString value; - FromJS(cx, *vp, value); - p->SetStringSelection(value); - break; - } - } - return true; -} - -/*** - * - * - * The major dimension parameter refers to the maximum number of rows. - * The major dimension parameter refers to the maximum number of columns. - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(RadioBox) - WXJS_CONSTANT(wxRA_, SPECIFY_ROWS) - WXJS_CONSTANT(wxRA_, SPECIFY_COLS) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * The parent of wxRadioBox. - * A window identifier. Use -1 when you don't need it. - * The title of the radiobox. - * - * The position of the RadioBox control on the given parent. - * - * - * The size of the RadioBox control. - * - * - * An array of Strings to initialize the control. - * - * - * Specifies the maximum number of rows (if style contains SPECIFY_ROWS) or columns - * (if style contains SPECIFY_COLS) for a two-dimensional radiobox. - * - * - * The wxRadioBox style. - * - * - * - * - * Constructs a new wxRadioBox object. - * - * - */ -wxRadioBox* RadioBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 9 ) - argc = 9; - - int style = 0; - int max = 0; - StringsPtr items; - const wxSize *size = &wxDefaultSize; - const wxPoint *pt = &wxDefaultPosition; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 9: - val = Validator::GetPrivate(cx, argv[8]); - if ( val == NULL ) - break; - case 8: - if ( ! FromJS(cx, argv[7], style) ) - break; - // Fall through - case 7: - if ( ! FromJS(cx, argv[6], max) ) - break; - // Fall through - case 6: - if ( ! FromJS(cx, argv[5], items) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString title; - FromJS(cx, argv[2], title); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxRadioBox *p = new RadioBox(cx, obj); - p->Create(parent, id, title, *pt, *size, - items.GetCount(), items.GetStrings(), max, style, *val); - return p; - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(RadioBox) - WXJS_METHOD("setString", setString, 2) - WXJS_METHOD("findString", setString, 2) - WXJS_METHOD("enable", enable, 2) - WXJS_METHOD("show", show, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The zero-based index of a button - * - * - * Sets the label of the button. - * - * - * - * - */ -JSBool RadioBox::setString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRadioBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - wxString label; - - if ( FromJS(cx, argv[0], idx) ) - { - FromJS(cx, argv[1], label); - p->SetString(idx, label); - } - else - { - return JS_FALSE; - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Finds a button matching the given string, returning the position if found, - * or -1 if not found. - * - * - */ -JSBool RadioBox::findString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRadioBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxString label; - FromJS(cx, argv[0], label); - *rval = ToJS(cx, p->FindString(label)); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * The zero-based index of a button - * - * - * - * - * Enables/Disables the button at the given index. - * See @wxRadioBoxItem @wxRadioBoxItem#enable. - * - * - */ -JSBool RadioBox::enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRadioBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) // The prototype method enable - { - bool sw; - if ( FromJS(cx, argv[0], sw) ) - { - p->Enable(sw); - return JS_TRUE; - } - } - else if ( argc == 2 ) - { - int idx; - bool sw; - if ( FromJS(cx, argv[0], idx) - && FromJS(cx, argv[1], sw) ) - { - p->Enable(idx, sw); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * The zero-based index of a button - * - * - * - * - * Shows/Hides the button at the given index. - * See @wxRadioBoxItem @wxRadioBoxItem#enable. - * - * - */ -JSBool RadioBox::show(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxRadioBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) // The prototype method enable - { - bool sw; - if ( FromJS(cx, argv[0], sw) ) - { - p->Show(sw); - return JS_TRUE; - } - } - else if ( argc == 2 ) - { - int idx; - bool sw; - if ( FromJS(cx, argv[0], idx) - && FromJS(cx, argv[1], sw) ) - { - p->Show(idx, sw); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * Called when a radio button is clicked. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - */ -void RadioBox::OnRadioBox(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onRadioBox"); -} - -BEGIN_EVENT_TABLE(RadioBox, wxRadioBox) - EVT_RADIOBOX(-1, RadioBox::OnRadioBox) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/window.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/window.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/window.cpp (nonexistent) @@ -1,1729 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - window.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: window.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// window.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "window.h" -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/rect.h" -#include "../misc/colour.h" -#include "../misc/font.h" -#include "../misc/sizer.h" -#include "../misc/validate.h" -#include "../misc/acctable.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/window - * gui - * - * wxWindow is the prototype of all objects based on wxWindow. - * This means that you can use all properties and methods in all those objects. - * - */ -WXJS_INIT_CLASS(Window, "wxWindow", 0) - -/*** - * - * - * - * Can this window have focus? - * - * - * can this window be given focus by keyboard navigation? if not, the - * only way to give it focus (provided it accepts it at all) is to - * click it - * - * - * Indicates whether the layout method must be called automatically or not when a window is resized. - * See @wxSizer - * - * - * Get/Set the background colour of the window - * - * - * Gets the size best suited for the window - * - * - * Gets a list of children - * - * - * Get the origin of the client area of the window relative to the - * window top left corner (the client area may be shifted because of - * the borders, scrollbars, other decorations...) - * - * - * Get/Set the client height. - * - * - * Gets the rectangle of the client area - * - * - * Get/Set the clientsize of the window. You can also use - * @wxRect (only when setting) - * - * - * Get/Set the client width. - * - * - * Enables/Disables the window - * - * - * Get/Set the extra window styles. - * See @wxWindow#extraStyles - * - * - * Get/Set the font. - * - * - * Get/Set the foreground colour of the window - * - * - * Returns true when this window has the capture. - * Set to true to capture this window, or false to release the capture. - * (not possible in wxWindows) - * - * - * Get/Set the height. - * - * - * Gets the unique id of the window, or -1 when it is not set. - * - * - * Get/Set the parent - * - * - * Get/Set the position. - * - * - * Gets the window rectangle - * - * - * Returns true when the window is visible - * See @wxWindow#visible property, @wxWindow#show method - * - * - * Get/Set the size of the window. You can also use - * @wxRect (only when setting) - * - * - * Get/Set the sizer of the window. Set @wxWindow#autoLayout to true when you - * want that the sizer is automatically used when the size of the window is changed. - * - * - * Returns true when the window is a top level window. - * Currently all frames and dialogs are considered to be - * top-level windows (even if they have a parent window). - * - * - * Get/Set the validator of the window - * - * - * Show/Hide the window. - * - * - * Get/Set the window flag styles. - * Please note that some styles cannot be changed after the window - * creation and that @wxWindow#refresh might be called after changing - * the others for the change to take place immediately. - * See @wxWindow_styles - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Window) - WXJS_PROPERTY(P_AUTO_LAYOUT, "autoLayout") - WXJS_PROPERTY(P_CLIENT_HEIGHT, "clientHeight") - WXJS_PROPERTY(P_CLIENT_WIDTH, "clientWidth") - WXJS_READONLY_PROPERTY(P_CLIENT_ORIGIN, "clientAreaOrigin") - WXJS_READONLY_PROPERTY(P_ACCEPTS_FOCUS, "acceptsFocus") - WXJS_READONLY_PROPERTY(P_ACCEPTS_FOCUS_KEYBOARD, "acceptsFocusFromKeyboard") - WXJS_PROPERTY(P_ENABLE, "enable") - WXJS_PROPERTY(P_HEIGHT, "height") - WXJS_PROPERTY(P_VISIBLE, "visible") - WXJS_PROPERTY(P_WIDTH, "width") - WXJS_PROPERTY(P_SIZE, "size") - WXJS_PROPERTY(P_SIZER, "sizer") - WXJS_PROPERTY(P_CLIENT_SIZE, "clientSize") - WXJS_PROPERTY(P_POSITION, "position") - WXJS_READONLY_PROPERTY(P_ID, "id") - WXJS_READONLY_PROPERTY(P_RECT, "rect") - WXJS_READONLY_PROPERTY(P_CLIENT_RECT, "clientRect") - WXJS_READONLY_PROPERTY(P_BEST_SIZE, "bestSize") - WXJS_PROPERTY(P_WINDOW_STYLE, "windowStyle") - WXJS_PROPERTY(P_EXTRA_STYLE, "extraStyle") - WXJS_READONLY_PROPERTY(P_SHOWN, "shown") - WXJS_READONLY_PROPERTY(P_TOP_LEVEL, "topLevel") - WXJS_READONLY_PROPERTY(P_CHILDREN, "children") - WXJS_PROPERTY(P_PARENT, "parent") - WXJS_PROPERTY(P_VALIDATOR, "validator") - WXJS_PROPERTY(P_ACCELERATOR_TABLE, "acceleratorTable") - WXJS_PROPERTY(P_HAS_CAPTURE, "hasCapture") - WXJS_PROPERTY(P_BACKGROUND_COLOUR, "backgroundColour") - WXJS_PROPERTY(P_FOREGROUND_COLOUR, "foregroundColour") - WXJS_PROPERTY(P_FONT, "font") -WXJS_END_PROPERTY_MAP() - -bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_VISIBLE: - case P_SHOWN: - *vp = ToJS(cx, p->IsShown()); - break; - case P_ENABLE: - *vp = ToJS(cx, p->IsEnabled()); - break; - case P_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetSize())); - break; - case P_CLIENT_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetClientSize())); - break; - case P_WIDTH: - *vp = ToJS(cx, p->GetSize().GetWidth()); - break; - case P_HEIGHT: - *vp = ToJS(cx, p->GetSize().GetHeight()); - break; - case P_CLIENT_HEIGHT: - *vp = ToJS(cx, p->GetClientSize().GetHeight()); - break; - case P_CLIENT_WIDTH: - *vp = ToJS(cx, p->GetClientSize().GetHeight()); - break; - case P_POSITION: - *vp = Point::CreateObject(cx, new wxPoint(p->GetPosition())); - break; - case P_CLIENT_ORIGIN: - { - const wxPoint &pt = p->GetClientAreaOrigin(); - *vp = Point::CreateObject(cx, new wxPoint(pt)); - break; - } - case P_SIZER: - { - Object *sizer = dynamic_cast(p->GetSizer()); - *vp = sizer == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(sizer->GetObject()); - break; - } - case P_AUTO_LAYOUT: - *vp = ToJS(cx, p->GetAutoLayout()); - break; - case P_ID: - *vp = ToJS(cx, p->GetId()); - break; - case P_RECT: - *vp = Rect::CreateObject(cx, new wxRect(p->GetRect())); - break; - case P_CLIENT_RECT: - *vp = Rect::CreateObject(cx, new wxRect(p->GetClientRect())); - break; - case P_BEST_SIZE: - *vp = Size::CreateObject(cx, new wxSize(p->GetBestSize())); - break; - case P_WINDOW_STYLE: - *vp = ToJS(cx, p->GetWindowStyle()); - break; - case P_EXTRA_STYLE: - *vp = ToJS(cx, p->GetExtraStyle()); - break; - case P_TOP_LEVEL: - *vp = ToJS(cx, p->IsTopLevel()); - break; - case P_ACCEPTS_FOCUS: - *vp = ToJS(cx, p->AcceptsFocus()); - break; - case P_ACCEPTS_FOCUS_KEYBOARD: - *vp = ToJS(cx, p->AcceptsFocusFromKeyboard()); - break; - case P_CHILDREN: - { - wxWindowList &winList = p->GetChildren(); - jsint count = winList.GetCount(); - - JSObject *objSelections = JS_NewArrayObject(cx, count, NULL); - *vp = OBJECT_TO_JSVAL(objSelections); - - jsint i = 0; - for (wxWindowList::Node *node = winList.GetFirst(); node; node = node->GetNext() ) - { - Object *win = dynamic_cast(node->GetData()); - jsval element = OBJECT_TO_JSVAL(win->GetObject()); - JS_SetElement(cx, objSelections, i++, &element); - } - break; - } - case P_PARENT: - { - Object *win = dynamic_cast(p->GetParent()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - break; - } - case P_VALIDATOR: - { - Object *val = dynamic_cast(p->GetValidator()); - *vp = val == NULL ? JSVAL_VOID : OBJECT_TO_JSVAL(val->GetObject()); - break; - } - case P_HAS_CAPTURE: - *vp = ToJS(cx, p->HasCapture()); - break; - case P_BACKGROUND_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(p->GetBackgroundColour())); - break; - case P_FOREGROUND_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(p->GetForegroundColour())); - break; - case P_FONT: - *vp = Font::CreateObject(cx, new wxFont(p->GetFont()), obj); - break; - } - return true; -} - -bool Window::SetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_ACCELERATOR_TABLE: - { - wxAcceleratorTable *table = AcceleratorTable::GetPrivate(cx, *vp); - if ( table != NULL ) - p->SetAcceleratorTable(*table); - break; - } - case P_VISIBLE: - { - bool visible; - if ( FromJS(cx, *vp, visible) ) - p->Show(visible); - break; - } - case P_ENABLE: - { - bool enable; - if ( FromJS(cx, *vp, enable) ) - p->Enable(enable); - break; - } - case P_WIDTH: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetSize(size, -1); - break; - } - case P_HEIGHT: - { - int height; - if ( FromJS(cx, *vp, height) ) - p->SetSize(-1, height); - break; - } - case P_SIZE: - { - wxSize *size = Size::GetPrivate(cx, *vp); - if ( size != NULL ) - { - p->SetSize(*size); - } - else - { - // Try wxRect - wxRect *rect = Rect::GetPrivate(cx, *vp); - if ( rect != NULL ) - p->SetSize(*rect); - } - break; - } - case P_SIZER: - { - wxSizer *sizer = Sizer::GetPrivate(cx, *vp); - if ( sizer != NULL ) - { - p->SetSizer(sizer); - AttachedSizer *a = dynamic_cast(sizer); - a->SetAttached(true); - } - break; - } - case P_CLIENT_HEIGHT: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetClientSize(-1, size); - break; - } - case P_CLIENT_WIDTH: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetClientSize(size, -1); - break; - } - case P_CLIENT_SIZE: - { - wxSize *size = Size::GetPrivate(cx, *vp); - if ( size != NULL ) - { - p->SetClientSize(*size); - } - else - { - // Try wxRect - wxRect *rect = Rect::GetPrivate(cx, *vp); - if ( rect != NULL ) - p->SetClientSize(*rect); - } - break; - } - case P_POSITION: - { - wxPoint *pt = Point::GetPrivate(cx, *vp); - if ( pt != NULL ) - p->Move(*pt); - } - break; - case P_AUTO_LAYOUT: - { - bool autoLayout; - if ( FromJS(cx, *vp, autoLayout) ) - p->SetAutoLayout(autoLayout); - break; - } - case P_WINDOW_STYLE: - { - int style; - if ( FromJS(cx, *vp, style) ) - p->SetWindowStyle(style); - break; - } - case P_EXTRA_STYLE: - { - int style; - if ( FromJS(cx, *vp, style) ) - p->SetExtraStyle(style); - break; - } - case P_PARENT: - { - wxWindow *win = Window::GetPrivate(cx, *vp); - if ( win != NULL ) - { - p->Reparent(win); - } - } - case P_VALIDATOR: - { - wxValidator *val = Validator::GetPrivate(cx, *vp); - if ( val != NULL ) - { - p->SetValidator(*val); - val->SetWindow(p); // We do this, because otherwise we loose the knowledge - // of WindowObject - } - break; - } - case P_HAS_CAPTURE: - { - bool capture; - if ( FromJS(cx, *vp, capture) ) - capture ? p->CaptureMouse() : p->ReleaseMouse(); - break; - } - case P_BACKGROUND_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetBackgroundColour(*colour); - break; - } - case P_FOREGROUND_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetForegroundColour(*colour); - break; - } - case P_FONT: - { - wxFont *font = Font::GetPrivate(cx, *vp); - if ( font != NULL ) - p->SetFont(*font); - break; - } - } - return true; -} - -/*** - * - * - * Gets the window that has the capture. - * See @wxWindow#hasCapture, @wxWindow#releaseMouse and @wxWindow#captureMouse - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(Window) - WXJS_READONLY_STATIC_PROPERTY(P_CAPTURE, "capture") -WXJS_END_PROPERTY_MAP() - -bool Window::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - if ( id == P_CAPTURE ) - { - Object *win = dynamic_cast(wxWindow::GetCapture()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * TransferDataTo/FromWindow() and Validate() methods will recursively descend - * into all children of the window if it has this style flag set. - * - * - * Normally, the command events are propagared upwards to the window parent recursively - * until a handler for them is found. Using this style allows to prevent them from being - * propagated beyond this window. Notice that wxDialog has this style on by default for - * the reasons explained in the event processing overview. - * - * - * This can be used to prevent a window from being used as an implicit parent for the - * dialogs which were created without a parent. It is useful for the windows which can - * disappear at any moment as creating childs of such windows results in fatal problems. - * - * - * - * - * Use internally-calculated width if -1 - * - * - * Use internally-calculated height if -1 - * - * - * Use internally-calculated width and height if each is -1 - * - * - * Ignore missing (-1) dimensions (use existing). - * - * - * Allow -1 as a valid position - * - * - * Don't do parent client adjustments (for implementation only) - * - * - * - */ - -WXJS_BEGIN_CONSTANT_MAP(Window) - WXJS_CONSTANT(wx, DOUBLE_BORDER) - WXJS_CONSTANT(wx, SUNKEN_BORDER) - WXJS_CONSTANT(wx, RAISED_BORDER) - WXJS_CONSTANT(wx, BORDER) - WXJS_CONSTANT(wx, SIMPLE_BORDER) - WXJS_CONSTANT(wx, STATIC_BORDER) - WXJS_CONSTANT(wx, NO_BORDER) - WXJS_CONSTANT(wx, NO_3D) - WXJS_CONSTANT(wx, CLIP_CHILDREN) - WXJS_CONSTANT(wx, TAB_TRAVERSAL) - WXJS_CONSTANT(wx, WANTS_CHARS) - WXJS_CONSTANT(wx, NO_FULL_REPAINT_ON_RESIZE) - WXJS_CONSTANT(wx, VSCROLL) - WXJS_CONSTANT(wx, HSCROLL) - WXJS_CONSTANT(wx, SIZE_AUTO_WIDTH) - WXJS_CONSTANT(wx, SIZE_AUTO_HEIGHT) - WXJS_CONSTANT(wx, SIZE_AUTO) - WXJS_CONSTANT(wx, SIZE_USE_EXISTING) - WXJS_CONSTANT(wx, SIZE_ALLOW_MINUS_ONE) - WXJS_CONSTANT(wx, SIZE_NO_ADJUSTMENTS) - WXJS_CONSTANT(wx, WS_EX_VALIDATE_RECURSIVELY) - WXJS_CONSTANT(wx, WS_EX_BLOCK_EVENTS) - WXJS_CONSTANT(wx, WS_EX_TRANSIENT) -WXJS_END_CONSTANT_MAP() - -WXJS_BEGIN_METHOD_MAP(Window) - WXJS_METHOD("captureMouse", captureMouse, 0) - WXJS_METHOD("centre", centre, 1) - WXJS_METHOD("center", centre, 1) - WXJS_METHOD("clearBackground", clearBackground, 0) - WXJS_METHOD("clientToScreen", clientToScreen, 1) - WXJS_METHOD("close", close, 1) - WXJS_METHOD("convertDialogToPixels", convertDialogToPixels, 1) - WXJS_METHOD("convertPixelsToDialog", convertPixelsToDialog, 1) - WXJS_METHOD("destroy", destroy, 0) - WXJS_METHOD("releaseMouse", releaseMouse, 0) - WXJS_METHOD("layout", layout, 0) - WXJS_METHOD("move", move, 2) - WXJS_METHOD("lower", lower, 0) - WXJS_METHOD("raise", raise, 0) - WXJS_METHOD("centreOnParent", centreOnParent, 1) - WXJS_METHOD("centerOnParent", centreOnParent, 1) - WXJS_METHOD("show", show, 1) - WXJS_METHOD("fit", fit, 0) - WXJS_METHOD("setSizeHints", setSizeHints, 6) - WXJS_METHOD("refresh", refresh, 2) - WXJS_METHOD("setFocus", setFocus, 0) - WXJS_METHOD("findWindow", findWindow, 1) - WXJS_METHOD("initDialog", initDialog, 0) - WXJS_METHOD("transferDataToWindow", transferDataToWindow, 0) - WXJS_METHOD("transferDataFromWindow", transferDataFromWindow, 0) - WXJS_METHOD("validate", validate, 0) - WXJS_METHOD("makeModal", makeModal, 1) - WXJS_METHOD("warpPointer", warpPointer, 1) - WXJS_METHOD("update", update, 0) - WXJS_METHOD("freeze", freeze, 0) - WXJS_METHOD("thaw", thaw, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Directs all mouse input to this window. Call @wxWindow#releaseMouse to release the capture. - * See @wxWindow#hasCapture - * - * - */ -JSBool Window::captureMouse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->CaptureMouse(); - - return JS_TRUE; -} - -/*** - * - * - * - * You can use the constants from @wxOrientation - * - * - * - */ -JSBool Window::centre(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 0 ) - { - p->Centre(); - } - else if (argc == 1) - { - int direction; - if ( FromJS(cx, argv[0], direction) ) - { - p->Centre(direction); - } - else - { - return JS_FALSE; - } - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * Clears the window by filling it with the current background color. - * - * - */ -JSBool Window::clearBackground(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->ClearBackground(); - - return JS_TRUE; -} - -/*** - * - * - * - * The client position - * - * - * - * Returns the screen coordinates from coordinates relative to this window. - * - * - */ -JSBool Window::clientToScreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - *rval = Point::CreateObject(cx, new wxPoint(p->ClientToScreen(*pt))); - else - return JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * When true the application can't veto the close. By default Force is false. - * - * - * - * Closes the window. This applies only for @wxFrame and @wxDialog objects. - * - * - */ -JSBool Window::close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - bool force = false; - if ( FromJS(cx, argv[0], force) ) - { - p->Close(force); - return JS_TRUE; - } - else - { - return JS_FALSE; - } - } - else if ( argc == 0 ) - { - p->Close(); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * Converts a point - * - * - * - * Converts a size - * - * - * - * Converts a point or a size to from dialog units to pixels. - * - * - */ -JSBool Window::convertDialogToPixels(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - JSBool result = JS_FALSE; - - wxSize *size = Size::GetPrivate(cx, argv[0]); - if ( size != NULL ) - { - *rval = Size::CreateObject(cx, new wxSize(p->ConvertDialogToPixels(*size))); - return JS_TRUE; - } - else - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - *rval = Point::CreateObject(cx, new wxPoint(p->ConvertDialogToPixels(*pt))); - result = JS_TRUE; - } - } - - return result; -} - -/*** - * - * - * Converts a point - * - * - * - * Converts a size - * - * - * - * Converts a point or a size from pixels to dialog units. - * - * - */ -JSBool Window::convertPixelsToDialog(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - JSBool result = JS_FALSE; - - wxSize *size = Size::GetPrivate(cx, argv[0]); - if ( size != NULL ) - { - *rval = Size::CreateObject(cx, new wxSize(p->ConvertPixelsToDialog(*size))); - result = JS_TRUE; - } - else - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - *rval = Point::CreateObject(cx, new wxPoint(p->ConvertPixelsToDialog(*pt))); - result = JS_TRUE; - } - } - - return result; -} - -/*** - * - * - * - * Destroys the window. Returns true when the window is destroyed. - * - * - */ -JSBool Window::destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->Destroy()); - - return JS_TRUE; -} - -/*** - * - * - * - * Releases mouse input captured by @wxWindow#captureMouse. - * See @wxWindow#hasCapture and @wxWindow#captureMouse - * - * - */ -JSBool Window::releaseMouse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->ReleaseMouse(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Moves the mouse to the given position - * - * - */ -JSBool Window::warpPointer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - p->WarpPointer(pt->x, pt->y); - return JS_TRUE; - } - } - else if ( argc == 2 ) - { - int x = 0; - int y = 0; - if ( FromJS(cx, argv[0], x) - || FromJS(cx, argv[1], y) ) - { - p->WarpPointer(x, y); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * Layout the window using the sizer. - * - * - */ -JSBool Window::layout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Layout(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * - * - * - * Moves the window. - * - * - */ -JSBool Window::move(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 2 ) - argc = 2; - - JSBool result = JS_FALSE; - - switch(argc) - { - case 2: - { - int x; - int y; - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->Move(x, y); - result = JS_TRUE; - } - break; - } - case 1: - { - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt == NULL ) - { - p->Move(*pt); - result = JS_TRUE; - } - break; - } - } - - return result; -} - -/*** - * - * - * - * X position in pixels, or -1 to indicate that the existing value should be used. - * - * - * Y position in pixels, or -1 to indicate that the existing value should be used. - * - * - * Width in pixels, or -1 to indicate that the existing value should be used. - * - * - * Height in pixels, or -1 to indicate that the existing value should be used. - * - * - * Indicates the interpretation of the parameters. - * - * - * - * - * Width in pixels, or -1 to indicate that the existing value should be used. - * - * - * Height in pixels, or -1 to indicate that the existing value should be used. - * - * - * - * Sets a new window size. - * See @wxWindow#size property, @wxWindow#sizeFlags - * - * - */ -JSBool Window::setSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - JSBool result = JS_FALSE; - - int x; - int y; - int width; - int height; - int flag = wxSIZE_AUTO; - - if ( argc == 2 ) - { - if ( FromJS(cx, argv[0], width) - && FromJS(cx, argv[1], height) ) - { - p->SetSize(width, height); - result = JS_TRUE; - } - } - else if ( argc > 3 ) - { - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) - && FromJS(cx, argv[2], width) - && FromJS(cx, argv[3], height) ) - { - if ( argc > 4 - && ! FromJS(cx, argv[4], flag) ) - { - return JS_FALSE; - } - p->SetSize(x, y, width, height, flag); - result = JS_TRUE; - } - } - - return result; -} - -/*** - * - * - * - * Raises the window to the top of the window hierarchy if it is a managed window (dialog or frame). - * - * - */ -JSBool Window::raise(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Raise(); - - return JS_TRUE; -} - -/*** - * - * - * - * Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog or frame). - * - * - */ -JSBool Window::lower(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Lower(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Centres the window based on the parent. centreOnParent is an alias for this method. - * - * - */ -JSBool Window::centreOnParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 0 ) - { - p->CentreOnParent(); - } - else - { - int direction; - if ( FromJS(cx, argv[0], direction) ) - { - p->CentreOnParent(direction); - } - else - { - return JS_FALSE; - } - } - return JS_TRUE; -} - -/*** - * - * - * - * Set window size to wrap around its children - * - * - */ -JSBool Window::fit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Fit(); - - return JS_TRUE; -} - -/*** - * - * - * - * The minimum width of the window. - * - * - * The minimum height of the window. - * - * - * The maximum width of the window. - * - * - * The maximum height of the window. - * - * - * The increment for resizing the width (Motif/Xt only). - * - * - * The increment for resizing the height (Motif/Xt only). - * - * - * - * Allows specification of minimum and maximum window sizes, and window size increments. - * If a pair of values is not set (or set to -1), the default values will be used. - * If this function is called, the user will not be able to size the window - * outside the given bounds. - *

- * The resizing increments are only significant under Motif or Xt. - *
- *
- */ -JSBool Window::setSizeHints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int minWidth = -1; - int minHeight = -1; - int maxWidth = -1; - int maxHeight = -1; - int incWidth = -1; - int incHeight = -1; - - if ( JS_ConvertArguments(cx, argc, argv, "/iiiiii", - &minWidth, &minHeight, &maxWidth, - &maxHeight, &incWidth, &incHeight) == JS_TRUE ) - { - p->SetSizeHints(minWidth, minHeight, maxWidth, maxHeight, incWidth, incHeight); - } - else - return JS_FALSE; - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Shows (true) or hides (false) the window. - * See @wxWindow#visible property, @wxWindow#shown property - * - * - */ -JSBool Window::show(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 0 ) - p->Show(); - else - { - bool visible; - if ( FromJS(cx, argv[0], visible) ) - p->Show(visible); - else - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * When true the background is erased. - * - * - * When set, the given rectangle will be treated as damaged. - * - * - * - * Generates an event for repainting the window - * - * - */ -JSBool Window::refresh(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool erase = true; - wxRect *rect = NULL; - - if ( argc > 2 ) - argc = 2; - - switch(argc) - { - case 2: - rect = Rect::GetPrivate(cx, argv[1]); - if ( rect == NULL ) - break; - // Fall Through - case 1: - if ( ! FromJS(cx, argv[0], erase) ) - break; - // Fall Through - default: - p->Refresh(erase, rect); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * This sets the window to receive keyboard input. - * - * - */ -JSBool Window::setFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->SetFocus(); - - return JS_TRUE; -} - -/*** - * - * - * The id of a window - * - * - * The name of a window - * - * - * Find a child of this window, by identifier or by name - * - * - */ -JSBool Window::findWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *win; - int id; - if ( FromJS(cx, argv[0], id) ) - { - win = p->FindWindow(id); - } - else - { - wxString name; - FromJS(cx, argv[0], name); - win = p->FindWindow(name); - } - if ( win == (wxWindow*) NULL ) - *rval = JSVAL_VOID; - else - { - Object *winObj = dynamic_cast(win); - *rval = OBJECT_TO_JSVAL(winObj->GetObject()); - } - - return JS_TRUE; - -} - -/*** - * - * - * - * Sends an onInitDialog event, which in turn transfers data to the dialog via validators - * - * - */ -JSBool Window::initDialog(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->InitDialog(); - - return JS_TRUE; -} - -/*** - * - * - * - * Transfers values to child controls from data areas specified by their validators - * Returns FALSE if a transfer failed. - * - * - */ -JSBool Window::transferDataToWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->TransferDataToWindow()); - - return JS_TRUE; -} - -/*** - * - * - * - * Transfers values from child controls to data areas specified by their validators. - * Returns false if a transfer failed. - * - * - */ -JSBool Window::transferDataFromWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->TransferDataToWindow()); - - return JS_TRUE; -} - -/*** - * - * - * - * Validates the current values of the child controls using their validators. - * - * - */ -JSBool Window::validate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->Validate()); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Make modal or not. - * When flag is true, all other windows are disabled. - * - * - */ -JSBool Window::makeModal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - bool flag; - if ( FromJS(cx, argv[0], flag) ) - { - p->MakeModal(flag); - } - else - { - return JS_FALSE; - } - } - else - p->MakeModal(); - - return JS_TRUE; -} - -/*** - * - * - * - * Repaint all invalid areas of the window immediately - * - * - */ -JSBool Window::update(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Update(); - - return JS_TRUE; -} - -/*** - * - * - * - * Freeze the window: don't redraw it until it is thawed - * See @wxWindow#thaw - * - * - */ -JSBool Window::freeze(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Freeze(); - - return JS_TRUE; -} - -/*** - * - * - * - * Thaw the window: redraw it after it had been frozen. - * See @wxWindow#freeze - * - * - */ -JSBool Window::thaw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Thaw(); - - return JS_TRUE; -} - -WXJS_BEGIN_STATIC_METHOD_MAP(Window) - WXJS_METHOD("findFocus", findFocus, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Finds the window or control which currently has the keyboard focus - * - * - */ -JSBool Window::findFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - Object *winObj = dynamic_cast(wxWindow::FindFocus()); - - *rval = (winObj == (Object*) NULL) - ? JSVAL_VOID - : OBJECT_TO_JSVAL(winObj->GetObject()); - - return JS_TRUE; -} - -/*** - * - * - * Called when the window is activated/disactivated. The function - * gets a @wxActivateEvent as argument. - * - * - * Called when the user enters a character. The function - * gets a @wxKeyEvent object as argument. - * - * - * This event is triggered to allow the window to intercept keyboard events before they are - * processed by child windows. The function gets a @wxKeyEvent as argument. - * - * - * Called when the user has pressed a key, before it is translated into an - * ASCII value using other modifier keys that might be pressed at the same time. - * The function gets a @wxKeyEvent object as argument. - * - * - * Called when the user has released the key. - * The function gets a @wxKeyEvent object as argument. - * - * - * Called when the window gets the focus. - * The function gets a @wxFocusEvent object as argument. - * - * - * Called when the window looses the focus. - * The function gets a @wxFocusEvent object as argument. - * - * - * This event is sent as a dialog or panel is being initialised. - * Handlers for this event can transfer data to the window. - * The function gets a @wxInitDialogEvent as argument - * - * - * Used for handling all the mouse events. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the mouse enters the window. The function - * gets a @wxMouseEvent as argument. - * Under Windows mouse enter and leave events are not natively supported by the - * system but are generated by wxWindows itself. This has several drawbacks: - * the @wxWindow#onLeaveWindow event might be received some time after the mouse left - * the window and the state variables for it may have changed during this time. - * See @wxWindow#onLeaveWindow - * - * - * Event triggered when the mouse leaves the window. The function - * gets a @wxMouseEvent as argument. - * Under Windows mouse enter and leave events are not natively supported by the - * system but are generated by wxWindows itself. This has several drawbacks: - * the onLeaveWindow event might be received some time after the mouse left - * the window and the state variables for it may have changed during this time. - * See @wxWindow#onEnterWindow - * - * - * Event triggered when the left button is pressed. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the left button is released. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the left button is double clicked. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the middle button is pressed. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the middle button is released. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the middle button is double clicked. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the right button is pressed. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the right button is released. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the right button is double clicked. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the mouse is moved. The function - * gets a @wxMouseEvent as argument. - * - * - * Event triggered when the mousewheel is used. The function - * gets a @wxMouseEvent as argument. - * - * - * Called when the window is moved. The function gets a @wxMoveEvent as argument. - * - * - * Called when the window is resized. The function gets a @wxSizeEvent as argument. - * - * - * Catch all scroll commands. The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a command to put the scroll thumb at the maximum position. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a command to put the scroll thumb at the maximum position. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a line up command. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a line down command. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a page up command. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a page down command. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a thumbtrack command (continuous movement of the scroll thumb). - * The argument of the function is a @wxScrollWinEvent. - * - * - * Catch a thumbtrack release command. - * The argument of the function is a @wxScrollWinEvent. - * - * - * Triggered when the user pressed F1 (on Windows) or - * when the user requested context-sensitive help. - * The argument of the function is a @wxHelpEvent. - * See @wxContextHelp, @wxHelpEvent and @wxContextHelpButton - * - * -*/ Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/window.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * wxJavaScript - radiobtn.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: radiobtn.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSRadioButton_H -#define _WXJSRadioButton_H - -///////////////////////////////////////////////////////////////////////////// -// Name: radiobtn.h -// Purpose: RadioButton ports wxRadioButton to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 19.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class RadioButton : public wxRadioButton - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - RadioButton(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~RadioButton(); - - static bool GetProperty(wxRadioButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxRadioButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxRadioButton* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxRadioButton *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Property Ids. - */ - enum - { - P_VALUE - }; - - void OnRadioButton(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSRadioButton_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.cpp (nonexistent) @@ -1,475 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - combobox.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: combobox.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// combobox.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "combobox.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -ComboBox::ComboBox(JSContext *cx, JSObject *obj) - : wxComboBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -ComboBox::~ComboBox() -{ - PopEventHandler(true); -} - -/*** - * control/combobox - * gui - * - * A combobox is like a combination of an edit control and a listbox. - * It can be displayed as static list with editable or read-only text field; - * or a drop-down list with text field; or a drop-down list without a text field. - * - */ -WXJS_INIT_CLASS(ComboBox, "wxComboBox", 2) - -/*** - * - * - * Returns true if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows. - * - * - * Returns true if the combobox is editable and there is a text selection to cut to the clipboard. Only available on Windows. - * - * - * Returns true if the combobox is editable and there is text to paste from the clipboard. Only available on Windows. - * - * - * Returns true if the combobox is editable and the last undo can be redone. Only available on Windows. - * - * - * Returns true if the combobox is editable and the last edit can be undone. Only available on Windows. - * - * - * Gets/Sets the text field - * - * - * Gets/Sets the insertion point of the text field - * - * - * Gets the last position of the text field - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ComboBox) - WXJS_PROPERTY(P_VALUE, "value") - WXJS_PROPERTY(P_INSERTION_POINT, "insertionPoint") - WXJS_READONLY_PROPERTY(P_LAST_POSITION, "lastPosition") - WXJS_READONLY_PROPERTY(P_CAN_COPY, "canCopy") - WXJS_READONLY_PROPERTY(P_CAN_CUT, "canCut") - WXJS_READONLY_PROPERTY(P_CAN_PASTE, "canPaste") - WXJS_READONLY_PROPERTY(P_CAN_REDO, "canRedo") - WXJS_READONLY_PROPERTY(P_CAN_UNDO, "canUndo") -WXJS_END_PROPERTY_MAP() - -bool ComboBox::GetProperty(wxComboBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_CAN_COPY: - *vp = ToJS(cx, p->CanCopy()); - break; - case P_CAN_CUT: - *vp = ToJS(cx, p->CanCut()); - break; - case P_CAN_PASTE: - *vp = ToJS(cx, p->CanPaste()); - break; - case P_CAN_REDO: - *vp = ToJS(cx, p->CanRedo()); - break; - case P_CAN_UNDO: - *vp = ToJS(cx, p->CanUndo()); - break; - case P_VALUE: - *vp = ToJS(cx, p->GetValue()); - break; - case P_INSERTION_POINT: - *vp = ToJS(cx, p->GetInsertionPoint()); - break; - case P_LAST_POSITION: - *vp = ToJS(cx, p->GetLastPosition()); - break; - } - return true; -} - -bool ComboBox::SetProperty(wxComboBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_VALUE: - { - wxString value; - FromJS(cx, *vp, value); - p->SetValue(value); - break; - } - case P_INSERTION_POINT: - { - int point; - if ( FromJS(cx, *vp, point) ) - p->SetInsertionPoint(point); - break; - } - } - return true; -} - -/*** - * - * - * SIMPLE - * DROPDOWN - * READONLY - * SORT - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(ComboBox) - WXJS_CONSTANT(wxCB_, SIMPLE) - WXJS_CONSTANT(wxCB_, DROPDOWN) - WXJS_CONSTANT(wxCB_, READONLY) - WXJS_CONSTANT(wxCB_, SORT) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of the wxComboBox - * - * - * A window identifier. Use -1 when you don't need it - * - * - * The default text of the text field - * - * - * The position of the control on the given parent. - * - * - * The size of the control. - * - * - * An array of Strings to initialize the control. - * - * - * The window style. - * - * - * A validator - * - * - * - * Constructs a new wxComboBox object - * - * - */ -wxComboBox *ComboBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 8 ) - argc = 8; - - int style = 0; - StringsPtr items; - wxString text; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 8: - val = Validator::GetPrivate(cx, argv[7]); - if ( val == NULL ) - break; - case 7: - if ( ! FromJS(cx, argv[6], style) ) - break; - // Fall through - case 6: - if ( ! FromJS(cx, argv[5], items) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - ComboBox *p = new ComboBox(cx, obj); - p->Create(parent, id, text, *pt, *size, items.GetCount(), items.GetStrings(), style, *val); - - return p; - } - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(ComboBox) - WXJS_METHOD("copy", copy, 0) - WXJS_METHOD("cut", cut, 0) - WXJS_METHOD("paste", paste, 0) - WXJS_METHOD("replace", replace, 3) - WXJS_METHOD("remove", remove, 2) - WXJS_METHOD("redo", redo, 0) - WXJS_METHOD("undo", undo, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * Copies the selected text to the clipboard - * - * - */ -JSBool ComboBox::copy(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Copy(); - - return JS_TRUE; -} - -/*** - * - * - * - * Copies the selected text to the clipboard and removes the selected text - * - * - */ -JSBool ComboBox::cut(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Cut(); - - return JS_TRUE; -} - -/*** - * - * - * - * Pastes the content of the clipboard in the text field. - * - * - */ -JSBool ComboBox::paste(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Paste(); - - return JS_TRUE; -} - -/*** - * - * - * - * Redoes the last undo in the text field. Windows only. - * - * - */ -JSBool ComboBox::redo(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Redo(); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Removes the text between From and To - * - * - */ -JSBool ComboBox::remove(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long from = 0L; - long to = 0L; - if ( FromJS(cx, argv[0], from) - && FromJS(cx, argv[1], to) ) - { - p->Remove(from, to); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * - * Replaces the text between From and To with the given text - * - * - */ -JSBool ComboBox::replace(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int from; - int to; - wxString text; - - if ( FromJS(cx, argv[0], from) - && FromJS(cx, argv[1], to) - && FromJS(cx, argv[2], text) ) - { - p->Replace(from, to, text); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * Undoes the last edit in the text field. Windows only. - * - * - */ -JSBool ComboBox::undo(JSContext *cx, JSObject *obj, - uintN argc, jsval *argv, jsval *rval) -{ - wxComboBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Undo(); - - return JS_TRUE; -} - -/*** - * - * - * Called when the text of the textfield is changed. - * The type of the argument that your handler receives is @wxCommandEvent. - * - * - * Called when an item is selected. The type of the argument - * that your handler receives is @wxCommandEvent. - * - * - */ -void ComboBox::OnText(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onText"); -} - -void ComboBox::OnComboBox(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onComboBox"); -} - -BEGIN_EVENT_TABLE(ComboBox, wxComboBox) - EVT_TEXT(-1, ComboBox::OnText) - EVT_COMBOBOX(-1, ComboBox::OnComboBox) -END_EVENT_TABLE() - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/combobox.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.h (nonexistent) @@ -1,55 +0,0 @@ -/* - * wxJavaScript - listitattr.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: listitattr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_gui_listitattr_h -#define _wxjs_gui_listitattr_h - -namespace wxjs -{ - namespace gui - { - class ListItemAttr : public ApiWrapper - { - public: - - static bool GetProperty(wxListItemAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxListItemAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static wxListItemAttr *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_TEXT_COLOUR = WXJS_START_PROPERTY_ID - , P_BG_COLOUR - , P_FONT - , P_HAS_TEXT_COLOUR - , P_HAS_BG_COLOUR - , P_HAS_FONT - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_wxjs_gui_listitattr_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listitattr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.cpp (nonexistent) @@ -1,142 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - pwdlg.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: pwdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "../misc/point.h" - -#include "../event/jsevent.h" -#include "../event/evthand.h" - -#include "pwdlg.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -PasswordEntryDialog::PasswordEntryDialog( JSContext *cx - , JSObject *obj - , wxWindow* parent - , const wxString& message - , const wxString& caption - , const wxString& defaultValue - , long style - , const wxPoint& pos) - : wxPasswordEntryDialog(parent, message, caption, defaultValue, style, pos) - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -PasswordEntryDialog::~PasswordEntryDialog() -{ - PopEventHandler(true); -} - -/*** - * control/pwdlg - * gui - * - * This class represents a dialog that requests a password from the user. - * - */ -WXJS_INIT_CLASS(PasswordEntryDialog, "wxPasswordEntryDialog", 2) - -/*** - * - * - * The parent of the dialog. null is Allowed. - * Message to show on the dialog. - * The title of the dialog. - * The default value of the text control. - * The position of the dialog. - * A dialog style, the buttons wxId.OK and wxId.CANCEL can be used. - * - * - * Constructs a new wxPasswordEntryDialog object. - * - * - */ -wxPasswordEntryDialog* PasswordEntryDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = wxOK | wxCANCEL | wxCENTRE; - const wxPoint *pt = &wxDefaultPosition; - wxString defaultValue = wxEmptyString; - wxString caption = wxEmptyString; - - switch(argc) - { - case 6: - pt = Point::GetPrivate(cx, argv[5]); - if ( pt == NULL ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], defaultValue) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], caption) ) - break; - // Fall through - default: - wxString message; - if ( ! FromJS(cx, argv[1], message) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - PasswordEntryDialog *p = new PasswordEntryDialog(cx, obj, parent, message, - caption, defaultValue, style, *pt); - return p; - } - - return NULL; -} - -void PasswordEntryDialog::Destruct(JSContext *cx, wxPasswordEntryDialog *p) -{ -} - -BEGIN_EVENT_TABLE(PasswordEntryDialog, wxPasswordEntryDialog) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/control.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/control.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/control.cpp (nonexistent) @@ -1,94 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - control.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: control.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// control.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "control.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/control - * gui - * - * This is the prototype for a control or 'widget'. - * A control is generally a small window which processes user input - * and/or displays one or more item of data. - * - */ -WXJS_INIT_CLASS(Control, "wxControl", 0) - -/*** - * - * - * Get/Set the label - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Control) - WXJS_PROPERTY(P_LABEL, "label") -WXJS_END_PROPERTY_MAP() - -bool Control::GetProperty(wxControl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_LABEL ) - *vp = ToJS(cx, p->GetLabel()); - return true; -} - -bool Control::SetProperty(wxControl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_LABEL ) - { - wxString label; - FromJS(cx, *vp, label); - p->SetLabel(label); - } - return true; -} - -void Control::Destruct(JSContext *cx, wxControl* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(Control) -WXJS_END_METHOD_MAP() - -//TODO: An event can't be created yet, so this function is not used. -JSBool Control::command(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxControl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/control.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - treeid.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: treeid.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTreeItemId_H -#define _WXJSTreeItemId_H - -///////////////////////////////////////////////////////////////////////////// -// Name: treeid.h -// Purpose: TreeItemId ports wxTreeItemId to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 03.01.2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - - -namespace wxjs -{ - namespace gui - { - class TreeItemId : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxTreeItemId - */ - static bool GetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - /** - * Property Ids. - */ - enum - { - P_OK - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTreeItemId_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.h (nonexistent) @@ -1,91 +0,0 @@ -/* - * wxJavaScript - treeitem.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: treeitem.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTreeItem_H -#define _WXJSTreeItem_H - -///////////////////////////////////////////////////////////////////////////// -// Name: treeitem.h -// Purpose: wxTreeItem is not part of wxWindows -// It's purpose is to concentrate the specific item methods -// into one class. -// Author: Franky Braem -// Modified by: -// Created: -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class TreeItem : public ApiWrapper - { - public: - /** - * Callback for retrieving properties of wxTreeItem - */ - static bool GetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for setting properties - */ - static bool SetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_TEXT - , P_DATA - , P_TEXT_COLOUR - , P_BACKGROUND_COLOUR - , P_FONT - , P_HAS_CHILDREN - , P_BOLD - , P_VISIBLE - , P_EXPANDED - , P_SELECTED - , P_CHILDREN_COUNT - , P_ALL_CHILDREN_COUNT - , P_PARENT - , P_LAST_CHILD - , P_NEXT_SIBLING - , P_PREV_SIBLING - }; - - static JSBool getImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getFirstChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getNextChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTreeItem_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.cpp (nonexistent) @@ -1,2269 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - treectrl.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: treectrl.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSTreeCtrl.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.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" -#include "../misc/imagelst.h" -#include "../misc/font.h" - -#include "treectrl.h" -#include "treeid.h" -#include "treeitem.h" -#include "treehit.h" -#include "window.h" -#include "textctrl.h" - -using namespace wxjs; -using namespace wxjs::gui; - -TreeCtrl::TreeCtrl(JSContext *cx, JSObject *obj) - : wxTreeCtrl() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -TreeCtrl::~TreeCtrl() -{ - PopEventHandler(true); -} - -int TreeCtrl::OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2) -{ - JSContext *cx = GetContext(); - if (cx == NULL ) - return 0; - - jsval rval; - jsval argv[] = { - TreeItemId::CreateObject(cx, new wxTreeItemId(item1)), - TreeItemId::CreateObject(cx, new wxTreeItemId(item2)) - }; - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onCompareItems", &fval) == JS_TRUE ) - { - if ( JS_CallFunctionValue(cx, GetObject(), fval, 2, argv, &rval) == JS_TRUE ) - { - int rc; - if ( FromJS(cx, rval, rc) ) - return rc; - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - } - return wxTreeCtrl::OnCompareItems(item1, item2); -} - -/*** - * control/treectrl - * gui - * - * A tree control presents information as a hierarchy, with items that may be - * expanded to show further items. Items in a tree control are referenced by - * @wxTreeItemId handles. - * - */ -WXJS_INIT_CLASS(TreeCtrl, "wxTreeCtrl", 2) - -/*** - * - * - * Get the total number of items in the control. - * - * - * Gets the first visible item. - * - * - * Get/Set the normal image list. - * - * - * Get/Set the indent. Indent is the number of pixels the children are indented relative to - * the parents position. Setting indent also redraws the control immediately. - * - * - * Set this to a function when you want to change the sort order of the items in the - * tree control. The function should return a negative, zero or positive value if the first - * item is less than, equal to or greater than the second one. The function gets two - * @wxTreeItemId objects as arguments. When not set, the items are sorted - * alphabetically. - * - * - * Gets the root item. - * - * - * Gets the selection. Use @wxTreeCtrl#selections when the tree can have more then - * one selected item (MULTIPLE style). - * - * - * Gets all selected items (An array with @wxTreeItemId objects). - * - * - * Get/Set the state image list. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TreeCtrl) - WXJS_READONLY_PROPERTY(P_COUNT, "count") - WXJS_PROPERTY(P_INDENT, "indent") - WXJS_PROPERTY(P_IMAGE_LIST, "imageList") - WXJS_PROPERTY(P_STATE_IMAGE_LIST, "stateImageList") - WXJS_READONLY_PROPERTY(P_ROOT_ITEM, "rootItem") - WXJS_READONLY_PROPERTY(P_SELECTION, "selection") - WXJS_READONLY_PROPERTY(P_SELECTIONS, "selections") - WXJS_READONLY_PROPERTY(P_FIRST_VISIBLE, "firstVisibleItem") - WXJS_READONLY_PROPERTY(P_EDIT_CONTROL, "editControl") -WXJS_END_PROPERTY_MAP() - -bool TreeCtrl::GetProperty(wxTreeCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_COUNT: - *vp = ToJS(cx, p->GetCount()); - break; - case P_INDENT: - *vp = ToJS(cx, p->GetIndent()); - break; - case P_IMAGE_LIST: - { - Object *imgList = dynamic_cast(p->GetImageList()); - *vp =( imgList == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(imgList->GetObject()); - break; - } - case P_STATE_IMAGE_LIST: - { - Object *imgList = dynamic_cast(p->GetStateImageList()); - *vp =( imgList == NULL ) ? JSVAL_VOID : OBJECT_TO_JSVAL(imgList->GetObject()); - break; - } - case P_ROOT_ITEM: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetRootItem())); - break; - case P_SELECTION: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetSelection())); - break; - case P_FIRST_VISIBLE: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetFirstVisibleItem())); - break; - case P_EDIT_CONTROL: - *vp = TextCtrl::CreateObject(cx, p->GetEditControl(), obj); - break; - case P_SELECTIONS: - { - wxArrayTreeItemIds selections; - jsint count = p->GetSelections(selections); - JSObject *objSelections = JS_NewArrayObject(cx, count, NULL); - - *vp = OBJECT_TO_JSVAL(objSelections); - - jsint i = 0; - for (; i < count; i++) - { - jsval element = TreeItemId::CreateObject(cx, new wxTreeItemId(selections[i])); - JS_SetElement(cx, objSelections, i++, &element); - } - } - break; - } - return true; -} - -bool TreeCtrl::SetProperty(wxTreeCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch(id) - { - case P_INDENT: - { - int indent; - if ( FromJS(cx, p->GetIndent(), indent)) - p->SetIndent(indent); - break; - } - case P_IMAGE_LIST: - { - wxImageList *imgList = ImageList::GetPrivate(cx, *vp); - if ( imgList != NULL ) - p->SetImageList(imgList); - break; - } - case P_STATE_IMAGE_LIST: - { - wxImageList *imgList = ImageList::GetPrivate(cx, *vp); - if ( imgList != NULL ) - p->SetStateImageList(imgList); - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(TreeCtrl) - WXJS_CONSTANT(wxTR_, NO_BUTTONS) - WXJS_CONSTANT(wxTR_, HAS_BUTTONS) - WXJS_CONSTANT(wxTR_, TWIST_BUTTONS) - WXJS_CONSTANT(wxTR_, NO_LINES) - WXJS_CONSTANT(wxTR_, LINES_AT_ROOT) - WXJS_CONSTANT(wxTR_, MAC_BUTTONS) - WXJS_CONSTANT(wxTR_, AQUA_BUTTONS) - WXJS_CONSTANT(wxTR_, SINGLE) - WXJS_CONSTANT(wxTR_, MULTIPLE) - WXJS_CONSTANT(wxTR_, EXTENDED) - WXJS_CONSTANT(wxTR_, FULL_ROW_HIGHLIGHT) - WXJS_CONSTANT(wxTR_, EDIT_LABELS) - WXJS_CONSTANT(wxTR_, ROW_LINES) - WXJS_CONSTANT(wxTR_, HIDE_ROOT) - WXJS_CONSTANT(wxTR_, HAS_VARIABLE_ROW_HEIGHT) - WXJS_CONSTANT(wxTR_, DEFAULT_STYLE) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxTreeCtrl. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The position of the TreeCtrl control on the given parent. - * - * - * The size of the TreeCtrl control. - * - * - * The wxTreeCtrl style. - * - * - * Validator. - * - * - * - * Constructs a new wxTreeCtrl object. - * - * - */ -wxTreeCtrl* TreeCtrl::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 6: - val = Validator::GetPrivate(cx, argv[5]); - if ( val == NULL ) - break; - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxTreeCtrl *p = new TreeCtrl(cx, obj); - p->Create(parent, id, *pt, *size, style, *val); - - return p; - } - return NULL; -} - -void TreeCtrl::Destruct(JSContext *cx, wxTreeCtrl* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(TreeCtrl) - WXJS_METHOD("getItem", getItem, 1) - WXJS_METHOD("getItemText", getItemText, 1) - WXJS_METHOD("setItemText", setItemText, 2) - WXJS_METHOD("getItemImage", getItemImage, 2) - WXJS_METHOD("setItemImage", setItemImage, 3) - WXJS_METHOD("getItemData", getItemData, 1) - WXJS_METHOD("setItemData", setItemData, 2) - WXJS_METHOD("getItemTextColour", getItemTextColour, 1) - WXJS_METHOD("setItemTextColour", setItemTextColour, 2) - WXJS_METHOD("getItemBackgroundColour", getItemBackgroundColour, 1) - WXJS_METHOD("setItemBackgroundColour", setItemBackgroundColour, 2) - WXJS_METHOD("getItemFont", getItemFont, 1) - WXJS_METHOD("setItemFont", setItemFont, 2) - WXJS_METHOD("setItemHasChildren", setItemHasChildren, 1) - WXJS_METHOD("isBold", isBold, 1) - WXJS_METHOD("setItemBold", setItemBold, 1) - WXJS_METHOD("setItemDropHighlight", setItemDropHighlight, 1) - WXJS_METHOD("isVisible", isVisible, 1) - WXJS_METHOD("isExpanded", isExpanded, 1) - WXJS_METHOD("isSelected", isSelected, 1) - WXJS_METHOD("getChildrenCount", getChildrenCount, 1) - WXJS_METHOD("getItemParent", getItemParent, 1) - WXJS_METHOD("getFirstChild", getFirstChild, 2) - WXJS_METHOD("getNextChild", getNextChild, 2) - WXJS_METHOD("getPrevSibling", getPrevSibling, 1) - WXJS_METHOD("getNextSibling", getNextSibling, 1) - WXJS_METHOD("getPrevVisible", getPrevVisible, 1) - WXJS_METHOD("getNextVisible", getNextVisible, 1) - WXJS_METHOD("addRoot", addRoot, 1) - WXJS_METHOD("appendItem", appendItem, 2) - WXJS_METHOD("prependItem", prependItem, 2) - WXJS_METHOD("insertItem", insertItem, 3) - WXJS_METHOD("deleteItem", deleteItem, 1) - WXJS_METHOD("deleteChildren", deleteChildren, 1) - WXJS_METHOD("deleteAllItems", deleteAllItems, 0) - WXJS_METHOD("expand", expand, 1) - WXJS_METHOD("collapse", collapse, 1) - WXJS_METHOD("collapseAndReset", collapseAndReset, 1) - WXJS_METHOD("toggle", toggle, 1) - WXJS_METHOD("unselect", unselect, 0) - WXJS_METHOD("unselectAll", unselectAll, 0) - WXJS_METHOD("selectItem", selectItem, 1) - WXJS_METHOD("ensureVisible", ensureVisible, 1) - WXJS_METHOD("scrollTo", scrollTo, 1) - WXJS_METHOD("editLabel", editLabel, 1) - WXJS_METHOD("sortChildren", sortChildren, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The id of the item - * - * - * - * Creates a @wxTreeItem from the given @wxTreeItemId. - * @wxTreeItem can be used to alter the item without - * always passing the id to the tree control. null is returned - * when the id is not valid. - * - * - */ -JSBool TreeCtrl::getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - if ( id->IsOk() ) - *rval = TreeItem::CreateObject(cx, new wxTreeItemId(*id)); - else - *rval = JSVAL_VOID; - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Gets the text of the given item. - * See also @wxTreeItem @wxTreeItem#text property - * - * - */ -JSBool TreeCtrl::getItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = ToJS(cx, p->GetItemText(*id)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The new text for the item. - * - * - * - * Sets the text of the given item. - * The example changes the text of the root. - * - * tree.setItemText(tree.rootItem, "root"); - * - * See @wxTreeItem @wxTreeItem#text property - * - * - */ -JSBool TreeCtrl::setItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - wxString text; - FromJS(cx, argv[1], text); - p->SetItemText(*id, text); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * A @wxTreeItemIcon constant. - * - * - * - * Gets the specified item image. - * See @wxTreeItem @wxTreeItem#getImage method - * - * - */ -JSBool TreeCtrl::getItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - int which; - - if ( id != NULL - && FromJS(cx, argv[1], which) ) - { - *rval = ToJS(cx, p->GetItemImage(*id, (wxTreeItemIcon) which)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The new image for the item. - * - * - * A @wxTreeItemIcon constant. - * - * - * - * Sets the image for the given item. - * See @wxTreeItem @wxTreeItem#setImage method - * - * - */ -JSBool TreeCtrl::setItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - int image; - int which; - if ( id != NULL - && FromJS(cx, argv[1], image) - && FromJS(cx, argv[2], which) ) - { - p->SetItemImage(*id, image, (wxTreeItemIcon) which); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Gets the associated object or value of the item. The item data - * can be any possible JavaScript type. - * See @wxTreeItem @wxTreeItem#data property, @wxTreeCtrl#setItemData - * - * - */ -JSBool TreeCtrl::getItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - ObjectTreeData *data = (ObjectTreeData*) p->GetItemData(*id); - *rval = ( data == NULL ) ? JSVAL_VOID : data->GetJSVal(); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The data to associate with this item. - * - * - * - * Sets the associated data for the given item. You can use - * any type: Integer, Object, Boolean, ... - *

- * The following example shows that you can use an object as item data. - *

- *    dlg = new wxDialog(null, -1, "Tree example");
- *    dlg.tree = new wxTreeCtrl(dlg, 1);
- *
- *    var root = dlg.tree.addRoot("Root");
- *    var id = dlg.tree.appendItem(root, "Child 1");
- *
- *    dlg.tree.setItemData(id, new Date());
- *    id = dlg.tree.appendItem(root, "Child 2");
- *    dlg.tree.setItemData(id, new Date());
- *    id = dlg.tree.appendItem(root, "Child 3");
- *    dlg.tree.setItemData(id, new Date());
- *   
- * See @wxTreeItem @wxTreeItem#data property, @wxTreeCtrl#getItemData - *
- *
- */ -JSBool TreeCtrl::setItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - ObjectTreeData *data = new ObjectTreeData(cx, argv[1]); - p->SetItemData(*id, data); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * Gets the text colour of the item. - * See @wxTreeItem @wxTreeItem#textColour property - * - * - */ -JSBool TreeCtrl::getItemTextColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = Colour::CreateObject(cx, new wxColour(p->GetItemTextColour(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The new colour. - * - * - * - * Sets a new text colour for this item. - * The example sets red as the text colour of the root item. - * - * tree.setItemTextColour(tree.rootItem, wxRED); - * - * See @wxTreeItem @wxTreeItem#textColour property - * - * - */ -JSBool TreeCtrl::setItemTextColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - wxColour *colour = Colour::GetPrivate(cx, argv[1]); - if ( id != NULL ) - { - p->SetItemTextColour(*id, *colour); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * Gets the background colour of the item. - * See @wxTreeItem @wxTreeItem#backgroundColour property - * - * - */ -JSBool TreeCtrl::getItemBackgroundColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = Colour::CreateObject(cx, new wxColour(p->GetItemBackgroundColour(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The new colour. - * - * - * - * Sets a new background colour for this item. - * The example sets the backgroundcolour of the root item to red. - * - * tree.setItemBackgroundColour(tree.rootItem, wxRED); - * - * See @wxTreeItem @wxTreeItem#backgroundColour property - * - * - */ -JSBool TreeCtrl::setItemBackgroundColour(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - wxColour *colour = Colour::GetPrivate(cx, argv[1]); - if ( id != NULL ) - { - p->SetItemBackgroundColour(*id, *colour); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Gets the font of the item. - * See @wxTreeItem @wxTreeItem#font property - * - * - */ -JSBool TreeCtrl::getItemFont(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = Font::CreateObject(cx, new wxFont(p->GetItemFont(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * The new font. - * - * - * - * Sets a new font for this item. - * See @wxTreeItem @wxTreeItem#font property. - * - * - */ -JSBool TreeCtrl::setItemFont(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - wxFont *font = Font::GetPrivate(cx, argv[1]); - if ( id != NULL - && font != NULL ) - { - p->SetItemFont(*id, *font); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * - * Force appearance of the button next to the item. This is useful to allow - * the user to expand the items which don't have any children now, but instead - * adding them only when needed, thus minimizing memory usage and loading time. - * See @wxTreeItem @wxTreeItem#hasChildren property - * - * - */ -JSBool TreeCtrl::setItemHasChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool hasChildren; - if ( argc == 1 ) - hasChildren = true; - else if ( ! FromJS(cx, argv[1], hasChildren) ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->SetItemHasChildren(*id, hasChildren); - return JS_TRUE; - } - return JS_FALSE; -} - - -/*** - * - * - * - * The id of the item - * - * - * - * Returns true when the item text is in bold. - * See @wxTreeItem @wxTreeItem#bold property - * - * - */ -JSBool TreeCtrl::isBold(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = ToJS(cx, p->IsBold(*id)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * - * Makes item appear in bold font if bold parameter is true - * or resets it to the normal state. - * See @wxTreeItem @wxTreeItem#bold property - * - * - */ -JSBool TreeCtrl::setItemBold(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - bool bold; - if ( argc == 1 ) - bold = true; - else if ( ! FromJS(cx, argv[1], bold) ) - return JS_FALSE; - - if ( id != NULL ) - { - p->SetItemBold(*id, bold); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * - * The item will be shown with a drop highlight or not. - * - * - */ -JSBool TreeCtrl::setItemDropHighlight(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - bool highlight; - if ( argc == 1 ) - highlight = true; - else if ( ! FromJS(cx, argv[1], highlight) ) - return JS_FALSE; - - if ( id != NULL ) - { - p->SetItemDropHighlight(*id, highlight); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns true when the item is visible. - * See @wxTreeItem @wxTreeItem#visible property - * - * - */ -JSBool TreeCtrl::isVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = ToJS(cx, p->IsVisible(*id)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns true when the item is expanded. - * See @wxTreeItem @wxTreeItem#expanded property - * - * - */ -JSBool TreeCtrl::isExpanded(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = TreeCtrl::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = ToJS(cx, p->IsExpanded(*id)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns true when the item is selected. - * See @wxTreeItem @wxTreeItem#selected property - * - * - */ -JSBool TreeCtrl::isSelected(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = ToJS(cx, p->IsSelected(*id)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * If Recurse is true (the default), returns the total number of descendants, - * otherwise only one level of children is counted - * - * - * - * Returns the number of childrens of the item. - * See @wxTreeItem @wxTreeItem#bold property - * - * - */ -JSBool TreeCtrl::getChildrenCount(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - bool recursive; - if ( argc == 1 ) - recursive = true; - else if ( ! FromJS(cx, argv[1], recursive) ) - return JS_FALSE; - - if ( id != NULL ) - { - *rval = ToJS(cx, p->GetChildrenCount(*id, recursive)); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns the parent of the item. - * See @wxTreeItem @wxTreeItem#parent property - * - * - */ -JSBool TreeCtrl::getItemParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - - if ( id != NULL ) - { - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetItemParent(*id))); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * For this enumeration function you must pass in a 'cookie' parameter - * which is opaque for the application but is necessary for the library - * to make these functions reentrant (i.e. allow more than one enumeration - * on one and the same object simultaneously). The cookie passed - * to getFirstChild and @wxTreeCtrl_getNextChild should be the same variable. - * - * - * - * Returns the first child item. An invalid item is returned when there is no child item. - * See @wxTreeItem @wxTreeItem#getFirstChild method - * - * - */ -JSBool TreeCtrl::getFirstChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - long cookie; - if ( id != NULL - && FromJS(cx, argv[1], cookie) ) - { - wxTreeItemIdValue newCookie = (wxTreeItemIdValue) cookie; - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetFirstChild(*id, newCookie))); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * For this enumeration function you must pass in a 'cookie' parameter - * which is opaque for the application but is necessary for the library - * to make these functions reentrant (i.e. allow more than one enumeration - * on one and the same object simultaneously). The cookie passed - * to @wxTreeCtrl#getNextChild and getNextChild should be the same variable. - * - * - * - * Returns the next child item. An invalid item is returned when there is no child item. - * See @wxTreeItem @wxTreeItem#getNextChild method - * - * - */ -JSBool TreeCtrl::getNextChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - long cookie; - if ( id != NULL - && FromJS(cx, argv[1], cookie) ) - { - wxTreeItemIdValue newCookie = (wxTreeItemIdValue) cookie; - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetNextChild(*id, newCookie))); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns the previous sibling item. An invalid item is returned when there is no child item. - * See @wxTreeItem @wxTreeItem#prevSibling property - * - * - */ -JSBool TreeCtrl::getPrevSibling(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetPrevSibling(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns the next sibling item. An invalid item is returned when there is no child item. - * See @wxTreeItem @wxTreeItem#nextSibling property - * - * - */ -JSBool TreeCtrl::getNextSibling(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetNextSibling(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns the previous visible item. - * - * - */ -JSBool TreeCtrl::getPrevVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetPrevVisible(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Returns the next visible item. The item itself must also be visible. - * See @wxTreeItem @wxTreeItem#nextSibling property - * - * - */ -JSBool TreeCtrl::getNextVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->GetNextVisible(*id))); - return JS_TRUE; - } - return JS_FALSE; -} - - -/*** - * - * - * - * The text for the root item. - * - * - * Index of the image for normal items. The default is -1 which means don't use. - * - * - * Index of the image for selected items. The default is -1 which means don't use. - * - * - * - * - * Adds the root node to the tree, returning the id of the new item. - * The Image and SelectedImage parameters are an index within the normal image list - * specifying the image to use for unselected and selected items, respectively. - * If Image > -1 and SelectedImage is -1, the same image is used for both selected - * and unselected items. - *

- * The following example adds a root item and 3 childs to the root. - *

- *     var dlg = new wxDialog(null, -1, "Tree example");
- *     dlg.tree = new wxTreeCtrl(dlg, 1);
- *
- *     var root = dlg.tree.addRoot("Root");
- *     dlg.tree.appendItem(root, "Child 1");
- *     dlg.tree.appendItem(root, "Child 2");
- *     dlg.tree.appendItem(root, "Child 3");
- *    
- *
- *
- */ -JSBool TreeCtrl::addRoot(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if (argc > 4 ) - argc = 4; - - ObjectTreeData *data = NULL; - int selImage = -1; - int image = -1; - - switch(argc) - { - case 4: - data = new ObjectTreeData(cx, argv[3]); - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], selImage) ) - break; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], image) ) - break; - // Fall through - default: - - wxString text; - FromJS(cx, argv[0], text); - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(p->AddRoot(text, image, selImage, data))); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the parent item. - * - * - * The text for the root item. - * - * - * Index of the image for normal items. The default is -1 which means don't use. - * - * - * Index of the image for selected items. The default is -1 which means don't use. - * - * - * - * - * Appends an item to the end of the branch identified by parent, return a new item id. - * The Image and SelectedImage parameters are an index within the normal image list - * specifying the image to use for unselected and selected items, respectively. - * If Image > -1 and SelectedImage is -1, the same image is used for both selected - * and unselected items. - * - * - */ -JSBool TreeCtrl::appendItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if (argc > 5 ) - argc = 5; - - ObjectTreeData *data = NULL; - int selImage = -1; - int image = -1; - - switch(argc) - { - case 5: - data = new ObjectTreeData(cx, argv[4]); - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], selImage) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], image) ) - break; - // Fall through - default: - - wxString text; - FromJS(cx, argv[1], text); - - wxTreeItemId *parent = TreeItemId::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - wxTreeItemId newId = p->AppendItem(*parent, text, image, selImage, data); - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(newId)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the parent item. - * - * - * The text for the root item. - * - * - * Index of the image for normal items. The default is -1 which means don't use. - * - * - * Index of the image for selected items. The default is -1 which means don't use. - * - * - * - * - * Inserts a new item as the first child of the parent item, returns a new item id. - * The Image and SelectedImage parameters are an index within the normal image list - * specifying the image to use for unselected and selected items, respectively. - * If Image > -1 and SelectedImage is -1, the same image is used for both selected - * and unselected items. - * - * - */ -JSBool TreeCtrl::prependItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if (argc > 5 ) - argc = 5; - - ObjectTreeData *data = NULL; - int selImage = -1; - int image = -1; - - switch(argc) - { - case 5: - data = new ObjectTreeData(cx, argv[4]); - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], selImage) ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], image) ) - break; - // Fall through - default: - - wxString text; - FromJS(cx, argv[1], text); - - wxTreeItemId *parent = TreeItemId::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - wxTreeItemId newId = p->PrependItem(*parent, text, image, selImage, data); - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(newId)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the parent item. - * - * - * The id of the item to use as previous sibling. - * - * - * The text for the root item. - * - * - * Index of the image for normal items. The default is -1 which means don't use. - * - * - * Index of the image for selected items. The default is -1 which means don't use. - * - * - * - * - * The id of the parent item. - * - * - * The position of the item to use as previous sibling. - * - * - * The text for the root item. - * - * - * Index of the image for normal items. The default is -1 which means don't use. - * - * - * Index of the image for selected items. The default is -1 which means don't use. - * - * - * - * Inserts an item after a given one (Prev) or before one identified by its position (Pos). - * The Image and SelectedImage parameters are an index within the normal image list - * specifying the image to use for unselected and selected items, respectively. - * If Image > -1 and SelectedImage is -1, the same image is used for both selected - * and unselected items. - * - * - */ -JSBool TreeCtrl::insertItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if (argc > 6 ) - argc = 6; - - ObjectTreeData *data = NULL; - int selImage = -1; - int image = -1; - - switch(argc) - { - case 6: - data = new ObjectTreeData(cx, argv[5]); - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], selImage) ) - break; - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], image) ) - break; - // Fall through - default: - - wxString text; - FromJS(cx, argv[2], text); - - wxTreeItemId *parent = TreeItemId::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - wxTreeItemId newId; - if ( JSVAL_IS_INT(argv[1]) ) - { - int pos; - FromJS(cx, argv[1], pos); - newId = p->InsertItem(*parent, pos, text, image, selImage, data); - } - else - { - wxTreeItemId *prevId = TreeItemId::GetPrivate(cx, argv[1]); - if ( prevId == NULL ) - break; - newId = p->InsertItem(*parent, prevId, text, image, selImage, data); - } - *rval = TreeItemId::CreateObject(cx, new wxTreeItemId(newId)); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Deletes the item. - * You receive an event as @wxTreeCtrl#onDeleteItem. - * - * - */ -JSBool TreeCtrl::deleteItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->Delete(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Deletes all the children of the item. You don't get an event as @wxTreeCtrl#onDeleteItem - * event for the deleted items. - * - * - */ -JSBool TreeCtrl::deleteChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->DeleteChildren(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * Deletes all items. You don't get an @wxTreeCtrl#onDeleteItem - * event for the deleted items. - * - * - */ -JSBool TreeCtrl::deleteAllItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->DeleteAllItems(); - return JS_TRUE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Expands the item. - * See @wxTreeItem @wxTreeItem#expanded property - * - * - */ -JSBool TreeCtrl::expand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->Expand(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Collapses the item. - * See @wxTreeItem @wxTreeItem#expanded property - * - * - */ -JSBool TreeCtrl::collapse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->Collapse(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Collapses the item and removes the children. - * - * - */ -JSBool TreeCtrl::collapseAndReset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->CollapseAndReset(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Toggles the given item between collapsed and expanded states. - * See @wxTreeItem @wxTreeItem#expanded property - * - * - */ -JSBool TreeCtrl::toggle(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->Toggle(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * Unselects the selected item. - * See @wxTreeItem @wxTreeItem#selected property - * - * - */ -JSBool TreeCtrl::unselect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->Unselect(); - return JS_TRUE; -} - -/*** - * - * - * - * Unselects all selected items. - * - * - */ -JSBool TreeCtrl::unselectAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->UnselectAll(); - return JS_TRUE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Selects the given item. - * See @wxTreeItem @wxTreeItem#selected property - * - * - */ -JSBool TreeCtrl::selectItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->SelectItem(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Make sure the item is visible (expanding the parent item and/or - * scrolling to this item if necessary) - * See @wxTreeItem @wxTreeItem#visible property - * - * - */ -JSBool TreeCtrl::ensureVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->EnsureVisible(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Scroll to the item (but don't expand its parent) - * - * - */ -JSBool TreeCtrl::scrollTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->ScrollTo(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Start editing the label of the item. The item will be selected when - * it hadn't been before. - * - * - */ -JSBool TreeCtrl::editLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->EditLabel(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The id of the item - * - * - * Accept (false) or discard(true) the changes to the item label. Default is false. - * - * - * - * Ends editing the label of the item. Only on Windows - * - * - */ -JSBool TreeCtrl::endEditLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - #ifdef __WXMSW__ - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - bool discard = false; - if ( id != NULL ) - { - p->EditLabel(*id); - if ( argc > 1 ) - { - if ( ! FromJS(cx, argv[1], discard) ) - return JS_FALSE; - } - } - p->EndEditLabel(*id, discard); - #endif - - return JS_TRUE; -} - -/*** - * - * - * - * The id of the item - * - * - * - * Sorts the children of the given item using the function of @wxTreeCtrl#onCompareItems. - * When no function is set, the items are sorted alphabetically. - * - * - */ -JSBool TreeCtrl::sortChildren(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeItemId *id = TreeItemId::GetPrivate(cx, argv[0]); - if ( id != NULL ) - { - p->SortChildren(*id); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * The position to test. - * - * - * - * Determines which item (if any) is at the specified point. - * - * - */ -JSBool TreeCtrl::hitTest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - int flags; - wxTreeItemId item = p->HitTest(*pt, flags); - - *rval = TreeHitTest::CreateObject(cx, new wxTreeHitTest(item, flags)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * This event is triggered when the user starts dragging with the left mouse button. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the user starts dragging with the right mouse button. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the user starts editing an item. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the user ends editing the label. - * The function receives a @wxTreeEvent as argument. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * - * - * This event is triggered when an item is deleted. - * See @wxTreeCtrl#deleteItem. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the application needs information. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when information is supplied. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is expanded. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is about to expanded. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is collapsed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is about to collapse. - * The event can be vetoed using @wxNotifyEvent#veto or @wxNotifyEvent#allowed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the selection is changed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the selection is about to change. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when a key is pressed. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is activated. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is clicked with the right mousebutton. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when an item is clicked with the middle mousebutton. - * The function receives a @wxTreeEvent as argument. - * - * - * This event is triggered when the user releases the mouse button. - * The function receives a @wxTreeEvent as argument. - * - * - */ -BEGIN_EVENT_TABLE(TreeCtrl, wxTreeCtrl) - EVT_TREE_BEGIN_DRAG(-1, TreeCtrl::onBeginDrag) - EVT_TREE_BEGIN_RDRAG(-1, TreeCtrl::onBeginRDrag) - EVT_TREE_BEGIN_LABEL_EDIT(-1, TreeCtrl::onBeginLabelEdit) - EVT_TREE_END_LABEL_EDIT(-1, TreeCtrl::onEndLabelEdit) - EVT_TREE_DELETE_ITEM(-1, TreeCtrl::onDeleteItem) - EVT_TREE_GET_INFO(-1, TreeCtrl::onGetInfo) - EVT_TREE_SET_INFO(-1, TreeCtrl::onSetInfo) - EVT_TREE_ITEM_EXPANDED(-1, TreeCtrl::onItemExpanded) - EVT_TREE_ITEM_EXPANDING(-1, TreeCtrl::onItemExpanding) - EVT_TREE_ITEM_COLLAPSED(-1, TreeCtrl::onItemCollapsed) - EVT_TREE_ITEM_COLLAPSING(-1, TreeCtrl::onItemCollapsing) - EVT_TREE_SEL_CHANGED(-1, TreeCtrl::onSelChanged) - EVT_TREE_SEL_CHANGING(-1, TreeCtrl::onSelChanging) - EVT_TREE_KEY_DOWN(-1, TreeCtrl::onKeyDown) - EVT_TREE_ITEM_ACTIVATED(-1, TreeCtrl::onItemActivated) - EVT_TREE_ITEM_RIGHT_CLICK(-1, TreeCtrl::onItemRightClick) - EVT_TREE_ITEM_MIDDLE_CLICK(-1, TreeCtrl::onItemMiddleClick) - EVT_TREE_END_DRAG(-1, TreeCtrl::onEndDrag) -END_EVENT_TABLE() - -void TreeCtrl::onBeginDrag(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onBeginDrag"); -} - -void TreeCtrl::onBeginRDrag(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onBeginRDrag"); -} - -void TreeCtrl::onBeginLabelEdit(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onBeginLabelEdit"); -} - -void TreeCtrl::onEndLabelEdit(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onEndLabelEdit"); -} - -void TreeCtrl::onDeleteItem(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onDeleteItem"); -} - -void TreeCtrl::onGetInfo(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onGetInfo"); -} - -void TreeCtrl::onSetInfo(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onSetInfo"); -} - -void TreeCtrl::onItemExpanded(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemExpanded"); -} - -void TreeCtrl::onItemExpanding(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemExpanding"); -} - -void TreeCtrl::onItemCollapsed(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemCollapsed"); -} - -void TreeCtrl::onItemCollapsing(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemCollapsing"); -} - -void TreeCtrl::onSelChanged(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onSelChanged"); -} - -void TreeCtrl::onSelChanging(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onSelChanging"); -} - -void TreeCtrl::onKeyDown(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onKeyDown"); -} - -void TreeCtrl::onItemActivated(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemActivated"); -} - -void TreeCtrl::onItemRightClick(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemRightClick"); -} - -void TreeCtrl::onItemMiddleClick(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onItemMiddleClick"); -} - -void TreeCtrl::onEndDrag(wxTreeEvent &event) -{ - PrivTreeEvent::Fire(this, event, "onEndDrag"); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treectrl.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.cpp (nonexistent) @@ -1,315 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listbox.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: listbox.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// listbox.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -#include "listbox.h" -#include "item.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -ListBox::ListBox(JSContext *cx, JSObject *obj) - : wxListBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -ListBox::~ListBox() -{ - PopEventHandler(true); -} - -/*** - * control/listbox - * gui - * - * A listbox is used to select one or more of a list of strings. - * The strings are displayed in a scrolling box, with the selected - * string(s) marked in reverse video. A listbox can be single selection - * (if an item is selected, the previous selection is removed) or - * multiple selection (clicking an item toggles the item on or off independently of other selections). - * - */ -WXJS_INIT_CLASS(ListBox, "wxListBox", 2) - -/*** - * - * - * An array with all the indexes of the selected items - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListBox) - WXJS_READONLY_PROPERTY(P_SELECTIONS, "selections") -WXJS_END_PROPERTY_MAP() - -bool ListBox::GetProperty(wxListBox* p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_SELECTIONS: - { - wxArrayInt selections; - jsint count = p->GetSelections(selections); - JSObject *objSelections = JS_NewArrayObject(cx, count, NULL); - *vp = OBJECT_TO_JSVAL(objSelections); - for(jsint i = 0; i < count; i++) - { - jsval element = ToJS(cx, selections[i]); - JS_SetElement(cx, objSelections, i, &element); - } - break; - } - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(ListBox) - WXJS_CONSTANT(wxLB_, SINGLE) - WXJS_CONSTANT(wxLB_, MULTIPLE) - WXJS_CONSTANT(wxLB_, EXTENDED) - WXJS_CONSTANT(wxLB_, HSCROLL) - WXJS_CONSTANT(wxLB_, ALWAYS_SB) - WXJS_CONSTANT(wxLB_, NEEDED_SB) - WXJS_CONSTANT(wxLB_, SORT) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of the wxListBox. null is not Allowed. - * - * - * The windows identifier. -1 can be used when you don't need a unique id. - * - * - * The position of the listbox. - * - * - * The size of the listbox. - * - * - * The items for the listbox. - * - * - * The style of listbox. You can use the @wxListBox#style. - * - * - * - * - * Creates a new wxListBox object - * - * - */ -wxListBox* ListBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - StringsPtr items; - const wxValidator *val = &wxDefaultValidator; - - if ( argc > 7 ) - argc = 7; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - if ( ! FromJS(cx, argv[4], items) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxListBox *p = new ListBox(cx, obj); - p->Create(parent, id, *pt, *size, items.GetCount(), items.GetStrings(), style, *val); - - return p; - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(ListBox) - WXJS_METHOD("setFirstItem", set_first_item, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The zero-based item index - * - * - * - * - * The string that should be visible - * - * - * - * Set the specified item to be the first visible item. Windows only. - * - * - */ -JSBool ListBox::set_first_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int idx; - if ( FromJS(cx, argv[0], idx) ) - p->SetFirstItem(idx); - else - { - wxString item; - FromJS(cx, argv[0], item); - p->SetFirstItem(item); - } - return JS_TRUE; -} - -/*** - * - * - * - * - * Position before which to insert the items: for example, if - * pos is 0 (= the default) the items will be inserted in the beginning of the listbox - * - * - * - * Inserts all the items - * - * - */ -JSBool ListBox::insert_items(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) -{ - wxListBox *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - StringsPtr items; - if ( FromJS(cx, argv[0], items) ) - { - int pos = 0; - if ( argc > 0 - && ! FromJS(cx, argv[1], pos) ) - return JS_FALSE; - - p->InsertItems(items.GetCount(), items.GetStrings(), pos); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * Called when an item is selected. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - * Called when the listbox is double clicked. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - */ -void ListBox::OnListBox(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onListBox"); -} - -void ListBox::OnDoubleClick(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onDoubleClicked"); -} - -BEGIN_EVENT_TABLE(ListBox, wxListBox) - EVT_TEXT(-1, ListBox::OnDoubleClick) - EVT_COMBOBOX(-1, ListBox::OnListBox) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listbox.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.h (nonexistent) @@ -1,85 +0,0 @@ -/* - * wxJavaScript - bmpbtn.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: bmpbtn.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSBitmapButton_H -#define _WXJSBitmapButton_H - -///////////////////////////////////////////////////////////////////////////// -// Name: bmpbtn.h -// Purpose: BitmapButton ports wxBitmapButton to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 01.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class BitmapButton : public wxBitmapButton - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - BitmapButton(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~BitmapButton(); - - static bool GetProperty(wxBitmapButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxBitmapButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxBitmapButton* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxBitmapButton *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_BITMAP_DISABLED - , P_BITMAP_FOCUS - , P_BITMAP_SELECTED - , P_BITMAP_LABEL - }; - - void OnClicked(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - - }; - }; // namespace gui -}; //namespace wxjs -#endif //_WXJSBitmapButton_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.h (nonexistent) @@ -1,66 +0,0 @@ -/* - * wxJavaScript - ctrlitem.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: ctrlitem.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSControlWithItems_H -#define _WXJSControlWithItems_H - -namespace wxjs -{ - namespace gui - { - class ControlWithItems : public ApiWrapper - { - public: - - static bool GetProperty(wxControlWithItems *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxControlWithItems *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxControlWithItems *p); - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_COUNT = WXJS_START_PROPERTY_ID - , P_SELECTION - , P_ITEM - , P_STRING_SELECTION - , P_EMPTY - }; - - WXJS_DECLARE_METHOD_MAP() - static JSBool append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clear(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool delete_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSControlWithItems_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/ctrlitem.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.h (nonexistent) @@ -1,81 +0,0 @@ -/* - * wxJavaScript - menuitem.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: menuitem.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMENUITEM_H -#define _WXJSMENUITEM_H - -///////////////////////////////////////////////////////////////////////////// -// Name: menuitem.h -// Purpose: MenuItem ports wxMenuItem to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 19.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class MenuItem : public ApiWrapper - { - public: - static bool GetProperty(wxMenuItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxMenuItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxMenuItem* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxMenuItem *p); - - static JSBool is_checkable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool is_separator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setBitmaps(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - enum - { - P_LABEL = WXJS_START_PROPERTY_ID - , P_TEXT - , P_CHECK - , P_CHECKABLE - , P_ENABLE - , P_HELP - , P_ID - , P_MARGIN_WIDTH - , P_SUB_MENU - , P_ACCEL - , P_BG_COLOUR - , P_MENU - , P_FONT - , P_BITMAP - , P_TEXT_COLOUR - , P_SEPARATOR - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSMENUITEM_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menuitem.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.h (nonexistent) @@ -1,79 +0,0 @@ -/* - * wxJavaScript - checkbox.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: checkbox.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCheckBox_H -#define _WXJSCheckBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: checkbox.h -// Purpose: CheckBox ports wxCheckBox to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 06.02.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class CheckBox : public wxCheckBox - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - CheckBox(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~CheckBox(); - - static bool GetProperty(wxCheckBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxCheckBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxCheckBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxCheckBox *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - enum - { - P_VALUE - }; - - DECLARE_EVENT_TABLE() - void OnCheckBox(wxCommandEvent &event); - - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCheckBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.cpp (nonexistent) @@ -1,92 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - helpbtn.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: helpbtn.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/size.h" -#include "../misc/point.h" -#include "helpbtn.h" -#include "../misc/bitmap.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/helpbtn - * gui - * - * Instances of this class may be used to add a question mark button that when pressed, - * puts the application into context-help mode. It does this by creating a @wxContextHelp - * object which itself generates a @wxHelpEvent event when the user clicks on a window. - * - */ -WXJS_INIT_CLASS(ContextHelpButton, "wxContextHelpButton", 1) - -ContextHelpButton::ContextHelpButton(wxWindow *parent, JSContext *cx, JSObject *obj) - : wxContextHelpButton(parent) - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -ContextHelpButton::~ContextHelpButton() -{ - PopEventHandler(true); -} - -/*** - * - * - * - * The parent of wxContextHelpButton. - * - * - * - * Constructs a new wxContextHelpButton object. - * - * - */ -wxContextHelpButton* ContextHelpButton::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - ContextHelpButton *p = new ContextHelpButton(parent, cx, obj); - return p; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/helpbtn.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.h (nonexistent) @@ -1,92 +0,0 @@ -/* - * wxJavaScript - findrdlg.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: findrdlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFindReplaceDialog_H -#define _WXJSFindReplaceDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: findrdlg.h -// Purpose: FindReplaceDialog ports wxFindReplaceDialog to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 30.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class FindReplaceDialog : public wxFindReplaceDialog - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - FindReplaceDialog(JSContext *cx, JSObject *obj); - - virtual ~FindReplaceDialog() - { - } - - static bool GetProperty(wxFindReplaceDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxFindReplaceDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxFindReplaceDialog *p) - { - } - - static JSBool create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_DATA - }; - - // Keep our own data. This is because the wxFindReplaceData object - // can be gc'd by the engine, which results in memory problems. - wxFindReplaceData m_data; - - WXJS_DECLARE_PROPERTY_MAP() - - DECLARE_EVENT_TABLE() - void OnFind(wxFindDialogEvent& event); - void OnFindNext(wxFindDialogEvent& event); - void OnReplace(wxFindDialogEvent& event); - void OnReplaceAll(wxFindDialogEvent& event); - void OnFindClose(wxFindDialogEvent& event); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFindReplaceDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/findrdlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.h (nonexistent) @@ -1,78 +0,0 @@ -/* - * wxJavaScript - listitem.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: listitem.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSListItem_H -#define _WXJSListItem_H - -///////////////////////////////////////////////////////////////////////////// -// Name: listitem.h -// Purpose: ListItem ports wxListItem -// ListItemAttr ports wxListItemAttr -// Author: Franky Braem -// Modified by: -// Created: 30.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - - class ListObjectData; - - class ListItem : public ApiWrapper - { - public: - - static bool GetProperty(wxListItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxListItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxListItem *Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_MASK = WXJS_START_PROPERTY_ID - , P_ID - , P_COLUMN - , P_STATE - , P_STATE_MASK - , P_TEXT - , P_IMAGE - , P_DATA - , P_WIDTH - , P_ALIGN - , P_TEXT_COLOUR - , P_BG_COLOUR - , P_FONT - , P_HAS_ATTR - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSListItem_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.cpp (nonexistent) @@ -1,314 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - dialog.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: dialog.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// dialog.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/jsevent.h" -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/close.h" - -#include "dialog.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -Dialog::Dialog(JSContext *cx, JSObject *obj) - : wxDialog() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Dialog::~Dialog() -{ - PopEventHandler(true); -} - -/*** - * control/dialog - * gui - * - * A dialog box is a window with a title bar and sometimes a system menu, - * which can be moved around the screen. It can contain controls and other windows. - *

- * The following sample shows a simple dialog: - *

- *  wxTheApp.onInit = function()
- *  {
- *    dlg = new wxDialog(null, -1, "test");
- *  
- *    dlg.button = new wxButton(dlg, 1, "Ok");
- *  
- *    dlg.button.onClicked = function()
- *    {
- *  	  endModal(1);
- *    }
- *    
- *    dlg.showModal();
- *    
- *    // Return false, will end the main loop
- *    return false;
- *  }
- *  
- *  wxTheApp.mainLoop();
- *  
- *
- */ -WXJS_INIT_CLASS(Dialog, "wxDialog", 3) - -/*** - * - * - * The returncode of the modal dialog - * - * - * Returns true when the dialog is a modal dialog - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Dialog) - WXJS_READONLY_PROPERTY(P_RETURN_CODE, "returnCode") - WXJS_READONLY_PROPERTY(P_MODAL, "modal") -WXJS_END_PROPERTY_MAP() - -bool Dialog::GetProperty(wxDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_RETURN_CODE: - *vp = ToJS(cx, p->GetReturnCode()); - break; - case P_MODAL: - *vp = ToJS(cx, p->IsModal()); - break; - } - return true; -} - -/*** - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Dialog) - // Style constants - WXJS_CONSTANT(wx, DIALOG_MODAL) - WXJS_CONSTANT(wx, CAPTION) - WXJS_CONSTANT(wx, DEFAULT_DIALOG_STYLE) - WXJS_CONSTANT(wx, RESIZE_BORDER) - WXJS_CONSTANT(wx, SYSTEM_MENU) - WXJS_CONSTANT(wx, THICK_FRAME) - WXJS_CONSTANT(wx, STAY_ON_TOP) - WXJS_CONSTANT(wx, NO_3D) - WXJS_CONSTANT(wx, DIALOG_EX_CONTEXTHELP) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of the dialog. null is Allowed. - * - * - * The window identifier - * - * - * The title of the dialog - * - * - * The position of the dialog. - * - * - * The size of the dialog - * - * - * The window style - * - * - * - * Creates a dialog - * - * - */ -wxDialog* Dialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = wxDEFAULT_DIALOG_STYLE; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - - switch(argc) - { - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString title; - FromJS(cx, argv[2], title); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - Dialog *p = new Dialog(cx, obj); - - if ( parent == NULL ) - style |= wxDIALOG_NO_PARENT; - - p->Create(parent, id, title, *pt, *size, style); - return p; - } - - return NULL; -} - -void Dialog::Destruct(JSContext *cx, wxDialog *p) -{ -// p->Destroy(); -} - -WXJS_BEGIN_METHOD_MAP(Dialog) - WXJS_METHOD("endModal", end_modal, 1) - WXJS_METHOD("showModal", show_modal, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The value to be returned from @wxDialog#showModal - * - * - * - * Ends a modal dialog. - * - * - */ -JSBool Dialog::end_modal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDialog *p = Dialog::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int code; - if ( FromJS(cx, argv[0], code) ) - { - p->EndModal(code); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Shows a modal dialog. The value returned is the return code set by @wxDialog#endModal. - * - * - */ -JSBool Dialog::show_modal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxDialog *p = Dialog::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ShowModal()); - - return JS_TRUE; -} - -/*** - * - * - * Called when the dialog is closed. The type of the argument that your - * handler receives is @wxCloseEvent. - * - * - */ -void Dialog::OnClose(wxCloseEvent &event) -{ - bool destroy = true; - - if ( PrivCloseEvent::Fire(this, event, "onClose") ) - { - destroy = ! event.GetVeto(); - } - - // When the close event is not handled by JavaScript, - // wxJS destroys the dialog. - if ( destroy ) - { - Destroy(); - } - -} - -BEGIN_EVENT_TABLE(Dialog, wxDialog) - EVT_CLOSE(Dialog::OnClose) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/dialog.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.cpp (nonexistent) @@ -1,2565 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listctrl.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: listctrl.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// ListCtrl.cpp -#include -#ifndef WX_PRECOMP - #include -#endif - -#ifdef __WXMSW__ - #include "commctrl.h" -#endif - -#include "../../common/main.h" - -#include "../event/evthand.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" -#include "../misc/imagelst.h" - -#include "listctrl.h" -#include "listitem.h" -#include "listitattr.h" -#include "listhit.h" -#include "window.h" -#include "textctrl.h" - -using namespace wxjs; -using namespace wxjs::gui; - -ListCtrl::ListCtrl(JSContext *cx, JSObject *obj) - : wxListCtrl() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -ListCtrl::~ListCtrl() -{ - // Destroy all item data - int n = GetItemCount(); - long i = 0; - - for (i = 0; i < n; i++) - { - ListObjectData *wxjs_data = (ListObjectData*) GetItemData(i); - if ( wxjs_data != NULL ) - { - delete wxjs_data; - wxjs_data = NULL; - } - } - PopEventHandler(true); -} - -int wxCALLBACK ListCtrl::SortFn(long item1, long item2, long data) -{ - ListSort *sortData = reinterpret_cast(data); - - ListObjectData *data1 = (ListObjectData*) item1; - ListObjectData *data2 = (ListObjectData*) item2; - - jsval rval; - jsval argv[] = { data1 == NULL ? JSVAL_VOID : data1->GetJSVal(), - data2 == NULL ? JSVAL_VOID : data2->GetJSVal(), - ToJS(sortData->GetContext(), sortData->GetData()) - }; - if ( JS_CallFunction(sortData->GetContext(), JS_GetGlobalObject(sortData->GetContext()), sortData->GetFn(), 3, argv, &rval) == JS_TRUE ) - { - int rc; - if ( FromJS(sortData->GetContext(), rval, rc) ) - return rc; - else - return 0; - } - else - { - JS_ReportError(sortData->GetContext(), "Error occurred while running sort function of wxListCtrl"); - } - return 0; -} - -/*** - * control/listctrl - * gui - * - * A list control presents lists in a number of formats: list view, report view, - * icon view and small icon view. In any case, elements are numbered from zero. - * For all these modes, the items are stored in the control and must be added to - * it using @wxListCtrl#insertItem method. - *

- * A special case of report view quite different from the other modes of the - * list control is a virtual control in which the items data (including text, - * images and attributes) is managed by the main program and is requested by - * the control itself only when needed which allows to have controls with millions - * of items without consuming much memory. To use virtual list control you must set - * @wxListCtrl#itemCount first and set at least @wxListCtrl#onGetItemText - * (and optionally @wxListCtrl#onGetItemImage and @wxListCtrl#onGetItemAttr) - * to return the information about the items when the control requests it. - * Virtual list control can be used as a normal one except that no operations - * which can take time proportional to the number of items in the control happen - * -- this is required to allow having a practically infinite number of items. - * For example, in a multiple selection virtual list control, the selections won't be - * sent when many items are selected at once because this could mean iterating - * over all the items. - *

How to sort items?
- * This example shows a dialog containing a wxListCtrl and two buttons. - * The list control contains 4 elements 'A', 'B', 'C' and 'D'. Clicking - * on one of the buttons, will sort the elements in - * descending or ascending order. First the dialog box is created. - * A @wxBoxSizer is used to layout - * the dialog. The list control will be shown above the buttons and centered - * horizontally. Above and below the listcontrol a space of 10 is placed. - *

- *   dlg = new wxDialog(null, -1, "wxListCtrl sort example", 
- *                      wxDefaultPosition, new wxSize(200, 200));
- *   // The main sizer
- *   dlg.sizer = new wxBoxSizer(wxOrientation.VERTICAL);
- *
- *   // Create the listcontrol and add it to the sizer.
- *   list = new wxListCtrl(dlg, -1, wxDefaultPosition, new wxSize(100, 100));
- *   dlg.sizer.add(list, 0, wxAlignment.CENTER | wxDirection.BOTTOM | wxDirection.TOP, 10);
- *
- *   // Create buttons and add them to a boxsizer.
- *   var btn1 = new wxButton(dlg, -1, "Sort Descending");
- *   btn1.onClicked = function()
- *   {
- *     list.sortItems(sort, 1);
- *   };
- *  
- *   var btn2 = new wxButton(dlg, -2, "Sort Ascending");
- *   btn2.onClicked = function()
- *   {
- *     list.sortItems(sort, 0);
- *   };
- *
- *   boxsizer = new wxBoxSizer(wxOrientation.HORIZONTAL);
- *   boxsizer.add(btn1, 0, wxDirection.RIGHT, 10);
- *   boxsizer.add(btn2);
- *
- *   dlg.sizer.add(boxsizer, 0, wxAlignment.CENTER);
- *   
- * An array which hold the characters 'A', 'B', 'C' and 'D' is created. Each element is - * inserted. The itemdata is set to the letter. This is necessary - * because the sort function uses the itemdata. - *
 
- *   var letter = new Array();
- *   letter[0] = "A";
- *   letter[1] = "B";
- *   letter[2] = "C";
- *   letter[3] = "D";
- *   for(e in letter)
- *   {
- *     var idx = list.insertItem(e, letter[e]);
- *     list.setItemData(idx, letter[e]);
- *   }
- *  
- * Show the dialog. - *

- *   dlg.layout();
- *   dlg.showModal();
- *  
- * - * The function gets 3 arguments. The first two are the itemdata (which is the index - * of the corresponding array element) of the first item and the second item. Data - * is the data passed to @wxListCtrl#sortItems in the @wxButton#onClicked event - * of @wxButton. This way the sort function knows how to sort the items. - *

- *   function sort(item1, item2, data)
- *   {
- *     if ( data == 1 )
- *     {
- *       if ( item1 > item2 )
- *         return -1;
- *       else if ( item1 < item2 )
- *         return 1;
- *       else return 0;
- *     }
- *     else
- *     {
- *       if ( item1 > item2 )
- *         return 1;
- *       else if ( item1 < item2 )
- *         return -1;
- *       else return 0;
- *     }
- *   }
- *   
- *
How to use virtual list controls ?
- * This example shows how a virtual list control is built. - * First an array is create which will contain objects of type Car. - *

- *   var cars = new Array();
- *
- *   function Car(brand, type, colour)
- *   {
- *     this.brand = brand;
- *     this.type = type;
- *     this.colour = colour;
- *   }
- *
- *   cars[0] = new Car("Opel", "Astra", "Red");
- *   cars[1] = new Car("Ford", "Focus", "Black");
- *   cars[2] = new Car("Skoda", "Octavia", "Green");
- *   cars[3] = new Car("Peugeot", "305", "White");
- *   cars[4] = new Car("Citroen", "Picasso", "Green");
- *   
- * The init function will create a frame and a list control. The list control - * is the child of the frame and its style is REPORT and VIRTUAL. For each property - * of Car, a column is created. - * Because the list control is virtual, @wxListCtrl#onGetItemText and - * @wxListCtrl#itemCount must be set. - *

- *   function init()
- *   {
- *     var frame = new wxFrame(null, -1, "wxListCtrl example");
- *   
- *     var listCtrl = new wxListCtrl(frame, -1, wxDefaultPosition,
- *                                   wxDefaultSize, wxListCtrl.REPORT | wxListCtrl.VIRTUAL);
- *     listCtrl.insertColumn(0, "Brand");
- *     listCtrl.insertColumn(1, "Type");
- *     listCtrl.insertColumn(2, "Colour");
- *     listCtrl.onGetItemText = getItemText;
- *     listCtrl.itemCount = cars.length;
- *     
- *     frame.visible = true;
- *     topWindow = frame;
- *     
- *     return true;
- *     }
- *   
- * The function getItemText will be called by wxWidgets whenever it needs - * to know the text of an item. This function gets two arguments: the item and the column - * index. The text that must be shown is returned. - *

- *   function getItemText(item, col)
- *   {
- *     var car = cars[item];
- *   
- *     switch(col)
- *     {
- *       case 0: return car.brand;
- *       case 1: return car.type;
- *       case 2: return car.colour;    
- *     }
- *   }
- *   
- *   wxTheApp.onInit = init;
- *   wxTheApp.mainLoop();
- *  
- *
- */ -WXJS_INIT_CLASS(ListCtrl, "wxListCtrl", 2) - -/*** - * - * - * - * - * - * - * - * - * - * - * wxListMask is ported as a separate JavaScript class - * - * - * - * - * (Windows only) - * - * - * (Windows only) - * - * wxListState is ported as a separate JavaScript class - * - * - * - * Searches for an item above the specified item - * Searches for subsequent item by index - * Searches for an item below the specified item - * Searches for an item to the left of the specified item - * Searches for an item to the right of the specified item - * - * wxListNext is ported as a separate JavaScript class. See @wxListCtrl#getNextItem. - * - * - * - * - * - * - * - * - * wxListAlign is ported as a separate JavaScript class. - * - * - * - * - * - * - * - * - * wxListColumnFormat is ported as a separate JavaScript class. - * - * - * - * - * - * - * - * wxListRect is ported as a separate JavaScript class. - * - * - * - * - * - * - * - * - * wxListFind is ported as a separate JavaScript class. - * - * - * - * - * Multicolumn list view, with optional small icons. Columns are computed automatically, - * i.e. you don't set columns as in REPORT. In other words, the list wraps, unlike a - * wxListBox. - * - * Single or multicolumn report view, with optional header. - * - * Virtual control, may only be used with REPORT - * - * Large icon view, with optional labels. - * - * Small icon view, with optional labels. - * - * Icons align to the top. Win32 default, Win32 only. - * - * Icons align to the left. - * - * Icons arrange themselves. Win32 only. - * - * The application provides label text on demand, except for column headers. Win32 only. - * - * Labels are editable: the application will be notified when editing starts. - * - * No header in report mode. Win32 only. - * - * Single selection. - * - * Sort in ascending order (must still supply a comparison callback in SortItems). - * - * Sort in descending order (must still supply a comparison callback in SortItems). - * - * Draws light horizontal rules between rows in report mode. - * - * Draws light vertical rules between columns in report mode. - * - * - * - * Resize the column to the length of its longest item - * - * Resize the column to the length of the header (Win32) or 80 pixels (other platforms). - * These constants can be used with @wxListCtrl#setColumnWidth. - * - * - * - * The normal (large icon) image list. - * - * The small icon image list. - * - * The user-defined state image list (unimplemented). - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(ListCtrl) - WXJS_CONSTANT(wxLC_, LIST) - WXJS_CONSTANT(wxLC_, REPORT) - WXJS_CONSTANT(wxLC_, VIRTUAL) - WXJS_CONSTANT(wxLC_, ICON) - WXJS_CONSTANT(wxLC_, SMALL_ICON) - WXJS_CONSTANT(wxLC_, ALIGN_TOP) - WXJS_CONSTANT(wxLC_, ALIGN_LEFT) - WXJS_CONSTANT(wxLC_, AUTOARRANGE) - WXJS_CONSTANT(wxLC_, USER_TEXT) - WXJS_CONSTANT(wxLC_, EDIT_LABELS) - WXJS_CONSTANT(wxLC_, NO_HEADER) - WXJS_CONSTANT(wxLC_, SINGLE_SEL) - WXJS_CONSTANT(wxLC_, SORT_ASCENDING) - WXJS_CONSTANT(wxLC_, SORT_DESCENDING) - WXJS_CONSTANT(wxLC_, HRULES) - WXJS_CONSTANT(wxLIST_, AUTOSIZE) - WXJS_CONSTANT(wxLIST_, AUTOSIZE_USEHEADER) - WXJS_CONSTANT(wxIMAGE_LIST_, NORMAL) - WXJS_CONSTANT(wxIMAGE_LIST_, SMALL) - WXJS_CONSTANT(wxIMAGE_LIST_, STATE) -WXJS_END_CONSTANT_MAP() - -void ListCtrl::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxListMaskMap[] = - { - WXJS_CONSTANT(wxLIST_MASK_, STATE) - WXJS_CONSTANT(wxLIST_MASK_, TEXT) - WXJS_CONSTANT(wxLIST_MASK_, IMAGE) - WXJS_CONSTANT(wxLIST_MASK_, DATA) - WXJS_CONSTANT(wxLIST_SET_, ITEM) - WXJS_CONSTANT(wxLIST_MASK_, WIDTH) - WXJS_CONSTANT(wxLIST_MASK_, FORMAT) - { 0 } - }; - JSObject *constObj = JS_DefineObject(cx, obj, "wxListMask", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListMaskMap); - - JSConstDoubleSpec wxListStateMap[] = - { - WXJS_CONSTANT(wxLIST_STATE_, DONTCARE) - WXJS_CONSTANT(wxLIST_STATE_, DROPHILITED) - WXJS_CONSTANT(wxLIST_STATE_, FOCUSED) - WXJS_CONSTANT(wxLIST_STATE_, SELECTED) - WXJS_CONSTANT(wxLIST_STATE_, CUT) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListState", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListStateMap); - - JSConstDoubleSpec wxListNextMap[] = - { - WXJS_CONSTANT(wxLIST_NEXT_, ABOVE) - WXJS_CONSTANT(wxLIST_NEXT_, ALL) - WXJS_CONSTANT(wxLIST_NEXT_, BELOW) - WXJS_CONSTANT(wxLIST_NEXT_, LEFT) - WXJS_CONSTANT(wxLIST_NEXT_, RIGHT) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListNext", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListNextMap); - - JSConstDoubleSpec wxListAlignMap[] = - { - WXJS_CONSTANT(wxLIST_ALIGN_, DEFAULT) - WXJS_CONSTANT(wxLIST_ALIGN_, LEFT) - WXJS_CONSTANT(wxLIST_ALIGN_, TOP) - WXJS_CONSTANT(wxLIST_ALIGN_, SNAP_TO_GRID) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListAlign", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListAlignMap); - - JSConstDoubleSpec wxListColumnFormatMap[] = - { - WXJS_CONSTANT(wxLIST_FORMAT_, LEFT) - WXJS_CONSTANT(wxLIST_FORMAT_, RIGHT) - WXJS_CONSTANT(wxLIST_FORMAT_, CENTRE) - WXJS_CONSTANT(wxLIST_FORMAT_, CENTER) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListColumnFormat", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListColumnFormatMap); - - JSConstDoubleSpec wxListRectMap[] = - { - WXJS_CONSTANT(wxLIST_RECT_, BOUNDS) - WXJS_CONSTANT(wxLIST_RECT_, ICON) - WXJS_CONSTANT(wxLIST_RECT_, LABEL) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListRect", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListRectMap); - - JSConstDoubleSpec wxListFindMap[] = - { - WXJS_CONSTANT(wxLIST_FIND_, UP) - WXJS_CONSTANT(wxLIST_FIND_, DOWN) - WXJS_CONSTANT(wxLIST_FIND_, LEFT) - WXJS_CONSTANT(wxLIST_FIND_, RIGHT) - { 0 } - }; - constObj = JS_DefineObject(cx, obj, "wxListFind", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxListFindMap); -} - - -/*** - * - * - * Gets the number of columns. - * - * - * Gets the number of items that can fit vertically in the visible area of the list control - * (list or report view) or the total number of items in the list control - * (icon or small icon view). - * - * - * Gets the textcontrol used for editing labels. - * - * - * Returns true when the list control is virtual. - * - * - * Gets/Sets the number of items. Setting the number of items is only allowed - * with virtual list controls. - * - * - * Assign a function that returns a @wxListItemAttr object. - * The function gets one argument: the index of the item. - * This can only be used in virtual list controls. - * - * - * Assign a function that returns the index of the image. - * The function gets one argument: the index of the item. - * This can only be used in virtual list controls. - * - * - * Assign a function that returns a String. This String is used as text of the item. - * The function gets two arguments: the index of the item and the index of the column. - * You must set this property for virtual list controls. - * - * - * Gets the number of selected items. - * - * - * Gets/Sets the text colour of the list control. - * - * - * Gets the index of the topmost visible item in report view. - * - * - * Gets/Sets the window style flag. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListCtrl) - WXJS_READONLY_PROPERTY(P_COLUMN_COUNT, "columnCount") - WXJS_READONLY_PROPERTY(P_COUNT_PER_PAGE, "countPerPage") - WXJS_READONLY_PROPERTY(P_EDIT_CONTROL, "editControl") - WXJS_PROPERTY(P_ITEM_COUNT, "itemCount") - WXJS_READONLY_PROPERTY(P_SELECTED_ITEM_COUNT, "selectedItemCount") - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_READONLY_PROPERTY(P_TOP_ITEM, "topItem") - WXJS_PROPERTY(P_WINDOW_STYLE, "windowStyleFlag") - WXJS_READONLY_PROPERTY(P_IS_VIRTUAL, "virtual") -WXJS_END_PROPERTY_MAP() - -wxString ListCtrl::OnGetItemText(long item, long column) const -{ - JSContext *cx = GetContext(); - if (cx == NULL ) - return wxEmptyString; - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onGetItemText", &fval) == JS_FALSE ) - return wxEmptyString; - - jsval rval; - jsval argv[] = { ToJS(cx, item), ToJS(cx, column) }; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 2, argv, &rval) == JS_TRUE ) - { - wxString text; - FromJS(cx, rval, text); - return text; - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - return wxEmptyString; -} - -int ListCtrl::OnGetItemImage(long item) const -{ - JSContext *cx = GetContext(); - if (cx == NULL ) - return -1; - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onGetItemImage", &fval) == JS_FALSE ) - return -1; - - jsval rval; - jsval argv[] = { ToJS(cx, item) }; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval) == JS_TRUE ) - { - int img; - if ( FromJS(cx, rval, img) ) - return img; - else - return -1; - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - return -1; -} - -wxListItemAttr *ListCtrl::OnGetItemAttr(long item) const -{ - JSContext *cx = GetContext(); - if (cx == NULL ) - return NULL; - - jsval fval; - if ( GetFunctionProperty(cx, GetObject(), "onGetItemText", &fval) == JS_FALSE ) - return NULL; - - jsval rval; - jsval argv[] = { ToJS(cx, item) }; - if ( JS_CallFunctionValue(cx, GetObject(), fval, 1, argv, &rval) == JS_TRUE ) - { - wxListItemAttr *attr = ListItemAttr::GetPrivate(cx, rval); - return attr; - } - else - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - return NULL; -} - -bool ListCtrl::GetProperty(wxListCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_COLUMN_COUNT: - *vp = ToJS(cx, p->GetColumnCount()); - break; - case P_COUNT_PER_PAGE: - *vp = ToJS(cx, p->GetCountPerPage()); - break; - case P_EDIT_CONTROL: - #ifdef __WXMSW__ - *vp = TextCtrl::CreateObject(cx, p->GetEditControl(), obj); - #endif - break; - case P_ITEM_COUNT: - *vp = ToJS(cx, p->GetColumnCount()); - break; - case P_SELECTED_ITEM_COUNT: - *vp = ToJS(cx, p->GetSelectedItemCount()); - break; - case P_TEXT_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(p->GetTextColour())); - break; - case P_TOP_ITEM: - *vp = ToJS(cx, p->GetTopItem()); - break; - case P_WINDOW_STYLE: - *vp = ToJS(cx, p->GetWindowStyleFlag()); - break; - case P_IS_VIRTUAL: - *vp = ToJS(cx, p->IsVirtual()); - break; - } - return true; -} - -bool ListCtrl::SetProperty(wxListCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ITEM_COUNT: - { - long count; - if ( p->IsVirtual() - && FromJS(cx, *vp, count) ) - p->SetItemCount(count); - break; - } - case P_TEXT_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetTextColour(*colour); - break; - } - case P_WINDOW_STYLE: - { - long style; - if ( FromJS(cx, *vp, style) ) - p->SetWindowStyleFlag(style); - break; - } - } - return true; -} - -/*** - * - * - * - * The parent of wxListCtrl. Can't be null. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The position of the ListCtrl control on the given parent. - * - * - * The size of the ListCtrl control. - * - * - * The wxListCtrl style. - * - * - * Validator. - * - * - * - * Constructs a new wxListCtrl object. - * - * - */ -wxListCtrl* ListCtrl::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = wxLC_ICON; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 6: - val = Validator::GetPrivate(cx, argv[5]); - if ( val == NULL ) - break; - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxListCtrl *p = new ListCtrl(cx, obj); - p->Create(parent, id, *pt, *size, style, *val); - - return p; - } - return NULL; -} - -void ListCtrl::Destruct(JSContext *cx, wxListCtrl* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(ListCtrl) - WXJS_METHOD("getColumn", getColumn, 2) - WXJS_METHOD("setColumn", setColumn, 2) - WXJS_METHOD("getColumnWidth", getColumnWidth, 1) - WXJS_METHOD("setColumnWidth", setColumnWidth, 2) - WXJS_METHOD("getItem", getItem, 1) - WXJS_METHOD("setItem", setItem, 1) - WXJS_METHOD("getItemState", getItemState, 2) - WXJS_METHOD("setItemState", setItemState, 3) - WXJS_METHOD("setItemImage", setItemImage, 3) - WXJS_METHOD("getItemText", getItemText, 1) - WXJS_METHOD("setItemText", setItemText, 2) - WXJS_METHOD("getItemData", getItemData, 1) - WXJS_METHOD("setItemData", setItemData, 2) - WXJS_METHOD("getItemRect", getItemRect, 2) - WXJS_METHOD("getItemPosition", getItemPosition, 1) - WXJS_METHOD("setItemPosition", setItemPosition, 2) - WXJS_METHOD("getItemSpacing", getItemSpacing, 1) - WXJS_METHOD("setSingleStyle", setSingleStyle, 1) - WXJS_METHOD("getNextItem", getNextItem, 1) - WXJS_METHOD("getImageList", getImageList, 1) - WXJS_METHOD("setImageList", setImageList, 2) - WXJS_METHOD("refreshItem", refreshItem, 1) - WXJS_METHOD("refreshItems", refreshItems, 2) - WXJS_METHOD("arrange", arrange, 0) - WXJS_METHOD("deleteItem", deleteItem, 1) - WXJS_METHOD("deleteAllItems", deleteAllItems, 0) - WXJS_METHOD("deleteColumn", deleteColumn, 1) - WXJS_METHOD("deleteAllColumns", deleteAllColumns, 0) - WXJS_METHOD("clearAll", clearAll, 0) - WXJS_METHOD("insertItem", insertItem, 1) - WXJS_METHOD("insertColumn", insertColumn, 2) - WXJS_METHOD("editLabel", editLabel, 1) - WXJS_METHOD("endEditLabel", endEditLabel, 1) - WXJS_METHOD("ensureVisible", ensureVisible, 1) - WXJS_METHOD("findItem", findItem, 2) - WXJS_METHOD("hitTest", hitTest, 1) - WXJS_METHOD("scrollList", scrollList, 2) - WXJS_METHOD("sortItems", sortItems, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The column number - * - * - * The item index - * - * - * - * - * The column number - * - * - * The item info. Make sure that the id property is set. - * - * - * - * Gets the column information. The first form returns a @wxListItem object or - * undefined when the column is not found. The second form returns true when the - * column is found and puts the column information in the second argument. - * - * - */ -JSBool ListCtrl::getColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int col; - if ( FromJS(cx, argv[0], col) ) - { - if ( ListItem::HasPrototype(cx, argv[1]) ) - { - wxListItem *item = ListItem::GetPrivate(cx, argv[1], false); - *rval = ToJS(cx, p->GetColumn(col, *item)); - } - else - { - int idx; - if ( FromJS(cx, argv[1], idx) ) - { - wxListItem *item = new wxListItem(); - item->SetId(idx); - if ( p->GetColumn(col, *item) ) - { - *rval = ListItem::CreateObject(cx, item, obj); - } - else - { - delete item; - *rval = JSVAL_VOID; - } - } - else - { - return JS_FALSE; - } - } - } - else - { - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * The column number - * - * - * The item index - * - * - * - * - * The column number - * - * - * The item info. Make sure that the id property is set. - * - * - * - * Sets the column information. False is returned when the column doesn't exist. - * - * - */ -JSBool ListCtrl::setColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int col; - - if ( ! FromJS(cx, argv[0], col) ) - return JS_FALSE; - - wxListItem *item = ListItem::GetPrivate(cx, argv[1]); - if ( item == NULL ) - return JS_FALSE; - - p->SetColumn(col, *item); - - return JS_TRUE; -} - -/*** - * - * - * - * The column number - * - * - * - * Returns the width of the column. - * - * - */ -JSBool ListCtrl::getColumnWidth(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int col; - if ( FromJS(cx, argv[0], col) ) - { - *rval = ToJS(cx, p->GetColumnWidth(col)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The column number. In small or normal icon view, col must be -1, and the column - * width is set for all columns. - * - * - * Width can be the width in pixels, AUTOSIZE or AUTOSIZE_USEHEADER. - * AUTOSIZE will resize the column to the length of the longest item. - * AUTOSIZE_USEHEADER will resize the column to the length of the header - * (on windows) or on 80 pixels (other platforms). - * - * - * - * Sets the columnwidth. Returns true on success, false on failure. - * See @wxListCtrl#autosize. - * - * - */ -JSBool ListCtrl::setColumnWidth(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int col; - if ( ! FromJS(cx, argv[0], col) ) - return JS_FALSE; - - int width; - if ( ! FromJS(cx, argv[1], width) ) - return JS_FALSE; - - *rval = ToJS(cx, p->SetColumnWidth(col, width)); - return JS_TRUE; -} - -/*** - * - * - * - * The item index - * - * - * - * - * The item info. Make sure that the id property is set. - * - * - * - * Gets the item information. The first form returns a @wxListItem object or - * undefined when the item is not found. The second form returns true when the - * item is found and puts the item information in the argument. - * - * - */ -JSBool ListCtrl::getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( ListItem::HasPrototype(cx, argv[0]) ) - { - wxListItem *item = ListItem::GetPrivate(cx, argv[0], false); - *rval = ToJS(cx, p->GetItem(*item)); - } - else - { - int idx; - if ( FromJS(cx, argv[0], idx) ) - { - wxListItem *item = new wxListItem(); - item->SetId(idx); - if ( p->GetItem(*item) ) - { - *rval = ListItem::CreateObject(cx, item, obj); - } - else - { - delete item; - *rval = JSVAL_VOID; - } - } - else - return JS_FALSE; - } - - return JS_TRUE; -} - -/*** - * - * - * - * The item info - * - * - * - * - * The item index - * - * - * The column index - * - * - * The text of the item - * - * - * The zero-base index of an image list. - * - * - * - * Sets the item information. On success, true is returned. - * - * - */ -JSBool ListCtrl::setItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( ListItem::HasPrototype(cx, argv[0]) ) - { - wxListItem *item = ListItem::GetPrivate(cx, argv[0], false); - *rval = ToJS(cx, p->SetItem(*item)); - } - else - { - if ( argc < 3 ) - return JS_FALSE; - - int imageId = -1; - if ( argc > 3 - && ! FromJS(cx, argv[3], imageId) ) - return JS_FALSE; - - wxString label; - FromJS(cx, argv[2], label); - - int idx; - int col; - - if ( FromJS(cx, argv[1], col) - && FromJS(cx, argv[0], idx) ) - { - *rval = ToJS(cx, p->SetItem(idx, col, label, imageId)); - } - else - return JS_FALSE; - } - return JS_TRUE; -} - -/*** - * - * - * - * The item index - * - * - * Indicates which state flags are valid. - * - * - * - * Gets the item state. See @wxListCtrl#wxListState. - * - * - */ -JSBool ListCtrl::getItemState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - int stateMask; - - if ( FromJS(cx, argv[0], item) - && FromJS(cx, argv[1], stateMask) ) - { - *rval = ToJS(cx, p->GetItemState(item, stateMask)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * The new state. - * - * - * Indicates which state flags are valid. - * - * - * - * Sets the new state of an item. See @wxListCtrl#wxListState. - * - * - */ -JSBool ListCtrl::setItemState(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - long state; - long stateMask; - - if ( FromJS(cx, argv[0], item) - && FromJS(cx, argv[1], state) - && FromJS(cx, argv[2], stateMask) ) - { - *rval = ToJS(cx, p->SetItemState(item, state, stateMask)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * Index of the image to show for unselected items. - * - * - * Index of the image to show for selected items. - * - * - * - * Sets the unselected and selected images associated with the item. - * The images are indices into the image list associated with the list control. - * - * - */ -JSBool ListCtrl::setItemImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - int image; - int selImage; - - if ( FromJS(cx, argv[0], item) - && FromJS(cx, argv[1], image) - && FromJS(cx, argv[2], selImage) ) - { - *rval = ToJS(cx, p->SetItemImage(item, image, selImage)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Returns the text of the item. - * - * - */ -JSBool ListCtrl::getItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - *rval = ToJS(cx, p->GetItemText(item)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * The new text. - * - * - * - * Sets the text of an item. - * - * - */ -JSBool ListCtrl::setItemText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - wxString text; - - if ( FromJS(cx, argv[0], item) - && FromJS(cx, argv[1], text) ) - { - p->SetItemText(item, text); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Returns the associated data of the item. The type of the data can be any type: - * integer, long, object, ... - * - * - */ -JSBool ListCtrl::getItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - if ( FromJS(cx, argv[0], item) ) - { - ListObjectData *data = (ListObjectData*) p->GetItemData(item); - *rval = ( data == NULL ) ? JSVAL_VOID : data->GetJSVal(); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * The associated data. - * - * - * - * Sets the associated data of an item. The type of the data can - * be any type: integer, long, object, ... - * When the listcontrol is sortable, the item data must be set. - * - * - */ -JSBool ListCtrl::setItemData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - ListObjectData *data = (ListObjectData*) p->GetItemData(item); - if ( data != NULL ) - { - delete data; - data = NULL; - } - - data = new ListObjectData(cx, argv[1]); - if ( p->SetItemData(item, (long) data) ) - { - *rval = JSVAL_TRUE; - } - else - { - *rval = JSVAL_FALSE; - delete data; - data = NULL; - } - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * Indicates which rectangle to return. - * - * - * - * Returns the item rectangle. See @wxListCtrl#wxListRect. - * - * - */ -JSBool ListCtrl::getItemRect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - int code; - - if ( FromJS(cx, argv[0], item) - && FromJS(cx, argv[1], code) ) - { - wxRect *rect = new wxRect(); - if ( p->GetItemRect(item, *rect, code) ) - { - *rval = Rect::CreateObject(cx, rect); - } - else - { - delete rect; - *rval = JSVAL_VOID; - } - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Returns the position of the item in icon or small icon view. - * Returns undefined on failure. - * - * - */ -JSBool ListCtrl::getItemPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - wxPoint *pt = new wxPoint(); - if ( p->GetItemPosition(item, *pt) ) - { - *rval = Point::CreateObject(cx, pt); - } - else - { - delete pt; - *rval = JSVAL_VOID; - } - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * The new position - * - * - * - * Sets the item position in icon or small icon view. Returns true on success. - * - * - */ -JSBool ListCtrl::setItemPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - if ( FromJS(cx, argv[0], item) ) - { - wxPoint *pt = Point::GetPrivate(cx, argv[1]); - if ( pt != NULL ) - { - *rval = ToJS(cx, p->SetItemPosition(item, *pt)); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * When true, the item spacing for small icon view is returned. Otherwise - * the item spacing for large icon view is returned. - * - * - * - * Returns the item spacing used in icon view. - * - * - */ -JSBool ListCtrl::getItemSpacing(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - -#if wxCHECK_VERSION(2,7,0) - *rval = Size::CreateObject(cx, new wxSize(p->GetItemSpacing())); -#else - bool isSmall; - - if ( FromJS(cx, argv[0], isSmall) ) - { - *rval = ToJS(cx, p->GetItemSpacing(isSmall)); - } -#endif - return JS_TRUE; -} - -/*** - * - * - * - * A window style. - * - * - * When true (= default), the style is added. Otherwise the style is removed. - * - * - * - * Adds or removes a single window style. - * - * - */ -JSBool ListCtrl::setSingleStyle(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long style; - - if ( ! FromJS(cx, argv[0], style) ) - return JS_FALSE; - - bool add = true; - if ( argc > 1 - && ! FromJS(cx, argv[1], add) ) - return JS_FALSE; - - p->SetSingleStyle(style, add); - - return JS_TRUE; -} - -/*** - * - * - * - * The start item. Use -1 to start from the beginning. - * - * - * Search direction. Use one of the constants defined in @wxListCtrl#wxListNext. - * - * - * A state. Use one of the constants defined in @wxListCtrl#wxListState. - * - * - * - * Searches for an item with the given goemetry or state, starting from item but - * excluding the item itself. If item is -1, the first item that matches the specified - * flags will be returned.
- * The following example iterates all selected items: - *

- *    var item = -1;
- *    do
- *    {
- *      item = listctrl.getNextItem(item, wxListNext.ALL, wxListState.SELECTED);
- *    } 
- *    while(item != -1);
- *   
- *
- *
- */ -JSBool ListCtrl::getNextItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc > 3 ) - argc = 3; - - int state = wxLIST_STATE_DONTCARE; - int next = wxLIST_NEXT_ALL; - - switch(argc) - { - case 3: - if ( ! FromJS(cx, argv[2], state) ) - return JS_FALSE; - // Fall through - case 2: - if ( ! FromJS(cx, argv[1], next) ) - return JS_FALSE; - // Fall through - default: - long item; - if ( ! FromJS(cx, argv[0], item) ) - return JS_FALSE; - - *rval = ToJS(cx, p->GetNextItem(item, next, state)); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Type of the imagelist. - * - * - * - * Returns the associated imagelist. - * - * - */ -JSBool ListCtrl::getImageList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int which; - if ( FromJS(cx, argv[0], which) ) - { - Object *imgList = dynamic_cast(p->GetImageList(which)); - *rval = OBJECT_TO_JSVAL(imgList->GetObject()); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * Type of the imagelist. - * - * - * - * Sets the imagelist associated with the control. - * - * - */ -JSBool ListCtrl::setImageList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxImageList *img = ImageList::GetPrivate(cx, argv[1]); - int which; - if ( FromJS(cx, argv[1], which) ) - { - p->SetImageList(img, which); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Refreshes the item. Only useful for virtual list controls. - * - * - */ -JSBool ListCtrl::refreshItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - if ( FromJS(cx, argv[0], item) ) - { - p->RefreshItem(item); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * The item index to start from. - * - * - * The item index of the last item to refresh. - * - * - * - * Refreshes a range of items. Only useful for virtual list controls. - * - * - */ -JSBool ListCtrl::refreshItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long start; - long end; - - if ( FromJS(cx, argv[0], start) - && FromJS(cx, argv[0], end) ) - { - p->RefreshItems(start, end); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * Arranges the items in icon or small icon view. (Windows only) - * See @wxListCtrl#wxListAlign - * - * - */ -JSBool ListCtrl::arrange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int flag = wxLIST_ALIGN_DEFAULT; - if ( argc > 0 - && !FromJS(cx, argv[0], flag) ) - return JS_FALSE; - - *rval = ToJS(cx, p->Arrange(flag)); - return JS_TRUE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Deletes the item. Returns true on success. - * - * - */ -JSBool ListCtrl::deleteItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - *rval = ToJS(cx, p->DeleteItem(item)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Deletes all items. Returns true on success. - * - * - */ -JSBool ListCtrl::deleteAllItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->DeleteAllItems()); - return JS_TRUE; -} - -/*** - * - * - * - * The column index. - * - * - * - * Deletes the column. Returns true on success. - * - * - */ -JSBool ListCtrl::deleteColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long col; - - if ( FromJS(cx, argv[0], col) ) - { - *rval = ToJS(cx, p->DeleteColumn(col)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Deletes all columns. Returns true on success. - * - * - */ -JSBool ListCtrl::deleteAllColumns(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->DeleteAllColumns()); - return JS_TRUE; -} - -/*** - * - * - * - * Deletes all items and columns. - * - * - */ -JSBool ListCtrl::clearAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->ClearAll(); - return JS_TRUE; -} - -/*** - * - * - * - * A column index - * - * - * The item - * - * - * - * - * A column index - * - * - * The name for the header. - * - * - * The format of the header. Use one of the constants of @wxListCtrl#wxListColumnFormat. - * - * - * The width of the column. - * - * - * - * Inserts a column. On success, the index of the new column is returned. On failure, -1 is returned. - * - * - */ -JSBool ListCtrl::insertColumn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long col; - if ( ! FromJS(cx, argv[0], col) ) - return JS_FALSE; - - if ( ListItem::HasPrototype(cx, argv[1]) ) - { - wxListItem *item = ListItem::GetPrivate(cx, argv[1], false); - *rval = ToJS(cx, p->InsertColumn(col, *item)); - } - else - { - wxString header; - FromJS(cx, argv[1], header); - - int format = wxLIST_FORMAT_LEFT; - int width = -1; - - if ( argc == 3 - && ! FromJS(cx, argv[2], format) ) - return JS_FALSE; - - if ( argc == 4 - && ! FromJS(cx, argv[3], width) ) - return JS_FALSE; - - *rval = ToJS(cx, p->InsertColumn(col, header, format, width)); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Item information - * - * - * - * - * The item index. - * - * - * Label of the item - * - * - * The index of the image in the associated imagelist - * - * - * - * - * The item index. - * - * - * The index of the image in the associated imagelist. - * - * - * - * Inserts an item. On success, the index of the new item is returned. On failure, -1 is returned. - * - * - */ -JSBool ListCtrl::insertItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( ListItem::HasPrototype(cx, argv[0]) ) - { - wxListItem *item = ListItem::GetPrivate(cx, argv[0], false); - *rval = ToJS(cx, p->InsertItem(*item)); - return JS_TRUE; - } - else if ( argc > 1 ) - { - long item; - if ( FromJS(cx, argv[0], item) ) - { - int imageIdx; - if ( JSVAL_IS_INT(argv[1]) ) - { - imageIdx = JSVAL_TO_INT(argv[1]); - *rval = ToJS(cx, p->InsertItem(item, imageIdx)); - return JS_TRUE; - } - else - { - wxString label; - FromJS(cx, argv[1], label); - if ( argc > 2 ) - { - if ( FromJS(cx, argv[2], imageIdx) ) - { - *rval = ToJS(cx, p->InsertItem(item, label, imageIdx)); - return JS_TRUE; - } - } - else - { - *rval = ToJS(cx, p->InsertItem(item, label)); - return JS_TRUE; - } - } - } - } - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Edit the label. The text control is returned (on Windows). - * - * - */ -JSBool ListCtrl::editLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - p->EditLabel(item); - #ifdef __WXMSW__ - *rval = TextCtrl::CreateObject(cx, p->GetEditControl()); - #endif - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Cancel the edit, or commit the changes. - * - * - * - * Ends editing the label. When Cancel is true, the label is left unchanged. - * Windows only - * - * - */ -JSBool ListCtrl::endEditLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - #ifdef __WXMSW__ - bool cancel; - - if ( FromJS(cx, argv[0], cancel) ) - { - *rval = ToJS(cx, p->EndEditLabel(cancel)); - return JS_TRUE; - } - #endif - - return JS_FALSE; -} - -/*** - * - * - * - * The item index. - * - * - * - * Makes sure the item is visible. Returns true on success. - * - * - */ -JSBool ListCtrl::ensureVisible(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - *rval = ToJS(cx, p->EnsureVisible(item)); - return JS_TRUE; - } - - return JS_FALSE; -} - - -/*** - * - * - * - * The item to start the search or -1 to start from the beginning. - * - * - * The label to search - * - * - * The label must be exactly the same or may start with Str. Default is false. - * - * - * - * - * The item to start the search or -1 to start from the beginning. - * - * - * The associated data of an item. - * - * - * - * - * The item to start the search or -1 to start from the beginning. - * - * - * Find an item near this position. - * - * - * The direction of the search. See @wxListCtrl#wxListFind. - * - * - * - *
    - *
  1. Find an item whose label matches the string exact or partial.
  2. - *
  3. Find an item with the given associated data.
  4. - *
  5. Find an item nearest the position in the specified direction.
  6. - *
- * The search starts from the given item, or at the beginning when start is -1. - *
- *
- */ -JSBool ListCtrl::findItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - long item; - - if ( FromJS(cx, argv[0], item) ) - { - if ( Point::HasPrototype(cx, argv[1]) ) - { - if ( argc < 3 ) - return JS_FALSE; - - wxPoint *pt = Point::GetPrivate(cx, argv[1], false); - int direction; - if ( FromJS(cx, argv[2], direction) ) - { - *rval = ToJS(cx, p->FindItem(item, *pt, direction)); - return JS_TRUE; - } - } - else if ( JSVAL_IS_INT(argv[1]) ) - { - long data = JSVAL_TO_INT(argv[1]); - *rval = ToJS(cx, p->FindItem(item, data)); - return JS_TRUE; - } - else - { - wxString str; - FromJS(cx, argv[1], str); - - bool partial = false; - if ( argc > 2 - && ! FromJS(cx, argv[2], partial) ) - return JS_FALSE; - - *rval = ToJS(cx, p->FindItem(item, str, partial)); - return JS_TRUE; - } - } - - return JS_FALSE; -} - -/*** - * - * - * - * The position to test. - * - * - * - * Determines which item (if any) is at the specified point. - * - * - */ -JSBool ListCtrl::hitTest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxPoint *pt = Point::GetPrivate(cx, argv[0]); - if ( pt != NULL ) - { - int flags; - long item = p->HitTest(*pt, flags); - - *rval = ListHitTest::CreateObject(cx, new wxListHitTest(item, flags)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * Scrolls the list control. If in icon, small icon or report view mode, - * X specifies the number of pixels to scroll. If in list view mode, X - * specifies the number of columns to scroll. - * If in icon, small icon or list view mode, Y specifies the number of pixels - * to scroll. If in report view mode, Y specifies the number of lines to scroll. - * - * - */ -JSBool ListCtrl::scrollList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x; - int y; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - *rval = ToJS(cx, p->ScrollList(x, y)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * A function which receives 3 arguments. The first argument is the associated data - * of the first item. The second argument is the associated data of the second item. - * The third arugment is the Data argument you specify with this method. The - * third argument may be omitted when you don't use it. The return value is an integer - * value. Return 0 when the items are equal, a negative value if the first item - * is less then the second item and a positive value when the first item is greater - * then the second item. - * - * - * A value passed as the third argument of the sort function. When not passed, 0 is used. - * - * - * - * Call this method to sort the items in the list control. Sorting is done using the - * specified SortFn.
- * Remark: - * Notice that the control may only be sorted on client data associated with the items, - * so you must use @wxListCtrl#setItemData if you want to be able to sort the items - * in the control. - *
- *
- */ -JSBool ListCtrl::sortItems(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxListCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - JSFunction *fun = JS_ValueToFunction(cx, argv[0]); - if ( fun == NULL ) - return JS_FALSE; - - long data = 0; - - if ( argc > 1 - && ! FromJS(cx, argv[1], data) ) - { - return JS_FALSE; - } - - ListSort *sortData = new ListSort(cx, fun, data); - p->SortItems(ListCtrl::SortFn, (long)((void *) sortData)); - delete sortData; - - return JS_TRUE; -} - -/*** - * - * - * This event is triggered when the user starts dragging with the left mouse button. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user starts dragging with the right mouse button. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user starts editing the label. This event - * can be prevented by setting @wxNotifyEvent#veto to true. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user ends editing the label. - * This event can be prevented by setting @wxNotifyEvent#veto to true. - * The function receives a @wxListEvent. - * - * - * This event is triggered when an item is deleted. - * The function receives a @wxListEvent. - * - * - * This event is triggered when all items are deleted. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user selects an item. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user deselects an item. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user activates an item by pressing Enter or double clicking. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the currently focused item changes. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user starts right clicks an item. - * The function receives a @wxListEvent. - * - * - * This event is triggered when a key is pressed. - * The function receives a @wxListEvent. - * - * - * This event is triggered when an item is inserted. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user left-clicks a column. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user right-clicks a column. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the user starts resizing a column. - * The function receives a @wxListEvent. - * - * - * This event is triggered when the divider between two columns is dragged. - * The function receives a @wxListEvent. - * - * - * This event is triggered when a column is resized. - * The function receives a @wxListEvent. - * - * - * This event is triggered so that the application can prepare a cache for a virtual list control. - * The function receives a @wxListEvent. - * - * - */ -BEGIN_EVENT_TABLE(ListCtrl, wxListCtrl) - EVT_LIST_BEGIN_DRAG(-1, ListCtrl::OnBeginDrag) - EVT_LIST_BEGIN_RDRAG(-1, ListCtrl::OnBeginRDrag) - EVT_LIST_BEGIN_LABEL_EDIT(-1, ListCtrl::OnBeginLabelEdit) - EVT_LIST_END_LABEL_EDIT(-1, ListCtrl::OnEndLabelEdit) - EVT_LIST_DELETE_ITEM(-1, ListCtrl::onDeleteItem) - EVT_LIST_DELETE_ALL_ITEMS(-1, ListCtrl::onDeleteAllItems) - EVT_LIST_ITEM_SELECTED(-1, ListCtrl::onItemSelected) - EVT_LIST_ITEM_DESELECTED(-1, ListCtrl::onItemDeselected) - EVT_LIST_ITEM_ACTIVATED(-1, ListCtrl::onItemActivated) - EVT_LIST_ITEM_FOCUSED(-1, ListCtrl::onItemFocused) - EVT_LIST_ITEM_RIGHT_CLICK(-1, ListCtrl::onItemRightClick) - EVT_LIST_KEY_DOWN(-1, ListCtrl::onListKeyDown) - EVT_LIST_INSERT_ITEM(-1, ListCtrl::onInsertItem) - EVT_LIST_COL_CLICK(-1, ListCtrl::onColClick) - EVT_LIST_COL_RIGHT_CLICK(-1, ListCtrl::onColRightClick) - EVT_LIST_COL_BEGIN_DRAG(-1, ListCtrl::onColBeginDrag) - EVT_LIST_COL_DRAGGING(-1, ListCtrl::onColDragging) - EVT_LIST_COL_END_DRAG(-1, ListCtrl::onColEndDrag) - EVT_LIST_CACHE_HINT(-1, ListCtrl::onCacheHint) -END_EVENT_TABLE() - -void ListCtrl::OnBeginDrag(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onBeginDrag"); -} - -void ListCtrl::OnBeginRDrag(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onBeginRDrag"); -} - -void ListCtrl::OnBeginLabelEdit(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onBeginLabelEdit"); -} - -void ListCtrl::OnEndLabelEdit(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onEndLabelEdit"); -} - -void ListCtrl::onDeleteItem(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onDeleteItem"); -} - -void ListCtrl::onDeleteAllItems(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onDeleteAllItems"); -} - -void ListCtrl::onItemSelected(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onItemSelected"); -} - -void ListCtrl::onItemDeselected(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onItemDeselected"); -} - -void ListCtrl::onItemActivated(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onItemActivated"); -} - -void ListCtrl::onItemFocused(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onItemFocused"); -} - -void ListCtrl::onItemRightClick(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onItemRightClick"); -} - -void ListCtrl::onListKeyDown(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onListKeyDown"); -} - -void ListCtrl::onInsertItem(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onInsertItem"); -} - -void ListCtrl::onColClick(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onColClick"); -} - -void ListCtrl::onColRightClick(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onColRightClick"); -} - -void ListCtrl::onColBeginDrag(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onColBeginDrag"); -} - -void ListCtrl::onColDragging(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onColDragging"); -} - -void ListCtrl::onColEndDrag(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onColEndDrag"); -} - -void ListCtrl::onCacheHint(wxListEvent &event) -{ - PrivListEvent::Fire(this, event, "onCacheHint"); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listctrl.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.cpp (nonexistent) @@ -1,213 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - radiobtn.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: radiobtn.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// radiobtn.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/size.h" -#include "../misc/point.h" -#include "../misc/validate.h" - -#include "radiobtn.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -RadioButton::RadioButton(JSContext *cx, JSObject *obj) - : wxRadioButton() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -RadioButton::~RadioButton() -{ - PopEventHandler(true); -} - -/*** - * control/radiobtn - * gui - * - * A radio button item is a button which usually denotes one of several mutually exclusive - * options. It has a text label next to a (usually) round button. - *

You can create a group of mutually-exclusive radio buttons by specifying - * wxRadioButton.GROUP for the first in the group. The group ends when another radio button - * group is created, or there are no more radio buttons. - * See also @wxRadioBox. - *
- */ -WXJS_INIT_CLASS(RadioButton, "wxRadioButton", 3) - -/*** - * - * - * Select/Deselect the button - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(RadioButton) - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -bool RadioButton::GetProperty(wxRadioButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if (id == P_VALUE ) - { - *vp = ToJS(cx, p->GetValue()); - } - return true; -} - -bool RadioButton::SetProperty(wxRadioButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_VALUE ) - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->SetValue(value); - } - return true; -} - -/*** - * - * - * Marks the beginning of a new group of radio buttons. - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(RadioButton) - WXJS_CONSTANT(wxRB_, GROUP) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * - * The parent of wxRadioButton. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The title of the RadioButton. - * - * - * The position of the RadioButton control on the given parent. - * - * - * The size of the RadioButton control. - * - * - * The wxRadioButton style. - * - * - * - * - * Constructs a new wxRadioButton object. - * - * - */ -wxRadioButton* RadioButton::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 7 ) - argc = 7; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - RadioButton *p = new RadioButton(cx, obj); - p->Create(parent, id, text, *pt, *size, style, *val); - return p; - } - - return NULL; -} - -/*** - * - * - * Called when a radio button is clicked. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - */ -void RadioButton::OnRadioButton(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onRadioButton"); -} - -BEGIN_EVENT_TABLE(RadioButton, wxRadioButton) - EVT_RADIOBUTTON(-1, RadioButton::OnRadioButton) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobtn.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.h (nonexistent) @@ -1,68 +0,0 @@ -/* - * wxJavaScript - caldate.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: caldate.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCalendarDateAttr_H -#define _WXJSCalendarDateAttr_H - -namespace wxjs -{ - namespace gui - { - class CalendarDateAttr : public ApiWrapper - { - public: - - static bool GetProperty(wxCalendarDateAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxCalendarDateAttr *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxCalendarDateAttr* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static wxCalendarDateAttr *Clone(wxCalendarDateAttr *attr) - { - return new wxCalendarDateAttr(attr->GetTextColour() - , attr->GetBackgroundColour() - , attr->GetBorderColour() - , attr->GetFont() - , attr->GetBorder()); - - } - - WXJS_DECLARE_PROPERTY_MAP() - - /** - * Property Ids. - */ - enum - { - P_TEXT_COLOUR = WXJS_START_PROPERTY_ID - , P_BG_COLOUR - , P_BORDER_COLOUR - , P_FONT - , P_BORDER - , P_HOLIDAY - }; - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSCalendarDateAttr_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/caldate.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.cpp (nonexistent) @@ -1,170 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - dirdlg.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: dirdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// dirdlg.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "dirdlg.h" -#include "window.h" -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/dirdlg - * gui - * - * This class represents the directory chooser dialog. - * - */ -WXJS_INIT_CLASS(DirDialog, "wxDirDialog", 1) - -/*** - * - * - * Get/Set the message of the dialog - * - * - * Get/Set the full path of the selected file - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(DirDialog) - WXJS_PROPERTY(P_MESSAGE, "message") - WXJS_PROPERTY(P_PATH, "path") -WXJS_END_PROPERTY_MAP() - -bool DirDialog::GetProperty(wxDirDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MESSAGE: - *vp = ToJS(cx, p->GetMessage()); - break; - case P_PATH: - *vp = ToJS(cx, p->GetPath()); - break; - } - return true; -} - -bool DirDialog::SetProperty(wxDirDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MESSAGE: - { - wxString msg; - FromJS(cx, *vp, msg); - p->SetMessage(msg); - break; - } - case P_PATH: - { - wxString path; - FromJS(cx, *vp, path); - p->SetPath(path); - break; - } - } - return true; -} - -/*** - * - * - * - * The parent of wxDirDialog - * - * - * The title of the dialog - * - * - * The default directory - * - * - * Unused - * - * - * The position of the dialog. - * - * - * - * Constructs a new wxDirDialog object - * - * - */ -wxDirDialog* DirDialog::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 5 ) - argc = 5; - - const wxPoint *pt = &wxDefaultPosition; - int style = 0; - wxString defaultPath = wxEmptyString; - wxString message = wxDirSelectorPromptStr; - - switch(argc) - { - case 5: - pt = Point::GetPrivate(cx, argv[4]); - if ( pt == NULL ) - break; - // Fall through - case 4: - if ( ! FromJS(cx, argv[3], style) ) - break; - // Fall through - case 3: - FromJS(cx, argv[2], defaultPath); - // Fall through - case 2: - FromJS(cx, argv[1], message); - // Fall through - default: - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent != NULL ) - { - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - } - - return new wxDirDialog(parent, message, defaultPath, style, *pt); - } - - return NULL; -} - -void DirDialog::Destruct(JSContext *cx, wxDirDialog *p) -{ - p->Destroy(); -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/dirdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.cpp (nonexistent) @@ -1,525 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - scrollwnd.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: scrollwnd.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -/*** - * control/scrolwin - * gui - * - * The wxScrolledWindow class manages scrolling for its client area, transforming - * the coordinates according to the scrollbar positions, and setting the scroll positions, - * thumb sizes and ranges according to the area in view. - * - */ - -#include "../../common/main.h" - -#include "../misc/size.h" -#include "../misc/point.h" -#include "scrollwnd.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -WXJS_INIT_CLASS(ScrolledWindow, "wxScrolledWindow", 1) - -ScrolledWindow::ScrolledWindow(JSContext *cx, JSObject *obj) - : wxScrolledWindow() - , Object(obj, cx) -{ -} - -ScrolledWindow::~ScrolledWindow() -{ -} - - -/*** - * - * - * Motif only: true if the window has a backing bitmap - * - * - * Get the number of pixels per scroll unit (line), in each direction, as set - * by @wxScrolledWindow#setScrollbars. A value of zero indicates no scrolling in that direction. - * - * - * Get the position at which the visible portion of the window starts. - * - * - * Gets the size in device units of the scrollable window area (as opposed to the client size, - * which is the area of the window currently visible) - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ScrolledWindow) - WXJS_READONLY_PROPERTY(P_RETAINED, "retained") - WXJS_READONLY_PROPERTY(P_SCROLL_PIXELS_PER_UNIT, "scrollPixelsPerUnit") - WXJS_READONLY_PROPERTY(P_VIEW_START, "viewStart") - WXJS_READONLY_PROPERTY(P_VIRTUAL_SIZE, "virtualSize") -WXJS_END_PROPERTY_MAP() - -bool ScrolledWindow::GetProperty(wxScrolledWindow *p, JSContext *cx, JSObject* WXUNUSED(obj), int id, jsval *vp) -{ - switch (id) - { - case P_RETAINED: - *vp = ToJS(cx, p->IsRetained()); - break; - case P_SCROLL_PIXELS_PER_UNIT: - { - int x = 0; - int y = 0; - - p->GetScrollPixelsPerUnit(&x, &y); - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *vp = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, x); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, y); - JS_SetElement(cx, objArr, 1, &element); - } - case P_VIEW_START: - { - int x = 0; - int y = 0; - - p->GetViewStart(&x, &y); - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *vp = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, x); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, y); - JS_SetElement(cx, objArr, 1, &element); - } - case P_VIRTUAL_SIZE: - { - int x = 0; - int y = 0; - - p->GetVirtualSize(&x, &y); - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *vp = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, x); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, y); - JS_SetElement(cx, objArr, 1, &element); - } - } - return true; -} - -/*** - * - * - * The parent window - * A windows identifier. Use -1 when you don't need it. - * The position of the control on the given parent - * The size of the control - * The style of the control - * - * - * Constructs a new wxScrolledWindow object. - * - * - */ -wxScrolledWindow* ScrolledWindow::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool WXUNUSED(constructing)) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = wxHSCROLL + wxVSCROLL; - int id = -1; - - if ( argc > 5 ) - argc = 5; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Walk through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Walk through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Walk through - case 2: - if ( ! FromJS(cx, argv[1], id) ) - break; - // Walk through - default: - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - ScrolledWindow *p = new ScrolledWindow(cx, obj); - p->Create(parent, id, *pt, *size, style); - return p; - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(ScrolledWindow) - WXJS_METHOD("calcScrolledPosition", calcScrolledPosition, 2) - WXJS_METHOD("calcUnscrolledPosition", calcUnscrolledPosition, 2) - WXJS_METHOD("enableScrolling", enableScrolling, 2) - WXJS_METHOD("scroll", scroll, 2) - WXJS_METHOD("setScrollbars", setScrollbars, 4) - WXJS_METHOD("setScrollRate", setScrollRate, 2) - WXJS_METHOD("setTargetWindow", setTargetWindow, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * - * - * - * Translates the logical coordinates to the device ones. - * - * - */ -JSBool ScrolledWindow::calcScrolledPosition(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval *rval) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - int xx = 0; - int yy = 0; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->CalcScrolledPosition(x, y, &xx, &yy); - } - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *rval = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, xx); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, yy); - JS_SetElement(cx, objArr, 1, &element); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Translates the device coordinates to the logical ones. - * - * - */ -JSBool ScrolledWindow::calcUnscrolledPosition(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval *rval) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - int xx = 0; - int yy = 0; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->CalcUnscrolledPosition(x, y, &xx, &yy); - } - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *rval = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, xx); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, yy); - JS_SetElement(cx, objArr, 1, &element); - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Enable or disable physical scrolling in the given direction. - * Physical scrolling is the physical transfer of bits up or down the screen when a scroll event occurs. - * If the application scrolls by a variable amount (e.g. if there are different font sizes) - * then physical scrolling will not work, and you should switch it off. Note that you will have - * to reposition child windows yourself, if physical scrolling is disabled. - *
- * Physical scrolling may not be available on all platforms. Where it is available, it is enabled by default. - *
- *
- *
- */ -JSBool ScrolledWindow::enableScrolling(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval* WXUNUSED(rval)) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - bool xScrolling = true; - bool yScrolling = true; - - if ( FromJS(cx, argv[0], xScrolling) - && FromJS(cx, argv[1], yScrolling) ) - { - p->EnableScrolling(xScrolling, yScrolling); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Get the number of pixels per scroll unit (line), in each direction, as set - * by @wxScrolledWindow#setScrollbars. A value of zero indicates no scrolling in that direction. - * - * - */ -JSBool ScrolledWindow::getScrollPixelsPerUnit(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval* WXUNUSED(argv), jsval *rval) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - p->GetScrollPixelsPerUnit(&x, &y); - - JSObject *objArr = JS_NewArrayObject(cx, 2, NULL); - *rval = OBJECT_TO_JSVAL(objArr); - jsval element = ToJS(cx, x); - JS_SetElement(cx, objArr, 0, &element); - element = ToJS(cx, y); - JS_SetElement(cx, objArr, 1, &element); - - return JS_TRUE; -} - -/*** - * - * - * The x position to scroll to - * The y position to scroll to - * - * - * Scrolls a window so the view start is at the given point. - *
- * The positions are in scroll units, not pixels, so to convert to pixels you will have - * to multiply by the number of pixels per scroll increment. If either parameter is -1, - * that position will be ignored (no change in that direction). - *
- *
- *
- */ -JSBool ScrolledWindow::scroll(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval* WXUNUSED(rval)) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->Scroll(x, y); - } - - return JS_TRUE; -} - -/*** - * - * - * - * Pixels per scroll unit in the horizontal direction. - * - * - * Pixels per scroll unit in the vertical direction. - * - * - * Number of units in the horizontal direction. - * - * - * Number of units in the vertical direction. - * - * - * Position to initialize the scrollbars in the horizontal direction, in scroll units. - * - * - * Position to initialize the scrollbars in the vertical direction, in scroll units. - * - * - * Will not refresh window if true. - * - * - * - * Sets up vertical and/or horizontal scrollbars. - *
- * The first pair of parameters give the number of pixels per 'scroll step', i.e. amount moved when the up or down scroll arrows are pressed. The second pair gives the length of scrollbar in scroll steps, which sets the size of the virtual window. - * xPos and yPos optionally specify a position to scroll to immediately. - * For example, the following gives a window horizontal and vertical scrollbars with 20 pixels per scroll step, and a size of 50 steps (1000 pixels) in each direction. - * - * window.setScrollbars(20, 20, 50, 50); - * - * wxScrolledWindow manages the page size itself, using the current client window size as the page size. - *
- *
- *
- */ -JSBool ScrolledWindow::setScrollbars(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval* WXUNUSED(rval)) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pixelsPerUnitX; - int pixelsPerUnitY; - int noUnitsX; - int noUnitsY; - int xPos = 0; - int yPos = 0; - bool noRefresh = false; - - if ( argc > 7 ) - argc = 7; - switch(argc) - { - case 7: - if ( ! FromJS(cx, argv[6], noRefresh) ) - break; - // fall trough - case 6: - if ( ! FromJS(cx, argv[5], yPos) ) - break; - // fall through - case 5: - if ( ! FromJS(cx, argv[4], xPos) ) - break; - // fall through - default: - { - if ( FromJS(cx, argv[0], pixelsPerUnitX) - && FromJS(cx, argv[1], pixelsPerUnitY) - && FromJS(cx, argv[2], noUnitsX) - && FromJS(cx, argv[3], noUnitsY) ) - { - p->SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos, yPos, noRefresh); - } - } - } - return JS_TRUE; -} - -/*** - * - * - * - * - * - * - * Set the horizontal and vertical scrolling increment only. - * See the pixelsPerUnit parameter in @wxScrolledWindow#setScrollbars. - * - * - */ -JSBool ScrolledWindow::setScrollRate(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval* WXUNUSED(rval)) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int x = 0; - int y = 0; - - if ( FromJS(cx, argv[0], x) - && FromJS(cx, argv[1], y) ) - { - p->SetScrollRate(x, y); - } - - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Call this function to tell wxScrolledWindow to perform the actual scrolling on a different window (and not on itself). - * - * - */ -JSBool ScrolledWindow::setTargetWindow(JSContext *cx, JSObject *obj, uintN WXUNUSED(argc), jsval *argv, jsval* WXUNUSED(rval)) -{ - wxScrolledWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *win = Window::GetPrivate(cx, argv[0]); - if ( win ) - { - p->SetTargetWindow(win); - } - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/scrollwnd.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.cpp (nonexistent) @@ -1,529 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - splitwin.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: splitwin.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// splitwin.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../misc/size.h" -#include "../misc/point.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" - -#include "window.h" -#include "splitwin.h" - -using namespace wxjs; -using namespace wxjs::gui; - -SplitterWindow::SplitterWindow(JSContext *cx, JSObject *obj) - : wxSplitterWindow() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -SplitterWindow::~SplitterWindow() -{ - PopEventHandler(true); -} - -/*** - * control/splitwin - * gui - * - * This class manages up to two subwindows. The current view can be split into two - * programmatically, and unsplit either programmatically or via the wxSplitterWindow - * user interface. - *

- * The following example shows a frame that contains a @wxTreeCtrl and a @wxListCtrl. - * The frame is splitted horizontally. - *

- *   wxTheApp.onInit = function()
- *   {
- *     var frame = new wxFrame(null, -1, "wxSplitterWindow Example");
- *     var split = new wxSplitterWindow(frame, -1);
- *     var tree = new wxTreeCtrl(split, -1);
- *     var list = new wxListCtrl(split, -1);
- *   
- *     split.splitHorizontally(tree, list);
- *   
- *     topWindow = frame;
- *     frame.show();
- *   
- *     return true;
- *   };
- *   
- *   wxTheApp.mainLoop();
- *  
- *
- */ -WXJS_INIT_CLASS(SplitterWindow, "wxSplitterWindow", 2) - -/*** - * - * - * Get/Set the minimum pane size. - * - * - * Get/Set the sash position in pixels. When set the panes, sash and border are redrawn. - * See @wxSplitterWindow#setSashPosition. - * - * - * Get/Set the split mode. - * - * - * Returns the left/top or only pane. - * - * - * Returns the right/bottom or only pane. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(SplitterWindow) - WXJS_PROPERTY(P_MIN_PANE_SIZE, "minimumPaneSize") - WXJS_PROPERTY(P_SASH_POS, "sashPosition") - WXJS_PROPERTY(P_SPLIT_MODE, "splitMode") - WXJS_READONLY_PROPERTY(P_WINDOW1, "window1") - WXJS_READONLY_PROPERTY(P_WINDOW2, "window2") - WXJS_READONLY_PROPERTY(P_IS_SPLIT, "isSplit") -WXJS_END_PROPERTY_MAP() - -bool SplitterWindow::GetProperty(wxSplitterWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MIN_PANE_SIZE: - *vp = ToJS(cx, p->GetMinimumPaneSize()); - break; - case P_SASH_POS: - *vp = ToJS(cx, p->GetSashPosition()); - break; - case P_WINDOW1: - { - Object *win = dynamic_cast(p->GetWindow1()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - break; - } - case P_WINDOW2: - { - Object *win = dynamic_cast(p->GetWindow2()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - break; - } - case P_SPLIT_MODE: - *vp = ToJS(cx, (int) p->GetSplitMode()); - break; - case P_IS_SPLIT: - *vp = ToJS(cx, p->IsSplit()); - break; - } - return true; -} - -bool SplitterWindow::SetProperty(wxSplitterWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MIN_PANE_SIZE: - { - int size; - if ( FromJS(cx, *vp, size) ) - p->SetMinimumPaneSize(size); - break; - } - case P_SASH_POS: - { - int pos; - if ( FromJS(cx, *vp, pos) ) - p->SetSashPosition(pos); - break; - } - } - return true; -} - -/*** - * - * - * Draws a 3D effect border and sash. - * Draws a 3D effect sash. - * Draws a 3D effect border. - * Draws the ends of the sash (so the window can be used without a border). - * Draws a thin black border around the window. - * No border, and a black sash. - * Always allow to unsplit, even with the minimum pane size other than zero. - * Don't draw XOR line but resize the child windows immediately. - * - * - * - * - * wxSplitMode is ported as a separate class - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(SplitterWindow) - WXJS_CONSTANT(wxSP_, 3D) - WXJS_CONSTANT(wxSP_, 3DSASH) - WXJS_CONSTANT(wxSP_, 3DBORDER) - WXJS_CONSTANT(wxSP_, FULLSASH) - WXJS_CONSTANT(wxSP_, BORDER) - WXJS_CONSTANT(wxSP_, NOBORDER) - WXJS_CONSTANT(wxSP_, PERMIT_UNSPLIT) - WXJS_CONSTANT(wxSP_, LIVE_UPDATE) -WXJS_END_CONSTANT_MAP() - -void SplitterWindow::InitClass(JSContext *cx, JSObject *obj, JSObject *proto) -{ - JSConstDoubleSpec wxSplitModeMap[] = - { - WXJS_CONSTANT(wxSPLIT_, VERTICAL) - WXJS_CONSTANT(wxSPLIT_, HORIZONTAL) - { 0 } - }; - JSObject *constObj = JS_DefineObject(cx, obj, "wxSplitMode", - NULL, NULL, - JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineConstDoubles(cx, constObj, wxSplitModeMap); -} - -/*** - * - * - * - * The parent of wxSplitterWindow. - * - * - * An window identifier. Use -1 when you don't need it. - * - * - * The position of the SplitterWindow control on the given parent. - * - * - * The size of the SplitterWindow control. - * - * - * The wxSplitterWindow style. - * - * - * - * Constructs a new wxSplitterWindow object. - * - * - */ -wxSplitterWindow* SplitterWindow::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 5 ) - argc = 5; - - int style = wxSP_3D; - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - - switch(argc) - { - case 5: - if ( ! FromJS(cx, argv[4], style) ) - break; - // Fall through - case 4: - size = Size::GetPrivate(cx, argv[3]); - if ( size == NULL ) - break; - // Fall through - case 3: - pt = Point::GetPrivate(cx, argv[2]); - if ( pt == NULL ) - break; - // Fall through - default: - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxSplitterWindow *p = new SplitterWindow(cx, obj); - p->Create(parent, id, *pt, *size, style); - - return p; - } - return NULL; -} - -void SplitterWindow::Destruct(JSContext *cx, wxSplitterWindow* p) -{ -} - -WXJS_BEGIN_METHOD_MAP(SplitterWindow) - WXJS_METHOD("setSashPosition", setSashPosition, 1) - WXJS_METHOD("initialize", initialize, 1) - WXJS_METHOD("replaceWindow", replaceWindow, 2) - WXJS_METHOD("splitHorizontally", splitHorizontally, 2) - WXJS_METHOD("splitVertically", splitVertically, 2) - WXJS_METHOD("unsplit", unsplit, 0) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The sash position in pixels. - * - * - * When true (the default) resizes the panes and redraws the sash and border. - * - * - * - * Sets the sash position. - * - * - */ -JSBool SplitterWindow::setSashPosition(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - int pos; - if ( ! FromJS(cx, argv[0], pos) ) - return JS_FALSE; - - bool redraw = true; - if ( argc > 1 - && ! FromJS(cx, argv[1], redraw) ) - return JS_FALSE; - - p->SetSashPosition(pos, redraw); - return JS_TRUE; -} - -/*** - * - * - * - * - * - * Initializes the splitter window to have one pane. - * This should be called if you wish to initially view - * only a single pane in the splitter window. - * - * - */ -JSBool SplitterWindow::initialize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *win = Window::GetPrivate(cx, argv[0]); - if ( win != NULL ) - { - p->Initialize(win); - return JS_TRUE; - } - return JS_FALSE; -} - -/*** - * - * - * - * - * - * - * This function replaces one of the windows managed by the wxSplitterWindow - * with another one. It is in general better to use it instead of calling - * @wxSplitterWindow#unsplit and then resplitting the window back because - * it will provoke much less flicker (if any). It is valid to call this function - * whether the splitter has two windows or only one. - *

- * OldWindow must specify one of the windows managed by the splitter. - * If the parameters are incorrect or the window couldn't be replaced, false - * is returned. Otherwise the function will return true, but please notice that - * it will not destroy the replaced window and you may wish to do it yourself. - *
- *
- */ -JSBool SplitterWindow::replaceWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *oldWin = Window::GetPrivate(cx, argv[0]); - if ( oldWin == NULL ) - return JS_FALSE; - - wxWindow *newWin = Window::GetPrivate(cx, argv[1]); - if ( newWin == NULL ) - return JS_FALSE; - - *rval = ToJS(cx, p->ReplaceWindow(oldWin, newWin)); - - return JS_TRUE; -} - -/*** - * - * - * - * The top pane - * - * - * The bottom pane - * - * - * The initial position of the sash. If this value is positive, it specifies the - * size of the upper pane. If it is negative, it is absolute value gives the size - * of the lower pane. Finally, specify 0 (default) to choose the default position - * (half of the total window height). - * - * - * - * Initializes the top and bottom panes of the splitter window. - * This should be called if you wish to initially view two panes. It can also be - * called at any subsequent time, but the application should check that the window - * is not currently split using @wxSplitterWindow#isSplit. - * - * - */ -JSBool SplitterWindow::splitHorizontally(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *win1 = Window::GetPrivate(cx, argv[0]); - if ( win1 == NULL ) - return JS_FALSE; - - wxWindow *win2 = Window::GetPrivate(cx, argv[1]); - if ( win2 == NULL ) - return JS_FALSE; - - int pos = 0; - if ( argc > 2 - && FromJS(cx, argv[2], pos) ) - return JS_FALSE; - - *rval = ToJS(cx, p->SplitHorizontally(win1, win2, pos)); - return JS_TRUE; -} - -/*** - * - * - * - * The top pane - * - * - * The bottom pane - * - * - * The initial position of the sash. If this value is positive, it specifies - * the size of the left pane. If it is negative, it is absolute value gives the - * size of the right pane. Finally, specify 0 (default) to choose the default - * position (half of the total window width). - * - * - * - * Initializes the left and right panes of the splitter window. - * This should be called if you wish to initially view two panes. It can also be - * called at any subsequent time, but the application should check that the window - * is not currently split using @wxSplitterWindow#isSplit. - * - * - */ -JSBool SplitterWindow::splitVertically(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxWindow *win1 = Window::GetPrivate(cx, argv[0]); - if ( win1 == NULL ) - return JS_FALSE; - - wxWindow *win2 = Window::GetPrivate(cx, argv[1]); - if ( win2 == NULL ) - return JS_FALSE; - - int pos = 0; - if ( argc > 2 - && FromJS(cx, argv[2], pos) ) - return JS_FALSE; - - *rval = ToJS(cx, p->SplitVertically(win1, win2, pos)); - return JS_TRUE; -} - -/*** - * - * - * - * The pane to hide. When not specified, the right or bottom pane is hidden. - * - * - * - * Unsplits the window. - * - * - */ -JSBool SplitterWindow::unsplit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxSplitterWindow *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - if ( argc == 1 ) - { - wxWindow *win = Window::GetPrivate(cx, argv[0]); - if ( win != NULL ) - { - *rval = ToJS(cx, p->Unsplit(win)); - return JS_TRUE; - } - } - else - { - *rval = ToJS(cx, p->Unsplit()); - return JS_TRUE; - } - return JS_FALSE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/splitwin.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.h (nonexistent) @@ -1,77 +0,0 @@ -/* - * wxJavaScript - treehit.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: treehit.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_treehit_h -#define _wxjs_treehit_h - -namespace wxjs -{ - namespace gui - { - /** - * Helper class for returning information for hittest - */ - class wxTreeHitTest - { - public: - wxTreeItemId GetItem() const - { - return m_item; - } - long GetFlags() const - { - return m_flags; - } - friend class TreeCtrl; - private: - - wxTreeHitTest(const wxTreeItemId& item, int flags) : m_item(item), m_flags(flags) - { - } - - wxTreeItemId m_item; - int m_flags; - }; - - class TreeHitTest : public ApiWrapper - { - public: - static bool GetProperty(wxTreeHitTest *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - /** - * Property Ids. - */ - enum - { - P_ITEM - , P_FLAGS - }; - - WXJS_DECLARE_CONSTANT_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _wxjs_treehit_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treehit.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - coldlg.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: coldlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSColourDialog_H -#define _WXJSColourDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: coldlg.h -// Purpose: ColourDialog ports wxColourDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 29.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - class ColourDialog : public ApiWrapper - { - public: - static bool GetProperty(wxColourDialog *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxColourDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static void Destruct(JSContext *cx, wxColourDialog *p); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_COLOUR_DATA - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSColourDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/coldlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.cpp (nonexistent) @@ -1,550 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - calendar.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: calendar.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// calendar.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include - -#include "../../common/main.h" -#include "../../common/index.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/cal.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/colour.h" - -#include "calendar.h" -#include "caldate.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -CalendarCtrl::CalendarCtrl(JSContext *cx, JSObject *obj) - : wxCalendarCtrl() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -CalendarCtrl::~CalendarCtrl() -{ - PopEventHandler(true); -} - -/*** - * control/calendar - * gui - * - * The calendar control allows the user to pick a date. For this, it displays a window containing - * several parts: a control at the top to pick the month and the year (either or both of them may be disabled), - * and a month area below them which shows all the days in the month. The user can move the - * current selection using the keyboard and select the date (generating @wxCalendarCtrl#onCalendar event) - * by pressing return or double clicking it. - *

- * It has advanced possibilities for the customization of its display. All global settings - * (such as colours and fonts used) can, of course, be changed. But also, the display style - * for each day in the month can be set independently using @wxCalendarDateAttr. - *
- */ -WXJS_INIT_CLASS(CalendarCtrl, "wxCalendarCtrl", 2) - -/*** - * - * - * Get the attributes of a day. The array index must be between 1 and 31. - * - * Get/Set the current date - * Show/hide holidays (write only) - * Enable/Disable month changing (write only) - * Enable/Disable year changing (write only) - * Get/Set the background colour of the header. See @wxCalendarCtrl#setHeaderColours and @wxCalendarCtrl#headerColourFg - * Get/Set the foreground colour of the header. See @wxCalendarCtrl#setHeaderColours and @wxCalendarCtrl#headerColourBg - * Get/Set the background colour of the selected date. See @wxCalendarCtrl#setHighlightColours and @wxCalendarCtrl#highlightColourFg - * Get/Set the foreground colour of the selected date. See @wxCalendarCtrl#setHighlightColours and @wxCalendarCtrl#highlightColourBg - * Get/Set the background colour of a holiday. See @wxCalendarCtrl#setHolidayColours and @wxCalendarCtrl#holidayColourFg - * Get/Set the foreground colour of a holiday. See @wxCalendarCtrl#setHolidayColours and @wxCalendarCtrl#holidayColourBg - * Get/Set the lower date limit in which selection might occur. Set to null to remove the lower limit. See @wxCalendarCtrl#upperDateLimit and @wxCalendarCtrl#setDateRange - * Get/Set the upper date limit in which selection might occur. Set to null to remove the upper limit. See @wxCalendarCtrl#lowerDateLimit and @wxCalendarCtrl#setDateRange - * - */ -WXJS_BEGIN_PROPERTY_MAP(CalendarCtrl) - WXJS_PROPERTY(P_DATE, "date") - WXJS_PROPERTY(P_LOWER_DATE_LIMIT, "lowerDateLimit") - WXJS_PROPERTY(P_UPPER_DATE_LIMIT, "upperDateLimit") - WXJS_PROPERTY(P_ENABLE_HOLIDAY_DISPLAY, "enableHolidayDisplay") - WXJS_PROPERTY(P_ENABLE_MONTH_CHANGE, "enableMonthChange") - WXJS_PROPERTY(P_ENABLE_YEAR_CHANGE, "enableYearChange") - WXJS_PROPERTY(P_HEADER_COLOUR_FG, "headerColourFg") - WXJS_PROPERTY(P_HEADER_COLOUR_BG, "headerColourBg") - WXJS_PROPERTY(P_HIGHLIGHT_COLOUR_FG, "highlightColourFg") - WXJS_PROPERTY(P_HIGHLIGHT_COLOUR_BG, "highlightColourBg") - WXJS_PROPERTY(P_HOLIDAY_COLOUR_FG, "holidayColourFg") - WXJS_PROPERTY(P_HOLIDAY_COLOUR_BG, "holidayColourBg") - WXJS_READONLY_PROPERTY(P_ATTR, "attr") -WXJS_END_PROPERTY_MAP() - -bool CalendarCtrl::GetProperty(wxCalendarCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_ATTR: - *vp = CalendarDateAttr::CreateObject(cx, NULL, obj); - break; - case P_DATE: - *vp = ToJS(cx, p->GetDate()); - break; - case P_LOWER_DATE_LIMIT: - *vp = ToJS(cx, p->GetLowerDateLimit()); - break; - case P_UPPER_DATE_LIMIT: - *vp = ToJS(cx, p->GetUpperDateLimit()); - break; - case P_HEADER_COLOUR_FG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHeaderColourFg())); - break; - case P_HEADER_COLOUR_BG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHeaderColourBg())); - break; - case P_HIGHLIGHT_COLOUR_FG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHighlightColourFg())); - break; - case P_HIGHLIGHT_COLOUR_BG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHighlightColourBg())); - break; - case P_HOLIDAY_COLOUR_FG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHolidayColourFg())); - break; - case P_HOLIDAY_COLOUR_BG: - *vp = Colour::CreateObject(cx, new wxColour(p->GetHolidayColourBg())); - break; - } - return true; -} - -bool CalendarCtrl::SetProperty(wxCalendarCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DATE: - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetDate(date); - break; - } - case P_LOWER_DATE_LIMIT: - { - if ( JSVAL_IS_NULL(*vp) ) - p->SetLowerDateLimit(); - else if ( JSVAL_IS_OBJECT(*vp) ) - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetLowerDateLimit(date); - } - break; - } - case P_UPPER_DATE_LIMIT: - { - if ( JSVAL_IS_NULL(*vp) ) - p->SetLowerDateLimit(); - else if ( JSVAL_IS_OBJECT(*vp) ) - { - wxDateTime date; - if ( FromJS(cx, *vp, date) ) - p->SetUpperDateLimit(date); - } - break; - } - case P_ENABLE_HOLIDAY_DISPLAY: - { - bool enable; - if ( FromJS(cx, *vp, enable) ) - p->EnableHolidayDisplay(enable); - break; - } - case P_ENABLE_YEAR_CHANGE: - { - bool enable; - if ( FromJS(cx, *vp, enable) ) - p->EnableYearChange(enable); - break; - } - case P_ENABLE_MONTH_CHANGE: - { - bool enable; - if ( FromJS(cx, *vp, enable) ) - p->EnableMonthChange(enable); - break; - } - case P_HEADER_COLOUR_FG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour bg = p->GetHeaderColourBg(); - p->SetHeaderColours(*colour, bg); - } - break; - } - case P_HEADER_COLOUR_BG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour fg = p->GetHeaderColourFg(); - p->SetHeaderColours(fg, *colour); - } - break; - } - case P_HIGHLIGHT_COLOUR_FG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour bg = p->GetHighlightColourBg(); - p->SetHighlightColours(*colour, bg); - } - break; - } - case P_HIGHLIGHT_COLOUR_BG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour fg = p->GetHighlightColourBg(); - p->SetHighlightColours(fg, *colour); - } - break; - } - case P_HOLIDAY_COLOUR_FG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour bg = p->GetHolidayColourBg(); - p->SetHolidayColours(*colour, bg); - } - break; - } - case P_HOLIDAY_COLOUR_BG: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - { - wxColour fg = p->GetHolidayColourBg(); - p->SetHolidayColours(fg, *colour); - } - break; - } - } - return true; -} - -/*** - * - * - * Show Sunday as the first day in the week - * Show Monday as the first day in the week - * Highlight holidays in the calendar - * Disable the year changing - * Disable the month (and, implicitly, the year) changing - * Show the neighbouring weeks in the previous and next months - * Use alternative, more compact, style for the month and year selection controls. - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(CalendarCtrl) - WXJS_CONSTANT(wxCAL_, SUNDAY_FIRST) - WXJS_CONSTANT(wxCAL_, MONDAY_FIRST) - WXJS_CONSTANT(wxCAL_, SHOW_HOLIDAYS) - WXJS_CONSTANT(wxCAL_, NO_YEAR_CHANGE) - WXJS_CONSTANT(wxCAL_, NO_MONTH_CHANGE) - WXJS_CONSTANT(wxCAL_, SHOW_SURROUNDING_WEEKS) - WXJS_CONSTANT(wxCAL_, SEQUENTIAL_MONTH_SELECTION) -WXJS_END_CONSTANT_MAP() - -/*** - * - * - * The parent of wxCalendarCtrl. - * A window identifier. Use -1 when you don't need it. - * The date to select when the control is shown. Use null to use - * the default. - * - * The position of the CalendarCtrl control on the given parent. - * The size of the CalendarCtrl control. - * - * The wxCalendarCtrl style. - * - * - * Constructs a new wxCalendarCtrl object. - * - * - */ -wxCalendarCtrl *CalendarCtrl::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - int style = 0; - const wxSize *size = &wxDefaultSize; - const wxPoint *pt= &wxDefaultPosition; - wxDateTime date; - - switch(argc) - { - case 6: // style - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - case 3: - if ( ! FromJS(cx, argv[2], date) ) - break; - // Fall through - default: - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxCalendarCtrl *p = new CalendarCtrl(cx, obj); - p->Create(parent, id, date, *pt, *size, style); - return p; - } - - return NULL; -} - -WXJS_BEGIN_METHOD_MAP(CalendarCtrl) - WXJS_METHOD("setDateRange", setDateRange, 2) - WXJS_METHOD("setHeaderColours", setHeaderColours, 2) - WXJS_METHOD("setHighlightColours", setHighlightColours, 2) - WXJS_METHOD("setHolidayColours", setHolidayColours, 2) -WXJS_END_METHOD_MAP() - -/*** - * - * - * The lower limit of the selection. Use null to reset this. - * The upper limit of the selection. Use null to reset this. - * - * - * Set the range in which selection can occur. See @wxCalendarCtrl#lowerDateLimit and - * @wxCalendarCtrl#upperDateLimit - * - */ -JSBool CalendarCtrl::setDateRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxCalendarCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxDateTime minDate; - wxDateTime maxDate; - if ( FromJS(cx, argv[0], minDate) - && FromJS(cx, argv[1], maxDate) ) - p->SetDateRange(minDate, maxDate); - - return JS_TRUE; -} - -/*** - * - * - * The foreground colour of the header - * The background colour of the header - * - * - * Sets the colours of the header. See @wxCalendarCtrl#headerColourFg and @wxCalendarCtrl#headerColourBg - * - * - */ -JSBool CalendarCtrl::setHeaderColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxCalendarCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxColour *fg = Colour::GetPrivate(cx, argv[0]); - wxColour *bg = Colour::GetPrivate(cx, argv[1]); - - if ( fg != NULL - && bg != NULL ) - { - p->SetHeaderColours(*fg, *bg); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * The foreground colour of the highlighted date - * The background colour of the highlighted date - * - * - * Sets the colours of the highlighted date. See @wxCalendarCtrl#highlightColourFg and @wxCalendarCtrl#highlightColourBg - * - * - */ -JSBool CalendarCtrl::setHighlightColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxCalendarCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxColour *fg = Colour::GetPrivate(cx, argv[0]); - wxColour *bg = Colour::GetPrivate(cx, argv[1]); - - if ( fg != NULL - && bg != NULL ) - { - p->SetHighlightColours(*fg, *bg); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * The foreground colour of a holiday - * The background colour of a holiday - * - * - * Sets the colours of a holiday. See @wxCalendarCtrl#holidayColourFg and @wxCalendarCtrl#holidayColourBg - * - * - */ -JSBool CalendarCtrl::setHolidayColours(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxCalendarCtrl *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxColour *fg = Colour::GetPrivate(cx, argv[0]); - wxColour *bg = Colour::GetPrivate(cx, argv[1]); - - if ( fg != NULL - && bg != NULL ) - { - p->SetHolidayColours(*fg, *bg); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * A day is double clicked. The function gets a @wxCalendarEvent as argument. - * - * - * The selected date is changed. The function gets a @wxCalendarEvent as argument. - * - * - * The selected day is changed. The function gets a @wxCalendarEvent as argument. - * - * - * The selected month is changed. The function gets a @wxCalendarEvent as argument. - * - * - * The selected year is changed. The function gets a @wxCalendarEvent as argument. - * - * - * The user clicked on the week day header. The function gets a @wxCalendarEvent as argument. - * - * - */ - -void CalendarCtrl::OnCalendar(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendar"); -} - -void CalendarCtrl::OnCalendarSelChanged(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendarSelChanged"); -} - -void CalendarCtrl::OnCalendarDay(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendarDay"); -} - -void CalendarCtrl::OnCalendarMonth(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendarMonth"); -} - -void CalendarCtrl::OnCalendarYear(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendarYear"); -} - -void CalendarCtrl::OnCalendarWeekDayClicked(wxCalendarEvent &event) -{ - PrivCalendarEvent::Fire(this, event, "onCalendarWeekDayClicked"); -} - -BEGIN_EVENT_TABLE(CalendarCtrl, wxCalendarCtrl) - EVT_CALENDAR(-1, CalendarCtrl::OnCalendar) - EVT_CALENDAR_SEL_CHANGED(-1, CalendarCtrl::OnCalendarSelChanged) - EVT_CALENDAR_DAY(-1, CalendarCtrl::OnCalendarDay) - EVT_CALENDAR_MONTH(-1, CalendarCtrl::OnCalendarMonth) - EVT_CALENDAR_YEAR(-1, CalendarCtrl::OnCalendarYear) - EVT_CALENDAR_WEEKDAY_CLICKED(-1, CalendarCtrl::OnCalendarWeekDayClicked) -END_EVENT_TABLE() - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/calendar.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.h (nonexistent) @@ -1,51 +0,0 @@ -/* - * wxJavaScript - radioboxit.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: radioboxit.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_gui_radioboxit_h -#define _wxjs_gui_radioboxit_h -namespace wxjs -{ - namespace gui - { - class RadioBoxItem : public ApiWrapper - { - public: - - static bool GetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(Index *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_ENABLE = WXJS_START_PROPERTY_ID - , P_STRING - , P_SELECTED - , P_SHOW - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _wxjs_gui_radioboxit_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radioboxit.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/menu.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/menu.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/menu.h (nonexistent) @@ -1,103 +0,0 @@ -/* - * wxJavaScript - menu.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: menu.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMENU_H -#define _WXJSMENU_H - -///////////////////////////////////////////////////////////////////////////// -// Name: menu.h -// Purpose: Menu ports wxMenu to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 16.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Menu : public wxMenu - , public ApiWrapper - , public Object - { - public: - - /** - * Constructors - */ - Menu(JSContext *cx, JSObject *obj, const wxString& title, long style = 0); - Menu(JSContext *cx, JSObject *obj, long style = 0); - - virtual ~Menu(); - - static bool GetProperty(wxMenu *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxMenu *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * JSConstructor - Callback for when a wxMenu object is created - */ - static wxMenu* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - - static void Destruct(JSContext *cx, wxMenu *p); - - //////////////////////// - // JavaScript methods - //////////////////////// - - static JSBool append(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool append_separator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool new_column(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool check(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool delete_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool find_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool getLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isChecked(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool isEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setHelpString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setLabel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_MENU_ITEM_COUNT - , P_MENU_ITEMS - , P_TITLE - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSMENU_H - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/menu.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/button.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/button.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/button.cpp (nonexistent) @@ -1,267 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - button.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: button.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// button.cpp - -/*** - * control/button - * gui - * - * A button is a control that contains a text string, - * and is one of the commonest elements of a GUI. It may - * be placed on a dialog box or panel, or indeed almost any other window. - * An example: - *

- *	 // dlg is a wxDialog
- *	 var button = new wxButton(dlg, -1, "Click me");
- *	 button.onClicked = function(event)
- *	 {
- *	   wxMessageBox("You've clicked me");
- *	 }
- *  
- *
- */ - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -#include "button.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -WXJS_INIT_CLASS(Button, "wxButton", 3) - -/*** - * - * Get/Set the label of the button. - * - */ -WXJS_BEGIN_PROPERTY_MAP(Button) - WXJS_PROPERTY(P_LABEL, "label") -WXJS_END_PROPERTY_MAP() - -bool Button::GetProperty(wxButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_LABEL ) - *vp = ToJS(cx, p->GetLabel()); - return true; -} - -bool Button::SetProperty(wxButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_LABEL ) - { - wxString label; - FromJS(cx, *vp, label); - p->SetLabel(label); - } - return true; -} - -/*** - * - * - * Gets the default size of a button. - * - * - */ -WXJS_BEGIN_STATIC_PROPERTY_MAP(Button) - WXJS_READONLY_STATIC_PROPERTY(P_DEFAULT_SIZE, "defaultSize") -WXJS_END_PROPERTY_MAP() - -bool Button::GetStaticProperty(JSContext *cx, int id, jsval *vp) -{ - if ( id == P_DEFAULT_SIZE ) - { - *vp = Size::CreateObject(cx, new wxSize(wxButton::GetDefaultSize())); - } - return true; -} - -/*** - * - * - * Left-justifies the label. Windows and GTK+ only. - * Right-justifies the bitmap label. Windows and GTK+ only. - * Aligns the label to the top of the button. Windows and GTK+ only. - * Aligns the label to the bottom of the button. Windows and GTK+ only. - * Creates the button as small as possible instead of making it of the standard size (which is the default behaviour ). - * Creates a flat button. Windows and GTK+ only. - * - * If this is specified, the button will be drawn automatically using - * the label bitmap only, providing a 3D-look border. If this style is not specified, - * the button will be drawn without borders and using all provided bitmaps. WIN32 only. - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(Button) - WXJS_CONSTANT(wxBU_, LEFT) - WXJS_CONSTANT(wxBU_, RIGHT) - WXJS_CONSTANT(wxBU_, TOP) - WXJS_CONSTANT(wxBU_, BOTTOM) - WXJS_CONSTANT(wxBU_, EXACTFIT) - WXJS_CONSTANT(wxBU_, AUTODRAW) - WXJS_CONSTANT(wx, NO_BORDER) -WXJS_END_CONSTANT_MAP() - - -WXJS_BEGIN_METHOD_MAP(Button) - WXJS_METHOD("setDefault", setDefault, 0) -WXJS_END_METHOD_MAP() - -Button::Button(JSContext *cx, JSObject *obj) - : wxButton() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -Button::~Button() -{ - PopEventHandler(true); -} - -/*** - * - * - * The parent of the button. - * An window identifier. Use -1 when you don't need it. - * The label of the button - * - * The position of the button on the given parent. - * - * - * The size of the button. - * - * The button style - * - * - * - * Constructs a new wxButton object. - * - * - */ -wxButton *Button::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 7 ) - argc = 7; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - const wxValidator *val = &wxDefaultValidator; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxButton *p = new Button(cx, obj); - p->Create(parent, id, text, *pt, *size, style, *val); - return p; - } - - return NULL; -} - -/*** - * - * - * - * This sets the button to be the default item for the panel or dialog box. - * see @wxPanel#defaultItem. - * - * - */ -JSBool Button::setDefault(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxButton *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - p->SetDefault(); - - return JS_TRUE; -} - -/*** - * - * Called when the button is clicked. The type of the argument that your handler receives - * is @wxCommandEvent. - * - */ -void Button::OnClicked(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onClicked"); -} - -BEGIN_EVENT_TABLE(Button, wxButton) - EVT_BUTTON(-1, Button::OnClicked) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/button.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/window.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/window.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/window.h (nonexistent) @@ -1,134 +0,0 @@ -/* - * wxJavaScript - window.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: window.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSWINDOW_H -#define _WXJSWINDOW_H - -///////////////////////////////////////////////////////////////////////////// -// Name: window.h -// Purpose: Window ports wxWindow to JavaScript. -// wxWindow is used as a prototype object -// of several other wxWindow JavaScript objects. -// Author: Franky Braem -// Modified by: -// Created: 16.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class Window : public ApiWrapper - { - public: - - static bool GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - /** - * Callback for retrieving static properties - */ - static bool GetStaticProperty(JSContext *cx, int id, jsval *vp); - - static JSBool captureMouse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool centre(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clearBackground(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clientToScreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool move(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool convertDialogToPixels(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool convertPixelsToDialog(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool destroy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool releaseMouse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool layout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setSize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool raise(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool lower(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool centreOnParent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool fit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setSizeHints(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool show(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool refresh(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool initDialog(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool transferDataToWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool transferDataFromWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool validate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool makeModal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool warpPointer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool update(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool freeze(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool thaw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - WXJS_DECLARE_STATIC_METHOD_MAP() - WXJS_DECLARE_STATIC_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - enum - { - P_CLIENT_HEIGHT = -128 - , P_AUTO_LAYOUT - , P_CLIENT_WIDTH - , P_CLIENT_ORIGIN - , P_ENABLE - , P_HEIGHT - , P_TITLE - , P_VISIBLE - , P_WIDTH - , P_POSITION - , P_SIZE - , P_SIZER - , P_CLIENT_SIZE - , P_ID - , P_RECT - , P_CLIENT_RECT - , P_BEST_SIZE - , P_WINDOW_STYLE - , P_EXTRA_STYLE - , P_SHOWN - , P_TOP_LEVEL - , P_ACCEPTS_FOCUS - , P_ACCEPTS_FOCUS_KEYBOARD - , P_DEFAULT_ITEM - , P_CHILDREN - , P_PARENT - , P_VALIDATOR - , P_ACCELERATOR_TABLE - , P_CAPTURE - , P_HAS_CAPTURE - , P_UPDATE_REGION - , P_BACKGROUND_COLOUR - , P_FOREGROUND_COLOUR - , P_FONT - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif // _WXJSWINDOW_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/window.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.cpp (nonexistent) @@ -1,74 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - treeid.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: treeid.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include -/** - * @if JS - * @page wxTreeItemId wxTreeItemId - * @since version 0.6 - * @endif - */ - -#include "../../common/main.h" - -#include "treeid.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/treeid - * gui - * - * wxTreeItemId identifies an element of the tree. - * See @wxTreeCtrl and @wxTreeEvent - * - */ -WXJS_INIT_CLASS(TreeItemId, "wxTreeItemId", 0) - -/*** - * - * - * Returns true when the item is valid. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TreeItemId) - WXJS_READONLY_PROPERTY(P_OK, "ok") -WXJS_END_PROPERTY_MAP() - -bool TreeItemId::GetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_OK ) - { - *vp = ToJS(cx, p->IsOk()); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treeid.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.h (nonexistent) @@ -1,91 +0,0 @@ -/* - * wxJavaScript - radiobox.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: radiobox.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSRadioBox_H -#define _WXJSRadioBox_H - -///////////////////////////////////////////////////////////////////////////// -// Name: RadioBox.h -// Purpose: RadioBox ports wxRadioBox to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 17.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class RadioBox : public wxRadioBox - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - RadioBox(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~RadioBox(); - - static bool GetProperty(wxRadioBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxRadioBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxRadioBox* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxRadioBox *p) - { - } - - static JSBool setString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool findString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool enable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool show(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_SELECTION - , P_STRING_SELECTION - , P_ITEM - , P_COUNT - }; - - void OnRadioBox(wxCommandEvent &event); - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSRadioBox_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/radiobox.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.cpp (nonexistent) @@ -1,464 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - treeitem.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: treeitem.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// wxJSTreeItem.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include - -#include "../../common/main.h" - -#include "../misc/app.h" - -#include "treectrl.h" -#include "treeid.h" -#include "treeitem.h" - -#include "../misc/colour.h" -#include "../misc/font.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/treeitem - * gui - * - * wxTreeItem is not available in wxWidgets. It's main purpose is to concentrate - * item specific properties and methods in this class which will make it easier to work with - * tree items. - * See @wxTreeCtrl and @wxTreeItemId - * - */ -WXJS_INIT_CLASS(TreeItem, "wxTreeItem", 0) - -/*** - * - * - * Gets the number of child items. It returns the total number - * of descendants. - * - * - * Get/Set the background colour of the item. - * - * - * Get/Set the item text in bold. - * - * - * Gets the number of child items. Only the children of one level is returned. - * - * - * Get/Set the associated data of the item. - * - * - * Returns true when the item is expanded. When set to true - * the items is expanded, collapsed when set to false. - * - * - * Get/Set the font of the item. - * - * - * Returns true when the item has children. When set - * to true you can force the appearance of the button next to the item. - * This is useful to allow the user to expand the items which don't have - * any children now, but instead adding them only when needed, thus minimizing - * memory usage and loading time. - * - * - * Get the last child item. Returns null when the item has no childs. - * - * - * Get the next sibling item. Returns null when there are no items left. - * - * - * Get the parent item. Returns null when this item is the root item. - * - * - * Get the previous sibling item. Returns null when there are no items left. - * - * - * Returns true when the item is selected. When set to true - * the items is selected, unselected when set to false. - * - * - * Get/Set the item text. - * - * - * Get/Set the colour of the text. - * - * - * Get/Set the visibility of the item. Setting visible to false - * doesn't do anything. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TreeItem) - WXJS_PROPERTY(P_BOLD, "bold") - WXJS_PROPERTY(P_DATA, "data") - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_PROPERTY(P_TEXT, "text") - WXJS_PROPERTY(P_FONT, "font") - WXJS_PROPERTY(P_HAS_CHILDREN, "hasChildren") - WXJS_PROPERTY(P_VISIBLE, "visible") - WXJS_PROPERTY(P_EXPANDED, "expanded") - WXJS_PROPERTY(P_SELECTED, "selected") - WXJS_READONLY_PROPERTY(P_CHILDREN_COUNT, "childrenCount") - WXJS_READONLY_PROPERTY(P_ALL_CHILDREN_COUNT, "allChildrenCount") - WXJS_READONLY_PROPERTY(P_PARENT, "parent") - WXJS_READONLY_PROPERTY(P_LAST_CHILD, "lastChild") - WXJS_READONLY_PROPERTY(P_PREV_SIBLING, "prevSibling") - WXJS_READONLY_PROPERTY(P_NEXT_SIBLING, "nextSibling") -WXJS_END_PROPERTY_MAP() - -bool TreeItem::GetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *objParent = JS_GetParent(cx, obj); - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, objParent); - if ( tree == NULL ) - return false; - - switch (id) - { - case P_TEXT: - *vp = ToJS(cx, tree->GetItemText(*p)); - break; - case P_DATA: - { - ObjectTreeData *data = (ObjectTreeData*) tree->GetItemData(*p); - *vp = data->GetJSVal(); - break; - } - case P_TEXT_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(tree->GetItemTextColour(*p))); - break; - case P_BACKGROUND_COLOUR: - *vp = Colour::CreateObject(cx, new wxColour(tree->GetItemBackgroundColour(*p))); - break; - case P_FONT: - *vp = Font::CreateObject(cx, new wxFont(tree->GetItemFont(*p))); - break; - case P_HAS_CHILDREN: - *vp = ToJS(cx, tree->GetChildrenCount(*p, FALSE) != 0); - break; - case P_BOLD: - *vp = ToJS(cx, tree->IsBold(*p)); - break; - case P_VISIBLE: - *vp = ToJS(cx, tree->IsVisible(*p)); - break; - case P_EXPANDED: - *vp = ToJS(cx, tree->IsExpanded(*p)); - break; - case P_SELECTED: - *vp = ToJS(cx, tree->IsSelected(*p)); - break; - case P_CHILDREN_COUNT: - *vp = ToJS(cx, tree->GetChildrenCount(*p, false)); - break; - case P_ALL_CHILDREN_COUNT: - *vp = ToJS(cx, tree->GetChildrenCount(*p)); - break; - case P_PARENT: - { - wxTreeItemId parentId = tree->GetItemParent(*p); - if ( parentId.IsOk() ) - *vp = TreeItem::CreateObject(cx, new wxTreeItemId(parentId)); - break; - } - case P_LAST_CHILD: - { - wxTreeItemId childId = tree->GetLastChild(*p); - if ( childId.IsOk() ) - *vp = TreeItem::CreateObject(cx, new wxTreeItemId(childId)); - break; - } - case P_PREV_SIBLING: - { - wxTreeItemId prevId = tree->GetPrevSibling(*p); - if ( prevId.IsOk() ) - *vp = TreeItem::CreateObject(cx, new wxTreeItemId(prevId)); - break; - } - case P_NEXT_SIBLING: - { - wxTreeItemId nextId = tree->GetNextSibling(*p); - if ( nextId.IsOk() ) - *vp = TreeItem::CreateObject(cx, new wxTreeItemId(nextId)); - break; - } - } - return true; -} - -bool TreeItem::SetProperty(wxTreeItemId *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - JSObject *objParent = JS_GetParent(cx, obj); - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, objParent); - if ( tree == NULL ) - return false; - - switch (id) - { - case P_TEXT: - { - wxString text; - FromJS(cx, *vp, text); - tree->SetItemText(*p, text); - break; - } - case P_DATA: - tree->SetItemData(*p, new ObjectTreeData(cx, *vp)); - break; - case P_TEXT_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - tree->SetItemTextColour(*p, *colour); - } - break; - case P_BACKGROUND_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - tree->SetItemBackgroundColour(*p, *colour); - } - break; - case P_FONT: - { - wxFont *font = Font::GetPrivate(cx, *vp); - if ( font != NULL ) - tree->SetItemFont(*p, *font); - } - break; - case P_HAS_CHILDREN: - { - bool children; - if ( FromJS(cx, *vp, children) ) - tree->SetItemHasChildren(*p, children); - } - break; - case P_BOLD: - { - bool bold; - if ( FromJS(cx, *vp, bold) ) - tree->SetItemBold(*p, bold); - } - break; - case P_EXPANDED: - { - bool expand; - if ( FromJS(cx, *vp, expand) ) - { - if ( expand ) - tree->Expand(*p); - else - tree->Collapse(*p); - } - } - break; - case P_VISIBLE: - { - bool visible; - if ( FromJS(cx, *vp, visible) - && visible ) - { - tree->EnsureVisible(*p); - } - } - break; - case P_SELECTED: - { - bool select; - if ( FromJS(cx, *vp, select) ) - { - if ( select ) - tree->SelectItem(*p); - else - tree->Unselect(); - } - } - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(TreeItem) - WXJS_METHOD("getImage", getImage, 1) - WXJS_METHOD("setImage", setImage, 2) - WXJS_METHOD("getFirstChild", getFirstChild, 1) - WXJS_METHOD("getNextChild", getNextChild, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * A @wxTreeItemIcon constant. - * - * - * - * Gets the specified item image. - * See @wxTreeCtrl @wxTreeCtrl#getItemImage method - * - * - */ -JSBool TreeItem::getImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeItemId *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - JSObject *objParent = JS_GetParent(cx, obj); - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, objParent); - if ( tree == NULL ) - return JS_FALSE; - - int which; - if ( FromJS(cx, argv[0], which) ) - { - *rval = ToJS(cx, tree->GetItemImage(*p, (wxTreeItemIcon) which)); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * Index of the image in the image list - * - * - * A @wxTreeItemIcon constant. - * - * - * - * Sets the specified item image. - * See @wxTreeCtrl @wxTreeCtrl#setItemImage method - * - * - */ -JSBool TreeItem::setImage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeItemId *p = GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, JS_GetParent(cx, obj)); - if ( tree == NULL ) - return JS_FALSE; - - int image; - int which; - if ( FromJS(cx, argv[0], image) - && FromJS(cx, argv[1], which) ) - { - tree->SetItemImage(*p, image, (wxTreeItemIcon) which); - return JS_TRUE; - } - - return JS_FALSE; -} - -/*** - * - * - * - * For this enumeration function you must pass in a 'cookie' parameter - * which is opaque for the application but is necessary for the library - * to make these functions reentrant (i.e. allow more than one enumeration - * on one and the same object simultaneously). The cookie passed - * to getFirstChild and @wxTreeItem#getNextChild should be the same variable. - * - * - * - * Returns the first child item. An invalid item is returned when there is no child item. - * See @wxTreeCtrl @wxTreeCtrl#getFirstChild method - * - * - */ -JSBool TreeItem::getFirstChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeItemId *p = TreeItemId::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, JS_GetParent(cx, obj)); - if ( tree == NULL ) - return JS_FALSE; - - long cookie; - if ( FromJS(cx, argv[0], cookie) ) - { - wxTreeItemIdValue newCookie = (wxTreeItemIdValue) cookie; - *rval = TreeItem::CreateObject(cx, new wxTreeItemId(tree->GetFirstChild(*p, newCookie))); - return JS_TRUE; - } - return JS_FALSE; - -} - -/*** - * - * - * - * For this enumeration function you must pass in a 'cookie' parameter - * which is opaque for the application but is necessary for the library - * to make these functions reentrant (i.e. allow more than one enumeration - * on one and the same object simultaneously). The cookie passed - * to @wxTreeItem @wxTreeItem#getFirstChild and getNextChild should be the same variable. - * - * - * - * Returns the first child item. An invalid item is returned when there is no child item. - * See @wxTreeCtrl @wxTreeCtrl#getNextChild method - * - * - */ -JSBool TreeItem::getNextChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - wxTreeItemId *p = TreeItemId::GetPrivate(cx, obj); - if ( p == NULL ) - return JS_FALSE; - - wxTreeCtrl *tree = TreeCtrl::GetPrivate(cx, JS_GetParent(cx, obj)); - if ( tree == NULL ) - return JS_FALSE; - - long cookie; - if ( FromJS(cx, argv[0], cookie) ) - { - wxTreeItemIdValue newCookie = (wxTreeItemIdValue) cookie; - *rval = TreeItem::CreateObject(cx, new wxTreeItemId(tree->GetNextChild(*p, newCookie))); - return JS_TRUE; - } - return JS_FALSE; - -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/treeitem.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.cpp (nonexistent) @@ -1,140 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - staticbx.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: staticbx.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// staticbx.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" - -#include "staticbx.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -StaticBox::StaticBox(JSContext *cx, JSObject *obj) - : wxStaticBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -StaticBox::~StaticBox() -{ - PopEventHandler(true); -} - -/*** - * control/staticbox - * gui - * - * A static box is a rectangle drawn around other panel items to denote a logical grouping of items. - * - */ -WXJS_INIT_CLASS(StaticBox, "wxStaticBox", 6) - -/*** - * - * - * - * The parent of the staticbox - * - * - * The unique identifier. - * - * - * The text of the staticbox - * - * - * The position of the staticbox. - * - * - * The size of the staticBox. - * - * - * The style of the staticbox. - * - * - * - * Constructs a new wxStaticBox object - * - * - */ -wxStaticBox* StaticBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - - switch(argc) - { - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxStaticBox *p = new StaticBox(cx, obj); - p->Create(parent, id, text, *pt, *size, style); - return p; - } - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/staticbx.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.cpp (nonexistent) @@ -1,221 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - bmpbtn.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: bmpbtn.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// bmpbtn.cpp - -#ifndef WX_PRECOMP - #include -#endif - -/*** - * control/bmpbtn - * gui - * - * A button that contains a bitmap. - * - */ - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "../misc/size.h" -#include "../misc/point.h" -#include "bmpbtn.h" -#include "../misc/bitmap.h" -#include "window.h" - -using namespace wxjs; -using namespace wxjs::gui; - -WXJS_INIT_CLASS(BitmapButton, "wxBitmapButton", 3) - -BitmapButton::BitmapButton(JSContext *cx, JSObject *obj) - : wxBitmapButton() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -BitmapButton::~BitmapButton() -{ - PopEventHandler(true); -} - - -/*** - * - * Bitmap to show when the button is disabled. - * Bitmap to show when the button has the focus. - * The default bitmap. - * Bitmap to show when the button is selected. - * - */ -WXJS_BEGIN_PROPERTY_MAP(BitmapButton) - WXJS_PROPERTY(P_BITMAP_DISABLED, "bitmapDisabled") - WXJS_PROPERTY(P_BITMAP_FOCUS, "bitmapFocus") - WXJS_PROPERTY(P_BITMAP_LABEL, "bitmapLabel") - WXJS_PROPERTY(P_BITMAP_SELECTED, "bitmapSelected") -WXJS_END_PROPERTY_MAP() - -bool BitmapButton::GetProperty(wxBitmapButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BITMAP_DISABLED: - *vp = Bitmap::CreateObject(cx, new wxBitmap(p->GetBitmapDisabled())); - break; - case P_BITMAP_FOCUS: - *vp = Bitmap::CreateObject(cx, new wxBitmap(p->GetBitmapFocus())); - break; - case P_BITMAP_LABEL: - *vp = Bitmap::CreateObject(cx, new wxBitmap(p->GetBitmapLabel())); - break; - case P_BITMAP_SELECTED: - *vp = Bitmap::CreateObject(cx, new wxBitmap(p->GetBitmapSelected())); - break; - } - return true; -} - -bool BitmapButton::SetProperty(wxBitmapButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_BITMAP_DISABLED: - { - wxBitmap *bitmap = Bitmap::GetPrivate(cx, *vp); - if ( bitmap != NULL ) - p->SetBitmapDisabled(*bitmap); - break; - } - case P_BITMAP_FOCUS: - { - wxBitmap *bitmap = Bitmap::GetPrivate(cx, *vp); - if ( bitmap != NULL ) - p->SetBitmapFocus(*bitmap); - break; - } - case P_BITMAP_LABEL: - { - wxBitmap *bitmap = Bitmap::GetPrivate(cx, *vp); - if ( bitmap != NULL ) - p->SetBitmapLabel(*bitmap); - break; - } - case P_BITMAP_SELECTED: - { - wxBitmap *bitmap = Bitmap::GetPrivate(cx, *vp); - if ( bitmap != NULL ) - p->SetBitmapSelected(*bitmap); - break; - } - } - return true; -} - -/*** - * - * - * The parent window - * A windows identifier. Use -1 when you don't need it. - * The bitmap to display - * The position of the control on the given parent - * The size of the control - * The style of the control - * - * - * Constructs a new wxBitmapButton object. - * - * - */ -wxBitmapButton* BitmapButton::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = wxBU_AUTODRAW; - - if ( argc > 6 ) - argc = 6; - - switch(argc) - { - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Walk through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Walk through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Walk through - default: - wxBitmap *bmp = Bitmap::GetPrivate(cx, argv[2]); - if ( bmp == NULL ) - break; - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - return NULL; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - BitmapButton *p = new BitmapButton(cx, obj); - p->Create(parent, id, *bmp, *pt, *size, style); - return p; - } - - return NULL; -} - -/*** - * - * - * This event is triggered when the button is clicked. The function receives - * a @wxCommandEvent as argument. - * - * - */ -void BitmapButton::OnClicked(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onClicked"); -} - -BEGIN_EVENT_TABLE(BitmapButton, wxBitmapButton) - EVT_BUTTON(-1, BitmapButton::OnClicked) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/bmpbtn.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.h (nonexistent) @@ -1,69 +0,0 @@ -/* - * wxJavaScript - pwdlg.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: pwdlg.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSPasswordEntryDialog_H -#define _WXJSPasswordEntryDialog_H - -///////////////////////////////////////////////////////////////////////////// -// Name: pwdlg.h -// Purpose: PasswordEntryDialog ports wxPasswordEntryDialog to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 04.11.05 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class PasswordEntryDialog : public wxPasswordEntryDialog - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - PasswordEntryDialog(JSContext *cx, - JSObject *obj, - wxWindow* parent, - const wxString& message, - const wxString& caption, const wxString& defaultValue, long style, - const wxPoint& pos); - - /** - * Destructor - */ - virtual ~PasswordEntryDialog(); - - static wxPasswordEntryDialog* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - static void Destruct(JSContext *cx, wxPasswordEntryDialog *p); - - DECLARE_EVENT_TABLE() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSPasswordEntryDialog_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/pwdlg.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.h (nonexistent) @@ -1,79 +0,0 @@ -/* - * wxJavaScript - listhit.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: listhit.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_gui_listhit_h -#define _wxjs_gui_listhit_h - -#include - -namespace wxjs -{ - namespace gui - { - /** - * Helper class for returning information for hittest - */ - class wxListHitTest - { - public: - long GetItem() const - { - return m_item; - } - long GetFlags() const - { - return m_flags; - } - friend class ListCtrl; - private: - - wxListHitTest(long item, int flags) : m_item(item), m_flags(flags) - { - } - - long m_item; - int m_flags; - }; - - class ListHitTest : public ApiWrapper - { - public: - static bool GetProperty(wxListHitTest *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - /** - * Property Ids. - */ - enum - { - P_ITEM - , P_FLAGS - }; - - WXJS_DECLARE_CONSTANT_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_wxjs_gui_listhit_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listhit.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.cpp (nonexistent) @@ -1,197 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - checkbox.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: checkbox.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// checkbox.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" -#include "../event/jsevent.h" -#include "../event/command.h" - -#include "checkbox.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" -#include "../misc/validate.h" - -using namespace wxjs; -using namespace wxjs::gui; - -CheckBox::CheckBox(JSContext *cx, JSObject *obj) - : wxCheckBox() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -CheckBox::~CheckBox() -{ - PopEventHandler(true); -} - -/*** - * control/checkbox - * gui - * - * A checkbox is a labeled box which is either on - * (checkmark is visible) or off (no checkmark). - *
An example: - *

- *   // dlg is a wxDialog
- *   var chkbox = new wxCheckBox(dlg, -1, "Check me");
- *   chkbox.onCheckBox = function(event)
- *   {
- *     if ( event.checked )
- *       wxMessageBox("Checked");
- *     else
- *       wxMessageBox("Unchecked");
- *   }
- *  
- *
- */ -WXJS_INIT_CLASS(CheckBox, "wxCheckBox", 3) - -/*** - * - * - * Checks/Unchecks the checkbox. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(CheckBox) - WXJS_PROPERTY(P_VALUE, "value") -WXJS_END_PROPERTY_MAP() - -bool CheckBox::GetProperty(wxCheckBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_VALUE ) - { - *vp = ToJS(cx, p->GetValue()); - } - return true; -} - -bool CheckBox::SetProperty(wxCheckBox *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if (id == P_VALUE ) - { - bool value; - if ( FromJS(cx, *vp, value) ) - p->SetValue(value); - } - return true; -} -/*** - * - * - * The parent of the checkbox - * A window identifier. Use -1 when you don't need it - * The label of the checkbox - * The position of the checkbox on the given parent - * The size of the checkbox - * The style of the checkbox - * A validator - * - * - * Constructs a new wxCheckBox object. - * - * - */ -wxCheckBox *CheckBox::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - const wxValidator *val = &wxDefaultValidator; - - if ( argc > 7 ) - argc = 7; - - switch(argc) - { - case 7: - val = Validator::GetPrivate(cx, argv[6]); - if ( val == NULL ) - break; - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - CheckBox *p = new CheckBox(cx, obj); - p->Create(parent, id, text, *pt, *size, style, *val); - return p; - } - - return NULL; -} - -/*** - * - * - * Called when the checkbox is clicked. The type of the argument that your handler receives - * is @wxCommandEvent. - * - * - */ -void CheckBox::OnCheckBox(wxCommandEvent &event) -{ - PrivCommandEvent::Fire(this, event, "onCheckBox"); -} - -BEGIN_EVENT_TABLE(CheckBox, wxCheckBox) - EVT_CHECKBOX(-1, CheckBox::OnCheckBox) -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/checkbox.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/slider.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/slider.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/slider.h (nonexistent) @@ -1,109 +0,0 @@ -/* - * wxJavaScript - slider.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: slider.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSSlider_H -#define _WXJSSlider_H - -///////////////////////////////////////////////////////////////////////////// -// Name: slider.h -// Purpose: Slider ports wxSlider to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 19.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - class Slider : public wxSlider - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - Slider(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Slider(); - - /** - * Callback for retrieving properties - */ - static bool GetProperty(wxSlider *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxSlider *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxSlider* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxSlider *p) - { - } - - static JSBool clearSel(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool clearTicks(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setTickFreq(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - WXJS_DECLARE_METHOD_MAP() - - /** - * Property Ids. - */ - enum - { - P_LINESIZE - , P_MAX - , P_MIN - , P_PAGESIZE - , P_SEL_END - , P_SEL_START - , P_THUMB_LENGTH - , P_TICK - , P_VALUE - }; - - DECLARE_EVENT_TABLE() - - void OnScroll(wxScrollEvent& event); - void OnScrollTop(wxScrollEvent& event); - void OnScrollBottom(wxScrollEvent& event); - void OnScrollLineUp(wxScrollEvent& event); - void OnScrollLineDown(wxScrollEvent& event); - void OnScrollPageUp(wxScrollEvent& event); - void OnScrollPageDown(wxScrollEvent& event); - void OnScrollThumbTrack(wxScrollEvent& event); - void OnScrollThumbRelease(wxScrollEvent& event); - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSSlider_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/slider.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.cpp (nonexistent) @@ -1,315 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listitem.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: listitem.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// listitem.cpp -#include -#ifndef WX_PRECOMP - #include -#endif -#include - -#include "../../common/main.h" - -#include "../misc/app.h" -#include "../misc/font.h" -#include "../misc/colour.h" - -#include "listitem.h" -#include "listctrl.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * control/listitem - * gui - * - * This class stores information about a @wxListCtrl item or column. - * - */ -WXJS_INIT_CLASS(ListItem, "wxListItem", 0) - -/*** - * - * - * The column alignment. See @wxListCtrl#wxListColumnFormat. - * - * - * Get/Set the background colour of the item. - * - * - * Get/Set the column. - * - * - * Get/Set the associated data. - * - * - * Get/Set the font of the item. - * - * - * Returns true when the item has attributes. - * - * - * Get/Set index of the item. - * - * - * Get/Set the index of the image in the associated imagelist of the list control. - * - * - * Get/Set the mask. The mask indicates which fields of wxListItem are valid. - * See @wxListMask - * - * - * Get/Set the state. See @wxListState - * - * - * Get/Set the state mask. This indicates which state is valid. See @wxListState - * - * - * Get/Set the text of the item. - * - * - * Get/Set the text colour. - * - * - * Get/Set the width. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListItem) - WXJS_PROPERTY(P_ALIGN, "align") - WXJS_PROPERTY(P_BG_COLOUR, "backgroundColour") - WXJS_PROPERTY(P_COLUMN, "column") - WXJS_PROPERTY(P_DATA, "data") - WXJS_PROPERTY(P_FONT, "font") - WXJS_READONLY_PROPERTY(P_HAS_ATTR, "hasAttributes") - WXJS_PROPERTY(P_ID, "id") - WXJS_PROPERTY(P_IMAGE, "image") - WXJS_PROPERTY(P_MASK, "mask") - WXJS_PROPERTY(P_STATE, "state") - WXJS_PROPERTY(P_STATE_MASK, "stateMask") - WXJS_PROPERTY(P_TEXT, "text") - WXJS_PROPERTY(P_TEXT_COLOUR, "textColour") - WXJS_PROPERTY(P_WIDTH, "width") -WXJS_END_PROPERTY_MAP() - -bool ListItem::GetProperty(wxListItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MASK: - *vp = ToJS(cx, p->GetMask()); - break; - case P_ID: - *vp = ToJS(cx, p->GetId()); - break; - case P_COLUMN: - *vp = ToJS(cx, p->GetColumn()); - break; - case P_STATE: - *vp = ToJS(cx, p->GetState()); - break; - case P_TEXT: - *vp = ToJS(cx, p->GetText()); - break; - case P_IMAGE: - *vp = ToJS(cx, p->GetImage()); - break; - case P_DATA: - { - ListObjectData *data = (ListObjectData*) p->GetData(); - *vp = ( data == NULL ) ? JSVAL_VOID : data->GetJSVal(); - break; - } - case P_WIDTH: - *vp = ToJS(cx, p->GetWidth()); - break; - case P_ALIGN: - *vp = ToJS(cx, (int) p->GetAlign()); - break; - case P_TEXT_COLOUR: - { - wxColour colour = p->GetTextColour(); - *vp = ( colour == wxNullColour ) ? JSVAL_VOID - : Colour::CreateObject(cx, new wxColour(colour)); - break; - } - case P_BG_COLOUR: - { - wxColour colour = p->GetBackgroundColour(); - *vp = ( colour == wxNullColour ) ? JSVAL_VOID - : Colour::CreateObject(cx, new wxColour(colour)); - break; - } - case P_FONT: - { - wxFont font = p->GetFont(); - *vp = ( font == wxNullFont ) ? JSVAL_VOID - : Font::CreateObject(cx, new wxFont(font)); - break; - } - case P_HAS_ATTR: - *vp = ToJS(cx, p->HasAttributes()); - break; - } - return true; -} - -bool ListItem::SetProperty(wxListItem *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_MASK: - { - long mask; - if ( FromJS(cx, *vp, mask) ) - p->SetMask(mask); - break; - } - case P_ID: - { - long id; - if ( FromJS(cx, *vp, id) ) - p->SetId(id); - break; - } - case P_COLUMN: - { - int column; - if ( FromJS(cx, *vp, column) ) - p->SetColumn(column); - break; - } - case P_STATE: - { - long state; - if ( FromJS(cx, *vp, state) ) - p->SetState(state); - break; - } - case P_STATE_MASK: - { - long stateMask; - if ( FromJS(cx, *vp, stateMask) ) - p->SetStateMask(stateMask); - break; - } - case P_TEXT: - { - wxString text; - FromJS(cx, *vp, text); - p->SetText(text); - break; - } - case P_IMAGE: - { - int img; - if ( FromJS(cx, *vp, img) ) - p->SetImage(img); - break; - } - case P_DATA: - { - ListObjectData *data = (ListObjectData*) p->GetData(); - if ( data != NULL ) - { - delete data; - data = NULL; - } - - data = new ListObjectData(cx, *vp); - p->SetData((long) data); - break; - } - case P_WIDTH: - { - int width; - if ( FromJS(cx, *vp, width) ) - p->SetWidth(width); - break; - } - case P_ALIGN: - { - int align; - if ( FromJS(cx, *vp, align) ) - p->SetAlign((wxListColumnFormat) align); - break; - } - case P_TEXT_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetTextColour(*colour); - break; - } - case P_BG_COLOUR: - { - wxColour *colour = Colour::GetPrivate(cx, *vp); - if ( colour != NULL ) - p->SetBackgroundColour(*colour); - break; - } - case P_FONT: - { - wxFont *font = Font::GetPrivate(cx, *vp); - if ( font != NULL ) - p->SetFont(*font); - break; - } - } - return true; -} - -/*** - * - * - * - * The index of the item - * - * - * - * Creates a new wxListItem object. - * See @wxListCtrl#getItem and @wxListCtrl#setItem - * - * - */ -wxListItem *ListItem::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc == 0 ) - return new wxListItem(); - else if ( argc == 1 ) - { - int id; - if ( FromJS(cx, argv[0], id) ) - { - wxListItem *p = new wxListItem(); - p->SetId(id); - return p; - } - } - return NULL; -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/listitem.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.cpp (nonexistent) @@ -1,188 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sttext.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: sttext.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// sttext.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "../event/evthand.h" - -#include "sttext.h" -#include "window.h" - -#include "../misc/point.h" -#include "../misc/size.h" - -using namespace wxjs; -using namespace wxjs::gui; - -StaticText::StaticText(JSContext *cx, JSObject *obj) - : wxStaticText() - , Object(obj, cx) -{ - PushEventHandler(new EventHandler(this)); -} - -StaticText::~StaticText() -{ - PopEventHandler(true); -} - -/*** - * control/sttext - * gui - * - * A static text control displays one or more lines of read-only text. - * - */ -WXJS_INIT_CLASS(StaticText, "wxStaticText", 3) - -/*** - * - * - * Get/Sets the text. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(StaticText) - WXJS_PROPERTY(P_LABEL, "label") -WXJS_END_PROPERTY_MAP() - -/*** - * - * - * - * - * - * - * - * - */ -WXJS_BEGIN_CONSTANT_MAP(StaticText) - WXJS_CONSTANT(wx, ALIGN_LEFT) - WXJS_CONSTANT(wx, ALIGN_RIGHT) - WXJS_CONSTANT(wx, ALIGN_CENTER) - WXJS_CONSTANT(wxST_, NO_AUTORESIZE) -WXJS_END_CONSTANT_MAP() - -bool StaticText::GetProperty(wxStaticText *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if (id == P_LABEL ) - { - *vp = ToJS(cx, p->GetLabel()); - } - return true; -} - -bool StaticText::SetProperty(wxStaticText *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_LABEL ) - { - wxString label; - FromJS(cx, *vp, label); - p->SetLabel(label); - } - return true; -} - -/*** - * - * - * - * The parent of the static text. This can't be null. - * - * - * The unique identifier. - * - * - * The text of the static text - * - * - * The position of the static text. - * - * - * The size of the static text. - * - * - * The style of the static text. See @wxStaticText#styles - * - * - * - * Constructs a new wxStaticText object - * - * - */ -wxStaticText* StaticText::Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing) -{ - if ( argc > 6 ) - argc = 6; - - const wxPoint *pt = &wxDefaultPosition; - const wxSize *size = &wxDefaultSize; - int style = 0; - - switch(argc) - { - case 6: - if ( ! FromJS(cx, argv[5], style) ) - break; - // Fall through - case 5: - size = Size::GetPrivate(cx, argv[4]); - if ( size == NULL ) - break; - // Fall through - case 4: - pt = Point::GetPrivate(cx, argv[3]); - if ( pt == NULL ) - break; - // Fall through - default: - wxString text; - FromJS(cx, argv[2], text); - - int id; - if ( ! FromJS(cx, argv[1], id) ) - break; - - wxWindow *parent = Window::GetPrivate(cx, argv[0]); - if ( parent == NULL ) - break; - - Object *wxjsParent = dynamic_cast(parent); - JS_SetParent(cx, obj, wxjsParent->GetObject()); - - wxStaticText *p = new StaticText(cx, obj); - p->Create(parent, id, text, *pt, *size, style); - return p; - } - - return NULL; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/sttext.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.h (nonexistent) @@ -1,82 +0,0 @@ -/* - * wxJavaScript - gauge.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: gauge.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSGauge_H -#define _WXJSGauge_H - -///////////////////////////////////////////////////////////////////////////// -// Name: gauge.h -// Purpose: Gauge ports wxGauge to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 08.08.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - class Gauge : public wxGauge - , public ApiWrapper - , public Object - { - public: - /** - * Constructor - */ - Gauge(JSContext *cx, JSObject *obj); - - /** - * Destructor - */ - virtual ~Gauge(); - - static bool GetProperty(wxGauge *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxGauge *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - static wxGauge* Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, bool constructing); - // Empty to avoid deleting. (It will be deleted by wxWindows). - static void Destruct(JSContext *cx, wxGauge *p) - { - } - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_CONSTANT_MAP() - - /** - * Property Ids. - */ - enum - { - P_BEZEL_FACE - , P_RANGE - , P_SHADOW_WIDTH - , P_VALUE - }; - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSGauge_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/gauge.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - toplevel.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: toplevel.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTopLevel_H -#define _WXJSTopLevel_H - -namespace wxjs -{ - namespace gui - { - class TopLevelWindow :public ApiWrapper - { - public: - static bool GetProperty(wxTopLevelWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(wxTopLevelWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static void InitClass(JSContext *cx, JSObject *obj, JSObject *proto); - - static JSBool requestUserAttention(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setLeftMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool setRightMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool showFullScreen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - enum - { - P_DEFAULT_ITEM - , P_FULL_SCREEN - , P_ICON - , P_ICONS - , P_ACTIVE - , P_ICONIZED - , P_MAXIMIZED - , P_TITLE - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSTopLevel_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/control/toplevel.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.h (nonexistent) @@ -1,56 +0,0 @@ -/* - * wxJavaScript - htmllink.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: htmllink.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _wxjs_htmllink_h -#define _wxjs_htmllink_h - -#include -#include - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivHtmlLinkEvent; - class HtmlLinkEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivHtmlLinkEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~HtmlLinkEvent() - { - } - - enum - { - P_HREF - , P_TARGET - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_wxjs_htmllink_h Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/help.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/help.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/help.cpp (nonexistent) @@ -1,101 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - help.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: help.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// move.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "help.h" - -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/help - * gui - * - * A help event is sent when the user has requested context-sensitive help. - * This can either be caused by the application requesting context-sensitive - * help mode via @wxContextHelp, or (on MS Windows) by the system generating - * a WM_HELP message when the user pressed F1 or clicked on the query button in - * a dialog caption. - *

- * A help event is sent to the window that the user clicked on, and is propagated up - * the window hierarchy until the event is processed or there are no more event handlers. - * The application should use @wxEvent#id to check the identity of the clicked-on window, - * and then either show some suitable help or set @wxEvent#skip to true if the identifier is - * unrecognised. Setting @wxEvent#skip to true is important because it allows wxWindows to - * generate further events for ancestors of the clicked-on window. Otherwise it would be - * impossible to show help for container windows, since processing would stop after the - * first window found. - *

- * See @wxWindow#onHelp, @wxContextHelp and @wxContextHelpButton - *
- */ -WXJS_INIT_CLASS(HelpEvent, "wxHelpEvent", 0) - -/*** - * - * - * Get/Set the left-click position of the mouse in screen-coordinates. - * This helps the application to position the help appropriately. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(HelpEvent) - WXJS_PROPERTY(P_POSITION, "position") -WXJS_END_PROPERTY_MAP() - -bool HelpEvent::GetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxHelpEvent *event = p->GetEvent(); - - if ( id == P_POSITION ) - { - *vp = Point::CreateObject(cx, new wxPoint(event->GetPosition())); - } - return true; -} - -bool HelpEvent::SetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxHelpEvent *event = p->GetEvent(); - - if ( id == P_POSITION ) - { - wxPoint *pt = Point::GetPrivate(cx, *vp); - if ( pt != NULL ) - event->SetPosition(*pt); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/help.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/key.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/key.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/key.cpp (nonexistent) @@ -1,123 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - key.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: key.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// key.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "key.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/key - * gui - * - * This event class contains information about keypress (character) events. Look - * at @wxWindow#onChar for an example. See @wxWindow#onChar, - * @wxWindow#onCharHook, @wxWindow#onKeyDown, @wxWindow#onKeyUp - * - */ -WXJS_INIT_CLASS(KeyEvent, "wxKeyEvent", 0) - -/*** - * - * - * True when the ALT key was pressed at the time of the event. - * - * - * True when the CTRL key was pressed at the time of the event. - * - * - * True when META, CTRL or ALT key was down at the time of the event. - * - * - * The code of the key. See @wxKeyCode - * - * - * True when the META key was down at the time of the event. - * - * - * True when the SHIFT key was down at the time of the event. - * - * - * The x position of the event - * - * - * The y position of the event - * - * - */ - - WXJS_BEGIN_PROPERTY_MAP(KeyEvent) - WXJS_READONLY_PROPERTY(P_ALT_DOWN, "altDown") - WXJS_READONLY_PROPERTY(P_CONTROL_DOWN, "controlDown") - WXJS_READONLY_PROPERTY(P_KEY_CODE, "keyCode") - WXJS_READONLY_PROPERTY(P_META_DOWN, "metaDown") - WXJS_READONLY_PROPERTY(P_SHIFT_DOWN, "shiftDown") - WXJS_READONLY_PROPERTY(P_HAS_MODIFIERS, "hasModifiers") - WXJS_READONLY_PROPERTY(P_X, "x") - WXJS_READONLY_PROPERTY(P_Y, "y") -WXJS_END_PROPERTY_MAP() - -bool KeyEvent::GetProperty(PrivKeyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxKeyEvent *event = ((wxKeyEvent*) p->GetEvent()); - switch (id) - { - case P_ALT_DOWN: - *vp = ToJS(cx, event->AltDown()); - break; - case P_CONTROL_DOWN: - *vp = ToJS(cx, event->ControlDown()); - break; - case P_KEY_CODE: - *vp = ToJS(cx, event->GetKeyCode()); - break; - case P_META_DOWN: - *vp = ToJS(cx, event->MetaDown()); - break; - case P_SHIFT_DOWN: - *vp = ToJS(cx, event->ShiftDown()); - break; - case P_X: - *vp = ToJS(cx, event->GetX()); - break; - case P_Y: - *vp = ToJS(cx, event->GetY()); - break; - case P_HAS_MODIFIERS: - *vp = ToJS(cx, event->HasModifiers()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/key.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.cpp (nonexistent) @@ -1,393 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - mouse.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: mouse.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// mouse.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" -#include "../../common/apiwrap.h" - -#include "jsevent.h" -#include "mouse.h" -#include "../misc/point.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/mouse - * gui - * - * This event class contains information about mouse events. - *

- * Note the difference between methods like @wxMouseEvent#leftDown - * and @wxMouseEvent#leftIsDown: the formet returns true when the event corresponds - * to the left mouse button click while the latter returns true if the left mouse button - * is currently being pressed. For example, when the user is dragging the mouse you can use - * @wxMouseEvent#leftIsDown to test whether the left mouse button is (still) depressed. - * Also, by convention, if @wxMouseEvent#leftDown returns true, @wxMouseEvent#leftIsDown - * will also return true in wxWindows whatever the underlying GUI - * behaviour is (which is platform-dependent). - * The same applies, of course, to other mouse buttons as well. - *

- * See @wxWindow#onMouseEvents, @wxWindow#onEnterWindow, @wxWindow#onLeaveWindow, - * @wxWindow#onLeftUp, @wxWindow#onLeftDown, @wxWindow#onLeftDClick, - * @wxWindow#onMiddleUp, @wxWindow#onMiddleDown, @wxWindow#onMiddleDClick, - * @wxWindow#onRightUp, @wxWindow#onRightDown, @wxWindow#onRightDClick. - *
- */ -WXJS_INIT_CLASS(MouseEvent, "wxMouseEvent", 0) - -/*** - * - * - * Returns true when the alt key is down at the time of the key event. - * - * - * Get the button which is changing state - * - * - * Returns true when the control key is down at the time of the event. - * - * - * Returns true when this is a dragging event. - * - * - * Returns true when the mouse was entering the window. - * See @wxMouseEvent#leaving - * - * - * Returns true when the mouse was leaving the window. - * See @wxMouseEvent#entering. - * - * - * Returns true when the event is a left double click event (wxEVT_LEFT_DCLICK). - * - * - * Returns true when the event is a left down event (wxEVT_LEFT_DOWN). - * - * - * Returns true if the left mouse button is currently down, independent of the current event type. - * Please notice that it is not the same as @wxMouseEvent#leftDown which returns true - * if the left mouse button was just pressed. Rather, it describes the state of the mouse button - * before the event happened. - * - * - * Returns the configured number of lines (or whatever) - * to be scrolled per wheel action. Defaults to 1. - * - * - * Returns true when the meta key was down at the time of the event. - * - * - * Returns true when the event is a middle double click event (wxEVT_MIDDLE_DCLICK). - * - * - * Returns true when the event is a middle down event (wxEVT_MIDDLE_DOWN). - * - * - * Returns true if the middle mouse button is currently down, independent of the current event type. - * - * - * Returns true when this was a moving event (wxEVT_MOTION) - * - * - * Returns the physical mouse position in pixels. - * - * - * Returns true when the event is a right double click event (wxEVT_RIGHT_DCLICK). - * - * - * Returns true when the event is a right down event (wxEVT_RIGHT_DOWN). - * - * - * Returns true if the right mouse button is currently down, independent of the current event type. - * - * - * Returns true when the shift key was down at the time of the event. - * - * - * Get wheel delta, normally 120. This is the threshold for action to be - * taken, and one such action (for example, scrolling one increment) - * should occur for each delta. - * - * - * Get wheel rotation, positive or negative indicates direction of - * rotation. Current devices all send an event when rotation is equal to - * +/-WheelDelta, but this allows for finer resolution devices to be - * created in the future. Because of this you shouldn't assume that one - * event is equal to 1 line or whatever, but you should be able to either - * do partial line scrolling or wait until +/-WheelDelta rotation values - * have been accumulated before scrolling. - * - * - * Returns the x-coordinate of the physical mouse position. - * See @wxMouseEvent#position and @wxMouseEvent#y - * - * - * Returns the y-coordinate of the physical mouse position. - * See @wxMouseEvent#position and @wxMouseEvent#x - * - * - */ - -WXJS_BEGIN_PROPERTY_MAP(MouseEvent) - WXJS_READONLY_PROPERTY(P_ALTDOWN, "altDown") - WXJS_READONLY_PROPERTY(P_CONTROLDOWN, "controlDown") - WXJS_READONLY_PROPERTY(P_DRAGGING, "dragging") - WXJS_READONLY_PROPERTY(P_ENTERING, "entering") - WXJS_READONLY_PROPERTY(P_POSITION, "position") - WXJS_READONLY_PROPERTY(P_LINES_PER_ACTION, "linesPerAction") - WXJS_READONLY_PROPERTY(P_BUTTON, "button") - WXJS_READONLY_PROPERTY(P_METADOWN, "metaDown") - WXJS_READONLY_PROPERTY(P_SHIFTDOWN, "shiftDown") - WXJS_READONLY_PROPERTY(P_LEFT_DOWN, "leftDown") - WXJS_READONLY_PROPERTY(P_MIDDLE_DOWN, "middleDown") - WXJS_READONLY_PROPERTY(P_RIGHT_DOWN, "rightDown") - WXJS_READONLY_PROPERTY(P_LEFT_UP, "leftUp") - WXJS_READONLY_PROPERTY(P_MIDDLE_UP, "middleUp") - WXJS_READONLY_PROPERTY(P_RIGHT_UP, "rightUp") - WXJS_READONLY_PROPERTY(P_LEFT_DCLICK, "leftDClick") - WXJS_READONLY_PROPERTY(P_MIDDLE_DCLICK, "middleDClick") - WXJS_READONLY_PROPERTY(P_RIGHT_DCLICK, "rightDClick") - WXJS_READONLY_PROPERTY(P_LEFT_IS_DOWN, "leftIsDown") - WXJS_READONLY_PROPERTY(P_MIDDLE_IS_DOWN, "middleIsDown") - WXJS_READONLY_PROPERTY(P_RIGHT_IS_DOWN, "rightIsDown") - WXJS_READONLY_PROPERTY(P_MOVING, "moving") - WXJS_READONLY_PROPERTY(P_LEAVING, "leaving") - WXJS_READONLY_PROPERTY(P_X, "x") - WXJS_READONLY_PROPERTY(P_Y, "y") - WXJS_READONLY_PROPERTY(P_WHEELROTATION, "wheelRotation") - WXJS_READONLY_PROPERTY(P_WHEELDELTA, "wheelDelta") -WXJS_END_PROPERTY_MAP() - -bool MouseEvent::GetProperty(PrivMouseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxMouseEvent *event = (wxMouseEvent*) p->GetEvent(); - switch (id) - { - case P_ALTDOWN: - *vp = ToJS(cx, event->AltDown()); - break; - case P_CONTROLDOWN: - *vp = ToJS(cx, event->ControlDown()); - break; - case P_DRAGGING: - *vp = ToJS(cx, event->Dragging()); - break; - case P_ENTERING: - *vp = ToJS(cx, event->Entering()); - break; - case P_POSITION: - *vp = Point::CreateObject(cx, new wxPoint(event->GetPosition())); - break; - case P_LINES_PER_ACTION: - *vp = ToJS(cx, event->GetLinesPerAction()); - break; - case P_BUTTON: - *vp = ToJS(cx, event->GetButton()); - break; - case P_METADOWN: - *vp = ToJS(cx, event->MetaDown()); - break; - case P_SHIFTDOWN: - *vp = ToJS(cx, event->ShiftDown()); - break; - case P_LEFT_DOWN: - *vp = ToJS(cx, event->LeftDown()); - break; - case P_MIDDLE_DOWN: - *vp = ToJS(cx, event->MiddleDown()); - break; - case P_RIGHT_DOWN: - *vp = ToJS(cx, event->RightDown()); - break; - case P_LEFT_UP: - *vp = ToJS(cx, event->LeftUp()); - break; - case P_MIDDLE_UP: - *vp = ToJS(cx, event->MiddleUp()); - break; - case P_RIGHT_UP: - *vp = ToJS(cx, event->RightUp()); - break; - case P_LEFT_DCLICK: - *vp = ToJS(cx, event->LeftDClick()); - break; - case P_MIDDLE_DCLICK: - *vp = ToJS(cx, event->MiddleDClick()); - break; - case P_RIGHT_DCLICK: - *vp = ToJS(cx, event->RightDClick()); - break; - case P_LEFT_IS_DOWN: - *vp = ToJS(cx, event->LeftIsDown()); - break; - case P_MIDDLE_IS_DOWN: - *vp = ToJS(cx, event->MiddleIsDown()); - break; - case P_RIGHT_IS_DOWN: - *vp = ToJS(cx, event->RightIsDown()); - break; - case P_MOVING: - *vp = ToJS(cx, event->Moving()); - break; - case P_LEAVING: - *vp = ToJS(cx, event->Leaving()); - break; - case P_X: - *vp = ToJS(cx, event->GetX()); - break; - case P_Y: - *vp = ToJS(cx, event->GetY()); - break; - case P_WHEELROTATION: - *vp = ToJS(cx, event->GetWheelRotation()); - break; - case P_WHEELDELTA: - *vp = ToJS(cx, event->GetWheelDelta()); - break; - } - return true; -} - -WXJS_BEGIN_METHOD_MAP(MouseEvent) - WXJS_METHOD("button", button, 1) - WXJS_METHOD("buttonDClick", buttonDClick, 1) - WXJS_METHOD("buttonDown", buttonDown, 1) - WXJS_METHOD("buttonUp", buttonUp, 1) -// Waiting for wxDC -// WXJS_METHOD("getLogicalPosition", getLogicalPosition, 1) -WXJS_END_METHOD_MAP() - -/*** - * - * - * - * The mouse button. - * - * - * - * Returns true if the identified mouse button is changing state. - * Valid values of button are 1, 2 or 3 for left, middle and right buttons respectively. - * - * - */ -JSBool MouseEvent::button(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - PrivMouseEvent *p = (PrivMouseEvent*) JS_GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxMouseEvent")); - - int button; - if ( FromJS(cx, argv[0], button) ) - { - *rval = ToJS(cx, p->GetEvent()->Button(button)); - return JS_TRUE; - } - else - { - return JS_FALSE; - } -} - -/*** - * - * - * - * The mouse button. - * - * - * - * If the argument is omitted, this returns true if the event was a mouse double click event. - * Otherwise the argument specifies which double click event was generated (1, 2 or 3 for left, middle and right buttons respectively). - * - * - */ -JSBool MouseEvent::buttonDClick(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - PrivMouseEvent *p = (PrivMouseEvent*) JS_GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxMouseEvent")); - - int button = -1; - FromJS(cx, argv[0], button); - *rval = ToJS(cx, p->GetEvent()->ButtonDClick(button)); - - return JS_TRUE; -} - -/*** - * - * - * - * The mouse button. - * - * - * - * If the argument is omitted, this returns true if the event was a mouse button down event. - * Otherwise the argument specifies which button-down event was generated (1, 2 or 3 for left, middle and right buttons respectively). - * - * - */ -JSBool MouseEvent::buttonDown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - PrivMouseEvent *p = (PrivMouseEvent*) JS_GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxMouseEvent")); - - int button = -1; - FromJS(cx, argv[0], button); - *rval = ToJS(cx, p->GetEvent()->ButtonDown(button)); - - return JS_TRUE; -} - -/*** - * - * - * - * The mouse button. - * - * - * - * If the argument is omitted, this returns true if the event was a mouse button up event. - * Otherwise the argument specifies which button-up event was generated (1, 2 or 3 for left, middle and right buttons respectively). - * - * - */ -JSBool MouseEvent::buttonUp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - PrivMouseEvent *p = (PrivMouseEvent*) JS_GetPrivate(cx, obj); - wxASSERT_MSG(p != NULL, wxT("No private data associated with wxMouseEvent")); - - int button = -1; - FromJS(cx, argv[0], button); - *rval = ToJS(cx, p->GetEvent()->ButtonUp(button)); - - return JS_TRUE; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.cpp (nonexistent) @@ -1,223 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - evthand.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: evthand.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// evthand.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "evthand.h" -#include "key.h" -#include "activate.h" -#include "mouse.h" -#include "move.h" -#include "sizeevt.h" -#include "help.h" -#include "scrollwin.h" - -using namespace wxjs; -using namespace wxjs::gui; - -void EventHandler::OnActivate(wxActivateEvent &event) -{ - PrivActivateEvent::Fire(m_obj, event, "onActivate"); -} - -void EventHandler::OnChar(wxKeyEvent &event) -{ - PrivKeyEvent::Fire(m_obj, event, "onChar"); -} - -void EventHandler::OnCharHook(wxKeyEvent &event) -{ - PrivKeyEvent::Fire(m_obj, event, "onCharHook"); -} - -void EventHandler::OnKeyDown(wxKeyEvent &event) -{ - PrivKeyEvent::Fire(m_obj, event, "onKeyDown"); -} - -void EventHandler::OnKeyUp(wxKeyEvent &event) -{ - PrivKeyEvent::Fire(m_obj, event, "onKeyUp"); -} - -void EventHandler::OnSetFocus(wxFocusEvent &event) -{ - PrivFocusEvent::Fire(m_obj, event, "onSetFocus"); -} - -void EventHandler::OnKillFocus(wxFocusEvent &event) -{ - PrivFocusEvent::Fire(m_obj, event, "onKillFocus"); -} - -void EventHandler::OnInitDialog(wxInitDialogEvent &event) -{ - PrivInitDialogEvent::Fire(m_obj, event, "onInitDialog"); -} - -void EventHandler::OnMouseEvents(wxMouseEvent &event) -{ - if ( ! PrivMouseEvent::Fire(m_obj, event, "onMouseEvents") ) - { - // MouseEvents is not handled, so try the other ones - char *property; - WXTYPE eventType = event.GetEventType(); - if ( eventType == wxEVT_LEFT_DOWN ) - property = "onLeftDown"; - else if ( eventType == wxEVT_LEFT_UP ) - property = "onLeftUp"; - else if ( eventType == wxEVT_LEFT_DCLICK ) - property = "onLeftDClick"; - else if ( eventType == wxEVT_MIDDLE_DOWN ) - property = "onMiddleDown"; - else if ( eventType == wxEVT_MIDDLE_UP ) - property = "onMiddleUp"; - else if ( eventType == wxEVT_MIDDLE_DCLICK ) - property = "onMiddleDClick"; - else if ( eventType == wxEVT_RIGHT_DOWN ) - property = "onRightDown"; - else if ( eventType == wxEVT_RIGHT_UP ) - property = "onRightUp"; - else if ( eventType == wxEVT_RIGHT_DCLICK ) - property = "onRightDClick"; - else if ( eventType == wxEVT_MOTION ) - property = "onMotion"; - else if ( eventType == wxEVT_ENTER_WINDOW ) - property = "onEnterWindow"; - else if ( eventType == wxEVT_LEAVE_WINDOW ) - property = "onLeaveWindow"; - else if ( eventType == wxEVT_MOUSEWHEEL ) - property = "onMouseWheel"; - else - return; - PrivMouseEvent::Fire(m_obj, event, property); - } -} - -void EventHandler::OnMove(wxMoveEvent &event) -{ - PrivMoveEvent::Fire(m_obj, event, "onMove"); -} - -void EventHandler::OnSize(wxSizeEvent &event) -{ - PrivSizeEvent::Fire(m_obj, event, "onSize"); -} - -void EventHandler::OnScroll(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScroll"); -} - -void EventHandler::OnScrollTop(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollTop"); -} - -void EventHandler::OnScrollBottom(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollBottom"); -} - -void EventHandler::OnScrollLineUp(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollLineUp"); -} - -void EventHandler::OnScrollLineDown(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollLineDown"); -} - -void EventHandler::OnScrollPageUp(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollPageUp"); -} - -void EventHandler::OnScrollPageDown(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollPageDown"); -} - -void EventHandler::OnScrollThumbTrack(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollThumbTrack"); -} - -void EventHandler::OnScrollThumbRelease(wxScrollWinEvent& event) -{ - PrivScrollWinEvent::Fire(m_obj, event, "onScrollThumbRelease"); -} - -void EventHandler::OnHelp(wxHelpEvent &event) -{ - PrivHelpEvent::Fire(m_obj, event, "onHelp"); -} - -BEGIN_EVENT_TABLE(EventHandler, wxEvtHandler) - EVT_ACTIVATE(EventHandler::OnActivate) - - // Key Events - EVT_CHAR(EventHandler::OnChar) - EVT_CHAR_HOOK(EventHandler::OnCharHook) - EVT_KEY_DOWN(EventHandler::OnKeyDown) - EVT_KEY_UP(EventHandler::OnKeyUp) - - // Mouse events - EVT_MOUSE_EVENTS(EventHandler::OnMouseEvents) - - // Focus events - EVT_SET_FOCUS(EventHandler::OnSetFocus) - EVT_KILL_FOCUS(EventHandler::OnKillFocus) - - // Init Dialog - EVT_INIT_DIALOG(EventHandler::OnInitDialog) - - EVT_MOVE(EventHandler::OnMove) - - EVT_SIZE(EventHandler::OnSize) - - // Scroll Events - EVT_SCROLLWIN(EventHandler::OnScroll) - EVT_SCROLLWIN_TOP(EventHandler::OnScrollTop) - EVT_SCROLLWIN_BOTTOM(EventHandler::OnScrollBottom) - EVT_SCROLLWIN_LINEUP(EventHandler::OnScrollLineUp) - EVT_SCROLLWIN_LINEDOWN(EventHandler::OnScrollLineDown) - EVT_SCROLLWIN_PAGEUP(EventHandler::OnScrollPageUp) - EVT_SCROLLWIN_PAGEDOWN(EventHandler::OnScrollPageDown) - EVT_SCROLLWIN_THUMBTRACK(EventHandler::OnScrollThumbTrack) - EVT_SCROLLWIN_THUMBRELEASE(EventHandler::OnScrollThumbRelease) - - EVT_HELP(-1, EventHandler::OnHelp) - -END_EVENT_TABLE() Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.cpp (nonexistent) @@ -1,157 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - listevt.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: listevt.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// listevt.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include - -#include "../../common/main.h" - -#include "../misc/point.h" - -#include "../control/listitem.h" - -#include "jsevent.h" -#include "listevt.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/listevt - * gui - * - * This object is passed to a function that is set to a @wxListCtrl event property. - * - */ -WXJS_INIT_CLASS(ListEvent, "wxListEvent", 0) - -/*** - * - * - * The first item which the list control advises us to cache. - * - * - * The lasst item which the list control advises us to cache. - * - * - * The column index. For the column dragging events, it is the column to the left of - * the divider being dragged, for the column click events it may be -1 if the user - * clicked in the list control header outside any column. - * - * - * The associated data of the item. - * - * - * The image index of the item. - * - * - * The item index. - * - * - * The item. - * - * - * Keycode when the event is a keypress event. - * See @wxKeyCode - * - * - * The label. - * - * - * The mask. - * - * - * The position of the mouse pointer when the event is a drag event. - * - * - * The text. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ListEvent) - WXJS_READONLY_PROPERTY(P_CODE, "keyCode") - WXJS_READONLY_PROPERTY(P_INDEX, "index") - WXJS_READONLY_PROPERTY(P_COLUMN, "column") - WXJS_READONLY_PROPERTY(P_POINT, "point") - WXJS_READONLY_PROPERTY(P_LABEL, "label") - WXJS_READONLY_PROPERTY(P_TEXT, "text") - WXJS_READONLY_PROPERTY(P_IMAGE, "image") - WXJS_READONLY_PROPERTY(P_DATA, "data") - WXJS_READONLY_PROPERTY(P_MASK, "mask") - WXJS_READONLY_PROPERTY(P_ITEM, "item") - WXJS_READONLY_PROPERTY(P_CACHE_FROM, "cacheFrom") - WXJS_READONLY_PROPERTY(P_CACHE_TO, "cacheTo") -WXJS_END_PROPERTY_MAP() - -bool ListEvent::GetProperty(PrivListEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxListEvent *event = p->GetEvent(); - switch (id) - { - case P_CODE: - *vp = ToJS(cx, event->GetKeyCode()); - break; - case P_INDEX: - *vp = ToJS(cx, event->GetIndex()); - break; - case P_COLUMN: - *vp = ToJS(cx, event->GetColumn()); - break; - case P_POINT: - *vp = Point::CreateObject(cx, new wxPoint(event->GetPoint())); - break; - case P_LABEL: - *vp = ToJS(cx, event->GetLabel()); - break; - case P_TEXT: - *vp = ToJS(cx, event->GetText()); - break; - case P_IMAGE: - *vp = ToJS(cx, event->GetImage()); - break; - case P_DATA: - *vp = ToJS(cx, event->GetData()); - break; - case P_MASK: - *vp = ToJS(cx, event->GetMask()); - break; - case P_ITEM: - *vp = ListItem::CreateObject(cx, new wxListItem(event->GetItem())); - break; - case P_CACHE_FROM: - *vp = ToJS(cx, event->GetCacheFrom()); - break; - case P_CACHE_TO: - *vp = ToJS(cx, event->GetCacheTo()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/initdlg.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/initdlg.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/initdlg.cpp (nonexistent) @@ -1,49 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - initdlg.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: initdlg.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsevent.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "event.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/initdlg - * gui - * - * A wxInitDialogEvent is sent as a dialog or panel is being initialised. - * Handlers for this event can transfer data to the window. - * See @wxWindow#onInitDialog. - * - */ -WXJS_INIT_CLASS(InitDialogEvent, "wxInitDialogEvent", 0) Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/initdlg.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - sizeevt.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: sizeevt.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSSizeEvent_H -#define _WXJSSizeEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: move.h -// Purpose: SizeEvent ports wxSizeEvent to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 14.01.2003 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivSizeEvent; - class SizeEvent : public ApiWrapper - { - public: - virtual ~SizeEvent() - { - } - - static bool GetProperty(PrivSizeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_SIZE - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSSizeEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.cpp (nonexistent) @@ -1,81 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - scroll.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: scroll.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// scroll.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" - -#include "jsevent.h" -#include "scroll.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/scroll - * gui - * - * A scroll event holds information about events sent from stand-alone scrollbars, - * spin-buttons and sliders. Note that scrolled windows send the @wxScrollWinEvent - * don't confuse these two kinds of events, and use this event only for the scrollbar-like controls. - * - */ -WXJS_INIT_CLASS(ScrollEvent, "wxScrollEvent", 0) - -/*** - * - * - * Returns wxDirection.HORIZONTAL or wxDirection.VERTICAL - * - * - * Returns the position of the scrollbar - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ScrollEvent) - WXJS_READONLY_PROPERTY(P_ORIENTATION, "orientation") - WXJS_READONLY_PROPERTY(P_POSITION, "position") -WXJS_END_PROPERTY_MAP() - -bool ScrollEvent::GetProperty(PrivScrollEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxScrollEvent *event = p->GetEvent(); - switch(id) - { - case P_ORIENTATION: - *vp = ToJS(cx, event->GetOrientation()); - break; - case P_POSITION: - *vp = ToJS(cx, event->GetPosition()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/activate.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/activate.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/activate.cpp (nonexistent) @@ -1,65 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - activate.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: activate.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// activate.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "jsevent.h" -#include "activate.h" -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/activate - * gui - * - * This object is passed to a function that handles an activate event. - * Handle this event by setting the @wxWindow#onActivate property on a @wxWindow object. - * - */ -WXJS_INIT_CLASS(ActivateEvent, "wxActivateEvent", 0) - -/*** - * - * - * Returns true when the control is active, false when it's not. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ActivateEvent) - WXJS_READONLY_PROPERTY(P_ACTIVE, "active") -WXJS_END_PROPERTY_MAP() - -bool ActivateEvent::GetProperty(PrivActivateEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - if ( id == P_ACTIVE ) - *vp = ToJS(cx, p->GetEvent()->GetActive()); - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/activate.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/findr.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/findr.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/findr.cpp (nonexistent) @@ -1,91 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - findr.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: findr.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// findr.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" - -#include "jsevent.h" -#include "findr.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/findr - * gui - * - * This event class contains the information about - * all @wxFindReplaceDialog events: @wxFindReplaceDialog#onFind - * @wxFindReplaceDialog#onFindNext, @wxFindReplaceDialog#onFindReplace, - * @wxFindReplaceDialog#onFindReplaceAll, @wxFindReplaceDialog#onFindClose. - * - */ -WXJS_INIT_CLASS(FindDialogEvent, "wxFindDialogEvent", 0) - -/*** - * - * - * - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(FindDialogEvent) - WXJS_READONLY_PROPERTY(P_FLAGS, "flags") - WXJS_READONLY_PROPERTY(P_FINDSTRING, "findString") - WXJS_READONLY_PROPERTY(P_REPLACESTRING, "replaceString") - WXJS_READONLY_PROPERTY(P_DIALOG, "dialog") -WXJS_END_PROPERTY_MAP() - -bool FindDialogEvent::GetProperty(PrivFindDialogEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxFindDialogEvent *event = p->GetEvent(); - switch (id) - { - case P_FLAGS: - *vp = ToJS(cx, event->GetFlags()); - break; - case P_FINDSTRING: - *vp = ToJS(cx, event->GetFindString()); - break; - case P_REPLACESTRING: - *vp = ToJS(cx, event->GetReplaceString()); - break; - case P_DIALOG: - { - Object *win = dynamic_cast(event->GetDialog()); - *vp = win == NULL ? JSVAL_VOID - : OBJECT_TO_JSVAL(win->GetObject()); - break; - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/findr.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/cal.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/cal.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/cal.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - cal.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: cal.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCalendarEvent_H -#define _WXJSCalendarEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: cal.h -// Purpose: Ports wxCalendarEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 23.07.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivCalendarEvent; - - class CalendarEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivCalendarEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~CalendarEvent() - { - } - - enum - { - P_DATE - , P_WEEKDAY - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSCalendarEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/cal.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/close.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/close.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/close.cpp (nonexistent) @@ -1,117 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - close.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: close.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// close.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "close.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/close - * gui - * - * This object is passed to a function that is set to an onClose property of a - * @wxFrame or @wxDialog. The following example vetoes the close event - * because the text control was changed. - *

- *	frame.onclose = close;
- *
- *	function close(closeEvent)
- *	{
- *	  if ( closeEvent.canVeto )
- *	  {
- *		if ( textCtrl.modified )
- *		{
- *		  wxMessageBox("Can't close because you didn't save the contents");
- *		  closeEvent.veto = true;
- *		}
- *	  }
- *	}
- *  
- *
- */ -WXJS_INIT_CLASS(CloseEvent, "wxCloseEvent", 0) - -/*** - * - * - * Returns true when the close event can be vetoed. - * - * - * Returns true when the user is logging off. - * - * - * Set this to true when you don't want to close the window. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(CloseEvent) - WXJS_READONLY_PROPERTY(P_CAN_VETO, "canVeto") - WXJS_READONLY_PROPERTY(P_LOGGING_OFF, "loggingOff") - WXJS_PROPERTY(P_VETO, "veto") -WXJS_END_PROPERTY_MAP() - -bool CloseEvent::GetProperty(PrivCloseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxCloseEvent *event = p->GetEvent(); - switch (id) - { - case P_CAN_VETO: - *vp = ToJS(cx, event->CanVeto()); - break; - case P_LOGGING_OFF: - *vp = ToJS(cx, event->GetLoggingOff()); - break; - case P_VETO: - *vp = ToJS(cx, event->GetVeto()); - break; - } - return true; -} - -bool CloseEvent::SetProperty(PrivCloseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxCloseEvent *event = p->GetEvent(); - if ( id == P_VETO - && event->CanVeto() ) - { - bool veto; - if ( FromJS(cx, *vp, veto) ) - { - event->Veto(veto); - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/close.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - iconize.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: iconize.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSIconizeEvent_H -#define _WXJSIconizeEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: iconize.h -// Purpose: IconizeEvent ports wxIconizeEvent to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 11.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivIconizeEvent; - class IconizeEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivIconizeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~IconizeEvent() - { - } - - enum - { - P_ICONIZED - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSIconizeEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/move.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/move.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/move.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - move.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: move.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSMoveEvent_H -#define _WXJSMoveEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: move.h -// Purpose: MoveEvent ports wxMoveEvent to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 02.07.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivMoveEvent; - class MoveEvent : public ApiWrapper - { - public: - virtual ~MoveEvent() - { - } - - static bool GetProperty(PrivMoveEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_POSITION - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSMoveEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/move.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.cpp (nonexistent) @@ -1,83 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - scrollwin.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: scrollwin.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * @if JS - * @page wxScrollWinEvent wxScrollWinEvent - * @since version 0.4 - * @endif - */ - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "scrollwin.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/scrollwin - * gui - * - * A scroll event holds information about events sent from scrolling windows. - * - */ -WXJS_INIT_CLASS(ScrollWinEvent, "wxScrollWinEvent", 0) - -/*** - * - * - * Returns wxDirection.HORIZONTAL or wxDirection.VERTICAL - * - * - * Returns the position of the ScrollWinbar - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(ScrollWinEvent) - WXJS_READONLY_PROPERTY(P_ORIENTATION, "orientation") - WXJS_READONLY_PROPERTY(P_POSITION, "position") -WXJS_END_PROPERTY_MAP() - -bool ScrollWinEvent::GetProperty(PrivScrollWinEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxScrollWinEvent *event = p->GetEvent(); - switch(id) - { - case P_ORIENTATION: - *vp = ToJS(cx, event->GetOrientation()); - break; - case P_POSITION: - *vp = ToJS(cx, event->GetPosition()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/syscol.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/syscol.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/syscol.cpp (nonexistent) @@ -1,48 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - syscol.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: syscol.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsevent.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "event.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/syscol - * gui - * - * An event being sent when a system colour is changed. - * See @wxPanel. - * - */ -WXJS_INIT_CLASS(SysColourChangedEvent, "wxSysColourChangedEvent", 0) Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/syscol.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/notify.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/notify.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/notify.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - notify.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: notify.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSNotifyEvent_H -#define _WXJSNotifyEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: notify.h -// Purpose: Ports wxNotifyEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 04.10.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivNotifyEvent; - class NotifyEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivNotifyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(PrivNotifyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~NotifyEvent() - { - } - - enum - { - P_ALLOWED - , P_VETO - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSNotifyEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/notify.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.cpp (nonexistent) @@ -1,76 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - htmllink.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: htmllink.cpp 612 2007-03-12 22:08:35Z fbraem $ - */ -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "jsevent.h" -#include "htmllink.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/htmllink - * gui - * - * This event class is used for the events generated by @wxHtmlWindow. - * - */ -WXJS_INIT_CLASS(HtmlLinkEvent, "wxHtmlLinkEvent", 0) - -/*** - * - * - * Return HREF value of the <a> tag. - * - * - * Return TARGET value of the <a> tag. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(HtmlLinkEvent) - WXJS_READONLY_PROPERTY(P_HREF, "href") - WXJS_READONLY_PROPERTY(P_TARGET, "target") -WXJS_END_PROPERTY_MAP() - -bool HtmlLinkEvent::GetProperty(PrivHtmlLinkEvent *p, JSContext *cx, JSObject* WXUNUSED(obj), int id, jsval *vp) -{ - wxHtmlLinkEvent *event = p->GetEvent(); - wxHtmlLinkInfo info = event->GetLinkInfo(); - switch(id) - { - case P_HREF: - *vp = ToJS(cx, info.GetHref()); - break; - case P_TARGET: - *vp = ToJS(cx, info.GetTarget()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/htmllink.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.h (nonexistent) @@ -1,148 +0,0 @@ -/* - * wxJavaScript - jsevent.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: jsevent.h 598 2007-03-07 20:13:28Z fbraem $ - */ -///////////////////////////////////////////////////////////////////////////// -// Name: jsevent.h -// Purpose: Each JavaScript event object must derive from JSEvent. -// The template argument is the class of the event. -// This class stores a reference to the event. A JavaScript -// event object is only valid within the function that is triggered. -// Don't forget that the event argument of the constructor must be a reference !!! -// Author: Franky Braem -// Modified by: -// Created: 04.06.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#ifndef wxJS_Event_H -#define wxJS_Event_H - -#include "../misc/app.h" -#include "../../common/jsutil.h" - -namespace wxjs -{ - namespace gui - { - template - class JSEvent - { - public: - JSEvent(E &event) : m_event(event), m_inScoop(true), m_clonedEvent(NULL) - { - } - - virtual ~JSEvent() - { - delete m_clonedEvent; - } - - E* GetEvent() - { - if ( InScoop() ) - return &m_event; - else - return m_clonedEvent; - } - - inline bool InScoop() const - { - return m_inScoop; - } - - E &m_event; - bool m_inScoop; - E *m_clonedEvent; - - inline void SetScoop(bool scoop) - { - m_inScoop = scoop; - if ( ! scoop ) - m_clonedEvent = (E *) m_event.Clone(); - } - - template - static bool Fire(Object *obj - , E &event - , const char *property) - { - bool ok = true; - bool skip = true; - - JSContext *cx = obj->GetContext(); - wxASSERT_MSG(cx != NULL, wxT("No application context")); - jsval fval; - if ( GetFunctionProperty(cx, obj->GetObject(), property, &fval) == JS_TRUE ) - { - jsval rval; - - JSEvent *jsEvent = new JSEvent(event); - - jsval argv[] = { T::CreateObject(cx, jsEvent) }; - - JSBool result = JS_CallFunctionValue(cx, obj->GetObject(), fval, 1, argv, &rval); - jsEvent->SetScoop(false); - - if ( result == JS_FALSE ) - { - if ( JS_IsExceptionPending(cx) ) - { - JS_ReportPendingException(cx); - } - } - else - skip = true; - } - else - { - ok = false; - } - - if ( skip ) - event.Skip(); - - return ok; - } - }; - - // Define the simple event classes: classes without properties and methods. - // Remove the wx from the wxClass when using this macro - #define WXJS_DECLARE_SIMPLE_EVENT(name, wxClass) \ - typedef JSEvent Priv##wxClass; \ - class name : public ApiWrapper > \ - { \ - }; - - WXJS_DECLARE_SIMPLE_EVENT(FocusEvent, FocusEvent) - WXJS_DECLARE_SIMPLE_EVENT(SysColourChangedEvent, SysColourChangedEvent) - WXJS_DECLARE_SIMPLE_EVENT(MaximizeEvent, MaximizeEvent) - WXJS_DECLARE_SIMPLE_EVENT(InitDialogEvent, InitDialogEvent) - - // Initialize the event prototypes - bool InitEventClasses(JSContext *cx, JSObject *global); - }; // namespace gui -}; // namespace wxjs - -#endif // wxJS_Event_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.h (nonexistent) @@ -1,69 +0,0 @@ -/* - * wxJavaScript - treeevt.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: treeevt.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSTreeEvent_H -#define _WXJSTreeEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: cal.h -// Purpose: Ports wxTreeEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 03.01.2003 -// Copyright: (c) 2001-2003 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivTreeEvent; - class TreeEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivTreeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~TreeEvent() - { - } - - enum - { - P_ITEM - , P_OLD_ITEM - , P_POINT - , P_KEY_CODE - , P_KEY_EVENT - , P_LABEL - , P_IS_CANCELLED - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCalendarEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/command.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/command.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/command.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - command.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: command.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCommandEvent_H -#define _WXJSCommandEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: command.h -// Purpose: CommandEvent ports wxCommandEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 01.02.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivCommandEvent; - class CommandEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivCommandEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~CommandEvent() - { - } - - enum - { - P_CHECKED - , P_SELECTION - , P_STRING - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCommandEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/command.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/event.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/event.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/event.h (nonexistent) @@ -1,61 +0,0 @@ -/* - * wxJavaScript - event.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: event.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSEvent_H -#define _WXJSEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: event.h -// Purpose: Event ports wxEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 08.01.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivEvent; - class Event : public ApiWrapper - { - public: - static bool GetProperty(PrivEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(PrivEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - WXJS_DECLARE_PROPERTY_MAP() - - enum - { - P_ID - , P_SKIP - , P_TIMESTAMP - }; - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/event.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.cpp (nonexistent) @@ -1,78 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - sizeevt.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: sizeevt.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// sizeevt.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "jsevent.h" -#include "../misc/size.h" -#include "sizeevt.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/sizeevt - * gui - * - * A size event holds information about size change events. - * Handle this event by setting a function to the @wxWindow#onSize - * property on a @wxWindow object. - *

- * The size retrieved with size property is the size of the whole window. - * Use @wxWindow#clientSize for the area which may be used by the application. - *
- */ -WXJS_INIT_CLASS(SizeEvent, "wxSizeEvent", 0) - -/*** - * - * - * Returns the size of the window generating this event. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(SizeEvent) - WXJS_READONLY_PROPERTY(P_SIZE, "size") -WXJS_END_PROPERTY_MAP() - -bool SizeEvent::GetProperty(PrivSizeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxSizeEvent *event = (wxSizeEvent*) p->GetEvent(); - - if ( id == P_SIZE ) - { - *vp = Size::CreateObject(cx, new wxSize(event->GetSize())); - } - return true; -} - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/sizeevt.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/key.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/key.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/key.h (nonexistent) @@ -1,69 +0,0 @@ -/* - * wxJavaScript - key.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: key.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSKeyEvent_H -#define _WXJSKeyEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: key.h -// Purpose: Ports wxKeyEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 25.12.01 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivKeyEvent; - - class KeyEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivKeyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~KeyEvent() - { - } - - enum - { - P_ALT_DOWN - , P_CONTROL_DOWN - , P_KEY_CODE - , P_META_DOWN - , P_SHIFT_DOWN - , P_X - , P_Y - , P_HAS_MODIFIERS - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSKeyEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/key.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.h (nonexistent) @@ -1,95 +0,0 @@ -/* - * wxJavaScript - mouse.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: mouse.h 598 2007-03-07 20:13:28Z fbraem $ - */ -///////////////////////////////////////////////////////////////////////////// -// Name: mouse.h -// Purpose: MouseEvent ports wxMouseEvent to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 01.07.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WXJSMouseEvent_H -#define _WXJSMouseEvent_H - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivMouseEvent; - - class MouseEvent : public ApiWrapper - { - public: - virtual ~MouseEvent() - { - } - - static bool GetProperty(PrivMouseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - // Property ID's - enum - { - P_ALTDOWN - , P_CONTROLDOWN - , P_DRAGGING - , P_ENTERING - , P_POSITION - , P_LINES_PER_ACTION - , P_BUTTON - , P_METADOWN - , P_SHIFTDOWN - , P_LEFT_DOWN - , P_MIDDLE_DOWN - , P_RIGHT_DOWN - , P_LEFT_UP - , P_MIDDLE_UP - , P_RIGHT_UP - , P_LEFT_DCLICK - , P_MIDDLE_DCLICK - , P_RIGHT_DCLICK - , P_LEFT_IS_DOWN - , P_MIDDLE_IS_DOWN - , P_RIGHT_IS_DOWN - , P_MOVING - , P_LEAVING - , P_X - , P_Y - , P_WHEELROTATION - , P_WHEELDELTA - }; - - WXJS_DECLARE_PROPERTY_MAP() - WXJS_DECLARE_METHOD_MAP() - - static JSBool button(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool buttonDClick(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool buttonDown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - static JSBool buttonUp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSMouseEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/mouse.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/help.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/help.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/help.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - help.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: help.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSHelpEvent_H -#define _WXJSHelpEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: help.h -// Purpose: HelpEvent ports wxHelpEvent to JavaScript. -// Author: Franky Braem -// Modified by: -// Created: 28.09.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivHelpEvent; - - class HelpEvent : public ApiWrapper - { - public: - virtual ~HelpEvent() - { - } - - static bool GetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(PrivHelpEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_POSITION - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSMoveEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/help.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.h (nonexistent) @@ -1,142 +0,0 @@ -/* - * wxJavaScript - evthand.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: evthand.h 598 2007-03-07 20:13:28Z fbraem $ - */ -/** - * (c) 2001-2002 Franky Braem (S.A.W.) - * - * This file is part of wxJS. wxJS ports wxWindows to JavaScript - * - * File : EventHandler.h - * Desc. : EventHandler will try to handle the normal control events - * received from all wxJSxxx classes. - * Created : 16-12-2001 - * L. Update : - */ - -#ifndef _wxJS_EventHandler_H -#define _wxJS_EventHandler_H - -namespace wxjs -{ - namespace gui - { - class EventHandler : public wxEvtHandler - { - public: - - /** - * Constructors - */ - EventHandler(Object *obj) : wxEvtHandler(), m_obj(obj) - { - } - - virtual ~EventHandler() - { - } - - protected: - DECLARE_EVENT_TABLE() - - /** - * Handles the OnChar event. Executes the function - * in the onChar property. - */ - void OnChar(wxKeyEvent &event); - - /** - * Handles the OnKeyDown event. Executes the function - * in the onKeyDown property. - */ - void OnKeyDown(wxKeyEvent &event); - - /** - * Handles the OnKeyUp event. Executes the function - * in the onKeyUp property. - */ - void OnKeyUp(wxKeyEvent &event); - - /** - * Handles the OnCharHook event. Executes the function - * in the onCharHook property. - */ - void OnCharHook(wxKeyEvent &event); - - /** - * Handles the OnActivate event. Executes the function - * in the onActivate property. - */ - void OnActivate(wxActivateEvent &event); - - /** - * Handles the OnSetFocus event. Executes the function - * in the onSetFocus property. - */ - void OnSetFocus(wxFocusEvent &event); - - /** - * Handles the OnKillFocus event. Executes the function - * in the onKillFocus property. - */ - void OnKillFocus(wxFocusEvent &event); - - /** - * Handles the OnInitDialog event. Executes the function - * in the onInitDialog property. - */ - void OnInitDialog(wxInitDialogEvent &event); - - /** - * Handles all the mouse events. - */ - void OnMouseEvents(wxMouseEvent &event); - - /** - * Handles the move event - */ - void OnMove(wxMoveEvent &event); - - void OnSize(wxSizeEvent &event); - - void OnScroll(wxScrollWinEvent& event); - void OnScrollTop(wxScrollWinEvent& event); - void OnScrollBottom(wxScrollWinEvent& event); - void OnScrollLineUp(wxScrollWinEvent& event); - void OnScrollLineDown(wxScrollWinEvent& event); - void OnScrollPageUp(wxScrollWinEvent& event); - void OnScrollPageDown(wxScrollWinEvent& event); - void OnScrollThumbTrack(wxScrollWinEvent& event); - void OnScrollThumbRelease(wxScrollWinEvent& event); - - void OnHelp(wxHelpEvent &event); - - private: - - // No need to root it. It's alive as long as the window is available. - // And when the window is destroyed, this is also destroyed. - Object *m_obj; - }; - }; // namespace gui -}; // namespace wxjs -#endif // _wxJS_EventHandler_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/evthand.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.h (nonexistent) @@ -1,75 +0,0 @@ -/* - * wxJavaScript - listevt.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: listevt.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSListEvent_H -#define _WXJSListEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: listevt.h -// Purpose: Ports wxListEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 04.10.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivListEvent; - class ListEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivListEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~ListEvent() - { - } - - enum - { - P_CODE - , P_INDEX - , P_COLUMN - , P_POINT - , P_LABEL - , P_TEXT - , P_IMAGE - , P_DATA - , P_MASK - , P_ITEM - , P_CACHE_FROM - , P_CACHE_TO - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCalendarEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/listevt.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/cal.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/cal.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/cal.cpp (nonexistent) @@ -1,77 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - cal.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: cal.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// cal.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "cal.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/cal - * gui - * - * This object is passed to a function that is set to a @wxCalendarCtrl event property. - * - */ -WXJS_INIT_CLASS(CalendarEvent, "wxCalendarEvent", 0) - -/*** - * - * - * Returns the date. - * - * - * Returns the weekday - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(CalendarEvent) - WXJS_READONLY_PROPERTY(P_DATE, "date") - WXJS_READONLY_PROPERTY(P_WEEKDAY, "weekDay") -WXJS_END_PROPERTY_MAP() - -bool CalendarEvent::GetProperty(PrivCalendarEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - switch (id) - { - case P_DATE: - *vp = ToJS(cx, p->GetEvent()->GetDate()); - break; - case P_WEEKDAY: - *vp = ToJS(cx, (int) p->GetEvent()->GetWeekDay()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/cal.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.cpp (nonexistent) @@ -1,69 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - iconize.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: iconize.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// iconize.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "iconize.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/iconize - * gui - * - * An event being sent when the frame is iconized (minimized) or restored. - * Currently only Windows and GTK generate such events. - * See @wxFrame. - * - */ -WXJS_INIT_CLASS(IconizeEvent, "wxIconizeEvent", 0) - -/*** - * - * - * Returns true when the frame is iconized, false when it's not. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(IconizeEvent) - WXJS_READONLY_PROPERTY(P_ICONIZED, "iconized") -WXJS_END_PROPERTY_MAP() - -bool IconizeEvent::GetProperty(PrivIconizeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxIconizeEvent *event = p->GetEvent(); - if ( id == P_ICONIZED ) - *vp = ToJS(cx, event->Iconized()); - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/iconize.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * wxJavaScript - scroll.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: scroll.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSScrollEvent_H -#define _WXJSScrollEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: ScrollEvent.h -// Purpose: ScrollEvent ports wxScrollEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 22.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivScrollEvent; - class ScrollEvent : public ApiWrapper - { - public: - virtual ~ScrollEvent() - { - } - - static bool GetProperty(PrivScrollEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_ORIENTATION - , P_POSITION - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSScrollEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/scroll.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/activate.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/activate.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/activate.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * wxJavaScript - activate.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: activate.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSActivateEvent_H -#define _WXJSActivateEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: activate.h -// Purpose: Ports wxActivateEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 06.01.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivActivateEvent; - - class ActivateEvent : - public ApiWrapper - { - public: - static bool GetProperty(PrivActivateEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~ActivateEvent() - { - } - - enum - { - P_ACTIVE - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs -#endif //_WXJSActivateEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/activate.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/move.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/move.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/move.cpp (nonexistent) @@ -1,74 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - move.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: move.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// move.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/apiwrap.h" - -#include "jsevent.h" -#include "../misc/point.h" -#include "move.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/move - * gui - * - * A move event holds information about move change events. - * Handle this event by setting a function to the @wxWindow#onMove - * property on a @wxWindow object. - * - */ -WXJS_INIT_CLASS(MoveEvent, "wxMoveEvent", 0) - -/*** - * - * - * Returns the position of the window generating this event. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(MoveEvent) - WXJS_READONLY_PROPERTY(P_POSITION, "position") -WXJS_END_PROPERTY_MAP() - -bool MoveEvent::GetProperty(PrivMoveEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxMoveEvent *event = p->GetEvent(); - - if ( id == P_POSITION ) - { - *vp = Point::CreateObject(cx, new wxPoint(event->GetPosition())); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/move.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/findr.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/findr.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/findr.h (nonexistent) @@ -1,67 +0,0 @@ -/* - * wxJavaScript - findr.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: findr.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSFindDialogEvent_H -#define _WXJSFindDialogEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: findr.h -// Purpose: Ports wxFindDialogEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 06.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -#include - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivFindDialogEvent; - class FindDialogEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivFindDialogEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~FindDialogEvent() - { - } - - enum - { - P_FLAGS - , P_FINDSTRING - , P_REPLACESTRING - , P_DIALOG - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSFindDialogEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/findr.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/notify.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/notify.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/notify.cpp (nonexistent) @@ -1,113 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - notify.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: notify.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// notify.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "notify.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/notify - * gui - * - * This class is a prototype for several events. - * See @wxListEvent. - * - */ -WXJS_INIT_CLASS(NotifyEvent, "wxNotifyEvent", 0) - -/*** - * - * - * Allow/Disallow the change. Setting allowed to false, is the same as setting veto to true. - * - * - * When set to true, prevents the change announced by this event from happening. - * Setting veto to false, is the same as setting allow to true. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(NotifyEvent) - WXJS_READONLY_PROPERTY(P_ALLOWED, "allowed") - WXJS_PROPERTY(P_VETO, "veto") -WXJS_END_PROPERTY_MAP() - -bool NotifyEvent::GetProperty(PrivNotifyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxNotifyEvent *event = p->GetEvent(); - switch (id) - { - case P_ALLOWED: - *vp = ToJS(cx, event->IsAllowed()); - break; - case P_VETO: - *vp = ToJS(cx, ! event->IsAllowed()); - break; - } - return true; -} - -bool NotifyEvent::SetProperty(PrivNotifyEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxNotifyEvent *event = p->GetEvent(); - switch (id) - { - case P_ALLOWED: - { - bool allow; - if ( FromJS(cx, *vp, allow) ) - { - if ( allow ) - event->Allow(); - else - event->Veto(); - } - break; - } - case P_VETO: - { - bool veto; - if ( FromJS(cx, *vp, veto) ) - { - if ( veto ) - event->Veto(); - else - event->Allow(); - } - break; - } - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/notify.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/close.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/close.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/close.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - close.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: close.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSCloseEvent_H -#define _WXJSCloseEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: close.h -// Purpose: Ports wxCloseEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 08.02.02 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivCloseEvent; - class CloseEvent : public ApiWrapper - { - public: - static bool GetProperty(PrivCloseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - static bool SetProperty(PrivCloseEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - virtual ~CloseEvent() - { - } - - enum - { - P_CAN_VETO - , P_LOGGING_OFF - , P_VETO - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSCloseEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/close.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.cpp (nonexistent) @@ -1,132 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - treeevt.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: treeevt.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// treeevt.cpp - -/** - * @if JS - * @page wxTreeEvent wxTreeEvent - * @since version 0.6 - * @endif - */ - -#ifndef WX_PRECOMP - #include -#endif - -#include - -#include "../../common/main.h" - -#include "../misc/point.h" - -#include "../control/treeid.h" - -#include "jsevent.h" -#include "treeevt.h" -#include "key.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/treeevt - * gui - * - * This object is passed to a function that is set to a @wxTreeCtrl event property. - * - */ -WXJS_INIT_CLASS(TreeEvent, "wxTreeEvent", 0) - -/*** - * - * - * Returns true when the edit is cancelled. - * - * - * The item. - * - * - * Keycode when the event is a keypress event. See @wxKeyCode. - * - * - * A key event. - * - * - * The label. - * - * - * Get the previously selected item. - * - * - * The position of the mouse pointer when the event is a drag event. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(TreeEvent) - WXJS_READONLY_PROPERTY(P_ITEM, "item") - WXJS_READONLY_PROPERTY(P_OLD_ITEM, "oldItem") - WXJS_READONLY_PROPERTY(P_POINT, "point") - WXJS_READONLY_PROPERTY(P_KEY_CODE, "keyCode") - WXJS_READONLY_PROPERTY(P_KEY_EVENT, "keyEvent") - WXJS_READONLY_PROPERTY(P_LABEL, "label") - WXJS_READONLY_PROPERTY(P_IS_CANCELLED, "isEditCancelled") -WXJS_END_PROPERTY_MAP() - -bool TreeEvent::GetProperty(PrivTreeEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxTreeEvent *event = p->GetEvent(); - switch (id) - { - case P_KEY_CODE: - *vp = ToJS(cx, event->GetKeyCode()); - break; - case P_KEY_EVENT: - { - wxKeyEvent evt(event->GetKeyEvent()); - PrivKeyEvent *jsEvent = new PrivKeyEvent(evt); - jsEvent->SetScoop(false); - *vp = KeyEvent::CreateObject(cx, jsEvent); - break; - } - case P_POINT: - *vp = Point::CreateObject(cx, new wxPoint(event->GetPoint())); - break; - case P_LABEL: - *vp = ToJS(cx, event->GetLabel()); - break; - case P_IS_CANCELLED: - *vp = ToJS(cx, event->IsEditCancelled()); - break; - case P_ITEM: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(event->GetItem())); - break; - case P_OLD_ITEM: - *vp = TreeItemId::CreateObject(cx, new wxTreeItemId(event->GetOldItem())); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/treeevt.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.cpp (nonexistent) @@ -1,165 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - jsevent.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: jsevent.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsevent.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "event.h" -#include "command.h" -#include "iconize.h" -#include "close.h" -#include "key.h" -#include "activate.h" -#include "mouse.h" -#include "move.h" -#include "cal.h" -#include "findr.h" -#include "scroll.h" -#include "scrollwin.h" -#include "help.h" -#include "sizeevt.h" - -#include "notify.h" -#include "listevt.h" -#include "treeevt.h" - -using namespace wxjs; -using namespace wxjs::gui; - -bool wxjs::gui::InitEventClasses(JSContext *cx, JSObject *global) -{ - JSObject *obj = Event::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxEvent creation prototype failed")); - if ( !obj ) - return false; - - obj = CommandEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCommandEvent prototype creation failed")); - if (! obj ) - return false; - - obj = KeyEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxKeyEvent prototype creation failed")); - if (! obj ) - return false; - - obj = ActivateEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxActivateEvent prototype creation failed")); - if (! obj ) - return false; - - obj = CloseEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCloseEvent prototype creation failed")); - if (! obj ) - return false; - - obj = FocusEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFocusEvent prototype creation failed")); - if (! obj ) - return false; - - obj = InitDialogEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxInitDialogEvent prototype creation failed")); - if (! obj ) - return false; - - obj = MouseEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxMouseEvent prototype creation failed")); - if (! obj ) - return false; - - obj = MoveEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxMoveEvent prototype creation failed")); - if (! obj ) - return false; - - obj = SizeEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSizeEvent prototype creation failed")); - if (! obj ) - return false; - - obj = CalendarEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCalendarEvent prototype creation failed")); - if (! obj ) - return false; - - obj = IconizeEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxIconizeEvent prototype creation failed")); - if (! obj ) - return false; - - obj = MaximizeEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxMaximizeEvent prototype creation failed")); - if (! obj ) - return false; - - obj = FindDialogEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFindDialogEvent prototype creation failed")); - if (! obj ) - return false; - - obj = ScrollEvent::JSInit(cx, global, CommandEvent::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxScrollEvent prototype creation failed")); - if (! obj ) - return false; - - obj = ScrollWinEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxScrollWinEvent prototype creation failed")); - if (! obj ) - return false; - - obj = SysColourChangedEvent::JSInit(cx, global, Event::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSysColourChangedEvent prototype creation failed")); - if (! obj ) - return false; - - obj = HelpEvent::JSInit(cx, global, CommandEvent::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxHelpEvent prototype creation failed")); - if (! obj ) - return false; - - obj = NotifyEvent::JSInit(cx, global, CommandEvent::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxNotifyEvent prototype creation failed")); - if (! obj ) - return false; - - obj = ListEvent::JSInit(cx, global, NotifyEvent::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxListEvent prototype creation failed")); - if (! obj ) - return false; - - obj = TreeEvent::JSInit(cx, global, NotifyEvent::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTreeEvent prototype creation failed")); - if (! obj ) - return false; - - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/jsevent.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/command.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/command.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/command.cpp (nonexistent) @@ -1,86 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - command.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: command.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// command.cpp - -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "jsevent.h" -#include "command.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/command - * gui - * - * This event class contains information about command events, - * which originate from a variety of simple controls. - * - */ -WXJS_INIT_CLASS(CommandEvent, "wxCommandEvent", 0) - -/*** - * - * - * This can be used for menus or checkboxes to check if they are checked or not - * - * - * This can be used to know which item is selected in a @wxListBox or @wxChoice control - * - * - * This can be used to know the string of the item selected in a - * @wxListBox or @wxChoice control. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(CommandEvent) - WXJS_READONLY_PROPERTY(P_CHECKED, "checked") - WXJS_READONLY_PROPERTY(P_SELECTION, "selection") - WXJS_READONLY_PROPERTY(P_STRING, "string") -WXJS_END_PROPERTY_MAP() - -bool CommandEvent::GetProperty(PrivCommandEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxCommandEvent *event = p->GetEvent(); - switch(id) - { - case P_CHECKED: - *vp = ToJS(cx, event->IsChecked()); - break; - case P_SELECTION: - *vp = ToJS(cx, event->GetSelection()); - break; - case P_STRING: - *vp = ToJS(cx, event->GetString()); - break; - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/command.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/focus.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/focus.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/focus.cpp (nonexistent) @@ -1,48 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - focus.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: focus.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsevent.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "jsevent.h" -#include "event.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/focus - * gui - * - * A focus event is sent when a window's focus changes. - * See @wxWindow#onSetFocus and @wxWindow#onKillFocus. - * - */ -WXJS_INIT_CLASS(FocusEvent, "wxFocusEvent", 0) - Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/focus.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/event.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/event.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/event.cpp (nonexistent) @@ -1,92 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - event.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: event.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// event.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" -#include "../../common/type.h" - -#include "jsevent.h" -#include "event.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/event - * gui - * - * wxEvent is the prototype for the following event objects. - * - */ -WXJS_INIT_CLASS(Event, "wxEvent", 0) - -/*** - * - * - * The identifier of the associated window - * - * - * Set this to true when you want to tell the system to skip the current event handler - * and to use the next valid handler. - * - * - */ -WXJS_BEGIN_PROPERTY_MAP(Event) - WXJS_READONLY_PROPERTY(P_ID, "id") - WXJS_PROPERTY(P_SKIP, "skip") -WXJS_END_PROPERTY_MAP() - -bool Event::GetProperty(PrivEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxEvent *event = p->GetEvent(); - - switch (id) - { - case P_ID: - *vp = ToJS(cx, event->GetId()); - break; - case P_SKIP: - *vp = ToJS(cx, event->GetSkipped()); - break; - } - return true; -} - -bool Event::SetProperty(PrivEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp) -{ - wxEvent *event = p->GetEvent(); - if ( id == P_SKIP ) - { - bool skip; - if ( FromJS(cx, *vp, skip) ) - event->Skip(skip); - } - return true; -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/event.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.h =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.h (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.h (nonexistent) @@ -1,64 +0,0 @@ -/* - * wxJavaScript - scrollwin.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: scrollwin.h 598 2007-03-07 20:13:28Z fbraem $ - */ -#ifndef _WXJSScrollWinEvent_H -#define _WXJSScrollWinEvent_H - -///////////////////////////////////////////////////////////////////////////// -// Name: ScrollWinEvent.h -// Purpose: ScrollWinEvent ports wxScrollWinEvent to JavaScript -// Author: Franky Braem -// Modified by: -// Created: 24.08.2002 -// Copyright: (c) 2001-2002 Franky Braem -// Licence: LGPL -///////////////////////////////////////////////////////////////////////////// - -namespace wxjs -{ - namespace gui - { - typedef JSEvent PrivScrollWinEvent; - - class ScrollWinEvent : public ApiWrapper - { - public: - virtual ~ScrollWinEvent() - { - } - - static bool GetProperty(PrivScrollWinEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp); - - enum - { - P_ORIENTATION - , P_POSITION - }; - - WXJS_DECLARE_PROPERTY_MAP() - }; - }; // namespace gui -}; // namespace wxjs - -#endif //_WXJSScrollWinEvent_H Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/scrollwin.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/event/maximize.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/event/maximize.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/event/maximize.cpp (nonexistent) @@ -1,48 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - maximize.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: maximize.cpp 598 2007-03-07 20:13:28Z fbraem $ - */ -// jsevent.cpp -#ifndef WX_PRECOMP - #include -#endif - -#include "../../common/main.h" - -#include "jsevent.h" -#include "event.h" - -using namespace wxjs; -using namespace wxjs::gui; - -/*** - * event/maximize - * gui - * - * An event being sent when the frame is maximized (minimized) or restored. - * See @wxFrame. - * - */ -WXJS_INIT_CLASS(MaximizeEvent, "wxMaximizeEvent", 0) Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/event/maximize.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/gui/init.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/gui/init.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/gui/init.cpp (nonexistent) @@ -1,645 +0,0 @@ -#include "precompiled.h" - -/* - * wxJavaScript - init.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$ - */ -// main.cpp -#include - -#ifndef WX_PRECOMP - #include -#endif -#include - -#if defined(__WXMSW__) - #include -#endif -#include - -#if defined(__WXMSW__) - #include -#endif - -#include -#include "../common/wxjs.h" -#include "../common/main.h" -#include "../common/jsutil.h" -#include "../common/index.h" - -// All wxJS objects -#include "misc/app.h" -#include "control/window.h" -#include "control/toplevel.h" -#include "control/frame.h" -#include "control/dialog.h" -#include "control/menu.h" -#include "control/menuitem.h" -#include "control/menubar.h" - -// Controls -#include "control/control.h" -#include "control/textctrl.h" -#include "control/button.h" -#include "control/bmpbtn.h" -#include "control/sttext.h" -#include "control/staticbx.h" -#include "control/checkbox.h" -#include "control/ctrlitem.h" -#include "control/item.h" -#include "control/listbox.h" -#include "control/chklstbx.h" -#include "control/chklstbxchk.h" -#include "control/choice.h" -#include "control/combobox.h" -#include "control/calendar.h" -#include "control/caldate.h" -#include "control/gauge.h" -#include "control/radiobox.h" -#include "control/radiobtn.h" -#include "control/slider.h" -#include "control/helpbtn.h" -#include "control/splitwin.h" -#include "control/statbar.h" -#include "control/toolbar.h" -#include "control/txtdlg.h" -#include "control/pwdlg.h" -#include "control/scrollwnd.h" -#include "control/htmlwin.h" - -// Validators -#include "misc/validate.h" -#include "misc/genval.h" -#include "misc/textval.h" - -// Sizers -#include "misc/sizer.h" -#include "misc/gridszr.h" -#include "misc/flexgrid.h" -#include "misc/boxsizer.h" -#include "misc/stsizer.h" - -// Dialogs -#include "control/panel.h" -#include "control/filedlg.h" -#include "control/dirdlg.h" -#include "control/coldata.h" -#include "control/coldlg.h" -#include "control/fontdata.h" -#include "control/fontdlg.h" -#include "control/findrdlg.h" -#include "control/finddata.h" - -// Miscellaneous wxWindow classes -#include "misc/point.h" -#include "misc/size.h" -#include "misc/rect.h" -#include "misc/accentry.h" -#include "misc/acctable.h" -#include "misc/colour.h" -#include "misc/font.h" -#include "misc/fontenum.h" -#include "misc/fontlist.h" -#include "misc/bitmap.h" -#include "misc/image.h" -#include "misc/imghand.h" -#include "misc/icon.h" -#include "misc/colourdb.h" -#include "misc/cshelp.h" -#include "misc/constant.h" -#if defined(__WXMSW__) - #include "misc/autoobj.h" -#endif - -// Events -#include "event/jsevent.h" - -// Common Controls -#include "misc/cmnconst.h" -#include "misc/imagelst.h" -#include "control/listctrl.h" -#include "control/listhit.h" -#include "control/listitem.h" -#include "control/listitattr.h" -#include "control/treectrl.h" -#include "control/treeitem.h" -#include "control/treeid.h" -#include "control/treehit.h" - -#include "misc/globfun.h" -#include "init.h" - -using namespace wxjs; -using namespace wxjs::gui; - -bool wxjs::gui::InitClass(JSContext *cx, JSObject *global) -{ - InitGuiConstants(cx, 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")); - if (! obj) - return false; - - obj = Control::JSInit(cx, global, Window::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxControl prototype creation failed")); - if (! obj) - return false; - - obj = TopLevelWindow::JSInit(cx, global, Window::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFrame prototype creation failed")); - if (! obj ) - return false; - - obj = Frame::JSInit(cx, global, TopLevelWindow::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFrame prototype creation failed")); - if (! obj ) - return false; - - obj = Menu::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxMenu prototype creation failed")); - if (! obj ) - return false; - - obj = MenuItem::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxMenuItem prototype creation failed")); - if (! obj ) - return false; - - obj = MenuBar::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxMenuBar prototype creation failed")); - if (! obj ) - return false; - - obj = TextCtrl::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTextCtrl prototype creation failed")); - if (! obj ) - return false; - - obj = Button::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxButton prototype creation failed")); - if (! obj ) - return false; - - obj = BitmapButton::JSInit(cx, global, Button::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxBitmapButton prototype creation failed")); - if (! obj ) - return false; - - obj = ContextHelpButton::JSInit(cx, global, BitmapButton::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxContextHelptButton prototype creation failed")); - if (! obj ) - return false; - - obj = StaticText::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxStaticText prototype creation failed")); - if (! obj ) - return false; - - obj = StaticBox::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxStaticBox prototype creation failed")); - if (! obj ) - return false; - - obj = CheckBox::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCheckBox prototype creation failed")); - if (! obj ) - return false; - - obj = ControlWithItems::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxControlWithItems prototype creation failed")); - if (! obj ) - return false; - - obj = ListBox::JSInit(cx, global, ControlWithItems::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxListBox prototype creation failed")); - if (! obj ) - return false; - - obj = CheckListBox::JSInit(cx, global, ListBox::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCheckListBox prototype creation failed")); - if (! obj ) - return false; - - obj = CheckListBoxChecked::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxCheckListBoxChecked prototype creation failed")); - if (! obj ) - return false; - - obj = Choice::JSInit(cx, global, ControlWithItems::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxChoice prototype creation failed")); - if (! obj ) - return false; - - obj = CalendarCtrl::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxCalendarCtrl prototype creation failed")); - if (! obj ) - return false; - - obj = Gauge::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxGauge prototype creation failed")); - if (! obj ) - return false; - - obj = RadioBox::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxRadioBox prototype creation failed")); - if (! obj ) - return false; - - obj = RadioButton::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxRadioButton prototype creation failed")); - if (! obj ) - return false; - - obj = Panel::JSInit(cx, global, Window::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxPanel prototype creation failed")); - if (! obj ) - return false; - - obj = Dialog::JSInit(cx, global, TopLevelWindow::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxDialog prototype creation failed")); - if (! obj ) - return false; - - obj = CalendarDateAttr::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxCalendarDateAttr prototype creation failed")); - if (! obj ) - return false; - - obj = ComboBox::JSInit(cx, global, ControlWithItems::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxComboBox prototype creation failed")); - if (! obj ) - return false; - - obj = Slider::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSlider 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 ) - return false; - - obj = Rect::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxRect prototype creation failed")); - if (! obj ) - return false; - - obj = FileDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFileDialog prototype creation failed")); - if (! obj ) - return false; - - if ( ! InitEventClasses(cx, global) ) - return false; - - obj = Sizer::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxSizer prototype creation failed")); - if (! obj ) - return false; - - obj = GridSizer::JSInit(cx, global, Sizer::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxGridSizer prototype creation failed")); - if (! obj ) - return false; - - obj = FlexGridSizer::JSInit(cx, global, GridSizer::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFlexGridSizer prototype creation failed")); - if (! obj ) - return false; - - obj = BoxSizer::JSInit(cx, global, Sizer::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxBoxSizer prototype creation failed")); - if (! obj ) - return false; - - obj = StaticBoxSizer::JSInit(cx, global, BoxSizer::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxStaticBoxSizer prototype creation failed")); - if (! obj ) - return false; - - obj = Validator::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxValidator prototype creation failed")); - if (! obj ) - return false; - - obj = GenericValidator::JSInit(cx, global, Validator::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxGenericValidator prototype creation failed")); - if (! obj ) - return false; - - obj = TextValidator::JSInit(cx, global, Validator::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTextValidator prototype creation failed")); - if (! obj ) - return false; - - obj = AcceleratorEntry::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxAcceleratorEntry prototype creation failed")); - if (! obj ) - return false; - - obj = AcceleratorTable::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxAcceleratorTable prototype creation failed")); - if (! obj ) - return false; - - obj = Colour::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxColour prototype creation failed")); - if (! obj ) - return false; - - obj = ColourDatabase::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxColourDatabase prototype creation failed")); - if (! obj ) - return false; - - obj = Font::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFont prototype creation failed")); - if (! obj ) - return false; - - obj = ColourData::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxColourData prototype creation failed")); - if (! obj ) - return false; - - obj = ColourDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxColourDialog prototype creation failed")); - if (! obj ) - return false; - - obj = FontData::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFontData prototype creation failed")); - if (! obj ) - return false; - - obj = FontDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFontDialog prototype creation failed")); - if (! obj ) - return false; - - obj = FontList::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFontList prototype creation failed")); - if (! obj ) - return false; - - obj = DirDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxDirDialog prototype creation failed")); - if (! obj ) - return false; - - obj = FindReplaceData::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFindReplaceData prototype creation failed")); - if (! obj ) - return false; - - obj = FindReplaceDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxFindReplaceDialog prototype creation failed")); - if (! obj ) - return false; - - obj = FontEnumerator::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFontEnumerator prototype creation failed")); - if (! obj ) - return false; - - obj = Bitmap::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxBitmap prototype creation failed")); - if (! obj ) - return false; - - obj = Icon::JSInit(cx, global, Bitmap::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxIcon prototype creation failed")); - if (! obj ) - return false; - - obj = ContextHelp::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxFile prototype creation failed")); - if (! obj ) - return false; - - InitCommonConst(cx, global); - - obj = ImageList::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxImageList prototype creation failed")); - if (! obj ) - return false; - - obj = ListCtrl::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxListCtrl prototype creation failed")); - if (! obj ) - return false; - - obj = ListItem::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxListItem prototype creation failed")); - if (! obj ) - return false; - - obj = ListItemAttr::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxListItemAttr prototype creation failed")); - if (! obj ) - return false; - - obj = ListHitTest::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxListHitTest prototype creation failed")); - if (! obj ) - return false; - - obj = TreeCtrl::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTreeCtrl prototype creation failed")); - if (! obj ) - return false; - - obj = TreeItem::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTreeItem prototype creation failed")); - if (! obj ) - return false; - - obj = TreeItemId::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTreeItemId prototype creation failed")); - if (! obj ) - return false; - - obj = TreeHitTest::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxTreeHitTest prototype creation failed")); - if (! obj ) - return false; - - obj = SplitterWindow::JSInit(cx, global, Window::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxSplitterWindow prototype creation failed")); - if (! obj ) - return false; - - obj = StatusBar::JSInit(cx, global, Window::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxStatusBar prototype creation failed")); - if (! obj ) - return false; - - obj = ToolBar::JSInit(cx, global, Control::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxToolBar prototype creation failed")); - if (! obj ) - return false; - -#ifdef __WXMSW__ - obj = AutomationObject::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxAutomationObject prototype creation failed")); - if (! obj ) - return false; -#endif - - obj = Image::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxImage prototype creation failed")); - if (! obj ) - return false; - - obj = ImageHandler::JSInit(cx, global); - wxASSERT_MSG(obj != NULL, wxT("wxImageHandler prototype creation failed")); - if (! obj ) - return false; - - obj = BMPHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxBMPHandler prototype creation failed")); - if (! obj ) - return false; - - obj = GIFHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxGIFHandler prototype creation failed")); - if (! obj ) - return false; - - obj = ICOHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxICOHandler prototype creation failed")); - if (! obj ) - return false; - - obj = JPEGHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxJPEGHandler prototype creation failed")); - if (! obj ) - return false; - - obj = PCXHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxPCXHandler prototype creation failed")); - if (! obj ) - return false; - - obj = PNGHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxPNGHandler prototype creation failed")); - if (! obj ) - return false; - - obj = PNMHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxPNMHandler prototype creation failed")); - if (! obj ) - return false; - - obj = TIFFHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTIFFHandler prototype creation failed")); - if (! obj ) - return false; - - obj = XPMHandler::JSInit(cx, global, ImageHandler::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxXPMHandler prototype creation failed")); - if (! obj ) - return false; - - obj = TextEntryDialog::JSInit(cx, global, Dialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxTextEntryDialog prototype creation failed")); - if (! obj ) - return false; - - obj = PasswordEntryDialog::JSInit(cx, global, TextEntryDialog::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxPasswordEntryDialog prototype creation failed")); - if (! obj ) - return false; - - obj = ScrolledWindow::JSInit(cx, global, Panel::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxScrollWindow prototype creation failed")); - if (! obj ) - return false; - - obj = HtmlWindow::JSInit(cx, global, ScrolledWindow::GetClassPrototype()); - wxASSERT_MSG(obj != NULL, wxT("wxHtmlWindow prototype creation failed")); - if (! obj ) - return false; - - // Define the global functions - InitFunctions(cx, global); - - DefineGlobals(cx, global); - return true; -} - -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 *app = JS_ConstructObject(cx, App::GetClass(), App::GetClassPrototype(), NULL); - JS_DefineProperty(cx, obj, "wxTheApp", OBJECT_TO_JSVAL(app), NULL, NULL, 0); - } - - return true; -} - -void wxjs::gui::Destroy() -{ - // Only exit wxTheApp, if there is no running mainloop, becuase in this - // case there exists still an instance of wxApp, which is the case when embedding - // wxJS into a wxWidgets application - if ( wxTheApp ) - { - wxClassInfo *cInfo = wxTheApp->GetClassInfo(); - wxString t_strClassName( cInfo->GetClassName() ); - - if ( ! wxApp::IsMainLoopRunning() && t_strClassName.IsSameAs(_("wxJSApp")) ) - { - wxTheApp->OnExit(); - // Cleanup - #ifdef __WXMSW__ - wxEntryCleanup(); - #endif - } - } -} Property changes on: ps/trunk/source/tools/atlas/wxJS/gui/init.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/source/tools/atlas/wxJS/precompiled.cpp =================================================================== --- ps/trunk/source/tools/atlas/wxJS/precompiled.cpp (revision 5152) +++ ps/trunk/source/tools/atlas/wxJS/precompiled.cpp (nonexistent) @@ -1 +0,0 @@ -#include "precompiled.h" Property changes on: ps/trunk/source/tools/atlas/wxJS/precompiled.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property