void toMain::windowsMenu ( void ) { WindowsMenu->clear(); WindowsMenu->insertItem ( "C&lose", TO_WINDOWS_CLOSE ); if ( !workspace() ->activeWindow() ) WindowsMenu->setItemEnabled ( TO_WINDOWS_CLOSE, false ); WindowsMenu->insertItem ( "Close &All", TO_WINDOWS_CLOSE_ALL ); WindowsMenu->insertSeparator(); WindowsMenu->insertItem ( "&Cascade", TO_WINDOWS_CASCADE ); WindowsMenu->insertItem ( "&Tile", TO_WINDOWS_TILE ); if ( workspace() ->windowList().isEmpty() ) { WindowsMenu->setItemEnabled ( TO_WINDOWS_CASCADE, false ); WindowsMenu->setItemEnabled ( TO_WINDOWS_TILE, false ); WindowsMenu->setItemEnabled ( TO_WINDOWS_CLOSE_ALL, false ); } else { WindowsMenu->insertSeparator(); QRegExp strip ( " <[0-9]+>$" ); for ( unsigned int i = 0;i < workspace() ->windowList().count();i++ ) { QWidget *widget = workspace() ->windowList().at ( i ); QString caption = widget->caption(); caption.replace ( strip, "" ); WindowsMenu->insertItem ( caption, TO_WINDOWS_WINDOWS + i ); WindowsMenu->setItemChecked ( TO_WINDOWS_WINDOWS + i, workspace() ->activeWindow() == workspace() ->windowList().at ( i ) ); if ( i < 9 ) { WindowsMenu->setAccel ( Key_1 + i | CTRL, TO_WINDOWS_WINDOWS + i ); caption += " <"; caption += QString::number ( i + 1 ); caption += ">"; } widget->setCaption ( caption ); } } }
void App::slotRefreshWindowMenu() { QWidget* widget; int id = 0; QPtrList <QWidget> wl = workspace()->windowList(); m_windowMenu->clear(); m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_sidetree.png")), "Cascade", this, SLOT(slotWindowCascade()), 0, ID_WINDOW_CASCADE); m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_left_right.png")), "Tile", this, SLOT(slotWindowTile()), 0, ID_WINDOW_TILE); m_windowMenu->insertSeparator(); for (widget = wl.first(); widget != NULL; widget = wl.next()) { m_windowMenu->insertItem(widget->caption(), id); if (widget->isVisible() == true) { m_windowMenu->setItemChecked(id, true); } id++; } connect(m_windowMenu, SIGNAL(activated(int)), this, SLOT(slotWindowMenuCallback(int))); }
void App::slotRefreshWindowMenu() { QWidget* widget; int id = 0; QList <QWidget> wl = workspace()->windowList(); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; m_windowMenu->clear(); m_windowMenu->insertItem(QPixmap(dir + QString("/cascadewindow.xpm")), "Cascade", this, SLOT(slotWindowCascade()), 0, ID_WINDOW_CASCADE); m_windowMenu->insertItem(QPixmap(dir + QString("/tilewindow.xpm")), "Tile", this, SLOT(slotWindowTile()), 0, ID_WINDOW_TILE); m_windowMenu->insertSeparator(); for (widget = wl.first(); widget != NULL; widget = wl.next()) { m_windowMenu->insertItem(widget->caption(), id); if (widget->isVisible() == true) { m_windowMenu->setItemChecked(id, true); } id++; } connect(m_windowMenu, SIGNAL(activated(int)), this, SLOT(slotWindowMenuCallback(int))); }
bool AQEventFilter::eventFilter(QObject *obj, QEvent *ev) #endif { if (AQWEBAPP->ignoreEvents_ || ev->aq_ignore || !obj->isWidgetType()) #ifdef AQ_USE_NOTIFY return QApplication::notify(obj, ev); #else return false; #endif switch (ev->type()) { case QEvent::Show: { ev->aq_ignore = true; QApplication::sendEvent(obj, ev); ev->aq_ignore = false; AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Show))); return true; } case QEvent::Hide: { ev->aq_ignore = true; QApplication::sendEvent(obj, ev); ev->aq_ignore = false; QWidget *w = AQ_WIDGET(obj); if (w->isTopLevel()) { //printf("hide %p %s\n", w, w->QObject::name()); //if (AQWEBAPP->lastDeactivate_) // printf("hide lastDeactivate_ %p %s\n", AQWEBAPP->lastDeactivate_, AQWEBAPP->lastDeactivate_->QObject::name()); if (AQWEBAPP->lastDeactivate_ == w) AQWEBAPP->lastDeactivate_ = 0; AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w); if (wInfo && wInfo->backActive_) { //printf("hide backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name()); if (AQWEBAPP->createdWidgets_.find(wInfo->backActive_)) wInfo->backActive_->setActiveWindow(); wInfo->backActive_ = 0; } } AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Hide))); //break; return true; } case QEvent::Move: { QMoveEvent *mv = static_cast<QMoveEvent *>(ev); if (mv->pos() != mv->oldPos()) AQWEBAPP->postAQEvent(new AQEvent(obj, new QMoveEvent(mv->pos(), mv->oldPos()))); break; } case QEvent::Resize: { QResizeEvent *rs = static_cast<QResizeEvent *>(ev); if (rs->size() != rs->oldSize()) AQWEBAPP->postAQEvent(new AQEvent(obj, new QResizeEvent(rs->size(), rs->oldSize()))); break; } case QEvent::Reparent: { AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Reparent))); break; } case QEvent::WindowActivate: { QWidget *w = AQ_WIDGET(obj); if (w->isTopLevel()) { //printf("activate %p %s\n", w, w->QObject::name()); if (AQWEBAPP->lastDeactivate_ && AQWEBAPP->lastDeactivate_ != w) { AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w); if (wInfo) { wInfo->backActive_ = AQWEBAPP->lastDeactivate_; //printf("activate backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name()); } } AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowActivate))); } break; } case QEvent::WindowDeactivate: { QWidget *w = AQ_WIDGET(obj); if (w->isTopLevel()) { //printf("deactivate %p %s\n", w, w->QObject::name()); AQWEBAPP->lastDeactivate_ = w; AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowDeactivate))); } break; } case QEvent::CaptionChange: { QWidget *w = AQ_WIDGET(obj); if (w->isTopLevel() && !w->isPopup()) aq_notify_gui_args_event(w, "xgen", QString::fromLatin1("caption:") + w->caption()); break; } case QEvent::IconChange: { QWidget *w = AQ_WIDGET(obj); if (w->isTopLevel() && !w->isPopup()) aq_notify_gui_args_event(w, "xgen", QString::fromLatin1("icon:") + QString::number(aq_store_pixmap(w, w->icon()), 36)); break; } } #ifdef AQ_USE_NOTIFY return QApplication::notify(obj, ev); #else return false; #endif }
// // Refresh menu items' status depending on system mode // also fills window menu with open window titles // void App::slotRefreshMenus() { // // Refresh tools & mode menus // if (m_mode == Operate) { m_fileMenu->setItemEnabled(ID_FILE_NEW, false); m_fileMenu->setItemEnabled(ID_FILE_OPEN, false); m_fileMenu->setItemEnabled(ID_FILE_SAVE_AS, false); m_fileMenu->setItemEnabled(ID_FILE_SETTINGS, false); m_fileMenu->setItemEnabled(ID_FILE_QUIT, false); m_toolsMenu->setItemEnabled(ID_VIEW_FUNCTION_TREE, false); m_modeMenu->setItemChecked(ID_FUNCTIONS_MODE_OPERATE, true); m_modeMenu->setItemChecked(ID_FUNCTIONS_MODE_DESIGN, false); } else { m_fileMenu->setItemEnabled(ID_FILE_NEW, true); m_fileMenu->setItemEnabled(ID_FILE_OPEN, true); m_fileMenu->setItemEnabled(ID_FILE_SAVE_AS, true); m_fileMenu->setItemEnabled(ID_FILE_SETTINGS, true); m_fileMenu->setItemEnabled(ID_FILE_QUIT, true); m_toolsMenu->setItemEnabled(ID_VIEW_FUNCTION_TREE, true); m_modeMenu->setItemChecked(ID_FUNCTIONS_MODE_OPERATE, false); m_modeMenu->setItemChecked(ID_FUNCTIONS_MODE_DESIGN, true); } // // Refresh window menu // QWidget* widget; int id = 0; QPtrList <QWidget> wl = workspace()->windowList(); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; m_windowMenu->clear(); m_windowMenu->insertItem(QPixmap(dir + QString("/cascadewindow.xpm")), "Cascade", this, SLOT(slotWindowCascade()), 0, ID_WINDOW_CASCADE); m_windowMenu->insertItem(QPixmap(dir + QString("/tilewindow.xpm")), "Tile", this, SLOT(slotWindowTile()), 0, ID_WINDOW_TILE); m_windowMenu->insertSeparator(); for (widget = wl.first(); widget != NULL; widget = wl.next()) { m_windowMenu->insertItem(widget->caption(), id); if (widget->isVisible() == true) { m_windowMenu->setItemChecked(id, true); } id++; } }