本文整理汇总了C++中tlistbox::get_row_panel方法的典型用法代码示例。如果您正苦于以下问题:C++ tlistbox::get_row_panel方法的具体用法?C++ tlistbox::get_row_panel怎么用?C++ tlistbox::get_row_panel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tlistbox
的用法示例。
在下文中一共展示了tlistbox::get_row_panel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: city_changed
void tside_report::city_changed(twindow& window, tlistbox& list, const int type)
{
if (candidate_cities_.empty()) {
return;
}
twidget* grid_ptr = list.get_row_panel(list.get_selected_row());
unsigned int selected_row = dynamic_cast<ttoggle_panel*>(grid_ptr)->get_data();
}
示例2: add_row
void tbrowse::add_row(twindow& window, tlistbox& list, const std::string& name, bool dir)
{
std::stringstream ss;
string_map list_item;
std::map<std::string, string_map> list_item_item;
list_item["label"] = "misc/open.png~SCALE(32, 32)";
list_item_item.insert(std::make_pair("open", list_item));
ss << tintegrate::generate_img(get_browse_icon(dir) + "~SCALE(24, 24)") << name;
list_item["label"] = ss.str();
list_item_item.insert(std::make_pair("name", list_item));
list_item["label"] = "---";
list_item_item.insert(std::make_pair("date", list_item));
list_item["label"] = dir? null_str: "---";
list_item_item.insert(std::make_pair("size", list_item));
list.add_row(list_item_item);
int index = list.get_item_count() - 1;
ttoggle_panel* panel = dynamic_cast<ttoggle_panel*>(list.get_row_panel(index));
tbutton* button = find_widget<tbutton>(panel, "open", false, true);
if (dir) {
connect_signal_mouse_left_click(
*button
, boost::bind(
&tbrowse::open
, this
, boost::ref(window)
, _3
, _4
, (int)true
, (int)index));
panel->connect_signal<event::LEFT_BUTTON_DOUBLE_CLICK>(boost::bind(
&tbrowse::open
, this
, boost::ref(window)
, _3
, _4
, (int)true
, (int)index)
, event::tdispatcher::back_pre_child);
} else {
button->set_visible(twidget::HIDDEN);
button->set_active(false);
}
}
示例3: type_selected
void texpedite::type_selected(twindow& window, tlistbox& list, const int type)
{
tbutton* task = find_widget<tbutton>(&window, "task", false, true);
tbutton* ok = find_widget<tbutton>(&window, "ok", false, true);
// prevent visible/disable disband button from layouting window.
twindow::tinvalidate_layout_blocker invalidate_layout_blocker(window);
list.invalidate_layout(false);
troop_index_ = list.get_selected_row();
refresh_tooltip(window);
// There is maybe no troop after disband. so troop_index_ maybe equal -1.
if (troop_index_ >= 0) {
int size = city_.reside_troops().size();
const unit& u = *city_.reside_troops()[troop_index_];
for (int index = 0; index < size; index ++) {
twidget* grid_ptr = list.get_row_panel(index);
// tbutton& disband = find_widget<tbutton>(&window, "disband", false);
tbutton& disband = *dynamic_cast<tbutton*>(grid_ptr->find("disband", false));
if (index == troop_index_) {
disband.set_visible(twidget::VISIBLE);
disband.set_active(u.human());
} else {
disband.set_visible(twidget::INVISIBLE);
}
}
set_task_str(window, u);
ok->set_active(u.human() && can_move(u));
} else {
task->set_active(false);
ok->set_active(false);
}
}
示例4: fill_table
void tside_report::fill_table(tlistbox& list, int catalog)
{
for (std::vector<artifical*>::const_iterator it = candidate_cities_.begin(); it != candidate_cities_.end(); ++ it) {
artifical& city = **it;
std::stringstream str;
/*** Add list item ***/
string_map table_item;
std::map<std::string, string_map> table_item_item;
str.str("");
str << city.name();
str << "(Lv";
str << tintegrate::generate_format(city.level(), "green");
str << ")";
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("name", table_item));
if (catalog == STATUS_PAGE) {
str.str("");
if (city.hitpoints() < city.max_hitpoints() / 2) {
str << tintegrate::generate_format(city.hitpoints(), "red");
} else if (city.hitpoints() < city.max_hitpoints()) {
str << tintegrate::generate_format(city.hitpoints(), "yellow");
} else {
str << city.hitpoints();
}
str << "/" << city.max_hitpoints();
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("hp", table_item));
str.str("");
str << city.experience() << "/";
if (city.can_advance()) {
str << city.max_experience();
} else {
str << "-";
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("xp", table_item));
str.str("");
str << tintegrate::generate_format(city.fresh_heros().size(), "green");
str << "/";
str << tintegrate::generate_format(city.finish_heros().size(), "red");
str << "/";
str << tintegrate::generate_format(city.wander_heros().size(), "yellow");
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("hero", table_item));
str.str("");
str << tintegrate::generate_format(city.reside_troops().size(), "yellow");
str << "/";
str << city.field_troops().size();
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("troop", table_item));
str.str("");
str << tintegrate::generate_format(city.total_gold_income(current_team_.market_increase_), "yellow");
str << "/";
str << tintegrate::generate_format(city.total_technology_income(current_team_.technology_increase_), "green");
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("income", table_item));
size_t built = 0;
size_t building = 0;
const std::vector<map_location>& ea = city.economy_area();
for (std::vector<map_location>::const_iterator it2 = ea.begin(); it2 != ea.end(); ++ it2) {
unit* u = units_.find_unit(*it2);
if (!u || !hero::is_ea_artifical(u->type()->master())) {
continue;
}
if (u->get_state(ustate_tag::BUILDING)) {
building ++;
} else {
built ++;
}
}
str.str("");
str << tintegrate::generate_format(building + built, building? "yellow": "green");
str << "/";
if (building + built != ea.size()) {
str << tintegrate::generate_format(ea.size(), "red");
} else {
str << ea.size();
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("ea", table_item));
}
list.add_row(table_item_item);
unsigned hero_index = list.get_item_count() - 1;
twidget* grid_ptr = list.get_row_panel(hero_index);
ttoggle_panel* toggle = dynamic_cast<ttoggle_panel*>(grid_ptr);
toggle->set_data(hero_index);
}
}
示例5: fill_table
//.........这里部分代码省略.........
}
table_item_item.insert(std::make_pair("father", table_item));
if (h.parent_[1].hero_ != HEROS_INVALID_NUMBER) {
table_item["label"] = heros_[h.parent_[1].hero_].name();
} else {
table_item["label"] = "";
}
table_item_item.insert(std::make_pair("mother", table_item));
str.str("");
for (uint32_t i = 0; i < HEROS_MAX_OATH; i ++) {
if (h.oath_[i].hero_ != HEROS_INVALID_NUMBER) {
if (i == 0) {
str << heros_[h.oath_[i].hero_].name();
} else {
str << " " << heros_[h.oath_[i].hero_].name();
}
}
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("oath", table_item));
str.str("");
for (uint32_t i = 0; i < HEROS_MAX_CONSORT; i ++) {
if (h.consort_[i].hero_ != HEROS_INVALID_NUMBER) {
if (i == 0) {
str << heros_[h.consort_[i].hero_].name();
} else {
str << " " << heros_[h.consort_[i].hero_].name();
}
}
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("consort", table_item));
str.str("");
for (uint32_t i = 0; i < HEROS_MAX_INTIMATE; i ++) {
if (h.intimate_[i].hero_ != HEROS_INVALID_NUMBER) {
if (i == 0) {
str << heros_[h.intimate_[i].hero_].name();
} else {
str << " " << heros_[h.intimate_[i].hero_].name();
}
}
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("intimate", table_item));
str.str("");
for (uint32_t i = 0; i < HEROS_MAX_HATE; i ++) {
if (h.hate_[i].hero_ != HEROS_INVALID_NUMBER) {
if (i == 0) {
str << heros_[h.hate_[i].hero_].name();
} else {
str << " " << heros_[h.hate_[i].hero_].name();
}
}
}
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("hate", table_item));
}
list.add_row(table_item_item);
twidget* grid_ptr = list.get_row_panel(hero_index);
ttoggle_button* toggle = dynamic_cast<ttoggle_button*>(grid_ptr->find("prefix", true));
toggle->set_callback_state_change(boost::bind(&thero_selection::hero_toggled, this, _1));
toggle->set_data(hero_index);
if (checked_pairs_.find(hero_index) != checked_pairs_.end()) {
toggle->set_value(true);
}
bool enable = true;
for (std::vector<std::string>::const_iterator it2 = disables_.begin(); it2 != disables_.end() && enable; ++ it2) {
const std::string& tag = *it2;
if (tag == "loyalty") {
if (h.side_ != HEROS_INVALID_SIDE) {
hero& ownership_leader = *(*teams_)[h.side_].leader();
if (ownership_leader.base_catalog_ == h.base_catalog_) {
enable = false;
}
}
} else if (tag == "hate") {
if (leader.is_hate(h)) {
enable = false;
}
}
}
if (enable && h.player_ == HEROS_INVALID_NUMBER && std::find(disables_.begin(), disables_.end(), "member") != disables_.end()) {
if (runtime_groups::exist_member(h, leader)) {
toggle->set_active(false);
}
}
if (!enable) {
// grid_ptr->set_active(false);
toggle->set_active(false);
}
}
}