QList<QAction*> SwitchWindow::contextualActions() { makeMenu(); QList<QAction*> list; list << m_action; return list; }
void SwitchWindow::contextEvent(QGraphicsSceneMouseEvent *event) { makeMenu(); if (!m_menu->isEmpty()) { m_menu->exec(popupPosition(m_menu->size(), event)); } }
int Rubik3D::init3D() { int myargc=1; char * myargv[1]; myargv[0]=strdup("3dvisualization"); glutInit(&myargc, myargv); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (640, 600); glutCreateWindow ("RUBIK'S CUBE"); glClearColor(0.0f,0.0f,0.0f, 1.0f); glutPostRedisplay(); myreshape(640,640); glutReshapeFunc (myreshape); glutIdleFunc(display); glutMouseFunc(mouse); glutMotionFunc(motion); glutCreateMenu(mymenu); makeMenu(); glutAttachMenu(GLUT_RIGHT_BUTTON); glutKeyboardFunc(keyboard); glutDisplayFunc (display); glEnable(GL_DEPTH_TEST); glutMainLoop(); OUT_("\nopenGL main loop has been closed...") free(myargv[0]); return 0; }
int visualization(Rubik * cube, int argc, char **argv) { rubik=new Rubik3D(cube); glutInit(&argc, argv); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (640, 600); glutCreateWindow ("RUBIK'S CUBE"); glClearColor(0.0f,0.0f,0.0f, 1.0f); glutPostRedisplay(); // initLight(); myreshape(640,640); glutReshapeFunc (myreshape); glutIdleFunc(display); glutMouseFunc(mouse); glutMotionFunc(motion); glutCreateMenu(mymenu); makeMenu(); glutAttachMenu(GLUT_RIGHT_BUTTON); glutKeyboardFunc(keyboard); glutDisplayFunc (display); glEnable(GL_DEPTH_TEST); glutMainLoop(); OUT_("\nopenGL main loop has been closed...") delete rubik; return 0; }
MissionMenu::MissionMenu(sf::RenderWindow & win): Menu(win), game(0), missions() { missions.load(); offset = option.size(); makeMenu(); loadBackground(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_stringManager = new StringManager(); m_mindmapView = new MindMapView(this);// new GraphWidget(m_stringManager,this); m_mindtoolbar = new MindToolBar(m_stringManager,this); //m_detailpanel = new DetailPanel(this); m_browser = new ItemBrowser; m_scene = new MindMap(this); m_scene->setStringManager(m_stringManager); m_mindmapView->setScene(m_scene); m_scene->setSceneRect(0,0,1024,768); m_mindmapView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); m_mindmapView->setRenderHints(QPainter::Antialiasing |QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform ); /* m_timeLine = new TimeLineWidget(); QDockWidget* bottom = new QDockWidget(tr("TimeLine"),this); bottom->setWidget(m_timeLine); addDockWidget(Qt::BottomDockWidgetArea,bottom);*/ m_title = tr("%1[*] - MindMap Rolisteam - v0.0.1"); setObjectName("MainWindow"); setWindowTitle(m_title.arg(tr("untitled"))); /*connect(m_mindmapView,SIGNAL(currentEdge(GenericMindMapItem*)),m_detailpanel,SLOT(setCurrentGenericItem(GenericMindMapItem*))); connect(m_mindmapView,SIGNAL(currentNode(GenericMindMapItem*)),m_detailpanel,SLOT(setCurrentGenericItem(GenericMindMapItem*))); connect(m_mindmapView,SIGNAL(currentPackage(GenericMindMapItem*)),m_detailpanel,SLOT(setCurrentGenericItem(GenericMindMapItem*))); connect(m_mindmapView,SIGNAL(currentPackage(GenericMindMapItem*)),m_detailpanel,SLOT(show())); connect(m_mindmapView,SIGNAL(currentEdge(GenericMindMapItem*)),m_detailpanel,SLOT(show())); connect(m_mindmapView,SIGNAL(currentNode(GenericMindMapItem*)),m_detailpanel,SLOT(show())); connect(m_mindmapView,SIGNAL(selectionIsEmpty()),m_detailpanel,SLOT(hide())); connect(m_mindmapView,SIGNAL(nodeAsBrush(Node*)),m_mindtoolbar,SLOT(addNodeBrush(Node*))); connect(m_mindmapView,SIGNAL(itemHasBeenAdded(GenericMindMapItem*)),m_browser,SLOT(addItem(GenericMindMapItem*))); connect(m_mindmapView,SIGNAL(itemHasBeenDeleted(GenericMindMapItem*)),m_browser,SLOT(removeItem(GenericMindMapItem*)));*/ m_preferences = PreferencesManager::getInstance(); m_recentFileActions = new QList<QAction*>(); setupUi(); readSettings(); makeAction(); makeMenu(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { lastResult = 0; lastResultIsExist = false; fileName = ""; makeStatusBar(); makeMenu(); makeCentralWidget(); makeCalcWidget(); connections(); }
/** * @brief SceneFilter::SceneFilter * @param model * @param scene * @param parentForm * @param parent */ SceneFilter::SceneFilter(const models::SharedApplicationModel &model, QGraphicsScene *scene, MainWindow *parentForm, QObject *parent) : QObject(parent) , m_Scene(scene) , m_Menu(std::make_unique<QMenu>()) , m_EditDialog(std::make_unique<EditEntityDialog>(parentForm)) , m_ApplicationModel(model) { makeMenu(); connect(m_EditDialog.get(), &EditEntityDialog::needNewScope, parentForm, &MainWindow::onCreateScope); connect(m_ApplicationModel.get(), &models::ApplicationModel::scopeAdded, m_EditDialog.get(), &EditEntityDialog::onScopeAdded); }
bool ConfigMenu::init(){ if(!CCLayer::init()){ return false; } CCDirector* director = CCDirector::sharedDirector(); this->setContentSize(director->getWinSize()); MaskLayer* _mask = MaskLayer::create(); this->addChild(_mask); _mask->setOpacity(200); makeMenu(); return true; }
void LCDST7565::enterMenu(int m) { if(historyPos > MENU_HISTORY_SIZE - 1) return; menuHistory[historyPos] = currentMenu; itemIndexHistory[historyPos] = _item_index; drawIndexHistory[historyPos] = _draw_index; clineHistory[historyPos] = _current_line; historyPos++; currentMenu = m; // clear the current menu clearMenu(); makeMenu(m); //lastDrawIndex = _draw_index; //lastItemIndex = _item_index; update(); }
HMENU makeMenubar(void) { HMENU menubar; HMENU menu; size_t i; menusFinalized = TRUE; menubar = CreateMenu(); if (menubar == NULL) logLastError(L"error creating menubar"); for (i = 0; i < len; i++) { menu = makeMenu(menus[i]); if (AppendMenuW(menubar, MF_POPUP | MF_STRING, (UINT_PTR) menu, menus[i]->name) == 0) logLastError(L"error appending menu to menubar"); } return menubar; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (640, 600); glutCreateWindow ("RUBIK'S CUBE"); glClearColor(ScreenColor[0],ScreenColor[1],ScreenColor[2], 1.0f); glutPostRedisplay(); // initLight(); myreshape(640,640); glutReshapeFunc (myreshape); glutIdleFunc(display); glutMouseFunc(mouse); glutMotionFunc(motion); glutCreateMenu(mymenu); makeMenu(); glutAttachMenu(GLUT_RIGHT_BUTTON); glutKeyboardFunc(keyboard); glutDisplayFunc (display); glEnable(GL_DEPTH_TEST); glutMainLoop(); return 0; }
void LCDST7565::menuBack() { if(_menu_items[_item_index].type == MENU_ITEM_TYPE_INLINE_INT) { int val = this->updateInlineInt(_menu_items[_item_index].value, --_menu_items[_item_index].inlineValue); _menu_items[_item_index].inlineValue = val; } else { if(historyPos <= 1) return; historyPos--; currentMenu = menuHistory[historyPos]; // clear the current menu valueMenuActive = false; clearMenu(); makeMenu(currentMenu); _item_index = itemIndexHistory[historyPos]; _draw_index = drawIndexHistory[historyPos]; _current_line = clineHistory[historyPos]; } update(); }
void CallStackView::setupContextMenu() { mMenuBuilder = new MenuBuilder(this, [](QMenu*) { return DbgIsDebugging(); }); QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png")); mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress()))); QAction* mFollowTo = mMenuBuilder->addAction(makeAction(icon, tr("Follow &To"), SLOT(followTo()))); mFollowTo->setShortcutContext(Qt::WidgetShortcut); mFollowTo->setShortcut(QKeySequence("enter")); connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followTo())); mMenuBuilder->addAction(makeAction(icon, tr("Follow &From"), SLOT(followFrom())), [this](QMenu*) { return !getCellContent(getInitialSelection(), 2).isEmpty(); }); MenuBuilder* mCopyMenu = new MenuBuilder(this); setupCopyMenu(mCopyMenu); // Column count cannot be zero mMenuBuilder->addSeparator(); mMenuBuilder->addMenu(makeMenu(DIcon("copy.png"), tr("&Copy")), mCopyMenu); mMenuBuilder->loadFromConfig(); }
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), _logger(Poco::Logger::get("PothosFlow.MainWindow")), _splash(new MainSplash(this)), _settings(new MainSettings(this)), _actions(nullptr), _blockCache(nullptr), _editorTabs(nullptr), _propertiesPanel(nullptr) { globalMainWindow = this; _splash->show(); _splash->postMessage(tr("Creating main window...")); _splash->postMessage(tr("Launching scratch process...")); this->setupServer(); _splash->postMessage(tr("Loading Pothos plugins...")); Pothos::init(); this->setMinimumSize(800, 600); this->setWindowTitle("Pothos Flow"); //initialize actions and action buttons _splash->postMessage(tr("Creating actions...")); _actions = new MainActions(this); _splash->postMessage(tr("Creating toolbar...")); auto mainToolBar = new MainToolBar(this, _actions); this->addToolBar(mainToolBar); _splash->postMessage(tr("Creating menus...")); auto mainMenu = new MainMenu(this, _actions); //connect actions to the main window connect(_actions->exitAction, SIGNAL(triggered(void)), this, SLOT(close(void))); connect(_actions->showAboutAction, SIGNAL(triggered(void)), this, SLOT(handleShowAbout(void))); connect(_actions->showAboutQtAction, SIGNAL(triggered(void)), this, SLOT(handleShowAboutQt(void))); connect(_actions->showColorsDialogAction, SIGNAL(triggered(void)), this, SLOT(handleColorsDialogAction(void))); connect(_actions->fullScreenViewAction, SIGNAL(toggled(bool)), this, SLOT(handleFullScreenViewAction(bool))); connect(_actions->reloadPluginsAction, SIGNAL(triggered(bool)), this, SLOT(handleReloadPlugins(void))); //create message window dock _splash->postMessage(tr("Creating message window...")); auto messageWindowDock = new MessageWindowDock(this); this->addDockWidget(Qt::BottomDockWidgetArea, messageWindowDock); _logger.information("Welcome to Pothos v%s", Pothos::System::getLibVersion()); //create graph actions dock _splash->postMessage(tr("Creating actions dock...")); auto graphActionsDock = new GraphActionsDock(this); this->addDockWidget(Qt::BottomDockWidgetArea, graphActionsDock); //create host explorer dock _splash->postMessage(tr("Creating host explorer...")); auto hostExplorerDock = new HostExplorerDock(this); this->addDockWidget(Qt::RightDockWidgetArea, hostExplorerDock); //create affinity panel _splash->postMessage(tr("Creating affinity panel...")); auto affinityZonesDock = new AffinityZonesDock(this, hostExplorerDock); this->tabifyDockWidget(hostExplorerDock, affinityZonesDock); auto editMenu = mainMenu->editMenu; mainMenu->affinityZoneMenu = affinityZonesDock->makeMenu(editMenu); editMenu->addMenu(mainMenu->affinityZoneMenu); //block cache (make before block tree) _splash->postMessage(tr("Creating block cache...")); _blockCache = new BlockCache(this, hostExplorerDock); connect(this, &MainWindow::initDone, _blockCache, &BlockCache::update); //create topology editor tabbed widget _splash->postMessage(tr("Creating graph editor...")); _editorTabs = new GraphEditorTabs(this); this->setCentralWidget(_editorTabs); connect(this, &MainWindow::initDone, _editorTabs, &GraphEditorTabs::loadState); connect(this, &MainWindow::exitBegin, _editorTabs, &GraphEditorTabs::handleExit); //create block tree (after the block cache) _splash->postMessage(tr("Creating block tree...")); auto blockTreeDock = new BlockTreeDock(this, _blockCache, _editorTabs); connect(_actions->findAction, SIGNAL(triggered(void)), blockTreeDock, SLOT(activateFind(void))); this->tabifyDockWidget(affinityZonesDock, blockTreeDock); //create properties panel (make after block cache) _splash->postMessage(tr("Creating properties panel...")); _propertiesPanel = new PropertiesPanelDock(this); this->tabifyDockWidget(blockTreeDock, _propertiesPanel); //restore main window settings from file _splash->postMessage(tr("Restoring configuration...")); this->restoreGeometry(_settings->value("MainWindow/geometry").toByteArray()); this->restoreState(_settings->value("MainWindow/state").toByteArray()); _propertiesPanel->hide(); //hidden until used _actions->showPortNamesAction->setChecked(_settings->value("MainWindow/showPortNames", true).toBool()); _actions->eventPortsInlineAction->setChecked(_settings->value("MainWindow/eventPortsInline", true).toBool()); _actions->clickConnectModeAction->setChecked(_settings->value("MainWindow/clickConnectMode", false).toBool()); _actions->showGraphConnectionPointsAction->setChecked(_settings->value("MainWindow/showGraphConnectionPoints", false).toBool()); _actions->showGraphBoundingBoxesAction->setChecked(_settings->value("MainWindow/showGraphBoundingBoxes", false).toBool()); //finish view menu after docks and tool bars (view menu calls their toggleViewAction()) auto viewMenu = mainMenu->viewMenu; viewMenu->addAction(hostExplorerDock->toggleViewAction()); viewMenu->addAction(messageWindowDock->toggleViewAction()); viewMenu->addAction(graphActionsDock->toggleViewAction()); viewMenu->addAction(blockTreeDock->toggleViewAction()); viewMenu->addAction(affinityZonesDock->toggleViewAction()); viewMenu->addAction(mainToolBar->toggleViewAction()); //setup is complete, show the window and signal done this->show(); connect(this, &MainWindow::initDone, this, &MainWindow::handleInitDone); emit this->initDone(); }
//----------------------------------------------------------------------------- // // Class MainWindow // //----------------------------------------------------------------------------- MainWindow::MainWindow(QWidget *wp) : QMainWindow(wp) { QAction *a; setWindowTitle(_("untitled - UDAV")); setAttribute(Qt::WA_DeleteOnClose); split = new QSplitter(this); ltab = new QTabWidget(split); ltab->setMovable(true); ltab->setTabPosition(QTabWidget::South); // ltab->setTabsClosable(true); rtab = new QTabWidget(split); rtab->setMovable(true); rtab->setTabPosition(QTabWidget::South); messWnd = new QDockWidget(_("Messages and warnings"),this); mess = new QTextEdit(this); messWnd->setWidget(mess); messWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, messWnd); messWnd->resize(size().width(), 0); new MessSyntax(mess); // connect(mess,SIGNAL(cursorPositionChanged()),this,SLOT(messClicked())); connect(mess,SIGNAL(selectionChanged()),this,SLOT(messClicked())); hideWnd = new QDockWidget(_("Hidden plots"),this); hidden = new TextEdit(this); hideWnd->setWidget(hidden); hideWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, hideWnd); hideWnd->resize(size().width(), 0); hidden->setReadOnly(true); connect(hidden,SIGNAL(selectionChanged()),this,SLOT(hiddenClicked())); // TODO // connect(hidden,SIGNAL(cursorPositionChanged()),this,SLOT(hiddenClicked())); calcWnd = new QDockWidget(_("Calculator"),this); aload = a = new QAction(QPixmap(":/png/document-open.png"), _("Open file"), this); connect(a, SIGNAL(triggered()), this, SLOT(choose())); a->setToolTip(_("Open and execute/show script or data from file (Ctrl+O).\nYou may switch off automatic exection in UDAV properties.")); a->setShortcut(Qt::CTRL+Qt::Key_O); asave = a = new QAction(QPixmap(":/png/document-save.png"), _("Save script"), this); connect(a, SIGNAL(triggered()), this, SLOT(save())); a->setToolTip(_("Save script to a file (Ctrl+S)")); a->setShortcut(Qt::CTRL+Qt::Key_S); acalc = a = new QAction(QPixmap(":/png/accessories-calculator.png"), _("Calculator"), this); a->setShortcut(Qt::Key_F4); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), calcWnd, SLOT(setVisible(bool))); connect(calcWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setToolTip(_("Show calculator which evaluate and help to type textual formulas.\nTextual formulas may contain data variables too.")); a->setChecked(false); calcWnd->setVisible(false); ainfo = a = new QAction(_("Show info"), this); a->setShortcut(Qt::Key_F2); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), messWnd, SLOT(setVisible(bool))); connect(messWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setChecked(false); messWnd->setVisible(false); ahide = a = new QAction(QPixmap(":/png/layer-visible-on.png"), _("Show hidden plots"), this); a->setShortcut(Qt::Key_F8); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), hideWnd, SLOT(setVisible(bool))); connect(hideWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setChecked(false); hideWnd->setVisible(false); graph = new PlotPanel(this); rtab->addTab(graph,QPixmap(":/png/office-chart-line.png"),_("Canvas")); // connect(info,SIGNAL(addPanel(QWidget*)),this,SLOT(addPanel(QWidget*))); info = createMemPanel(this); rtab->addTab(info,QPixmap(":/png/system-file-manager.png"),_("Info")); hlp = createHlpPanel(this); rtab->addTab(hlp,QPixmap(":/png/help-contents.png"),_("Help")); edit = new TextPanel(this); edit->graph = graph; graph->textMGL = edit->edit; connect(graph->mgl,SIGNAL(showWarn(QString)),mess,SLOT(setText(QString))); connect(graph->mgl,SIGNAL(showWarn(QString)),edit->edit,SLOT(setErrMessage(QString))); connect(graph,SIGNAL(clearWarn()),mess,SLOT(clear())); ltab->addTab(edit,QPixmap(":/png/text-plain.png"),_("Script")); calcWnd->setWidget(createCalcDlg(this, edit->edit)); calcWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, calcWnd); calcWnd->resize(size().width(), 200); makeMenu(); setCentralWidget(split); setWindowIcon(QIcon(":/udav.png")); readSettings(); if(!propDlg) propDlg = new PropDialog; connect(graph, SIGNAL(save()), this, SLOT(save())); connect(graph, SIGNAL(setStatus(const QString &)), this, SLOT(setStatus(const QString &))); connect(graph, SIGNAL(animPutText(const QString &)), edit, SLOT(animPutText(const QString &))); connect(graph,SIGNAL(giveFocus()),edit->edit,SLOT(setFocus())); connect(graph->mgl, SIGNAL(objChanged(int)), edit, SLOT(setCursorPosition(int))); // connect(graph->mgl, SIGNAL(posChanged(QString)), statusBar(), SLOT(showMessage(QString))); connect(graph->mgl, SIGNAL(refreshData()), this, SLOT(refresh())); connect(graph->mgl, SIGNAL(refreshData()), edit, SLOT(refreshData())); connect(graph->mgl,SIGNAL(doubleClick(int)),edit,SLOT(newCmd(int))); connect(edit->edit,SIGNAL(textChanged()),this,SLOT(updateHidden())); connect(mess, SIGNAL(textChanged()), this, SLOT(warnChanged())); connect(propDlg, SIGNAL(sizeChanged(int,int)), graph->mgl, SLOT(imgSize(int,int))); connect(edit->edit,SIGNAL(textChanged()), this, SLOT(setAsterix())); connect(edit->edit, SIGNAL(cursorPositionChanged()), this, SLOT(editPosChanged())); connect(edit,SIGNAL(setCurrentFile(QString)),this,SLOT(setCurrentFile(QString))); connect(edit,SIGNAL(setStatus(QString)),this,SLOT(setStatus(QString))); setStatus(_("Ready")); num_wnd++; edit->setAcceptDrops(false); // for disabling default action by 'edit' setAcceptDrops(true); }
void SwitchDesktop::contextEvent(QGraphicsSceneMouseEvent *event) { makeMenu(); m_menu->exec(popupPosition(m_menu->size(), event)); }
TEDemo::TEDemo(char* name, QStrList & _args, int login_shell) : KTMainWindow(name), args(_args) { se = 0L; menubar = menuBar(); setMinimumSize(200,100); // session management setUnsavedData( true ); // terminals cannot store their contents // create terminal emulation framework //////////////////////////////////// te = new TEWidget(this); te->setMinimumSize(150,70); // allow resizing, cause resize in TEWidget // create applications ///////////////////////////////////////////////////// setView(te,FALSE); makeMenu(); makeStatusbar(); // Init DnD: Set up drop zone and drop handler ///////////////////////////// dropZone = new KDNDDropZone( this, DndURL ); connect( dropZone, SIGNAL( dropAction( KDNDDropZone* )), SLOT( onDrop( KDNDDropZone*))); // load session commands /////////////////////////////////////////////////// loadSessionCommands(); m_file->insertSeparator(); m_file->insertItem( i18n("E&xit"), kapp, SLOT(quit())); // load schema ///////////////////////////////////////////////////////////// curr_schema = 0; ColorSchema::loadAllSchemas(); for (int i = 0; i < ColorSchema::count(); i++) { ColorSchema* s = ColorSchema::find(i); assert( s ); m_schema->insertItem(s->title.data(),s->numb); } //FIXME: we should build a complete session before running it. // construct initial session /////////////////////////////////////////////// TESession* initial = new TESession(this,te,args,"xterm",login_shell); title = (args.count() && !strcmp(kapp->getCaption(),PACKAGE)) ? args.at(0) // program executed in the title bar : kapp->getCaption(); // `konsole' or -caption initial->setTitle(title); addSession(initial); // read and apply default values /////////////////////////////////////////// readProperties(kapp->getConfig()); // activate and run first session ////////////////////////////////////////// runSession(initial); }
// on "init" you need to initialize your instance bool HelloWorld::init() { ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object auto closeItem = MenuItemImage::create( "CloseNormal.png", "CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 , origin.y + closeItem->getContentSize().height/2)); // create menu, it's an autorelease object auto menu = Menu::create( closeItem, nullptr ); menu->setPosition(Vec2::ZERO); this->addChild(menu, 1); ///////////////////////////// // 3. add your codes below... // add a label shows "Hello World" // create and initialize a label auto label = LabelTTF::create("JNI Return Output", "Arial", 24); // position the label on the center of the screen label->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height - label->getContentSize().height ) ); // add the label as a child to this layer this->addChild(label, 1); debugLabel = LabelTTF::create("...", "Arial", 24); Vec2 tLabelPosition = Vec2( label->getPosition() ); tLabelPosition.y -= 40; debugLabel->setPosition( tLabelPosition ); this->addChild( debugLabel ); // add "HelloWorld" splash screen" auto sprite = Sprite::create("HelloWorld.png"); // FYI: Opacity range is 0-255 // label->setString( StringUtils::format( "%hhu", sprite->getOpacity() ) ); sprite->setOpacity( 128 ); // position the sprite on the center of the screen sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); #if( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID ) makeMenu(); #endif return true; }
QList<QAction*> SwitchWindow::contextualActions() { makeMenu(); return m_actions; }
int main(void) { int i; defaultExceptionHandler(); irqEnable(IRQ_VBLANK); irqEnable(IRQ_HBLANK); irqSet(IRQ_VBLANK, vblank_idle); fifoSetValue32Handler(FIFO_USER_02, arm7print, NULL); fifoSetValue32Handler(FIFO_USER_03, sleepMode, NULL); //vramSetBankA(VRAM_A_LCD); videoSetMode(MODE_0_2D); // map some VRAM // bank C to ARM7, bank H for subscreen graphics *(vu8*)0x04000242 = 0x82; *(vu8*)0x04000248 = 0x81; videoSetModeSub(MODE_0_2D); consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, false, true); *(vu16*)0x0400100A = 0x0300; setBackdropColorSub(0x7C00); // configure BLDCNT so that backdrop becomes black *(vu16*)0x04001050 = 0x00E0; *(vu8*)0x04001054 = 16; // enable window 0 and disable color effects inside it *(vu16*)0x04001000 |= 0x2000; *(vu16*)0x04001048 = 0x001F; *(vu16*)0x0400104A = 0x003F; toggleConsole(false); #ifdef NITROFS_ROM if (!nitroFSInit()) #else if (!fatInitDefault()) #endif { toggleConsole(true); iprintf("FAT init failed\n"); return -1; } makeROMList(); makeMenu(); iprintf("lolSnes " VERSION " -- by Mega-Mario\n"); for (;;) { if (keypress != 0x03FF) { if (!(keypress & 0x0040)) // up { menusel--; if (menusel < 0) menusel = 0; if (menusel < menuscroll) menuscroll = menusel; makeMenu(); } else if (!(keypress & 0x0080)) // down { menusel++; if (menusel > nfiles-1) menusel = nfiles-1; if (menusel-21 > menuscroll) menuscroll = menusel-21; makeMenu(); } else if ((keypress & 0x0003) != 0x0003) // A/B { strncpy(fullpath, "snes/", 5); strncpy(fullpath + 5, &filelist[menusel << 8], 256); if (!Mem_LoadROM(fullpath)) { iprintf("ROM loading failed\n"); continue; } *(vu16*)0x04001000 &= 0xDFFF; toggleConsole(true); iprintf("ROM loaded, running\n"); CPU_Reset(); fifoSendValue32(FIFO_USER_01, 1); swiWaitForVBlank(); fifoSendValue32(FIFO_USER_01, 2); irqSet(IRQ_VBLANK, vblank); irqSet(IRQ_HBLANK, PPU_HBlank); swiWaitForVBlank(); CPU_Run(); } keypress = 0x03FF; } swiWaitForVBlank(); } return 0; }
// rewrite the file with the current state void MissionMenu::updateProgressFile() { makeMenu(); // recreate the menu to take the update }
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), _currentItem(0) { setCaption( tr("OSearch") ); setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); QFrame *mainFrame = new QFrame( this, "mainFrame" ); mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout = new QVBoxLayout( mainFrame ); mainLayout->setSpacing( 0 ); mainLayout->setMargin( 3 ); resultsList = new OListView( mainFrame ); resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout->addWidget( resultsList ); detailsFrame = new QFrame( mainFrame, "detailsFrame" ); QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); richEdit = new QTextView( detailsFrame ); QWhatsThis::add( richEdit, tr("The details of the current result") ); richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); detailsLayout->addWidget( richEdit ); buttonBox = new QHBox( mainFrame, "Button Box" ); _buttonCount = 0; mainLayout->addWidget( detailsFrame ); mainLayout->addWidget( buttonBox ); detailsFrame->hide(); buttonBox->hide(); searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); searches.append( new MemoSearch( resultsList, tr("Notes") ) ); setCentralWidget( mainFrame ); popupTimer = new QTimer(); searchTimer = new QTimer(); connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); signalMapper = new QSignalMapper( this ); connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); makeMenu(); Config cfg( "osearch", Config::User ); cfg.setGroup( "search_settings" ); actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); }