Add tooltip support to wxJS
This was SVN commit r7258.
This commit is contained in:
parent
797c9e1644
commit
3339aea2a7
@ -27,6 +27,7 @@
|
||||
// window.cpp
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/tooltip.h>
|
||||
|
||||
#include "../../common/main.h"
|
||||
#include "../../ext/wxjs_ext.h"
|
||||
@ -196,6 +197,7 @@ WXJS_BEGIN_PROPERTY_MAP(Window)
|
||||
WXJS_PROPERTY(P_BACKGROUND_COLOUR, "backgroundColour")
|
||||
WXJS_PROPERTY(P_FOREGROUND_COLOUR, "foregroundColour")
|
||||
WXJS_PROPERTY(P_FONT, "font")
|
||||
WXJS_PROPERTY(P_TOOL_TIP, "toolTip")
|
||||
WXJS_END_PROPERTY_MAP()
|
||||
|
||||
bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsval *vp)
|
||||
@ -342,6 +344,12 @@ bool Window::GetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
|
||||
case P_FONT:
|
||||
*vp = Font::CreateObject(cx, new wxFont(p->GetFont()), obj);
|
||||
break;
|
||||
case P_TOOL_TIP:
|
||||
if ( p->GetToolTip() == NULL )
|
||||
*vp = JSVAL_VOID;
|
||||
else
|
||||
*vp = ToJS(cx, p->GetToolTip()->GetTip());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -523,6 +531,18 @@ bool Window::SetProperty(wxWindow *p, JSContext *cx, JSObject *obj, int id, jsva
|
||||
p->SetFont(*font);
|
||||
break;
|
||||
}
|
||||
case P_TOOL_TIP:
|
||||
{
|
||||
if ( JSVAL_IS_VOID(*vp) )
|
||||
p->SetToolTip(NULL);
|
||||
else
|
||||
{
|
||||
wxString toolTip;
|
||||
if ( FromJS(cx, *vp, toolTip) )
|
||||
p->SetToolTip(toolTip);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ namespace wxjs
|
||||
, P_BACKGROUND_COLOUR
|
||||
, P_FOREGROUND_COLOUR
|
||||
, P_FONT
|
||||
, P_TOOL_TIP
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user