]> git.decadent.org.uk Git - ion3.git/blob - mod_query/fwarn.c
Imported Upstream version 20090110
[ion3.git] / mod_query / fwarn.c
1 /*
2  * ion/mod_query/query.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2009. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9
10 #include <ioncore/common.h>
11 #include <ioncore/global.h>
12 #include <ioncore/focus.h>
13 #include <ioncore/frame.h>
14 #include <ioncore/stacking.h>
15 #include <libtu/objp.h>
16 #include "wmessage.h"
17 #include "fwarn.h"
18
19
20 /*(internal) EXTL_DOC
21  * Display an error message box in the multiplexer \var{mplex}.
22  */
23 EXTL_EXPORT
24 WMessage *mod_query_do_warn(WMPlex *mplex, const char *p)
25 {
26     char *p2;
27     WMessage *wmsg;
28     
29     if(p==NULL)
30         return NULL;
31     
32     p2=scat(TR("Error:\n"), p);
33     
34     if(p2==NULL)
35         return NULL;
36     
37     wmsg=mod_query_do_message(mplex, p2);
38     
39     free(p2);
40     
41     return wmsg;
42 }
43
44
45 /*(internal) EXTL_DOC
46  * Display a message in the \var{mplex}.
47  */
48 EXTL_EXPORT
49 WMessage *mod_query_do_message(WMPlex *mplex, const char *p)
50 {
51     WMPlexAttachParams par;
52
53     if(p==NULL)
54         return NULL;
55     
56     par.flags=(MPLEX_ATTACH_SWITCHTO|
57                MPLEX_ATTACH_LEVEL|
58                MPLEX_ATTACH_UNNUMBERED|
59                MPLEX_ATTACH_SIZEPOLICY);
60     par.szplcy=SIZEPOLICY_FULL_BOUNDS;
61     par.level=STACKING_LEVEL_MODAL1+2;
62
63     return (WMessage*)mplex_do_attach_new(mplex, &par,
64                                           (WRegionCreateFn*)create_wmsg,
65                                           (void*)p);
66 }
67