本文整理汇总了C++中tlistbox::set_callback_value_change方法的典型用法代码示例。如果您正苦于以下问题:C++ tlistbox::set_callback_value_change方法的具体用法?C++ tlistbox::set_callback_value_change怎么用?C++ tlistbox::set_callback_value_change使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tlistbox
的用法示例。
在下文中一共展示了tlistbox::set_callback_value_change方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_player_list
void ttent::init_player_list(tlistbox& list, twindow& window)
{
if (player_hero_->valid() && rpg_mode_) {
rows_mem_ = (hero_row*)malloc(sizeof(hero_row) * (heros_.size() + 1));
add_row_to_heros(list, player_hero_->number_, -1, -1, hero_stratum_citizen);
} else {
rows_mem_ = (hero_row*)malloc(sizeof(hero_row) * heros_.size());
}
std::string text;
config cfg_from_file;
wml_config_from_file(game_config::path + "/xwml/campaigns/" + campaign_config_["id"].str() + ".bin", cfg_from_file);
const config& scenario = cfg_from_file.child("scenario");
std::map<int, int> mayor_map;
std::vector<std::string> v;
int leader, city, stratum;
foreach (const config& side, scenario.child_range("side")) {
// city_map_.clear();
leader = side["leader"].to_int();
if (side.has_attribute("controller")) {
text = side["controller"].str();
if (text != "human") {
continue;
}
}
foreach (const config& c, side.child_range("artifical")) {
int mayor = -1;
if (c.has_attribute("mayor")) {
mayor = c["mayor"].to_int();
}
city = c["heros_army"].to_int();
int cityno = c["cityno"].to_int();
city_map_[cityno] = city;
city_leader_map_[cityno] = leader;
mayor_map[cityno] = mayor;
// service_heros
v = utils::split(c["service_heros"].str());
for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++ it) {
int h = lexical_cast_default<int>(*it);
if (h == leader) {
stratum = hero_stratum_leader;
} else if (h == mayor) {
stratum = hero_stratum_mayor;
} else {
stratum = hero_stratum_citizen;
}
if (rpg_mode_ || stratum == hero_stratum_leader) {
add_row_to_heros(list, h, leader, city, stratum);
}
}
if (rpg_mode_) {
// wander_heros
v = utils::split(c["wander_heros"].str());
for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++ it) {
int h = lexical_cast_default<int>(*it);
stratum = hero_stratum_wander;
// add_row_to_heros(list, h, leader, city, stratum);
}
}
}
// unit. they maybe leader
foreach (const config& u, side.child_range("unit")) {
v = utils::split(u["heros_army"].str());
for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++ it) {
int cityno = u["cityno"].to_int();
if (cityno == HEROS_DEFAULT_CITY) {
continue;
}
int h = lexical_cast_default<int>(*it);
std::map<int, int>::const_iterator it2 = mayor_map.find(cityno);
VALIDATE(it2 != mayor_map.end(), "Cannot find cityno = " + u["cityno"].str() + " duration parseing " + heros_[h].name());
int mayor = it2->second;
if (h == leader) {
stratum = hero_stratum_leader;
} else if (h == mayor) {
stratum = hero_stratum_mayor;
} else {
stratum = hero_stratum_citizen;
}
if (rpg_mode_ || stratum == hero_stratum_leader) {
std::map<int, int>::const_iterator it2 = city_map_.find(cityno);
VALIDATE(it2 != city_map_.end(), "Cannot find cityno = " + u["cityno"].str() + " duration parseing " + heros_[h].name());
add_row_to_heros(list, h, leader, it2->second, stratum);
}
}
}
}
list.set_callback_value_change(dialog_callback<ttent, &ttent::player_selected>);
// disable all sort button
tbutton* button = find_widget<tbutton>(&window, "hero_name", false, true);
button->set_active(false);
button = find_widget<tbutton>(&window, "hero_stratum", false, true);
button->set_active(false);
button = find_widget<tbutton>(&window, "hero_side", false, true);
button->set_active(false);
//.........这里部分代码省略.........