extern "C" DLL void rglDDrawActivate(unsigned char active) { HRESULT rval; if (WINDOWED || lpDD == NULL) { return; } if (active) { if (!bActive) { for (;;) { rval = lpDD->SetDisplayMode(SCRWIDTH, SCRHEIGHT, 16); if (rval == DD_OK) { break; } if (rval == DDERR_SURFACELOST) { if (!restoreAll()) { break; } } } bActive = TRUE; } } else { if (bActive) { for (;;) { rval = lpDD->RestoreDisplayMode(); if (rval == DD_OK) { break; } if (rval == DDERR_SURFACELOST) { if (!restoreAll()) { break; } } } bActive = FALSE; } } }
extern "C" void updateFrame(void) { HRESULT ddrval; RECT destRect, rcRect; POINT pt; if (!useDirectDraw) { noddrawUpdateFrame(); return; } if (WINDOWED) { GetClientRect(hwnd, &destRect); pt.x = pt.y = 0; ClientToScreen(hwnd, &pt); OffsetRect(&destRect, pt.x, pt.y); rcRect.left = 0; rcRect.top = 0; rcRect.right = SCRWIDTH; rcRect.bottom = SCRHEIGHT; } else { rcRect.left = rcRect.top = 0; rcRect.right = SCRWIDTH; rcRect.bottom = SCRHEIGHT; destRect = rcRect; } if (bSaveFramebuffer) { rglCopyScratchBuffer(); } for (;;) { ddrval = PrimarySurface->Blt(&destRect, BackSurface, &rcRect, 0, NULL); // ddrval = PrimarySurface->BltFast(0, 0, BackSurface, &rcRect, 0); if (ddrval == DD_OK) { break; } if (ddrval == DDERR_SURFACELOST) { if (!restoreAll()) { return; } } if (ddrval != DDERR_WASSTILLDRAWING) { return; } } }
NTrashTree::NTrashTree(QWidget *parent) : QTreeWidget(parent) { this->count = 0; QFont f = this->font(); f.setPointSize(8); this->setFont(f); filterPosition = -1; // setup options this->setEditTriggers(QAbstractItemView::NoEditTriggers); this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setSelectionMode(QAbstractItemView::ExtendedSelection); this->setRootIsDecorated(true); this->setSortingEnabled(false); this->header()->setVisible(false); this->setContentsMargins(10,10,10,10); //this->setStyleSheet("QTreeWidget { border: none; background-color:transparent; }"); // Build the root item QIcon icon(":trash.png"); root = new QTreeWidgetItem(this); root->setIcon(0,icon); root->setData(0, Qt::UserRole, "root"); root->setData(0, Qt::DisplayRole, tr("Trash")); QFont font = root->font(0); font.setBold(true); root->setFont(0,font); this->setMinimumHeight(1); this->addTopLevelItem(root); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection())); restoreAction = contextMenu.addAction(tr("Restore Deleted Notes")); connect(restoreAction, SIGNAL(triggered()), SLOT(restoreAll())); contextMenu.addSeparator(); expungeAction = contextMenu.addAction(tr("Empty Trash")); connect(expungeAction, SIGNAL(triggered()), this, SLOT(expungeAll())); setItemDelegate(new NTrashViewDelegate()); this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); this->setFrameShape(QFrame::NoFrame); }
void KviMdiManager::fillWindowPopup() { m_pWindowPopup->clear(); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::CascadeWindows)),(__tr2qs("&Cascade Windows")),this,SLOT(cascadeWindows())); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::CascadeWindows)),(__tr2qs("Cascade &Maximized")),this,SLOT(cascadeMaximized())); m_pWindowPopup->addSeparator(); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("&Tile Windows")),this,SLOT(tile())); m_pTileMethodPopup->clear(); QAction * pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::AutoTileWindows)),(__tr2qs("&Auto Tile")),this,SLOT(toggleAutoTile())); pAction->setCheckable(true); pAction->setChecked(KVI_OPTION_BOOL(KviOption_boolAutoTileWindows)); pAction->setData(-1); m_pTileMethodPopup->addSeparator(); if(KVI_OPTION_UINT(KviOption_uintTileMethod) >= KVI_NUM_TILE_METHODS) KVI_OPTION_UINT(KviOption_uintTileMethod) = KVI_TILE_METHOD_PRAGMA9HOR; uint uSelectedMethod= KVI_OPTION_UINT(KviOption_uintTileMethod); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Anodine's Full Grid"))); pAction->setData(KVI_TILE_METHOD_ANODINE); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_ANODINE) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 4-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA4HOR); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA4HOR) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 4-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA4VER); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA4VER) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 6-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA6HOR); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA6HOR) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 6-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA6VER); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA6VER) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 9-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA9HOR); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA9HOR) pAction->setChecked(true); pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 9-Grid"))); pAction->setData(KVI_TILE_METHOD_PRAGMA9VER); pAction->setCheckable(true); if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA9VER) pAction->setChecked(true); pAction = m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Tile Met&hod"))); pAction->setMenu(m_pTileMethodPopup); m_pWindowPopup->addSeparator(); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::MaxVertical)),(__tr2qs("Expand &Vertically")),this,SLOT(expandVertical())); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::MaxHorizontal)),(__tr2qs("Expand &Horizontally")),this,SLOT(expandHorizontal())); m_pWindowPopup->addSeparator(); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minimize)),(__tr2qs("Mi&nimize All")),this,SLOT(minimizeAll())); m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Restore)),(__tr2qs("&Restore all")),this,SLOT(restoreAll())); m_pWindowPopup->addSeparator(); int i = 100; QString szItem; QString szCaption; QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder); QListIterator<QMdiSubWindow*> it(tmp); KviMdiChild * lpC; while (it.hasNext()) { lpC = (KviMdiChild *) it.next(); if (!lpC->inherits("KviMdiChild")) { i++; continue; } szItem.setNum(((uint)i)-99); szItem+=". "; szCaption = lpC->windowTitle(); if(szCaption.length() > 30) { QString trail = szCaption.right(12); szCaption.truncate(12); szCaption+="..."; szCaption+=trail; } if(lpC->state()==KviMdiChild::Minimized) { szItem+="("; szItem+=szCaption; szItem+=")"; } else szItem+=szCaption; const QPixmap * pix = lpC->icon(); if (pix && !(pix->isNull())) { pAction = m_pWindowPopup->addAction(*pix, szItem); pAction->setData(i); } else { pAction = m_pWindowPopup->addAction(szItem); pAction->setData(i); } //this is useless, since the windows are listed in stacking order, the active one //will always be the last anyway. //if(lpC==currentSubWindow()) // m_pWindowPopup->setItemChecked(i, true ); i++; } }