1 #include <../../nrnconf.h> 15 #include <InterViews/adjust.h> 16 #include <InterViews/hit.h> 51 virtual void reload();
53 virtual void set_select_action(
const char*,
bool on_rel =
false,
Object* pyact=
NULL);
54 virtual void set_accept_action(
const char*,
Object* pyact=
NULL);
55 virtual void accept();
85 if(!o || o->ctemplate != list_class_sym_->
u.
ctemplate) {
102 b_->load_item(count()-1);
103 b_->select_and_adjust(count()-1);
198 Object* ob = oli_->item(i);
203 b_->remove_selectable(i);
218 long i,
cnt = oli_->count();
219 for (i=0; i <
cnt; ++
i) {
220 if (oli_->item(i) == ob) {
233 return oli_->item(i);
242 long i,
cnt = oli_->count();
243 for (i = 0; i <
cnt; ++
i) {
244 Object* ob = oli_->item(i);
293 b->select_and_adjust(i);
307 on_rel = (bool)
chkarg(2, 0, 1);
312 b->set_select_action(
gargstr(1), on_rel);
346 b->set_accept_action(
gargstr(1));
364 c = (double)o->count() - a->cur_length(
Dimension_Y) -
c;
368 return (
double)(o->count()-1) - (
double)a->cur_upper(
Dimension_Y);
417 return list->
count();
422 if (i >= 0 && i < list->count()) {
430 oli_ =
new OcListImpl(n);
440 if (!s || s->
type != TEMPLATE) {
444 int cnt = ct_->count;
446 oli_ =
new OcListImpl(cnt);
483 for (
long i=0;
i <
cnt; ++
i) {
492 for (
long i = 0;
i <
cnt; ++
i) {
512 if (oblook->ctemplate->constructor ==
l_cons) {
516 for (i=0; i <
cnt; ++
i) {
519 if (obj && obj != oblook &&
525 sprintf(buf,
"object(%ld)", i);
576 select_action_ =
NULL;
577 accept_action_ =
NULL;
579 label_action_ =
NULL;
580 label_pystract_ =
NULL;
594 OcListBrowser::OcListBrowser(
OcList* ocl,
char** pstr,
const char* action)
599 select_action_ =
NULL;
600 accept_action_ =
NULL;
606 label_pystract_ =
NULL;
610 OcListBrowser::~OcListBrowser(){
611 if (select_action_) {
612 delete select_action_;
614 if (accept_action_) {
615 delete accept_action_;
618 delete label_action_;
620 if (label_pystract_) {
621 delete label_pystract_;
630 if (select_action_ && on_release_) {
634 select_action_->execute();
651 OcBrowser::select(i);
653 if (select_action_ && !on_release_ && !ignore_) {
656 select_action_->execute();
659 void OcListBrowser::dragselect(
GlyphIndex i) {
661 OcBrowser::select(i);
663 if (old != i && select_action_ && !on_release_ && !ignore_) {
666 select_action_->execute();
675 dragselect(h.index(0));
682 void OcListBrowser::reload() {
685 for (i=0; i <
cnt; ++
i) {
686 remove_selectable(0);
690 for (i=0; i <
cnt; ++
i) {
704 void OcListBrowser::change_name(
GlyphIndex i) {
705 if (label_pystract_) {
708 if (label_pystract_->exec_strret(buf, 256,
bool(
false))) {
711 change_item(i,
"label error");
715 if (label_action_->execute(
bool(
false)) == 0) {
716 change_item(i, *plabel_);
718 change_item(i,
"label error");
723 change_item(i, pstr);
732 void OcListBrowser::set_select_action(
const char*
s,
bool on_rel,
Object* pyact) {
733 if (select_action_) {
734 delete select_action_;
741 on_release_ = on_rel;
743 void OcListBrowser::set_accept_action(
const char* s,
Object* pyact) {
744 if (accept_action_) {
745 delete accept_action_;
753 void OcListBrowser::accept() {
754 if (accept_action_) {
761 accept_action_->execute();
764 void OcListBrowser::ocglyph(
Window* w) {
769 void OcListBrowser::ocglyph_unmap() {
virtual bool has_window()
void hoc_path_prepend(char *, const char *, const char *)
static double l_remove(void *v)
static Member_ret_obj_func l_retobj_members[]
int hoc_is_str_arg(int narg)
static char * object_str(const char *symname, Object *=NULL)
static void l_destruct(void *v)
Object * ivoc_list_item(Object *, int)
#define ITERATE(itm, lst)
static double inside(void *)
Symbol * hoc_lookup(const char *)
bool hoc_objectpath_impl(Object *ob, Object *oblook, char *path, int depth)
char * hoc_object_name(Object *ob)
#define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v)
declarePtrList(OcListImpl, Object)
static double l_prepend(void *v)
static double l_index(void *v)
check_obj_type(o, "SectionList")
Object ** hoc_temp_objptr(Object *)
char ** hoc_pgargstr(int narg)
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
virtual const char * name() const
static Symbol * list_class_sym_
static void chk_list(Object *o)
OcListBrowser * browser()
double(* nrnpy_object_to_double_)(Object *)
int ivoc_list_look(Object *ob, Object *oblook, char *path, int)
static void Detach(cTemplate *, Observer *)
void append(Item *ql, Item *q)
int const size_t const size_t n
static Member_func l_members[]
virtual PrintableWindow * window()
static void Attach(cTemplate *, Observer *)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Symlist * hoc_top_level_symlist
static double l_count(void *v)
static double l_insert(void *v)
void hoc_execerror(const char *, const char *)
void create_browser(const char *name, const char *items=NULL, Object *pystract=NULL)
int ivoc_list_count(Object *)
void hoc_dec_refcount(Object **pobj)
static double l_append(void *v)
virtual void unref() const
static Checkpoint * instance()
static Object ** l_object(void *v)
static double l_select(void *v)
static double l_accept_action(void *v)
HocStruct cTemplate * ctemplate
virtual void update(Observable *)
Symbol * hoc_table_lookup(const char *, Symlist *)
static double l_selected(void *v)
static double l_scroll_pos(void *v)
static double l_browser(void *v)
void insert(long, Object *)
static double l_select_action(void *v)
int hoc_is_object_arg(int narg)
static void * l_cons(Object *)
static double l_remove_all(void *v)
Object ** hoc_objgetarg(int)
double chkarg(int, double low, double high)
implementPtrList(OcListImpl, Object)
static int l_chkpt(void **vp)