void CMDITabs::Update() { SetRedraw(false); HWND active = ::GetTopWindow(m_mdiClient); // get active view window (actually the frame of the view) typedef std::vector<HWND> TWndVec; typedef TWndVec::iterator TWndIter; TWndVec vChild; // put all child windows in a list (actually a vector) for (HWND child = active; child; child = ::GetNextWindow(child, GW_HWNDNEXT)) { vChild.push_back(child); } TCITEM item; char text[256]; item.pszText = text; int i = GetItemCount(); while ( i-- > 0 ) // for each tab { item.mask = TCIF_PARAM; GetItem(i, &item); TWndIter it = std::find(vChild.begin(), vChild.end(), HWND(item.lParam)); if (it == vChild.end()) // associatete view does no longer exist, so delete the tab { DeleteItem(i); if (m_bImages) RemoveImage(i); } else // update the tab's text, image and selection state { item.mask = TCIF_TEXT; ::GetWindowText(*it, text, 256); if (m_bImages) m_images.Replace(i, (HICON)::GetClassLong(*it, GCL_HICONSM)); SetItem(i, &item); if (*it == active) SetCurSel(i); // associated view is active => make it the current selection vChild.erase(it); // remove view from list } } // all remaining views in vChild have to be added as new tabs i = GetItemCount(); for (TWndIter it = vChild.begin(), end = vChild.end(); it != end; ++it) { item.mask = TCIF_TEXT|TCIF_PARAM|TCIF_IMAGE; ::GetWindowText(*it, text, 256); if (m_bImages) m_images.Add((HICON)::GetClassLong(*it, GCL_HICONSM)); item.iImage = i; item.lParam = LPARAM(*it); InsertItem(i, &item); if (*it == active) SetCurSel(i); ++i; } // this removes the control when there are no tabs and shows it when there is at least one tab bool bShow = GetItemCount() >= m_minViews; if ((!bShow && IsWindowVisible()) || (bShow && !IsWindowVisible())) { static_cast<CMDIFrameWnd*>(FromHandlePermanent(::GetParent(m_mdiClient)))->RecalcLayout(); } RedrawWindow(NULL, NULL, RDW_FRAME|RDW_INVALIDATE|RDW_ERASE); SetRedraw(true); }
bool Team::RemoveImage(image_id imageID) { Image* image = ImageByID(imageID); if (image == NULL) return false; RemoveImage(image); image->ReleaseReference(); return true; }
MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) { preview = NULL; setWindowTitle("ImageGlue"); setWindowIcon(QIcon(":/ImageGlue.png")); setAcceptDrops(true); // QWidget* widget = new QWidget(this); Q_CHECK_PTR(widget); QGridLayout *gridLayout = new QGridLayout(); Q_CHECK_PTR(gridLayout); gridLayout->setGeometry(geometry()); widget->setLayout(gridLayout); setCentralWidget(widget); QLabel *label1 = new QLabel(); Q_CHECK_PTR(label1); label1->setText(tr("Images:")); gridLayout->addWidget(label1, 0, 0); list = new QListWidget(); Q_CHECK_PTR(list); connect(list, SIGNAL(itemSelectionChanged()), this, SLOT(ListSelectionChanged())); gridLayout->addWidget(list, 1, 0, 1, 3); QPushButton *add = new QPushButton(); Q_CHECK_PTR(add); add->setText(tr("Add")); gridLayout->addWidget(add, 2, 0); connect(add, SIGNAL(clicked()), this, SLOT(AddImage())); fPreview = new QPushButton(); Q_CHECK_PTR(fPreview); fPreview->setText(tr("Preview")); fPreview->setEnabled(false); gridLayout->addWidget(fPreview, 2, 1); connect(fPreview, SIGNAL(clicked()), this, SLOT(PreviewImage())); fRemove = new QPushButton(); Q_CHECK_PTR(fRemove); fRemove->setText(tr("Remove")); fRemove->setEnabled(false); gridLayout->addWidget(fRemove, 2, 2); connect(fRemove, SIGNAL(clicked()), this, SLOT(RemoveImage())); LoadSettings(); }
void ImageLoader::DeregisterCSSImage(ImageLoader::Image* aImage) { RemoveImage(aImage); }
//set et props of tile to empty void Tile::RemoveAllProperties() { RemoveImage(); RemoveColor(); };
void Team::ClearImages() { while (!fImages.IsEmpty()) RemoveImage(fImages.First()); }