本文整理汇总了C++中ExtraIcon::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ ExtraIcon::getType方法的具体用法?C++ ExtraIcon::getType怎么用?C++ ExtraIcon::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtraIcon
的用法示例。
在下文中一共展示了ExtraIcon::getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RebuildListsBasedOnGroups
void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
{
extraIconsByHandle.destroy();
for (int i=0; i < registeredExtraIcons.getCount(); i++)
extraIconsByHandle.insert(registeredExtraIcons[i]);
for (int k=0; k < extraIconsBySlot.getCount(); k++) {
ExtraIcon *extra = extraIconsBySlot[k];
if (extra->getType() == EXTRAICON_TYPE_GROUP)
delete extra;
}
extraIconsBySlot.destroy();
for (int i=0; i < groups.getCount(); i++) {
ExtraIconGroup *group = groups[i];
for (int j = 0; j < group->m_items.getCount(); j++)
extraIconsByHandle.put(group->m_items[j]->getID()-1, group);
extraIconsBySlot.insert(group);
}
for (int k=0; k < extraIconsByHandle.getCount(); k++) {
ExtraIcon *extra = extraIconsByHandle[k];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
extraIconsBySlot.insert(extra);
}
}
示例2: RebuildListsBasedOnGroups
void RebuildListsBasedOnGroups(vector<ExtraIconGroup *> &groups)
{
unsigned int i;
for (i = 0; i < extraIconsByHandle.size(); ++i)
extraIconsByHandle[i] = registeredExtraIcons[i];
for (i = 0; i < extraIconsBySlot.size(); ++i)
{
ExtraIcon *extra = extraIconsBySlot[i];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
continue;
delete extra;
}
extraIconsBySlot.clear();
for (i = 0; i < groups.size(); ++i)
{
ExtraIconGroup *group = groups[i];
for (unsigned int j = 0; j < group->items.size(); ++j)
extraIconsByHandle[group->items[j]->getID() - 1] = group;
extraIconsBySlot.push_back(group);
}
for (i = 0; i < extraIconsByHandle.size(); ++i)
{
ExtraIcon *extra = extraIconsByHandle[i];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
extraIconsBySlot.push_back(extra);
}
std::sort(extraIconsBySlot.begin(), extraIconsBySlot.end(), compareFunc());
}
示例3: UnloadExtraIconsModule
void UnloadExtraIconsModule(void)
{
for (int k = 0; k < extraIconsBySlot.getCount(); k++) {
ExtraIcon *extra = extraIconsBySlot[k];
if (extra->getType() == EXTRAICON_TYPE_GROUP)
delete extra;
}
for (int i = 0; i < registeredExtraIcons.getCount(); i++)
delete registeredExtraIcons[i];
}
示例4: OnInitDialog
virtual void OnInitDialog()
{
int numSlots = GetNumberOfSlots();
if (numSlots < (int)registeredExtraIcons.getCount()) {
HWND label = GetDlgItem(m_hwnd, IDC_MAX_ICONS_L);
SetWindowText(label, CMString(FORMAT, TranslateT("*only the first %d icons will be shown"), numSlots));
ShowWindow(label, SW_SHOW);
}
int cx = g_iIconSX;
HIMAGELIST hImageList = ImageList_Create(cx, cx, ILC_COLOR32 | ILC_MASK, 2, 2);
HICON hBlankIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx, 0);
ImageList_AddIcon(hImageList, hBlankIcon);
for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
ExtraIcon *extra = registeredExtraIcons[i];
HICON hIcon = IcoLib_GetIcon(extra->getDescIcon());
if (hIcon == NULL)
ImageList_AddIcon(hImageList, hBlankIcon);
else {
ImageList_AddIcon(hImageList, hIcon);
IcoLib_ReleaseIcon(hIcon);
}
}
m_tree.SetImageList(hImageList, TVSIL_NORMAL);
DestroyIcon(hBlankIcon);
for (int k = 0; k < extraIconsBySlot.getCount(); k++) {
ExtraIcon *extra = extraIconsBySlot[k];
if (extra->getType() == EXTRAICON_TYPE_GROUP) {
ExtraIconGroup *group = (ExtraIconGroup *)extra;
intlist ids;
for (int j = 0; j < group->m_items.getCount(); j++)
ids.add(group->m_items[j]->getID());
Tree_AddExtraIconGroup(ids, extra->isEnabled());
}
else Tree_AddExtraIcon((BaseExtraIcon *)extra, extra->isEnabled());
}
TVSORTCB sort = { 0 };
sort.hParent = NULL;
sort.lParam = 0;
sort.lpfnCompare = CompareFunc;
m_tree.SortChildrenCB(&sort, 0);
}
示例5: OnApply
virtual void OnApply()
{
// Store old slots
int *oldSlots = new int[registeredExtraIcons.getCount()];
int lastUsedSlot = -1;
for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
if (extraIconsByHandle[i] == registeredExtraIcons[i])
oldSlots[i] = registeredExtraIcons[i]->getSlot();
else
// Remove old slot for groups to re-set images
oldSlots[i] = -1;
lastUsedSlot = MAX(lastUsedSlot, registeredExtraIcons[i]->getSlot());
}
lastUsedSlot = MIN(lastUsedSlot, GetNumberOfSlots());
// Get user data and create new groups
LIST<ExtraIconGroup> groups(1);
BYTE pos = 0;
int firstEmptySlot = 0;
HTREEITEM ht = m_tree.GetRoot();
TVITEMEX tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
while (ht) {
tvi.hItem = ht;
m_tree.GetItem(&tvi);
intlist*ids = (intlist*)tvi.lParam;
if (ids == NULL || ids->count < 1)
continue; // ???
bool enabled = ((tvi.state & INDEXTOSTATEIMAGEMASK(3)) == INDEXTOSTATEIMAGEMASK(2));
int slot = (enabled ? firstEmptySlot++ : -1);
if (slot >= GetNumberOfSlots())
slot = -1;
if (ids->count == 1) {
BaseExtraIcon *extra = registeredExtraIcons[ids->data[0] - 1];
extra->setPosition(pos++);
extra->setSlot(slot);
}
else {
char name[128];
mir_snprintf(name, "__group_%d", groups.getCount());
ExtraIconGroup *group = new ExtraIconGroup(name);
for (int i = 0; i < ids->count; i++) {
BaseExtraIcon *extra = registeredExtraIcons[ids->data[i] - 1];
extra->setPosition(pos++);
group->addExtraIcon(extra);
}
group->setSlot(slot);
groups.insert(group);
}
ht = m_tree.GetNextSibling(ht);
}
// Store data
for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[i];
char setting[512];
mir_snprintf(setting, "Position_%s", extra->getName());
db_set_w(NULL, MODULE_NAME, setting, extra->getPosition());
mir_snprintf(setting, "Slot_%s", extra->getName());
db_set_w(NULL, MODULE_NAME, setting, extra->getSlot());
}
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)MODULE_NAME "Groups");
db_set_w(NULL, MODULE_NAME "Groups", "Count", groups.getCount());
for (int k = 0; k < groups.getCount(); k++) {
ExtraIconGroup *group = groups[k];
char setting[512];
mir_snprintf(setting, "%d_count", k);
db_set_w(NULL, MODULE_NAME "Groups", setting, (WORD)group->m_items.getCount());
for (int j = 0; j < group->m_items.getCount(); j++) {
BaseExtraIcon *extra = group->m_items[j];
mir_snprintf(setting, "%d_%d", k, j);
db_set_s(NULL, MODULE_NAME "Groups", setting, extra->getName());
}
}
// Clean removed slots
for (int j = firstEmptySlot; j <= lastUsedSlot; j++)
RemoveExtraIcons(j);
// Apply icons to new slots
RebuildListsBasedOnGroups(groups);
for (int n = 0; n < extraIconsBySlot.getCount(); n++) {
ExtraIcon *extra = extraIconsBySlot[n];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
//.........这里部分代码省略.........