parent
aa5bdfe426
commit
7fede74cdf
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: bmpbtn.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: bmpbtn.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// bmpbtn.cpp
|
||||
|
||||
@ -185,7 +185,10 @@ wxBitmapButton* BitmapButton::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: button.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: button.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
/***
|
||||
@ -233,7 +233,10 @@ wxButton *Button::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: calendar.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: calendar.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// calendar.cpp
|
||||
|
||||
@ -414,7 +414,8 @@ wxCalendarCtrl *CalendarCtrl::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: checkbox.cpp 710 2007-05-14 20:05:10Z fbraem $
|
||||
* $Id: checkbox.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -166,7 +166,8 @@ wxCheckBox *CheckBox::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: chklstbx.cpp 711 2007-05-14 20:59:29Z fbraem $
|
||||
* $Id: chklstbx.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -162,7 +162,8 @@ wxCheckListBox* CheckListBox::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: choice.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: choice.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -188,7 +188,8 @@ wxChoice* Choice::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: combobox.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: combobox.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -260,7 +260,8 @@ wxComboBox *ComboBox::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: dialog.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: dialog.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -210,7 +210,8 @@ wxDialog* Dialog::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: findrdlg.cpp 682 2007-04-24 20:38:18Z fbraem $
|
||||
* $Id: findrdlg.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// findrdlg.cpp
|
||||
|
||||
@ -166,7 +166,8 @@ wxFindReplaceDialog *FindReplaceDialog::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return p;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: frame.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: frame.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@ -350,7 +350,8 @@ wxFrame* Frame::Construct(JSContext* cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@ -490,7 +491,7 @@ JSBool Frame::processCommand(JSContext *cx,
|
||||
return JS_FALSE;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if ( p->GetHWND() == NULL )
|
||||
if ( p->GetHWND() == NULL )
|
||||
{
|
||||
JS_ReportError(cx, "%s is not yet created", GetClass()->name);
|
||||
return JS_FALSE;
|
||||
@ -605,7 +606,7 @@ JSBool Frame::createToolBar(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
||||
return JS_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
long style = wxNO_BORDER | wxTB_HORIZONTAL;
|
||||
int id = -1;
|
||||
|
||||
@ -670,7 +671,7 @@ JSBool Frame::setStatusText(JSContext *cx,
|
||||
return JS_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
wxStatusBar *statusBar = p->GetStatusBar();
|
||||
if ( statusBar != (wxStatusBar*) NULL )
|
||||
{
|
||||
@ -725,7 +726,7 @@ JSBool Frame::setStatusWidths(JSContext *cx,
|
||||
return JS_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
wxStatusBar *statusBar = p->GetStatusBar();
|
||||
if ( statusBar == (wxStatusBar*) NULL )
|
||||
return JS_TRUE;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: gauge.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: gauge.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// gauge.cpp
|
||||
|
||||
@ -217,7 +217,8 @@ wxGauge *Gauge::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: htmlwin.cpp 714 2007-05-16 20:24:49Z fbraem $
|
||||
* $Id: htmlwin.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@ -234,7 +234,8 @@ wxHtmlWindow* HtmlWindow::Construct(JSContext *cx, JSObject *obj, uintN argc, js
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: listbox.cpp 710 2007-05-14 20:05:10Z fbraem $
|
||||
* $Id: listbox.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -195,7 +195,8 @@ wxListBox* ListBox::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: listctrl.cpp 734 2007-06-06 20:09:13Z fbraem $
|
||||
* $Id: listctrl.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// ListCtrl.cpp
|
||||
#include <wx/wxprec.h>
|
||||
@ -818,7 +818,8 @@ wxListCtrl* ListCtrl::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -92,7 +92,8 @@ wxMDIParentFrame* MDIParentFrame::Construct(JSContext* cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ wxMDIChildFrame* MDIChildFrame::Construct(JSContext* cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@ -180,9 +181,9 @@ JSBool MDIChildFrame::create(JSContext* cx,
|
||||
parent = MDIParentFrame::GetPrivate(cx, argv[0]);
|
||||
if ( parent == NULL
|
||||
#ifdef __WXMSW__
|
||||
|| parent->GetHWND() == NULL
|
||||
|| parent->GetHWND() == NULL
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 1, "wxMDIParentFrame");
|
||||
return JS_FALSE;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: panel.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: panel.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// panel.cpp
|
||||
|
||||
@ -189,11 +189,12 @@ wxPanel* Panel::Construct(JSContext *cx,
|
||||
bool WXUNUSED(constructing))
|
||||
{
|
||||
wxPanel *p = new wxPanel();
|
||||
SetPrivate(cx, obj, p);
|
||||
JS_SetPrivate(cx, obj, p);
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return p;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: radiobox.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: radiobox.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// radiobox.cpp
|
||||
|
||||
@ -220,7 +220,8 @@ wxRadioBox* RadioBox::Construct(JSContext* cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: radiobtn.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: radiobtn.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -183,7 +183,8 @@ wxRadioButton* RadioButton::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: scrollwnd.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: scrollwnd.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@ -196,7 +196,8 @@ wxScrolledWindow* ScrolledWindow::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: slider.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: slider.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// slider.cpp
|
||||
|
||||
@ -334,7 +334,8 @@ wxSlider* Slider::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
397
source/tools/atlas/wxJS/gui/control/spinbtn.cpp
Normal file
397
source/tools/atlas/wxJS/gui/control/spinbtn.cpp
Normal file
@ -0,0 +1,397 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include "../../common/main.h"
|
||||
|
||||
#include "../event/jsevent.h"
|
||||
#include "../event/command.h"
|
||||
#include "../event/spinevt.h"
|
||||
|
||||
#include "spinbtn.h"
|
||||
#include "window.h"
|
||||
|
||||
#include "../misc/point.h"
|
||||
#include "../misc/size.h"
|
||||
#include "../misc/validate.h"
|
||||
#include "../errors.h"
|
||||
|
||||
using namespace wxjs;
|
||||
using namespace wxjs::gui;
|
||||
|
||||
/***
|
||||
* <module>gui</module>
|
||||
* <file>spinbtn</file>
|
||||
* <class name="wxSplitButton" prototype="@wxControl">
|
||||
* A wxSpinButton has two small up and down (or left and right) arrow buttons.
|
||||
* It is often used next to a text control for increment and decrementing a
|
||||
* value. Portable programs should try to use @wxSpinButton instead as
|
||||
* wxSpinButton is not implemented for all platforms but @wxSpinButton is as it
|
||||
* degenerates to a simple @wxTextCtrl on such platforms.
|
||||
* </class>
|
||||
*/
|
||||
WXJS_INIT_CLASS(SpinButton, "wxSpinButton", 2)
|
||||
void SpinButton::InitClass(JSContext* WXUNUSED(cx),
|
||||
JSObject* WXUNUSED(obj),
|
||||
JSObject* WXUNUSED(proto))
|
||||
{
|
||||
SpinButtonEventHandler::InitConnectEventMap();
|
||||
}
|
||||
|
||||
/***
|
||||
* <constants>
|
||||
* <type name="styles">
|
||||
* <constant name="ARROW_KEYS" />
|
||||
* <constant name="WRAP" />
|
||||
* <constant name="HORIZONTAL" />
|
||||
* <constant name="VERTICAL" />
|
||||
* </type>
|
||||
* </constants>
|
||||
*/
|
||||
WXJS_BEGIN_CONSTANT_MAP(SpinButton)
|
||||
WXJS_CONSTANT(wxSP_, ARROW_KEYS)
|
||||
WXJS_CONSTANT(wxSP_, WRAP)
|
||||
WXJS_CONSTANT(wxSP_, HORIZONTAL)
|
||||
WXJS_CONSTANT(wxSP_, VERTICAL)
|
||||
WXJS_END_CONSTANT_MAP()
|
||||
|
||||
/***
|
||||
* <properties>
|
||||
* <property name="value" type="String">
|
||||
* The value of the spin control.
|
||||
* </property>
|
||||
* <property name="min" type="Integer" readonly="Y">
|
||||
* Gets minimal allowable value.
|
||||
* </property>
|
||||
* <property name="max" type="Integer" readonly="Y">
|
||||
* Gets maximal allowable value.
|
||||
* </property>
|
||||
* </properties>
|
||||
*/
|
||||
WXJS_BEGIN_PROPERTY_MAP(SpinButton)
|
||||
WXJS_PROPERTY(P_VALUE, "value")
|
||||
WXJS_READONLY_PROPERTY(P_MIN, "min")
|
||||
WXJS_READONLY_PROPERTY(P_MAX, "max")
|
||||
WXJS_END_PROPERTY_MAP()
|
||||
|
||||
bool SpinButton::GetProperty(wxSpinButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case P_VALUE:
|
||||
*vp = ToJS(cx, p->GetValue());
|
||||
break;
|
||||
case P_MIN:
|
||||
*vp = ToJS(cx, p->GetMin());
|
||||
break;
|
||||
case P_MAX:
|
||||
*vp = ToJS(cx, p->GetMax());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpinButton::SetProperty(wxSpinButton *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case P_VALUE:
|
||||
{
|
||||
int value;
|
||||
FromJS(cx, *vp, value);
|
||||
p->SetValue(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpinButton::AddProperty(wxSpinButton *p,
|
||||
JSContext* WXUNUSED(cx),
|
||||
JSObject* WXUNUSED(obj),
|
||||
const wxString &prop,
|
||||
jsval* WXUNUSED(vp))
|
||||
{
|
||||
if ( WindowEventHandler::ConnectEvent(p, prop, true) )
|
||||
return true;
|
||||
|
||||
SpinButtonEventHandler::ConnectEvent(p, prop, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpinButton::DeleteProperty(wxSpinButton *p,
|
||||
JSContext* WXUNUSED(cx),
|
||||
JSObject* WXUNUSED(obj),
|
||||
const wxString &prop)
|
||||
{
|
||||
if ( WindowEventHandler::ConnectEvent(p, prop, false) )
|
||||
return true;
|
||||
|
||||
SpinButtonEventHandler::ConnectEvent(p, prop, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
* <ctor>
|
||||
* <function />
|
||||
* <function>
|
||||
* <arg name="parent" type="@wxWindow">
|
||||
* Parent window. Must not be NULL.
|
||||
* </arg>
|
||||
* <arg name="id" type="Integer">
|
||||
* Window identifier. A value of -1 indicates a default value.
|
||||
* </arg>
|
||||
* <arg name="pos" type="@wxPoint" default="wxDefaultPosition">
|
||||
* Window position.
|
||||
* </arg>
|
||||
* <arg name="size" type="@wxSize" default="wxDefaultSize">
|
||||
* Window size.
|
||||
* </arg>
|
||||
* <arg name="style" type="Integer" default="wxSpinButton.ARROW_KEYS">
|
||||
* Window style.
|
||||
* </arg>
|
||||
* </function>
|
||||
* <desc>
|
||||
* Create a wxSpinButton
|
||||
* </desc>
|
||||
* </ctor>
|
||||
*/
|
||||
wxSpinButton* SpinButton::Construct(JSContext *cx,
|
||||
JSObject *obj,
|
||||
uintN argc,
|
||||
jsval *argv,
|
||||
bool WXUNUSED(constructing))
|
||||
{
|
||||
wxSpinButton *p = new wxSpinButton();
|
||||
SetPrivate(cx, obj, p);
|
||||
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
WXJS_BEGIN_METHOD_MAP(SpinButton)
|
||||
WXJS_METHOD("create", create, 2)
|
||||
WXJS_METHOD("setRange", setRange, 2)
|
||||
WXJS_END_METHOD_MAP()
|
||||
|
||||
/***
|
||||
* <method name="create">
|
||||
* <function returns="Boolean">
|
||||
* <arg name="parent" type="@wxWindow">
|
||||
* Parent window. Must not be NULL.
|
||||
* </arg>
|
||||
* <arg name="id" type="Integer">
|
||||
* Window identifier. A value of -1 indicates a default value.
|
||||
* </arg>
|
||||
* <arg name="pos" type="@wxPoint" default="wxDefaultPosition">
|
||||
* Window position.
|
||||
* </arg>
|
||||
* <arg name="size" type="@wxSize" default="wxDefaultSize">
|
||||
* Window size.
|
||||
* </arg>
|
||||
* <arg name="style" type="Integer" default="wxSpinButton.HORIZONTAL">
|
||||
* Window style.
|
||||
* </arg>
|
||||
* </function>
|
||||
* <desc>
|
||||
* Create a wxSpinButton
|
||||
* </desc>
|
||||
* </method>
|
||||
*/
|
||||
JSBool SpinButton::create(JSContext *cx,
|
||||
JSObject *obj,
|
||||
uintN argc,
|
||||
jsval *argv,
|
||||
jsval *rval)
|
||||
{
|
||||
wxSpinButton *p = GetPrivate(cx, obj);
|
||||
*rval = JSVAL_FALSE;
|
||||
|
||||
if ( argc > 5 )
|
||||
argc = 5;
|
||||
|
||||
wxWindowID id = -1;
|
||||
const wxPoint *pt = &wxDefaultPosition;
|
||||
const wxSize *size = &wxDefaultSize;
|
||||
int style = wxSP_ARROW_KEYS;
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
case 5:
|
||||
if ( ! FromJS(cx, argv[4], style) )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 4, "Integer");
|
||||
return JS_FALSE;
|
||||
}
|
||||
// Fall through
|
||||
case 4:
|
||||
size = Size::GetPrivate(cx, argv[3]);
|
||||
if ( size == NULL )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxSize");
|
||||
return JS_FALSE;
|
||||
}
|
||||
// Fall through
|
||||
case 3:
|
||||
pt = Point::GetPrivate(cx, argv[2]);
|
||||
if ( pt == NULL )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 3, "wxPoint");
|
||||
return JS_FALSE;
|
||||
}
|
||||
// Fall through
|
||||
default:
|
||||
|
||||
if ( ! FromJS(cx, argv[1], id) )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_INVALID_ARG_TYPE, 2, "Integer");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
wxWindow *parent = Window::GetPrivate(cx, argv[0]);
|
||||
if ( parent == NULL )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_NO_PARENT_ERROR, GetClass()->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JavaScriptClientData *clntParent =
|
||||
dynamic_cast<JavaScriptClientData *>(parent->GetClientObject());
|
||||
if ( clntParent == NULL )
|
||||
{
|
||||
JS_ReportError(cx, WXJS_NO_PARENT_ERROR, GetClass()->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JS_SetParent(cx, obj, clntParent->GetObject());
|
||||
|
||||
if ( p->Create(parent, id, *pt, *size, style) )
|
||||
{
|
||||
*rval = JSVAL_TRUE;
|
||||
p->SetClientObject(new JavaScriptClientData(cx, obj, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* <method name="setRange">
|
||||
* <function>
|
||||
* <arg name="Min" type="Integer" />
|
||||
* <arg name="Max" type="Integer" />
|
||||
* </function>
|
||||
* <desc>
|
||||
* Sets range of allowable values.
|
||||
* </desc>
|
||||
* </method>
|
||||
*/
|
||||
JSBool SpinButton::setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
wxSpinButton *p = GetPrivate(cx, obj);
|
||||
if ( p == NULL )
|
||||
return JS_FALSE;
|
||||
|
||||
int minVal, maxVal;
|
||||
|
||||
if (! FromJS(cx, argv[0], minVal))
|
||||
return JS_FALSE;
|
||||
|
||||
if (! FromJS(cx, argv[1], maxVal))
|
||||
return JS_FALSE;
|
||||
|
||||
p->SetRange(minVal, maxVal);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* <events>
|
||||
* <event name="onSpin">
|
||||
* Generated whenever an arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* <event name="onSpinUp">
|
||||
* Generated when left/up arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* <event name="onSpinDown">
|
||||
* Generated when right/down arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* </events>
|
||||
*/
|
||||
WXJS_INIT_EVENT_MAP(wxSpinButton)
|
||||
const wxString WXJS_SPIN_EVENT = wxT("onSpin");
|
||||
const wxString WXJS_SPIN_UP_EVENT = wxT("onSpinUp");
|
||||
const wxString WXJS_SPIN_DOWN_EVENT = wxT("onSpinDown");
|
||||
|
||||
void SpinButtonEventHandler::OnSpin(wxSpinEvent &event)
|
||||
{
|
||||
PrivSpinEvent::Fire<SpinEvent>(event, WXJS_SPIN_EVENT);
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::OnSpinUp(wxSpinEvent &event)
|
||||
{
|
||||
PrivSpinEvent::Fire<SpinEvent>(event, WXJS_SPIN_UP_EVENT);
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::OnSpinDown(wxSpinEvent &event)
|
||||
{
|
||||
PrivSpinEvent::Fire<SpinEvent>(event, WXJS_SPIN_DOWN_EVENT);
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::ConnectSpin(wxSpinButton *p, bool connect)
|
||||
{
|
||||
if ( connect )
|
||||
{
|
||||
p->Connect(wxEVT_SCROLL_THUMBTRACK,
|
||||
wxSpinEventHandler(OnSpin));
|
||||
}
|
||||
else
|
||||
{
|
||||
p->Disconnect(wxEVT_SCROLL_THUMBTRACK,
|
||||
wxSpinEventHandler(OnSpin));
|
||||
}
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::ConnectSpinUp(wxSpinButton *p, bool connect)
|
||||
{
|
||||
if ( connect )
|
||||
{
|
||||
p->Connect(wxEVT_SCROLL_LINEUP,
|
||||
wxSpinEventHandler(OnSpinUp));
|
||||
}
|
||||
else
|
||||
{
|
||||
p->Disconnect(wxEVT_SCROLL_LINEUP,
|
||||
wxSpinEventHandler(OnSpinUp));
|
||||
}
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::ConnectSpinDown(wxSpinButton *p, bool connect)
|
||||
{
|
||||
if ( connect )
|
||||
{
|
||||
p->Connect(wxEVT_SCROLL_LINEDOWN,
|
||||
wxSpinEventHandler(OnSpinDown));
|
||||
}
|
||||
else
|
||||
{
|
||||
p->Disconnect(wxEVT_SCROLL_LINEDOWN,
|
||||
wxSpinEventHandler(OnSpinDown));
|
||||
}
|
||||
}
|
||||
|
||||
void SpinButtonEventHandler::InitConnectEventMap()
|
||||
{
|
||||
AddConnector(WXJS_SPIN_EVENT, ConnectSpin);
|
||||
AddConnector(WXJS_SPIN_UP_EVENT, ConnectSpinUp);
|
||||
AddConnector(WXJS_SPIN_DOWN_EVENT, ConnectSpinDown);
|
||||
}
|
75
source/tools/atlas/wxJS/gui/control/spinbtn.h
Normal file
75
source/tools/atlas/wxJS/gui/control/spinbtn.h
Normal file
@ -0,0 +1,75 @@
|
||||
#ifndef _WXJSSPINBTN_H
|
||||
#define _WXJSSPINBTN_H
|
||||
|
||||
#include "../../common/evtconn.h"
|
||||
|
||||
#include <wx/spinbutt.h>
|
||||
|
||||
namespace wxjs
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
class SpinButton : public ApiWrapper<SpinButton, wxSpinButton>
|
||||
{
|
||||
public:
|
||||
static void InitClass(JSContext* cx,
|
||||
JSObject* obj,
|
||||
JSObject* proto);
|
||||
static bool AddProperty(wxSpinButton *p,
|
||||
JSContext *cx,
|
||||
JSObject *obj,
|
||||
const wxString &prop,
|
||||
jsval *vp);
|
||||
static bool DeleteProperty(wxSpinButton *p,
|
||||
JSContext* cx,
|
||||
JSObject* obj,
|
||||
const wxString &prop);
|
||||
static bool GetProperty(wxSpinButton *p,
|
||||
JSContext *cx,
|
||||
JSObject *obj,
|
||||
int id,
|
||||
jsval *vp);
|
||||
static bool SetProperty(wxSpinButton *p,
|
||||
JSContext *cx,
|
||||
JSObject *obj,
|
||||
int id,
|
||||
jsval *vp);
|
||||
|
||||
static wxSpinButton* Construct(JSContext *cx,
|
||||
JSObject *obj,
|
||||
uintN argc,
|
||||
jsval *argv,
|
||||
bool constructing);
|
||||
|
||||
WXJS_DECLARE_METHOD_MAP()
|
||||
WXJS_DECLARE_METHOD(create)
|
||||
WXJS_DECLARE_METHOD(setRange)
|
||||
|
||||
WXJS_DECLARE_CONSTANT_MAP()
|
||||
|
||||
WXJS_DECLARE_PROPERTY_MAP()
|
||||
enum
|
||||
{
|
||||
P_VALUE
|
||||
, P_MIN
|
||||
, P_MAX
|
||||
};
|
||||
};
|
||||
|
||||
class SpinButtonEventHandler : public EventConnector<wxSpinButton>
|
||||
, public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
void OnSpin(wxSpinEvent &event);
|
||||
void OnSpinUp(wxSpinEvent &event);
|
||||
void OnSpinDown(wxSpinEvent &event);
|
||||
static void InitConnectEventMap();
|
||||
private:
|
||||
static void ConnectSpin(wxSpinButton *p, bool connect);
|
||||
static void ConnectSpinUp(wxSpinButton *p, bool connect);
|
||||
static void ConnectSpinDown(wxSpinButton *p, bool connect);
|
||||
};
|
||||
}; // namespace gui
|
||||
}; // namespace wxjs
|
||||
|
||||
#endif //_WXJSSPINBTN_H
|
@ -3,7 +3,6 @@
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
#include <wx/file.h>
|
||||
|
||||
#include "../../common/main.h"
|
||||
|
||||
@ -22,6 +21,13 @@
|
||||
using namespace wxjs;
|
||||
using namespace wxjs::gui;
|
||||
|
||||
/***
|
||||
* <module>gui</module>
|
||||
* <file>spinctrl</file>
|
||||
* <class name="wxSplitCtrl" prototype="@wxControl">
|
||||
* wxSpinCtrl combines @wxTextCtrl and @wxSpinButton in one control.
|
||||
* </class>
|
||||
*/
|
||||
WXJS_INIT_CLASS(SpinCtrl, "wxSpinCtrl", 1)
|
||||
void SpinCtrl::InitClass(JSContext* WXUNUSED(cx),
|
||||
JSObject* WXUNUSED(obj),
|
||||
@ -30,17 +36,38 @@ void SpinCtrl::InitClass(JSContext* WXUNUSED(cx),
|
||||
SpinCtrlEventHandler::InitConnectEventMap();
|
||||
}
|
||||
|
||||
/***
|
||||
* <constants>
|
||||
* <type name="styles">
|
||||
* <constant name="ARROW_KEYS" />
|
||||
* <constant name="WRAP" />
|
||||
* </type>
|
||||
* </constants>
|
||||
*/
|
||||
WXJS_BEGIN_CONSTANT_MAP(SpinCtrl)
|
||||
WXJS_CONSTANT(wxSP_, ARROW_KEYS)
|
||||
WXJS_CONSTANT(wxSP_, WRAP)
|
||||
WXJS_END_CONSTANT_MAP()
|
||||
|
||||
/***
|
||||
* <properties>
|
||||
* <property name="value" type="String">
|
||||
* The value of the spin control.
|
||||
* </property>
|
||||
* <property name="min" type="Integer" readonly="Y">
|
||||
* Gets minimal allowable value.
|
||||
* </property>
|
||||
* <property name="max" type="Integer" readonly="Y">
|
||||
* Gets maximal allowable value.
|
||||
* </property>
|
||||
* </properties>
|
||||
*/
|
||||
WXJS_BEGIN_PROPERTY_MAP(SpinCtrl)
|
||||
WXJS_PROPERTY(P_VALUE, "value")
|
||||
WXJS_READONLY_PROPERTY(P_MIN, "min")
|
||||
WXJS_READONLY_PROPERTY(P_MAX, "max")
|
||||
WXJS_END_PROPERTY_MAP()
|
||||
|
||||
WXJS_BEGIN_CONSTANT_MAP(SpinCtrl)
|
||||
WXJS_CONSTANT(wxSP_, ARROW_KEYS)
|
||||
WXJS_CONSTANT(wxSP_, WRAP)
|
||||
WXJS_END_CONSTANT_MAP()
|
||||
|
||||
bool SpinCtrl::GetProperty(wxSpinCtrl *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
{
|
||||
switch (id)
|
||||
@ -99,6 +126,43 @@ bool SpinCtrl::DeleteProperty(wxSpinCtrl *p,
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
* <ctor>
|
||||
* <function />
|
||||
* <function>
|
||||
* <arg name="parent" type="@wxWindow">
|
||||
* Parent window. Must not be NULL.
|
||||
* </arg>
|
||||
* <arg name="id" type="Integer" default="-1">
|
||||
* Window identifier. A value of -1 indicates a default value.
|
||||
* </arg>
|
||||
* <arg name="value" type="String" default="">
|
||||
* Default value.
|
||||
* </arg>
|
||||
* <arg name="pos" type="@wxPoint" default="wxDefaultPosition">
|
||||
* Window position.
|
||||
* </arg>
|
||||
* <arg name="size" type="@wxSize" default="wxDefaultSize">
|
||||
* Window size.
|
||||
* </arg>
|
||||
* <arg name="style" type="Integer" default="wxSpinCtrl.ARROW_KEYS">
|
||||
* Window style.
|
||||
* </arg>
|
||||
* <arg name="min" type="Integer" default="0">
|
||||
* Minimal value.
|
||||
* </arg>
|
||||
* <arg name="max" type="Integer" default="100">
|
||||
* Maximal value.
|
||||
* </arg>
|
||||
* <arg name="initial" type="Integer default="0">
|
||||
* Initial value.
|
||||
* </arg>
|
||||
* </function>
|
||||
* <desc>
|
||||
* Create a wxSpinCtrl
|
||||
* </desc>
|
||||
* </ctor>
|
||||
*/
|
||||
wxSpinCtrl* SpinCtrl::Construct(JSContext *cx,
|
||||
JSObject *obj,
|
||||
uintN argc,
|
||||
@ -118,10 +182,47 @@ wxSpinCtrl* SpinCtrl::Construct(JSContext *cx,
|
||||
}
|
||||
|
||||
WXJS_BEGIN_METHOD_MAP(SpinCtrl)
|
||||
WXJS_METHOD("setRange", setRange, 2)
|
||||
WXJS_METHOD("setSelection", setSelection, 2)
|
||||
WXJS_METHOD("create", create, 1)
|
||||
WXJS_METHOD("setRange", setRange, 2)
|
||||
WXJS_METHOD("setSelection", setSelection, 2)
|
||||
WXJS_END_METHOD_MAP()
|
||||
|
||||
/***
|
||||
* <method name="create">
|
||||
* <function returns="Boolean">
|
||||
* <arg name="parent" type="@wxWindow">
|
||||
* Parent window. Must not be NULL.
|
||||
* </arg>
|
||||
* <arg name="id" type="Integer" default="-1">
|
||||
* Window identifier. A value of -1 indicates a default value.
|
||||
* </arg>
|
||||
* <arg name="value" type="String" default="">
|
||||
* Default value.
|
||||
* </arg>
|
||||
* <arg name="pos" type="@wxPoint" default="wxDefaultPosition">
|
||||
* Window position.
|
||||
* </arg>
|
||||
* <arg name="size" type="@wxSize" default="wxDefaultSize">
|
||||
* Window size.
|
||||
* </arg>
|
||||
* <arg name="style" type="Integer" default="wxSpinCtrl.ARROW_KEYS">
|
||||
* Window style.
|
||||
* </arg>
|
||||
* <arg name="min" type="Integer" default="0">
|
||||
* Minimal value.
|
||||
* </arg>
|
||||
* <arg name="max" type="Integer" default="100">
|
||||
* Maximal value.
|
||||
* </arg>
|
||||
* <arg name="initial" type="Integer default="0">
|
||||
* Initial value.
|
||||
* </arg>
|
||||
* </function>
|
||||
* <desc>
|
||||
* Create a wxSpinCtrl
|
||||
* </desc>
|
||||
* </method>
|
||||
*/
|
||||
JSBool SpinCtrl::create(JSContext *cx,
|
||||
JSObject *obj,
|
||||
uintN argc,
|
||||
@ -226,6 +327,18 @@ JSBool SpinCtrl::create(JSContext *cx,
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* <method name="setSelection">
|
||||
* <function>
|
||||
* <arg name="From" type="Integer" />
|
||||
* <arg name="To" type="Integer" />
|
||||
* </function>
|
||||
* <desc>
|
||||
* Select the text in the text part of the control between positions from
|
||||
* (inclusive) and to (exclusive). This is similar to @wxTextCtrl#setSelection.
|
||||
* </desc>
|
||||
* </method>
|
||||
*/
|
||||
JSBool SpinCtrl::setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
wxSpinCtrl *p = GetPrivate(cx, obj);
|
||||
@ -245,6 +358,17 @@ JSBool SpinCtrl::setSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *a
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* <method name="setRange">
|
||||
* <function>
|
||||
* <arg name="Min" type="Integer" />
|
||||
* <arg name="Max" type="Integer" />
|
||||
* </function>
|
||||
* <desc>
|
||||
* Sets range of allowable values.
|
||||
* </desc>
|
||||
* </method>
|
||||
*/
|
||||
JSBool SpinCtrl::setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
wxSpinCtrl *p = GetPrivate(cx, obj);
|
||||
@ -264,6 +388,30 @@ JSBool SpinCtrl::setRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* <events>
|
||||
* <event name="onText">
|
||||
* See @wxTextCtrl#onText
|
||||
* </event>
|
||||
* <event name="onSpinCtrl">
|
||||
* Called whenever the numeric value of the spinctrl is updated.
|
||||
* The method takes a @wxSpinEvent.
|
||||
* </event>
|
||||
* <event name="onSpin">
|
||||
* Generated whenever an arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* <event name="onSpinUp">
|
||||
* Generated when left/up arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* <event name="onSpinDown">
|
||||
* Generated when right/down arrow is pressed. A @wxSpinEvent is passed
|
||||
* as argument.
|
||||
* </event>
|
||||
* </event>
|
||||
* </events>
|
||||
*/
|
||||
WXJS_INIT_EVENT_MAP(wxSpinCtrl)
|
||||
const wxString WXJS_TEXT_EVENT = wxT("onText");
|
||||
const wxString WXJS_SPIN_CTRL_EVENT = wxT("onSpinCtrl");
|
||||
@ -366,7 +514,6 @@ void SpinCtrlEventHandler::ConnectSpinDown(wxSpinCtrl *p, bool connect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SpinCtrlEventHandler::InitConnectEventMap()
|
||||
{
|
||||
AddConnector(WXJS_TEXT_EVENT, ConnectText);
|
||||
|
@ -61,7 +61,6 @@ namespace wxjs
|
||||
, public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
// Events
|
||||
void OnText(wxCommandEvent &event);
|
||||
void OnSpinCtrl(wxSpinEvent &event);
|
||||
void OnSpin(wxSpinEvent &event);
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: splitwin.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: splitwin.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -299,7 +299,8 @@ wxSplitterWindow* SplitterWindow::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: statbar.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: statbar.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// wxJSStatusBar.cpp
|
||||
|
||||
@ -232,7 +232,8 @@ wxStatusBar* StatusBar::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: staticbx.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: staticbx.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -112,7 +112,7 @@ wxStaticBox* StaticBox::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
if (! create(cx, obj, argc, argv, &rval))
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: sttext.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: sttext.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -167,7 +167,8 @@ wxStaticText* StaticText::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: textctrl.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: textctrl.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -302,7 +302,8 @@ wxTextCtrl* TextCtrl::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: toolbar.cpp 708 2007-05-14 15:30:45Z fbraem $
|
||||
* $Id: toolbar.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
@ -276,7 +276,8 @@ wxToolBar* ToolBar::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: treectrl.cpp 734 2007-06-06 20:09:13Z fbraem $
|
||||
* $Id: treectrl.cpp 746 2007-06-11 20:58:21Z fbraem $
|
||||
*/
|
||||
// wxJSTreeCtrl.cpp
|
||||
|
||||
@ -407,7 +407,8 @@ wxTreeCtrl* TreeCtrl::Construct(JSContext *cx,
|
||||
if ( argc > 0 )
|
||||
{
|
||||
jsval rval;
|
||||
create(cx, obj, argc, argv, &rval);
|
||||
if ( ! create(cx, obj, argc, argv, &rval) )
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: window.cpp 733 2007-06-05 21:17:25Z fbraem $
|
||||
* $Id: window.cpp 745 2007-06-11 20:16:54Z fbraem $
|
||||
*/
|
||||
// window.cpp
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: window.h 709 2007-05-14 19:57:41Z fbraem $
|
||||
* $Id: window.h 745 2007-06-11 20:16:54Z fbraem $
|
||||
*/
|
||||
#ifndef _WXJSWINDOW_H
|
||||
#define _WXJSWINDOW_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: command.cpp 598 2007-03-07 20:13:28Z fbraem $
|
||||
* $Id: command.cpp 744 2007-06-11 19:57:09Z fbraem $
|
||||
*/
|
||||
// command.cpp
|
||||
|
||||
@ -49,6 +49,11 @@ WXJS_INIT_CLASS(CommandEvent, "wxCommandEvent", 0)
|
||||
|
||||
/***
|
||||
* <properties>
|
||||
* <property name="integer" type="Integer" readonly="Y">
|
||||
* Returns the integer identifier corresponding to a listbox, choice or
|
||||
* radiobox selection (only if the event was a selection, not a deselection)
|
||||
* , or a boolean value representing the value of a checkbox.
|
||||
* </property>
|
||||
* <property name="checked" type="Boolean" readonly="Y">
|
||||
* This can be used for menus or checkboxes to check if they are checked or not
|
||||
* </property>
|
||||
@ -82,9 +87,9 @@ bool CommandEvent::GetProperty(PrivCommandEvent *p, JSContext *cx, JSObject *obj
|
||||
case P_STRING:
|
||||
*vp = ToJS(cx, event->GetString());
|
||||
break;
|
||||
case P_INTEGER:
|
||||
*vp = ToJS(cx, event->GetInt());
|
||||
break;
|
||||
case P_INTEGER:
|
||||
*vp = ToJS(cx, event->GetInt());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: command.h 598 2007-03-07 20:13:28Z fbraem $
|
||||
* $Id: command.h 744 2007-06-11 19:57:09Z fbraem $
|
||||
*/
|
||||
#ifndef _WXJSCommandEvent_H
|
||||
#define _WXJSCommandEvent_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
* $Id: jsevent.cpp 693 2007-05-03 20:37:24Z fbraem $
|
||||
* $Id: jsevent.cpp 744 2007-06-11 19:57:09Z fbraem $
|
||||
*/
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@ -47,11 +47,11 @@
|
||||
#include "sizeevt.h"
|
||||
#include "htmllink.h"
|
||||
#include "split.h"
|
||||
#include "spinevt.h"
|
||||
|
||||
#include "notify.h"
|
||||
#include "listevt.h"
|
||||
#include "treeevt.h"
|
||||
#include "spinevt.h"
|
||||
|
||||
using namespace wxjs;
|
||||
using namespace wxjs::gui;
|
||||
@ -178,5 +178,5 @@ bool wxjs::gui::InitEventClasses(JSContext *cx, JSObject *global)
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
@ -16,13 +16,32 @@
|
||||
using namespace wxjs;
|
||||
using namespace wxjs::gui;
|
||||
|
||||
/***
|
||||
* <module>gui</module>
|
||||
* <file>event/spinevt</file>
|
||||
* <class name="wxSpinEvent" prototype="@wxNotifyEvent">
|
||||
* This event class is used for the events generated by @wxSpinButton
|
||||
* and @wxSpinCtrl.
|
||||
* </class>
|
||||
*/
|
||||
WXJS_INIT_CLASS(SpinEvent, "wxSpinEvent", 0)
|
||||
|
||||
/***
|
||||
* <properties>
|
||||
* <property name="position" type="Integer">
|
||||
* Get/Set the current spin button or control value.
|
||||
* </property>
|
||||
* </properties>
|
||||
*/
|
||||
WXJS_BEGIN_PROPERTY_MAP(SpinEvent)
|
||||
WXJS_PROPERTY(P_POSITION, "position")
|
||||
WXJS_END_PROPERTY_MAP()
|
||||
|
||||
bool SpinEvent::GetProperty(PrivSpinEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
bool SpinEvent::GetProperty(PrivSpinEvent *p,
|
||||
JSContext *cx,
|
||||
JSObject* WXUNUSED(obj),
|
||||
int id,
|
||||
jsval *vp)
|
||||
{
|
||||
wxSpinEvent *event = (wxSpinEvent*) p->GetEvent();
|
||||
|
||||
@ -35,7 +54,11 @@ bool SpinEvent::GetProperty(PrivSpinEvent *p, JSContext *cx, JSObject *obj, int
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpinEvent::SetProperty(PrivSpinEvent *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
bool SpinEvent::SetProperty(PrivSpinEvent *p,
|
||||
JSContext *cx,
|
||||
JSObject* WXUNUSED(obj),
|
||||
int id,
|
||||
jsval *vp)
|
||||
{
|
||||
wxSpinEvent *event = (wxSpinEvent*) p->GetEvent();
|
||||
|
||||
|
@ -62,7 +62,6 @@
|
||||
// Controls
|
||||
#include "control/control.h"
|
||||
#include "control/textctrl.h"
|
||||
#include "control/spinctrl.h"
|
||||
#include "control/button.h"
|
||||
#include "control/bmpbtn.h"
|
||||
#include "control/sttext.h"
|
||||
@ -89,6 +88,8 @@
|
||||
#include "control/pwdlg.h"
|
||||
#include "control/scrollwnd.h"
|
||||
#include "control/htmlwin.h"
|
||||
#include "control/spinctrl.h"
|
||||
#include "control/spinbtn.h"
|
||||
|
||||
// Validators
|
||||
#include "misc/validate.h"
|
||||
@ -224,11 +225,6 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
obj = SpinCtrl::JSInit(cx, global, Control::GetClassPrototype());
|
||||
wxASSERT_MSG(obj != NULL, wxT("wxSpinCtrl 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 )
|
||||
@ -333,7 +329,7 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
|
||||
wxASSERT_MSG(obj != NULL, wxT("wxTimer prototype creation failed"));
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
|
||||
obj = Point::JSInit(cx, global);
|
||||
wxASSERT_MSG(obj != NULL, wxT("wxPoint prototype creation failed"));
|
||||
if (! obj )
|
||||
@ -626,6 +622,16 @@ bool wxjs::gui::InitClass(JSContext *cx, JSObject *global)
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
obj = SpinCtrl::JSInit(cx, global, Control::GetClassPrototype());
|
||||
wxASSERT_MSG(obj != NULL, wxT("wxSpinCtrl prototype creation failed"));
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
obj = SpinButton::JSInit(cx, global, Control::GetClassPrototype());
|
||||
wxASSERT_MSG(obj != NULL, wxT("wxSpinButton prototype creation failed"));
|
||||
if (! obj )
|
||||
return false;
|
||||
|
||||
// Define the global functions
|
||||
InitFunctions(cx, global);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user