- the system of using the bx_param_c::set_handler() callback functions
to change the enable/disable status of other parameters worked fine for the text mode interface but poorly for the wxWindows gui. So I implemented it a different way. Now in every boolean parameter, there is a field called dependent_list which is a list of parameters which are enabled/disabled by that boolean. Having this list available allows both the text mode CI and the wxWindows CI to know which fields should be enabled and disabled as a result of a boolean changing value. - when the set() method of a bool param is called, or when the dependent_list is changed, a private method called update_dependents() changes the enabled status of all dependent parameters.
This commit is contained in:
parent
023408d33e
commit
7918513df4
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.cc,v 1.49 2002-08-30 16:23:36 bdenney Exp $
|
||||
// $Id: siminterface.cc,v 1.50 2002-09-03 08:44:55 bdenney Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// See siminterface.h for description of the siminterface concept.
|
||||
@ -574,6 +574,16 @@ bx_param_bool_c::bx_param_bool_c (bx_id id,
|
||||
{
|
||||
set_type (BXT_PARAM_BOOL);
|
||||
set (initial_val);
|
||||
dependent_list = NULL;
|
||||
}
|
||||
|
||||
void bx_param_bool_c::update_dependents ()
|
||||
{
|
||||
if (dependent_list) {
|
||||
int en = val? 1 : 0;
|
||||
for (int i=0; i<dependent_list->get_size (); i++)
|
||||
dependent_list->get (i)->set_enabled (en);
|
||||
}
|
||||
}
|
||||
|
||||
bx_param_enum_c::bx_param_enum_c (bx_id id,
|
||||
@ -688,7 +698,6 @@ bx_param_string_c::set (char *buf)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
bx_list_c::bx_list_c (bx_id id, int maxsize)
|
||||
: bx_param_c (id, "list", "")
|
||||
{
|
||||
@ -698,7 +707,6 @@ bx_list_c::bx_list_c (bx_id id, int maxsize)
|
||||
this->list = new bx_param_c* [maxsize];
|
||||
init ();
|
||||
}
|
||||
#endif
|
||||
|
||||
bx_list_c::bx_list_c (bx_id id, char *name, char *description, bx_param_c **init_list)
|
||||
: bx_param_c (id, name, description)
|
||||
|
Loading…
Reference in New Issue
Block a user