Ejemplo n.º 1
0
void IMessageDlg::_init(const v8::FunctionCallbackInfo<v8::Value>& args) {
	Isolate* isolate = args.GetIsolate();
	IMessageDlg* obj = new IMessageDlg();
	// Create messagedlg
	obj->hwnd = IupMessageDlg();
	if (args.Length()>=1 && args[0]->IsNumber()) {
		int ty = args[0]->Int32Value();
		switch(ty) {
			case 1:
			IupSetStrAttribute(obj->hwnd,"BUTTONS", "OKCANCEL");
			IupSetStrAttribute(obj->hwnd,"DIALOGTYPE", "QUESTION");
			break;
			case 2:
			IupSetStrAttribute(obj->hwnd,"BUTTONS", "YESNO");
			IupSetStrAttribute(obj->hwnd,"DIALOGTYPE", "QUESTION");
			break;
			default:
			IupSetStrAttribute(obj->hwnd,"BUTTONS", "OK");
			IupSetStrAttribute(obj->hwnd,"DIALOGTYPE", "INFORMATION");
			break;
		}
	}
	if (args.Length()>=2 && args[1]->IsString()) {
		Local<String> tt = Local<String>::Cast(args[1]);
		String::Utf8Value str(tt);
		IupSetStrAttribute(obj->hwnd,"TITLE", *str);
	}
	if (args.Length()>=3 && args[2]->IsString()) {
		Local<String> tt = Local<String>::Cast(args[2]);
		String::Utf8Value str(tt);
		IupSetStrAttribute(obj->hwnd,"VALUE", *str);
	}
	obj->Wrap(args.This());
	args.GetReturnValue().Set(Undefined(isolate));
}
Ejemplo n.º 2
0
void IMessageDlg::_popup(const v8::FunctionCallbackInfo<v8::Value>& args) {
	Isolate* isolate = args.GetIsolate();
	IMessageDlg* imd = ObjectWrap::Unwrap<IMessageDlg>(args.Holder());
	if (imd != NULL) {
		if (imd->hwnd != NULL) {
			IupPopup(imd->hwnd, IUP_CURRENT, IUP_CURRENT); 
		}
	}
	args.GetReturnValue().Set(Undefined(isolate));
}
Ejemplo n.º 3
0
void IMessageDlg::_destroy(const v8::FunctionCallbackInfo<v8::Value>& args)
{
	Isolate* isolate = args.GetIsolate();
	IMessageDlg* imd = ObjectWrap::Unwrap<IMessageDlg>(args.Holder());
	if (imd != NULL) {
		if (imd->hwnd != NULL) {
			IupDestroy(imd->hwnd);
			imd->hwnd = NULL;
		}
	}
	args.GetReturnValue().Set(Undefined(isolate));
}