本文整理汇总了C++中TooltipData类的典型用法代码示例。如果您正苦于以下问题:C++ TooltipData类的具体用法?C++ TooltipData怎么用?C++ TooltipData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TooltipData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkTooltip
/**
* Show mouseover descriptions of disciplines and powers
*/
TooltipData MenuPowers::checkTooltip(const Point& mouse) {
TooltipData tip;
for (size_t i=0; i<power_cell.size(); i++) {
if (tab_control && (tab_control->getActiveTab() != power_cell[i].tab)) continue;
int cell_index = getCellByPowerIndex(power_cell[i].id, power_cell_all);
if (!checkCellVisible(cell_index)) continue;
if (slots[i] && isWithinRect(slots[i]->pos, mouse)) {
bool base_unlocked = checkUnlocked(cell_index) || std::find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end();
createTooltip(&tip, static_cast<int>(i), power_cell, !base_unlocked);
if (!power_cell[i].upgrades.empty()) {
int next_level = getNextLevelCell(static_cast<int>(i));
if (next_level != -1) {
tip.addText("\n" + msg->get("Next Level:"));
createTooltip(&tip, next_level, power_cell_upgrade, base_unlocked);
}
}
return tip;
}
}
return tip;
}
示例2: checkTooltip
/**
* Show mouseover descriptions of disciplines and powers
*/
TooltipData MenuPowers::checkTooltip(Point mouse) {
TooltipData tip;
for (unsigned i=0; i<power_cell.size(); i++) {
if ((tabs_count > 1) && (tabControl->getActiveTab() != power_cell[i].tab)) continue;
if (!powerIsVisible(power_cell[i].id)) continue;
if (isWithin(slots[i]->pos, mouse)) {
generatePowerDescription(&tip, i);
if (power_cell[i].next_level != 0) {
tip.addText(msg->get("\nNext Level:"));
short next_level_cell = id_by_powerIndex(power_cell[i].next_level);
generatePowerDescription(&tip, next_level_cell);
}
return tip;
}
}
return tip;
}
示例3: checkTooltip
/**
* If mousing-over an item with a tooltip, return that tooltip data.
*
* @param mouse The x,y screen coordinates of the mouse cursor
*/
TooltipData MenuInventory::checkTooltip(Point position) {
int area;
int slot;
TooltipData tip;
area = areaOver(position);
if (area == -1) {
if (position.x >= window_area.x + help_pos.x && position.y >= window_area.y+help_pos.y && position.x < window_area.x+help_pos.x+help_pos.w && position.y < window_area.y+help_pos.y+help_pos.h) {
tip.addText(msg->get("Use SHIFT to move only one item."));
tip.addText(msg->get("CTRL-click a carried item to sell it."));
}
return tip;
}
slot = inventory[area].slotOver(position);
if (slot == -1)
return tip;
if (inventory[area][slot].item > 0) {
tip = inventory[area].checkTooltip(position, stats, PLAYER_INV);
}
else if (area == EQUIPMENT && inventory[area][slot].item == 0) {
tip.addText(msg->get(slot_desc[slot]));
}
return tip;
}
示例4: checkTooltip
/**
* Show mouseover descriptions of disciplines and powers
*/
TooltipData MenuPowers::checkTooltip(Point mouse) {
TooltipData tip;
for (unsigned i=0; i<power_cell.size(); i++) {
if ((tabs_count > 1) && (tabControl->getActiveTab() != power_cell[i].tab)) continue;
if (!powerIsVisible(power_cell[i].id)) continue;
if (isWithin(slots[i]->pos, mouse)) {
generatePowerDescription(&tip, i, power_cell);
if (!power_cell[i].upgrades.empty()) {
short next_level = nextLevel(i);
if (next_level != -1) {
tip.addText("\n" + msg->get("Next Level:"));
generatePowerDescription(&tip, next_level, power_cell_upgrade);
}
}
return tip;
}
}
return tip;
}
示例5: getShortTooltip
TooltipData ItemManager::getShortTooltip(ItemStack stack) {
stringstream ss;
TooltipData tip;
SDL_Color color = color_normal;
if (stack.item == 0) return tip;
// color quality
if (items[stack.item].set > 0) {
color = item_sets[items[stack.item].set].color;
}
else if (items[stack.item].quality == ITEM_QUALITY_LOW) {
color = color_low;
}
else if (items[stack.item].quality == ITEM_QUALITY_HIGH) {
color = color_high;
}
else if (items[stack.item].quality == ITEM_QUALITY_EPIC) {
color = color_epic;
}
// name
if (stack.quantity > 1) {
ss << stack.quantity << " " << items[stack.item].name;
} else {
ss << items[stack.item].name;
}
tip.addText(ss.str(), color);
return tip;
}
示例6: checkTooltip
/**
* Show mouseover descriptions of disciplines and powers
*/
TooltipData MenuPowers::checkTooltip(Point mouse) {
TooltipData tip;
for (unsigned i=0; i<power_cell.size(); i++) {
if (tab_control && (tab_control->getActiveTab() != power_cell[i].tab)) continue;
if (!powerIsVisible(power_cell[i].id)) continue;
if (slots[i] && isWithin(slots[i]->pos, mouse)) {
bool base_unlocked = requirementsMet(power_cell[i].id) || std::find(stats->powers_list.begin(), stats->powers_list.end(), power_cell[i].id) != stats->powers_list.end();
generatePowerDescription(&tip, i, power_cell, !base_unlocked);
if (!power_cell[i].upgrades.empty()) {
short next_level = nextLevel(static_cast<short>(i));
if (next_level != -1) {
tip.addText("\n" + msg->get("Next Level:"));
generatePowerDescription(&tip, next_level, power_cell_upgrade, base_unlocked);
}
}
return tip;
}
}
return tip;
}
示例7: checkTooltip
/**
* If mousing-over an item with a tooltip, return that tooltip data.
*
* @param mouse The x,y screen coordinates of the mouse cursor
*/
TooltipData MenuInventory::checkTooltip(const Point& position) {
int area;
int slot;
TooltipData tip;
area = areaOver(position);
if (area < 0) {
if (position.x >= window_area.x + help_pos.x && position.y >= window_area.y+help_pos.y && position.x < window_area.x+help_pos.x+help_pos.w && position.y < window_area.y+help_pos.y+help_pos.h) {
tip.addText(msg->get("Pick up item(s):") + " " + inpt->getBindingString(MAIN1));
tip.addText(msg->get("Use or equip item:") + " " + inpt->getBindingString(MAIN2) + "\n");
tip.addText(msg->get("%s modifiers", inpt->getBindingString(MAIN1).c_str()));
tip.addText(msg->get("Select a quantity of item:") + " " + inpt->getBindingString(SHIFT) + " / " + inpt->getBindingString(SHIFT, INPUT_BINDING_ALT));
if (inv_ctrl == INV_CTRL_STASH)
tip.addText(msg->get("Stash item stack:") + " " + inpt->getBindingString(CTRL) + " / " + inpt->getBindingString(CTRL, INPUT_BINDING_ALT));
else if (inv_ctrl == INV_CTRL_VENDOR || (SELL_WITHOUT_VENDOR && inv_ctrl != INV_CTRL_STASH))
tip.addText(msg->get("Sell item stack:") + " " + inpt->getBindingString(CTRL) + " / " + inpt->getBindingString(CTRL, INPUT_BINDING_ALT));
}
return tip;
}
slot = inventory[area].slotOver(position);
if (slot == -1)
return tip;
if (inventory[area][slot].item > 0) {
tip = inventory[area].checkTooltip(position, stats, PLAYER_INV);
}
else if (area == EQUIPMENT && inventory[area][slot].empty()) {
tip.addText(msg->get(items->getItemType(slot_type[slot])));
}
return tip;
}
示例8: push
void TooltipManager::push(const TooltipData& _tip_data, const Point& _pos, uint8_t _style) {
if (_tip_data.isEmpty())
return;
tip_data = _tip_data;
pos = _pos;
style = _style;
}
示例9: getShortTooltip
TooltipData ItemManager::getShortTooltip(ItemStack stack) {
std::stringstream ss;
TooltipData tip;
if (stack.empty()) return tip;
// name
if (stack.quantity > 1) {
ss << stack.quantity << " " << getItemName(stack.item);
}
else {
ss << getItemName(stack.item);
}
tip.addColoredText(ss.str(), getItemColor(stack.item));
return tip;
}
示例10: checkTooltip
/**
* On mouseover, show tooltip for buttons
*/
TooltipData MenuActionBar::checkTooltip(const Point& mouse) {
TooltipData tip;
if (isWithin(menus[MENU_CHARACTER]->pos, mouse)) {
if (COLORBLIND && requires_attention[MENU_CHARACTER])
tip.addText(msg->get("Character") + " (*)");
else
tip.addText(msg->get("Character"));
return tip;
}
if (isWithin(menus[MENU_INVENTORY]->pos, mouse)) {
if (COLORBLIND && requires_attention[MENU_INVENTORY])
tip.addText(msg->get("Inventory") + " (*)");
else
tip.addText(msg->get("Inventory"));
return tip;
}
if (isWithin(menus[MENU_POWERS]->pos, mouse)) {
if (COLORBLIND && requires_attention[MENU_POWERS])
tip.addText(msg->get("Powers") + " (*)");
else
tip.addText(msg->get("Powers"));
return tip;
}
if (isWithin(menus[MENU_LOG]->pos, mouse)) {
if (COLORBLIND && requires_attention[MENU_LOG])
tip.addText(msg->get("Log") + " (*)");
else
tip.addText(msg->get("Log"));
return tip;
}
for (unsigned i = 0; i < slots_count; i++) {
if (hotkeys_mod[i] != 0) {
if (slots[i] && isWithin(slots[i]->pos, mouse)) {
tip.addText(powers->powers[hotkeys_mod[i]].name);
}
}
}
return tip;
}
示例11: checkTooltip
/**
* On mouseover, show tooltip for buttons
*/
TooltipData MenuActionBar::checkTooltip(Point mouse) {
TooltipData tip;
if (isWithin(menus[0], mouse)) {
tip.addText(msg->get("Character Menu (C)"));
return tip;
}
if (isWithin(menus[1], mouse)) {
tip.addText(msg->get("Inventory Menu (I)"));
return tip;
}
if (isWithin(menus[2], mouse)) {
tip.addText(msg->get("Power Menu (P)"));
return tip;
}
if (isWithin(menus[3], mouse)) {
tip.addText(msg->get("Log Menu (L)"));
return tip;
}
for (int i=0; i<12; i++) {
if (hotkeys[i] != 0) {
if (isWithin(slots[i], mouse)) {
tip.addText(powers->powers[hotkeys[i]].name);
}
}
}
return tip;
}
示例12: checkTooltip
/**
* On mouseover, show tooltip for buttons
*/
TooltipData MenuActionBar::checkTooltip(Point mouse) {
TooltipData tip;
if (isWithin(menus[MENU_CHARACTER]->pos, mouse)) {
tip.addText(msg->get("Character"));
return tip;
}
if (isWithin(menus[MENU_INVENTORY]->pos, mouse)) {
tip.addText(msg->get("Inventory"));
return tip;
}
if (isWithin(menus[MENU_POWERS]->pos, mouse)) {
tip.addText(msg->get("Powers"));
return tip;
}
if (isWithin(menus[MENU_LOG]->pos, mouse)) {
tip.addText(msg->get("Log"));
return tip;
}
for (int i=0; i<12; i++) {
if (hotkeys[i] != 0) {
if (isWithin(slots[i]->pos, mouse)) {
tip.addText(powers->powers[hotkeys[i]].name);
}
}
}
return tip;
}
示例13: getTooltip
/**
* Create detailed tooltip showing all relevant item info
*/
TooltipData ItemManager::getTooltip(int item, StatBlock *stats, int context) {
TooltipData tip;
SDL_Color color = color_normal;
if (item == 0) return tip;
// color quality
if (items[item].set > 0) {
color = item_sets[items[item].set].color;
}
else if (items[item].quality == ITEM_QUALITY_LOW) {
color = color_low;
}
else if (items[item].quality == ITEM_QUALITY_HIGH) {
color = color_high;
}
else if (items[item].quality == ITEM_QUALITY_EPIC) {
color = color_epic;
}
// name
tip.addText(items[item].name, color);
// level
if (items[item].level != 0) {
tip.addText(msg->get("Level %d", items[item].level));
}
// type
if (items[item].type != "other") {
tip.addText(msg->get(getItemType(items[item].type)));
}
// damage
if (items[item].dmg_melee_max > 0) {
if (items[item].dmg_melee_min < items[item].dmg_melee_max)
tip.addText(msg->get("Melee damage: %d-%d", items[item].dmg_melee_min, items[item].dmg_melee_max));
else
tip.addText(msg->get("Melee damage: %d", items[item].dmg_melee_max));
}
if (items[item].dmg_ranged_max > 0) {
if (items[item].dmg_ranged_min < items[item].dmg_ranged_max)
tip.addText(msg->get("Ranged damage: %d-%d", items[item].dmg_ranged_min, items[item].dmg_ranged_max));
else
tip.addText(msg->get("Ranged damage: %d", items[item].dmg_ranged_max));
}
if (items[item].dmg_ment_max > 0) {
if (items[item].dmg_ment_min < items[item].dmg_ment_max)
tip.addText(msg->get("Mental damage: %d-%d", items[item].dmg_ment_min, items[item].dmg_ment_max));
else
tip.addText(msg->get("Mental damage: %d", items[item].dmg_ment_max));
}
// absorb
if (items[item].abs_max > 0) {
if (items[item].abs_min < items[item].abs_max)
tip.addText(msg->get("Absorb: %d-%d", items[item].abs_min, items[item].abs_max));
else
tip.addText(msg->get("Absorb: %d", items[item].abs_max));
}
// bonuses
unsigned bonus_counter = 0;
string modifier;
while (bonus_counter < items[item].bonus_val.size() && items[item].bonus_stat[bonus_counter] != "") {
if (items[item].bonus_stat[bonus_counter] == "speed") {
modifier = msg->get("%d%% Speed", items[item].bonus_val[bonus_counter]);
if (items[item].bonus_val[bonus_counter] >= 100) color = color_bonus;
else color = color_penalty;
} else {
if (items[item].bonus_val[bonus_counter] > 0) {
modifier = msg->get("Increases %s by %d",
items[item].bonus_val[bonus_counter],
msg->get(items[item].bonus_stat[bonus_counter]));
color = color_bonus;
}
else {
modifier = msg->get("Decreases %s by %d",
items[item].bonus_val[bonus_counter],
msg->get(items[item].bonus_stat[bonus_counter]));
color = color_penalty;
}
}
tip.addText(modifier, color);
bonus_counter++;
}
// power
if (items[item].power_desc != "") {
tip.addText(items[item].power_desc, color_bonus);
}
// requirement
if (items[item].req_val > 0) {
if (items[item].req_stat == REQUIRES_PHYS) {
//.........这里部分代码省略.........
示例14: getTooltip
/**
* Create detailed tooltip showing all relevant item info
*/
TooltipData ItemManager::getTooltip(ItemStack stack, StatBlock *stats, int context) {
TooltipData tip;
if (stack.empty()) return tip;
Color color = getItemColor(stack.item);
// name
std::stringstream ss;
if (stack.quantity == 1)
ss << getItemName(stack.item);
else
ss << getItemName(stack.item) << " (" << stack.quantity << ")";
tip.addColoredText(ss.str(), color);
// quest item
if (items[stack.item].quest_item) {
tip.addColoredText(msg->get("Quest Item"), font->getColor(FontEngine::COLOR_ITEM_BONUS));
}
// only show the name of the currency item
if (stack.item == eset->misc.currency_id)
return tip;
// flavor text
if (items[stack.item].flavor != "") {
tip.addColoredText(Utils::substituteVarsInString(items[stack.item].flavor, pc), font->getColor(FontEngine::COLOR_ITEM_FLAVOR));
}
// level
if (items[stack.item].level != 0) {
tip.addText(msg->get("Level %d", items[stack.item].level));
}
// type
if (items[stack.item].type != "") {
tip.addText(msg->get(getItemType(items[stack.item].type)));
}
// item quality text for colorblind users
if (settings->colorblind && items[stack.item].quality != "") {
color = font->getColor(FontEngine::COLOR_WIDGET_NORMAL);
for (size_t i=0; i<item_qualities.size(); ++i) {
if (item_qualities[i].id == items[stack.item].quality) {
tip.addColoredText(msg->get("Quality: %s", msg->get(item_qualities[i].name)), color);
break;
}
}
}
// damage
for (size_t i = 0; i < eset->damage_types.list.size(); ++i) {
if (items[stack.item].dmg_max[i] > 0) {
std::stringstream dmg_str;
dmg_str << eset->damage_types.list[i].name;
if (items[stack.item].dmg_min[i] < items[stack.item].dmg_max[i]) {
dmg_str << ": " << items[stack.item].dmg_min[i] << "-" << items[stack.item].dmg_max[i];
tip.addText(dmg_str.str());
}
else {
dmg_str << ": " << items[stack.item].dmg_max[i];
tip.addText(dmg_str.str());
}
}
}
// absorb
if (items[stack.item].abs_max > 0) {
if (items[stack.item].abs_min < items[stack.item].abs_max)
tip.addText(msg->get("Absorb: %d-%d", items[stack.item].abs_min, items[stack.item].abs_max));
else
tip.addText(msg->get("Absorb: %d", items[stack.item].abs_max));
}
// bonuses
unsigned bonus_counter = 0;
while (bonus_counter < items[stack.item].bonus.size()) {
ss.str("");
BonusData* bdata = &items[stack.item].bonus[bonus_counter];
if (bdata->is_speed || bdata->is_attack_speed) {
if (bdata->value >= 100)
color = font->getColor(FontEngine::COLOR_ITEM_BONUS);
else
color = font->getColor(FontEngine::COLOR_ITEM_PENALTY);
}
else {
if (bdata->value > 0)
color = font->getColor(FontEngine::COLOR_ITEM_BONUS);
else
color = font->getColor(FontEngine::COLOR_ITEM_PENALTY);
}
getBonusString(ss, bdata);
tip.addColoredText(ss.str(), color);
bonus_counter++;
//.........这里部分代码省略.........
示例15: getTooltip
/**
* Create detailed tooltip showing all relevant item info
*/
TooltipData ItemManager::getTooltip(int item, StatBlock *stats, int context) {
TooltipData tip;
SDL_Color color = color_normal;
if (item == 0) return tip;
// color quality
if (items[item].set > 0) {
color = item_sets[items[item].set].color;
}
else if (items[item].quality == ITEM_QUALITY_LOW) {
color = color_low;
}
else if (items[item].quality == ITEM_QUALITY_HIGH) {
color = color_high;
}
else if (items[item].quality == ITEM_QUALITY_EPIC) {
color = color_epic;
}
// name
tip.addText(items[item].name, color);
// level
if (items[item].level != 0) {
tip.addText(msg->get("Level %d", items[item].level));
}
// type
if (items[item].type != "other") {
tip.addText(msg->get(getItemType(items[item].type)));
}
// damage
if (items[item].dmg_melee_max > 0) {
if (items[item].dmg_melee_min < items[item].dmg_melee_max)
tip.addText(msg->get("Melee damage: %d-%d", items[item].dmg_melee_min, items[item].dmg_melee_max));
else
tip.addText(msg->get("Melee damage: %d", items[item].dmg_melee_max));
}
if (items[item].dmg_ranged_max > 0) {
if (items[item].dmg_ranged_min < items[item].dmg_ranged_max)
tip.addText(msg->get("Ranged damage: %d-%d", items[item].dmg_ranged_min, items[item].dmg_ranged_max));
else
tip.addText(msg->get("Ranged damage: %d", items[item].dmg_ranged_max));
}
if (items[item].dmg_ment_max > 0) {
if (items[item].dmg_ment_min < items[item].dmg_ment_max)
tip.addText(msg->get("Mental damage: %d-%d", items[item].dmg_ment_min, items[item].dmg_ment_max));
else
tip.addText(msg->get("Mental damage: %d", items[item].dmg_ment_max));
}
// absorb
if (items[item].abs_max > 0) {
if (items[item].abs_min < items[item].abs_max)
tip.addText(msg->get("Absorb: %d-%d", items[item].abs_min, items[item].abs_max));
else
tip.addText(msg->get("Absorb: %d", items[item].abs_max));
}
// bonuses
unsigned bonus_counter = 0;
string modifier;
while (bonus_counter < items[item].bonus_val.size() && items[item].bonus_stat[bonus_counter] != "") {
if (items[item].bonus_stat[bonus_counter] == "speed") {
modifier = msg->get("%d\% Speed", items[item].bonus_val[bonus_counter]);
if (items[item].bonus_val[bonus_counter] >= 100) color = color_bonus;
else color = color_penalty;
} else {
if (items[item].bonus_val[bonus_counter] > 0) {