2 * ion/mod_query/query.c
4 * Copyright (c) Tuomo Valkonen 1999-2007.
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.
12 #include <libextl/extl.h>
14 #include <ioncore/common.h>
15 #include <ioncore/global.h>
16 #include <ioncore/binding.h>
17 #include <ioncore/regbind.h>
18 #include <ioncore/bindmaps.h>
19 #include <ioncore/key.h>
24 /*--lowlevel routine not to be called by the user--EXTL_DOC
25 * Show a query window in \var{mplex} with prompt \var{prompt}, initial
26 * contents \var{dflt}. The function \var{handler} is called with
27 * the entered string as the sole argument when \fnref{WEdln.finish}
28 * is called. The function \var{completor} is called with the created
29 * \type{WEdln} is first argument and the string to complete is the
30 * second argument when \fnref{WEdln.complete} is called.
33 WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt,
34 ExtlFn handler, ExtlFn completor,
35 ExtlFn cycle, ExtlFn bcycle)
38 WEdlnCreateParams fnp;
39 WMPlexAttachParams par;
45 fnp.completor=completor;
47 par.flags=(MPLEX_ATTACH_SWITCHTO|
49 MPLEX_ATTACH_UNNUMBERED|
50 MPLEX_ATTACH_SIZEPOLICY);
51 par.szplcy=SIZEPOLICY_FULL_BOUNDS;
53 wedln=(WEdln*)mplex_do_attach_new(mplex, &par,
54 (WRegionCreateFn*)create_wedln,
57 if(wedln!=NULL && cycle!=extl_fn_none()){
61 if(ioncore_current_key(&kcb, &state, &sub) && !sub){
62 wedln->cycle_bindmap=region_add_cycle_bindmap((WRegion*)wedln,