]> git.decadent.org.uk Git - ion3.git/blob - mod_query/fwarn.c
5122948e8b2fe5006e23402392cc74841f49ee5e
[ion3.git] / mod_query / fwarn.c
1 /*
2  * ion/mod_query/query.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12
13 #include <ioncore/common.h>
14 #include <ioncore/global.h>
15 #include <ioncore/focus.h>
16 #include <ioncore/frame.h>
17 #include <libtu/objp.h>
18 #include "wmessage.h"
19 #include "fwarn.h"
20
21
22 /*(internal) EXTL_DOC
23  * Display an error message box in the multiplexer \var{mplex}.
24  */
25 EXTL_EXPORT
26 WMessage *mod_query_do_warn(WMPlex *mplex, const char *p)
27 {
28     char *p2;
29     WMessage *wmsg;
30     
31     if(p==NULL)
32         return NULL;
33     
34     p2=scat(TR("Error:\n"), p);
35     
36     if(p2==NULL)
37         return NULL;
38     
39     wmsg=mod_query_do_message(mplex, p2);
40     
41     free(p2);
42     
43     return wmsg;
44 }
45
46
47 /*(internal) EXTL_DOC
48  * Display a message in the \var{mplex}.
49  */
50 EXTL_EXPORT
51 WMessage *mod_query_do_message(WMPlex *mplex, const char *p)
52 {
53     WMPlexAttachParams par;
54
55     if(p==NULL)
56         return NULL;
57     
58     par.flags=(MPLEX_ATTACH_SWITCHTO|
59                MPLEX_ATTACH_MODAL|
60                MPLEX_ATTACH_UNNUMBERED|
61                MPLEX_ATTACH_SIZEPOLICY);
62     par.szplcy=SIZEPOLICY_FULL_BOUNDS;
63
64     return (WMessage*)mplex_do_attach_new(mplex, &par,
65                                           (WRegionCreateFn*)create_wmsg,
66                                           (void*)p);
67 }
68