1 #include <../../nrnconf.h>
12 #include <InterViews/adjust.h>
13 #include <InterViews/hit.h>
35 virtual void drag(
const Event& e);
38 virtual void reload();
40 virtual void set_select_action(
const char*,
bool on_rel =
false,
Object* pyact =
NULL);
41 virtual void set_accept_action(
const char*,
Object* pyact =
NULL);
42 virtual void accept();
43 virtual void release(
const Event&);
89 b_->select_and_adjust(
count() - 1);
191 b_->remove_selectable(
i);
206 for (
long i = 0;
i <
oli_.size(); ++
i) {
229 for (
auto& ob:
oli_) {
278 b->select_and_adjust(
i);
292 on_rel = (bool)
chkarg(2, 0, 1);
297 b->set_select_action(
gargstr(1), on_rel);
331 b->set_accept_action(
gargstr(1));
399 return list->
count();
405 if (
i >= 0 && i < list->count()) {
422 if (!
s ||
s->type != TEMPLATE) {
425 ct_ =
s->u.ctemplate;
467 for (
i = 0;
i <
cnt; ++
i) {
470 if (obj && obj != oblook &&
525 OcListBrowser::OcListBrowser(
OcList* ocl,
const char* items,
Object* pystract)
529 select_action_ =
NULL;
530 accept_action_ =
NULL;
532 label_action_ =
NULL;
533 label_pystract_ =
NULL;
540 items_ =
new CopyString(items);
547 OcListBrowser::OcListBrowser(
OcList* ocl,
char** pstr,
const char* action)
551 select_action_ =
NULL;
552 accept_action_ =
NULL;
558 label_pystract_ =
NULL;
562 OcListBrowser::~OcListBrowser() {
563 if (select_action_) {
564 delete select_action_;
566 if (accept_action_) {
567 delete accept_action_;
570 delete label_action_;
572 if (label_pystract_) {
573 delete label_pystract_;
580 void OcListBrowser::release(
const Event& e) {
581 OcBrowser::release(e);
582 if (select_action_ && on_release_) {
586 select_action_->execute();
603 OcBrowser::select(
i);
605 if (select_action_ && !on_release_ && !ignore_) {
608 select_action_->execute();
613 OcBrowser::select(
i);
615 if (old !=
i && select_action_ && !on_release_ && !ignore_) {
618 select_action_->execute();
622 void OcListBrowser::drag(
const Event& e) {
627 dragselect(h.index(0));
634 void OcListBrowser::reload() {
637 for (
i = 0;
i <
cnt; ++
i) {
638 remove_selectable(0);
642 for (
i = 0;
i <
cnt; ++
i) {
657 if (label_pystract_) {
660 if (label_pystract_->exec_strret(
buf, 256,
bool(
false))) {
663 change_item(
i,
"label error");
665 }
else if (plabel_) {
667 if (label_action_->execute(
bool(
false)) == 0) {
668 change_item(
i, *plabel_);
670 change_item(
i,
"label error");
675 change_item(
i, pstr);
684 void OcListBrowser::set_select_action(
const char*
s,
bool on_rel,
Object* pyact) {
685 if (select_action_) {
686 delete select_action_;
693 on_release_ = on_rel;
695 void OcListBrowser::set_accept_action(
const char*
s,
Object* pyact) {
696 if (accept_action_) {
697 delete accept_action_;
705 void OcListBrowser::accept() {
706 if (accept_action_) {
713 accept_action_->execute();
716 void OcListBrowser::ocglyph(
Window* w) {
717 ocg_ = (
OcGlyph*) (w->glyph());
721 void OcListBrowser::ocglyph_unmap() {
static void Detach(cTemplate *, Observer *)
static void Attach(cTemplate *, Observer *)
virtual const char * name() const
static char * object_str(const char *symname, Object *=NULL)
virtual PrintableWindow * window()
virtual bool has_window()
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
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
Symbol * hoc_table_lookup(const char *, Symlist *)
HocReturnType hoc_return_type_code
double chkarg(int, double low, double high)
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)
void check_obj_type(Object *obj, const char *type_name)
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 *)
void hoc_execerror(const char *s1, const char *s2)
std::string to_string(const T &obj)
int const size_t const size_t n
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)
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 double l_scroll_pos(void *v)
static double l_browser(void *v)
static Member_func l_members[]
void *(* constructor)(struct Object *)