fltk::Window* LabelNodeMenu::createWindow() { fltk::Window* w; {fltk::Window* o = mMenuWindow = new fltk::Window(250, 280, "Label Node Menu"); w = o; o->set_vertical(); o->shortcut(0xff1b); o->user_data((void*)(this)); o->tooltip("Set label attributes in this window"); o->begin(); {fltk::TextEditor* o = mTextEditor = new fltk::TextEditor(35, 10, 200, 18, "Label"); o->box(fltk::ENGRAVED_BOX); o->callback((fltk::Callback*)cb_mTextEditor); o->when(fltk::WHEN_CHANGED); o->tooltip("Text to be displayed by the node"); } {fltk::Button* o = new fltk::Button(70, 247, 100, 28, "Done"); o->callback((fltk::Callback*)cb_Done); } {fltk::Group* o = mFontWidget = new fltk::Group(0, 46, 250, 200, "Text Attributes"); o->labeltype(fltk::EMBOSSED_LABEL); o->textsize(11); fltk::Group::current()->resizable(o); } o->end(); } mTextEditor->text(mNode->text()); mFontWidget->begin(); addSubWindow(new FontMenuWidget(mNode,mMenuWindow)); mFontWidget->end(); return w; }
void app_area::add(app::generic_app* m) { REQUIRE(m); connect(m, SIGNAL(did_resize_hack()), this, SLOT(handle_resize_hack())); auto sw = new app_sub_window; CHECK(sw); sw->setWidget(m); m->set_sub_window(sw); ENSURE(sw->widget() == m); auto nsw = addSubWindow(sw); Qt::WindowFlags flags = Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint| Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint; nsw->setWindowFlags(flags); nsw->setWindowTitle(m->title_text().c_str()); //start generic app m->start(); m->set_alert(); }
Workspace::Workspace(PreviewFrame *parent) : QMdiArea(parent) { previewFrame = parent; PreviewWidget *previewWidget = previewFrame->widget(); QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); frame->move(10, 10); frame->show(); }
Workspace::Workspace(PreviewFrame* parent, const char* name) : QMdiArea(parent) { previewFrame = parent; PreviewWidget *previewWidget = previewFrame->widget(); setObjectName(QLatin1String(name)); QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); frame->move(10,10); frame->show(); }
void KviMdiManager::manageChild(KviMdiChild * lpC) { connect(lpC, SIGNAL(windowStateChanged(Qt::WindowStates,Qt::WindowStates)), this, SLOT(processWindowStateChanged(Qt::WindowStates,Qt::WindowStates))); addSubWindow((QMdiSubWindow*)lpC); if(!m_bInSDIMode && KVI_OPTION_BOOL(KviOption_boolAutoTileWindows)) tile(); }
void gdPluginList::__cb_addPlugin() { /* the usual callback that gWindow adds to each subwindow in this case * is not enough, because when we close the browser the plugin list * must be redrawn. We have a special callback, cb_refreshList, which * we add to gdBrowser. It does exactly what we need. */ gdBrowser *b = new gdBrowser("Browse Plugin", G_Conf.pluginPath.c_str(), ch, BROWSER_LOAD_PLUGIN, stackType); addSubWindow(b); b->callback(cb_refreshList, (void*)this); // 'this' refers to gdPluginList }
void MainWindow::menu_newConnection() { bool OK = false; QString label = "Geben Sie eine Hostadresse bzw. eine IP ein, mit der Sie sich verbinden möchten:"; QString titel = "Verbindung herstellen"; QString ip = QInputDialog::getText(this, titel, label, QLineEdit::Normal, "10.0.10.1", &OK); if(!OK || ip.length() == 0) return; if(!addSubWindow(ip)) QMessageBox::warning(this, "Info", "Es ist schon ein Fenster mit dieser IP vorhanden", "OK"); }
void CUIWindowResizer::addResizeGrip(void) { RECT clientRect; int x; int y; int width = ::GetSystemMetrics(SM_CXVSCROLL); int height = ::GetSystemMetrics(SM_CYHSCROLL); HWND hGrip; GetClientRect(hWindow, &clientRect); x = clientRect.right - width; y = clientRect.bottom - height; hGrip = createResizeGrip(hWindow, x, y, width, height); addSubWindow(hGrip, CUIFloatLeft | CUIFloatTop); }
QWidget* ImprovedWorkspace::addWindow(QWidget* child,QAction* action) { QMdiSubWindow* sub = addSubWindow(child); if(viewMode()==QMdiArea::TabbedView) { action->setChecked(true); sub->setVisible(true); child->setVisible(true); } insertActionAndSubWindow(action,sub); connect(action,SIGNAL(triggered()),this,SLOT(ensurePresent())); sub->setAttribute(Qt::WA_DeleteOnClose, false); child->setAttribute(Qt::WA_DeleteOnClose, false); sub->setObjectName(child->objectName()); sub->installEventFilter(this); return sub; }
void ImprovedWorkspace::addContainerMedia(MediaContainer* mediac) { if(NULL!=mediac) { addSubWindow(mediac); insertActionAndSubWindow(mediac->getAction(),mediac); if(viewMode()==QMdiArea::TabbedView) { mediac->setVisible(true); } mediac->setAttribute(Qt::WA_DeleteOnClose, false); if(NULL!=mediac->widget()) { mediac->widget()->setAttribute(Qt::WA_DeleteOnClose, false); } mediac->installEventFilter(this); } }
PlotWithCurves* Group::insertPlot() { QMdiSubWindow* window = new QMdiSubWindow; { window->setMinimumSize(250, 150); window->setWindowIcon(QIcon(":/res/mainWindow/closeAllPlots.png")); window->setAttribute(Qt::WA_DeleteOnClose); } PlotWithCurves* plot = new PlotWithCurves(samplesManager, curvesManagerView, window); { plot->connect(plot, SIGNAL(destroyed()), this, SLOT(retitle())); window->setWidget(plot); addSubWindow(window); window->show(); retitle(); } return plot; }
void CodeArea::addCodeWindow(Revision *r, QString fileText, int cursorPos = 0) { //setup the widget CodeEdit *edit = new CodeEdit(this); edit->setPlainText( fileText ); edit->rev = r; //set highlighter no matter what language, dirty hack SuperWordHighlighter *wh = new SuperWordHighlighter(edit->document()); //setup the subwindow QMdiSubWindow *subWindow = addSubWindow( edit ); subWindow->showMaximized(); subWindow->setWindowTitle( edit->rev->getBufferName() ); //don't delete windows when closed subWindow->setAttribute(Qt::WA_DeleteOnClose, false); //add to subwindow maps subWindowMap[r] = subWindow; subWindowMap2[subWindow] = r; //save the position, so that it may be restored if ( cursorPos > 0 ) { QTextCursor cursor = edit->textCursor(); cursor.setPosition( cursorPos ); edit->setTextCursor( cursor ); } notifyNewRevision(r); //listen changes edit->listenChanges(); //edit->focusWidget(); setActiveSubWindow( subWindow ); //listen to zoom changes connect( this, SIGNAL(updateZoom(int)), edit, SLOT(onZoomChanged(int)) ); }
//----------------------------------------------------------------------------------------- bool GenericTextEditor::displayText(QString docName, QString text, QString extension, QString optionalData) { // If there is no extra extension passed, then try to find the matching one based on the doc name ITextEditorCodecFactory* codecFactory; if(extension == "") codecFactory = GenericTextEditor::findMatchingCodecFactory(docName); else codecFactory = GenericTextEditor::findMatchingCodecFactory(extension); if(codecFactory == 0) return false; GenericTextEditorDocument* document = 0; if(!isDocAlreadyShowing(docName, document) || isAllowDoubleDisplay()) { document = new GenericTextEditorDocument(this); ITextEditorCodec* codec = codecFactory->create(document, docName); document->setCodec(codec); document->displayText(docName, text, optionalData); QMdiSubWindow *window = addSubWindow(document); window->setWindowIcon(QIcon(codec->getDocumentIcon())); document->showMaximized(); QTabBar* tabBar = findChildren<QTabBar*>().at(0); tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, docName); } else { document->getCodec()->setOptionalData(optionalData); document->getCodec()->onDisplayRequest(); setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window())); document->setFocus(Qt::ActiveWindowFocusReason); } moveToForeground(); connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified())); mActSave->setEnabled(false); return true; }
//----------------------------------------------------------------------------------------- bool GenericTextEditor::displayTextFromFile(QString filePath, QString optionalData) { ITextEditorCodecFactory* codecFactory = GenericTextEditor::findMatchingCodecFactory(filePath); if(codecFactory == 0) return false; GenericTextEditorDocument* document = 0; if(!isPathAlreadyShowing(filePath, document) || isAllowDoubleDisplay()) { document = new GenericTextEditorDocument(this); ITextEditorCodec* codec = codecFactory->create(document, filePath); document->setCodec(codec); document->displayTextFromFile(QFile(filePath).fileName(), filePath, optionalData); QMdiSubWindow *window = addSubWindow(document); window->setWindowIcon(QIcon(codec->getDocumentIcon())); document->showMaximized(); QTabBar* tabBar = findChildren<QTabBar*>().at(0); tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, QFile(filePath).fileName()); } else { document->getCodec()->setOptionalData(optionalData); document->getCodec()->onDisplayRequest(); setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window())); document->setFocus(Qt::ActiveWindowFocusReason); } moveToForeground(); connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified())); mActSave->setEnabled(false); return true; }
/** * Add a cubeViewport to the workspace. * * @param cube[in] (Cube *) cube information * * @internal * * @history 2007-04-13 Tracie Sucharski - Load entire image instead of * fitting smallest dimension. * @history 2008-05-27 Noah Hilt - Now returns a MdiCubeViewport * in order for the addCubeViewport(QString cubename) * method to modify the MdiCubeViewport. * @history 2008-08-20 Stacy Alley - Changed the setScale call * to match the zoomTool's fit in view * @history 2008-12-04 Jeannie Walldren - Added try/catch to * close the MdiCubeViewport if showCube() is not * successful. */ MdiCubeViewport *Workspace::addCubeViewport(Cube *cube) { MdiCubeViewport *result = NULL; try { ViewportMdiSubWindow *window(new ViewportMdiSubWindow(cube)); window->setAttribute(Qt::WA_DeleteOnClose); addSubWindow(window); window->show(); result = window->viewport(); emit cubeViewportAdded(result); } catch(IException &e) { throw IException(e, IException::Programmer, tr("Error when attempting to show cube [%1]") .arg(cube->fileName()), _FILEINFO_); } return result; }
/*! Enable/disable the \a generator according to \a enabled. */ void UiGeneratorArea::setGeneratorEnabled(GeneratorType generator, bool enabled) { GeneratorDevice* device = DeviceManager::instance().activeDevice() ->generatorDevice(); if (device == NULL) return; QMdiSubWindow* win; if (generator == AnalogGenerator) { win = mAnalogWin; device->enableAnalogGenerator(enabled); } else { win = mDigitalWin; device->enableDigitalGenerator(enabled); } bool added = (subWindowList().indexOf(win) != -1); if (enabled && !added) { addSubWindow(win); // for some reason the subwindow (win) can have a very small size // in some circumstances. Make sure it at least gets the same // size as its widget if (win->size().width() < win->widget()->size().width() || win->size().height() < win->widget()->size().height()) { win->resize(win->widget()->size()); } win->show(); win->widget()->show(); } else if (!enabled && added) { removeSubWindow(win); } }
PalettePreviewMdiArea::PalettePreviewMdiArea(QWidget *parent) : QMdiArea(parent) { mDemoWidget=addSubWindow(new PaletteDemoWidget(this), Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); mDemoWidget->setWindowState(Qt::WindowMaximized); }
void CUIWindowResizer::addSubWindow(int controlID, DWORD resizeMask) { addSubWindow(GetDlgItem(hWindow, controlID), resizeMask); }
void MainWindow::servermanager_connectionRequest(const QString &ip) { if(!addSubWindow(ip)) QMessageBox::warning(this, "Info", "Es ist schon ein Fenster mit dieser IP vorhanden", "OK"); }