2 * ion/mod_query/query.c
4 * Copyright (c) Tuomo Valkonen 1999-2008.
6 * See the included file LICENSE for details.
9 #include <libextl/extl.h>
11 #include <ioncore/common.h>
12 #include <ioncore/global.h>
13 #include <ioncore/binding.h>
14 #include <ioncore/regbind.h>
15 #include <ioncore/bindmaps.h>
16 #include <ioncore/stacking.h>
17 #include <ioncore/key.h>
22 /*--lowlevel routine not to be called by the user--EXTL_DOC
23 * Show a query window in \var{mplex} with prompt \var{prompt}, initial
24 * contents \var{dflt}. The function \var{handler} is called with
25 * the entered string as the sole argument when \fnref{WEdln.finish}
26 * is called. The function \var{completor} is called with the created
27 * \type{WEdln} is first argument and the string to complete is the
28 * second argument when \fnref{WEdln.complete} is called.
31 WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt,
32 ExtlFn handler, ExtlFn completor,
33 ExtlFn cycle, ExtlFn bcycle)
36 WEdlnCreateParams fnp;
37 WMPlexAttachParams par;
43 fnp.completor=completor;
45 par.flags=(MPLEX_ATTACH_SWITCHTO|
47 MPLEX_ATTACH_UNNUMBERED|
48 MPLEX_ATTACH_SIZEPOLICY);
49 par.szplcy=SIZEPOLICY_FULL_BOUNDS;
50 par.level=STACKING_LEVEL_MODAL1+2;
52 wedln=(WEdln*)mplex_do_attach_new(mplex, &par,
53 (WRegionCreateFn*)create_wedln,
56 if(wedln!=NULL && cycle!=extl_fn_none()){
60 if(ioncore_current_key(&kcb, &state, &sub) && !sub){
61 wedln->cycle_bindmap=region_add_cycle_bindmap((WRegion*)wedln,