1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/** \file
* \brief IupMessageDlg class
*
* See Copyright Notice in "iup.h"
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <stdarg.h>
#include <limits.h>
#include "iup.h"
#include "iup_object.h"
#include "iup_stdcontrols.h"
Ihandle* IupMessageDlg(void)
{
return IupCreate("messagedlg");
}
Iclass* iupMessageDlgGetClass(void)
{
Iclass* ic = iupClassNew(iupDialogGetClass());
ic->name = "messagedlg";
ic->nativetype = IUP_TYPEDIALOG;
ic->is_interactive = 1;
/* reset not used native dialog methods */
ic->parent->LayoutUpdate = NULL;
ic->parent->SetChildrenPosition = NULL;
ic->parent->Map = NULL;
ic->parent->UnMap = NULL;
iupdrvMessageDlgInitClass(ic);
/* only the default values */
iupClassRegisterAttribute(ic, "DIALOGTYPE", NULL, NULL, IUPAF_SAMEASSYSTEM, "MESSAGE", IUPAF_NO_INHERIT);
iupClassRegisterAttribute(ic, "BUTTONS", NULL, NULL, IUPAF_SAMEASSYSTEM, "OK", IUPAF_NO_INHERIT);
iupClassRegisterAttribute(ic, "BUTTONDEFAULT", NULL, NULL, IUPAF_SAMEASSYSTEM, "1", IUPAF_NO_INHERIT);
iupClassRegisterAttribute(ic, "BUTTONRESPONSE", NULL, NULL, IUPAF_SAMEASSYSTEM, "1", IUPAF_NO_INHERIT);
return ic;
}
void IupMessage(const char* title, const char* message)
{
Ihandle* dlg = IupCreate("messagedlg");
IupSetAttribute(dlg, "TITLE", (char*)title);
IupSetAttribute(dlg, "VALUE", (char*)message);
IupSetAttribute(dlg, "PARENTDIALOG", IupGetGlobal("PARENTDIALOG"));
IupPopup(dlg, IUP_CENTER, IUP_CENTER);
IupDestroy(dlg);
}
void IupMessagef(const char *title, const char *format, ...)
{
static char message[SHRT_MAX];
va_list arglist;
va_start(arglist, format);
vsprintf(message, format, arglist);
va_end (arglist);
IupMessage(title, message);
}
|