1 #include <../../nrnconf.h>
15 #include <InterViews/adjust.h>
16 #include <InterViews/hit.h>
50 virtual void reload();
52 virtual void set_select_action(
const char*,
bool on_rel =
false,
Object* pyact =
NULL);
53 virtual void set_accept_action(
const char*,
Object* pyact =
NULL);
54 virtual void accept();
101 b_->select_and_adjust(
count() - 1);
165 long i = long(
chkarg(1, 0,
o->count()));
193 long i = long(
chkarg(1, 0,
o->count() - 1));
203 b_->remove_selectable(
i);
218 for (
long i = 0;
i <
oli_.size(); ++
i) {
228 long i = long(
chkarg(1, 0,
o->count() - 1));
241 for (
auto& ob:
oli_) {
267 o->create_browser(s,
p,
i);
277 o->create_browser(s,
i);
290 b->select_and_adjust(
i);
304 on_rel = (bool)
chkarg(2, 0, 1);
309 b->set_select_action(
gargstr(1), on_rel);
343 b->set_accept_action(
gargstr(1));
366 return (
double) (
o->count() - 1) - (
double) a->cur_upper(
Dimension_Y);
411 return list->
count();
417 if (
i >= 0 && i < list->count()) {
434 if (!s || s->
type != TEMPLATE) {
475 for (
long i = 0;
i <
cnt; ++
i) {
484 for (
long i = 0;
i <
cnt; ++
i) {
504 if (oblook->ctemplate->constructor ==
l_cons) {
506 long i,
cnt =
o->count();
508 for (
i = 0;
i <
cnt; ++
i) {
511 if (obj && obj != oblook &&
567 OcListBrowser::OcListBrowser(
OcList* ocl,
const char* items,
Object* pystract)
571 select_action_ =
NULL;
572 accept_action_ =
NULL;
574 label_action_ =
NULL;
575 label_pystract_ =
NULL;
589 OcListBrowser::OcListBrowser(
OcList* ocl,
char** pstr,
const char* action)
593 select_action_ =
NULL;
594 accept_action_ =
NULL;
600 label_pystract_ =
NULL;
604 OcListBrowser::~OcListBrowser() {
605 if (select_action_) {
606 delete select_action_;
608 if (accept_action_) {
609 delete accept_action_;
612 delete label_action_;
614 if (label_pystract_) {
615 delete label_pystract_;
624 if (select_action_ && on_release_) {
628 select_action_->execute();
645 OcBrowser::select(
i);
647 if (select_action_ && !on_release_ && !ignore_) {
650 select_action_->execute();
655 OcBrowser::select(
i);
657 if (old !=
i && select_action_ && !on_release_ && !ignore_) {
660 select_action_->execute();
669 dragselect(h.index(0));
676 void OcListBrowser::reload() {
679 for (
i = 0;
i <
cnt; ++
i) {
680 remove_selectable(0);
684 for (
i = 0;
i <
cnt; ++
i) {
699 if (label_pystract_) {
702 if (label_pystract_->exec_strret(
buf, 256,
bool(
false))) {
705 change_item(
i,
"label error");
707 }
else if (plabel_) {
709 if (label_action_->execute(
bool(
false)) == 0) {
710 change_item(
i, *plabel_);
712 change_item(
i,
"label error");
717 change_item(
i, pstr);
726 void OcListBrowser::set_select_action(
const char* s,
bool on_rel,
Object* pyact) {
727 if (select_action_) {
728 delete select_action_;
735 on_release_ = on_rel;
737 void OcListBrowser::set_accept_action(
const char* s,
Object* pyact) {
738 if (accept_action_) {
739 delete accept_action_;
747 void OcListBrowser::accept() {
748 if (accept_action_) {
755 accept_action_->execute();
758 void OcListBrowser::ocglyph(
Window* w) {
759 ocg_ = (
OcGlyph*) (w->glyph());
763 void OcListBrowser::ocglyph_unmap() {
767 if (
o->has_window()) {
static Checkpoint * instance()
static void Detach(cTemplate *, Observer *)
static void Attach(cTemplate *, Observer *)
virtual const char * name() const
static char * object_str(const char *symname, Object *=NULL)
void create_browser(const char *name, const char *items=NULL, Object *pystract=NULL)
virtual void update(Observable *)
OcListBrowser * browser()
std::vector< Object * > oli_
void insert(long, Object *)
virtual void unref() const
Symbol * hoc_table_lookup(const char *, Symlist *)
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
double chkarg(int, double low, double high)
void hoc_execerror(const char *, const char *)
int hoc_is_object_arg(int narg)
Object * ivoc_list_item(Object *olist, int i)
int ivoc_list_look(Object *ob, Object *oblook, char *path, int)
int ivoc_list_count(Object *)
int hoc_is_str_arg(int narg)
char * hoc_object_name(Object *ob)
void hoc_dec_refcount(Object **pobj)
Symbol * hoc_lookup(const char *)
char ** hoc_pgargstr(int narg)
#define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v)
Object ** hoc_objgetarg(int)
#define ITERATE(itm, lst)
static double inside(void *)
int const size_t const size_t n
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
HOC interpreter function declarations (included by hocdec.h)
static double remove(void *v)
static double l_append(void *v)
static double l_accept_action(void *v)
static double l_remove_all(void *v)
static double l_count(void *v)
static Member_ret_obj_func l_retobj_members[]
bool hoc_objectpath_impl(Object *ob, Object *oblook, char *path, int depth)
Symlist * hoc_top_level_symlist
static double l_insert(void *v)
double(* nrnpy_object_to_double_)(Object *)
static void * l_cons(Object *)
static double l_select(void *v)
static double l_selected(void *v)
static double l_prepend(void *v)
Object ** hoc_temp_objptr(Object *)
static Symbol * list_class_sym_
static double l_index(void *v)
static double l_select_action(void *v)
void hoc_path_prepend(char *, const char *, const char *)
static void chk_list(Object *o)
static void l_destruct(void *v)
static double l_remove(void *v)
static Object ** l_object(void *v)
static int l_chkpt(void **vp)
static double l_scroll_pos(void *v)
static double l_browser(void *v)
static Member_func l_members[]
check_obj_type(o, "SectionList")
HocStruct cTemplate * ctemplate