int main(int argc, char** argv) { int aux; // inicialización del GLUT glutInit( &argc, argv ); // inicialiación de la ventana glutInitWindowSize( 1020, 850 ); //Tamaño de la Ventana Creada glutInitWindowPosition( 100, 100 ); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutCreateWindow( "Catastrofe Global - Fin del Sol" ); glEnable(GL_SMOOTH); // inicialización de los datos del programa anos = 0; dia = 0; hora = 0; min = 0; explo= 0; mov = 0; mov2 = 0.01; mov3 = 0; //derr = x; arr = y; z = z der = -5; arr = 5; z = -35; //Variable para controlar el menú. value = 0; //Creamos el menú. createMenu(); // registro de los eventos glutReshapeFunc (reshapeevent); glutDisplayFunc( displayevent ); //Cambio de teclas por menú. glutSpecialFunc( specialkeyevent ); //Controlamos no sólo las teclas especiales, las normales también //(Para aumentar y reducir velocidad de rotación) //glutKeyboardFunc (Keyboard); glutIdleFunc( animacion ); aux = carga_texturas(); // lazo de eventos glutMainLoop(); return 0; }
bool Victory::init() { // init the super if ( !LayerColor::initWithColor(Color4B(205, 203, 166, 120))) { return false; } Size parentVisibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); // this->setVisible(false); dialog = Sprite::create("Graphics/levelComplete.png"); if (!dialog) { printf("Error opening levelComplete.png\n"); return false; } Size rawSize = dialog->getBoundingBox().size; dialog->setAnchorPoint(Vec2(0,0)); createMenu(); dialog->setScale((rawSize.width/parentVisibleSize.width)*0.66); Size dialogSize = dialog->getBoundingBox().size; posX = (parentVisibleSize.width-dialogSize.width)/2.0; posY = (parentVisibleSize.height-dialogSize.height)/2.0; auto move = MoveTo::create(1.0, Vec2(posX, posY)); auto bounceIn = EaseElasticOut::create(move->clone()); dialog->setPosition(Vec2(posX, -dialogSize.height)); // is there any way to fade this in nicely? // How do we scale to fit the phone size? this->addChild(dialog, 1); dialog->runAction(bounceIn); return true; }
MainWindow::MainWindow() { srand(time(NULL)); setWindowTitle(trUtf8("Gomoku")); createMenu(); statusBarLabel = new QLabel(this); scorePlayer1 = new QLabel(this); scorePlayer2 = new QLabel(this); statusBarLabel->setStyleSheet("font: 12pt;"); scorePlayer1->setStyleSheet("font: 12pt;"); scorePlayer2->setStyleSheet("font: 12pt;"); statusBar()->addPermanentWidget(scorePlayer1, 90); statusBar()->addPermanentWidget(scorePlayer2, 200); statusBar()->addPermanentWidget(statusBarLabel); qApp->setStyleSheet("QStatusBar::item { border : 0px solid black }"); grid = new Grid(19, this); grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); connect(grid, SIGNAL(gameStateChanged(Gomoku::GameState, uint8_t, uint8_t)), this, SLOT(applyGameState(Gomoku::GameState, uint8_t, uint8_t))); windowLayout = new QHBoxLayout(); windowLayout->addWidget(grid); centralWidget = new QWidget(); centralWidget->setLayout(windowLayout); setCentralWidget(centralWidget); resize(QSize(800, 800)); gridDrawer = new GomokuGui(); grid->setDisplay(gridDrawer); grid->repaint(); newGame(); }
void WBModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) { if (!menu) { QString title = parent.data().toString(); menu = new QMenu(title, this); QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); menu->setIcon(icon); parentMenu->addMenu(menu); QVariant v; v.setValue(parent); menu->menuAction()->setData(v); connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); return; } int end = m_model->rowCount(parent); if (max != -1) end = qMin(max, end); connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*))); connect(menu, SIGNAL(hovered(QAction*)), this, SLOT(hovered(QAction*))); for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); if (m_model->hasChildren(idx)) { createMenu(idx, -1, menu); } else { if (m_separatorRole != 0 && idx.data(m_separatorRole).toBool()) addSeparator(); else menu->addAction(makeAction(idx)); } if (menu == this && i == m_firstSeparator - 1) addSeparator(); } }
int nativeLoop(void) { HINSTANCE hInstance = GetModuleHandle(NULL); TCHAR* szWindowClass = TEXT("SystrayClass"); MyRegisterClass(hInstance, szWindowClass); hWnd = InitInstance(hInstance, FALSE, szWindowClass); // Don't show window if (!hWnd) { return EXIT_FAILURE; } if (!createMenu() || !addNotifyIcon()) { return EXIT_FAILURE; } systray_ready(0); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return EXIT_SUCCESS; }
void TDDHelper::addTestButton(Node *parent, Point pos) { if(HAS_TDD == false) { log("ERROR: TDD Framework is disable!"); return; } if(parent == NULL) { log("ERROR: addTestButton: parent is NULL"); // or use Assert return; } Menu *menu = createMenu(pos, "Test!", [](Ref *sender) { TDDHelper::showTests(); } ); parent->addChild(menu); }
subMainWindow::subMainWindow(QWidget *parent) : QMainWindow(parent) { createMenu(); subImageLabel = new QLabel; subImageLabel->setBackgroundRole(QPalette::NoRole); subImageLabel->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored); subImageLabel->setScaledContents(true); //选择自动适应框的变化,就是无论将对话框,缩小放大都不影响像素,作用在看图片的时候,图片的像素会跟着相框调整 subScrollArea = new QScrollArea; //滚动区域 subScrollArea->setBackgroundRole(QPalette::Dark); subScrollArea->setWidget(subImageLabel); backImage = QImage(); setCentralWidget(subScrollArea); setWindowTitle(tr("处理后的图片")); resize(600,500); }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB); glutInitWindowSize(width, height); glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-width)/2, (glutGet(GLUT_SCREEN_HEIGHT)-height)/2); glutCreateWindow("Simple Paint And Draw Program"); glutDisplayFunc(display); glutMouseFunc(mouse); glutKeyboardFunc(keyboard); glutReshapeFunc(reshape); createMenu(); glClearColor(0.85f, 0.85f, 0.85f, 0.0f); glColor3f(0.0, 0.0, 0.0); glPointSize(5.0); glEnable(GL_MAP1_VERTEX_3); glutMainLoop(); }
void FSTableView::contextMenuEvent(QContextMenuEvent * event) { QModelIndex index = indexAt(event->pos()); QMenu * menu = 0; if (index.isValid()) { if (selectionModel()->selectedRows().count() > 1) menu = createSelectionMenu(); else menu = createItemMenu(); } else menu = createMenu(); menu->move(event->globalPos()); menu->exec(); delete menu; }
// on "init" you need to initialize your instance bool PizzaSpeedLevel::init() { // 1. super init first if ( !Layer::init() ) return false; createStarsBackground("Pictures/bigStar.png",20); createStarsBackground("Pictures/smallStar.png",50); showInstructions(); createMenu(); addRemainingTimeLabel(); addBackground("Pictures/PizzaSpeedBack.png"); addSpaceShip("Pictures/PizzaSpeedShip.png"); addTimeSlider(); schedule( schedule_selector( PizzaSpeedLevel::update) ); schedule( schedule_selector(PizzaSpeedLevel::updateRemainingTime)); return true; }
TrayIcon::TrayIcon() { trayIconMenu = new QMenu( this ); trayIcon = new QSystemTrayIcon( this ); createMenu(); trayIcon->setContextMenu( trayIconMenu ); trayIcon->setIcon( QIcon( QString::fromUtf8( ":/dboxfe_image" ) ) ); trayIcon->setToolTip( "DBoxFE - TrayIcon " + getAppVersion() ); trayIcon->show(); setWindowIcon( QIcon( QString::fromUtf8( ":/dboxfe_image" ) ) ); setWindowTitle( getAppTitel() ); update = new QTimer( this ); connect( update, SIGNAL( timeout() ), this, SLOT( reloadMenu() ) ); update->thread()->setPriority( QThread::NormalPriority ); update->start( 15000 ); }
/** * create window & run main loop */ void createWindow(windowData *win){ FNAME(); if(!initialized) return; if(!win) return; int w = win->w, h = win->h; DBG("create window with title %s", win->title); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(w, h); win->GL_ID = glutCreateWindow(win->title); DBG("created GL_ID=%d", win->GL_ID); glutReshapeFunc(Resize); glutDisplayFunc(RedrawWindow); glutKeyboardFunc(keyPressed); glutSpecialFunc(keySpPressed); //glutMouseWheelFunc(mouseWheel); glutMouseFunc(mousePressed); glutMotionFunc(mouseMove); //glutIdleFunc(glutPostRedisplay); glutIdleFunc(NULL); DBG("init textures"); glGenTextures(1, &(win->Tex)); calc_win_props(win, NULL, NULL); win->zoom = 1. / win->Daspect; glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, win->Tex); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->image->w, win->image->h, 0, GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata); glDisable(GL_TEXTURE_2D); totWindows++; createMenu(win->GL_ID); DBG("OK, total opened windows: %d", totWindows); }
Keyswitch::Keyswitch(XKeyboard *keyboard, QWidget *parent) : QLabel(parent) { keys=keyboard; QSettings * antico = new QSettings(QCoreApplication::applicationDirPath() + "/antico.cfg", QSettings::IniFormat, this); antico->beginGroup("Style"); map_path = antico->value("path").toString()+"/language/"; antico->endGroup(); //Style xkbConf = X11tools::loadXKBconf(); if (xkbConf->status!=DONT_USE_XKB) { load_rules(); qDebug()<<"XKB status : " <<xkbConf->status; if (xkbConf->status==USE_XKB) set_xkb(); init(); if (groupeName.count()>1 || xkbConf->showSingle) { draw_icon(); createMenu(); } } }
int main(int argc, char ** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(500,500); /*se voce deseja deixar em fullscreen comente essa linha e descomente a glutFullScreen(). Se quer só aumentar o tamanho inicial da janela, basta trocar os valores*/ glutCreateWindow("EP 2 - Fractais"); /* glutFullScreen(); */ init(); createMenu(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); /*O OpenGL passa a tomar controle total do programa*/ return 0; }
void Plane::create() { clearObject(); object_.header.frame_id = frame_id_; object_.name = name_; object_.description = name_ + " plane"; object_.pose = pose_; mesh_.type = Marker::CUBE; mesh_.color = color_; mesh_.scale = scale_; mesh_.scale.z = 0.001; control_.always_visible = true; control_.interaction_mode = InteractiveMarkerControl::BUTTON; control_.markers.push_back(mesh_); object_.controls.push_back(control_); createMenu(); }
// We initialize our instance bool OptionsScene::init() { // 1. super init first if (!Layer::init()) { // if there is a mistake then we terminate the program, it couldnt launch return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstance()->getVisibleOrigin(); // add a label shows "Creditos" create and initialize labels auto labelTitulo = LabelTTF::create("Opciones", "Tahoma", 32); // position the label on the upper center of the screen labelTitulo->setPosition(Point(origin.x + visibleSize.width * 0.5f, origin.y + visibleSize.height * .88f)); // add the label as a child to this layer this->addChild(labelTitulo, 1); // We add the devs labels this->showNames(origin, visibleSize); // Creates the background of the game menu. auto sprite = Sprite::create("GameMenu/0000.jpg"); // sprites are important, those are the images // position the sprite on the center of the screen sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); createMenu(); // We bring to live this scene. // Reproducir la musica de la seleccion del nivel: quiza sea mejor dejar la misma del menu // principal y cambiarla cuando se haya iniciado el nivel. Se deja aqui por propositos // ilustrativos auto sound = CocosDenshion::SimpleAudioEngine::getInstance(); sound->stopBackgroundMusic(); // this steps are to change tracks. sound->playBackgroundMusic("Music/Options.mp3", true); // We use a piece of music we already have and reproduce it for the options scene. return true; // we managed to bring frankestein alive, I mean, the game. }
/** \return **/ void BlTreeWidget::contextMenuEvent ( QContextMenuEvent * ) { BL_FUNC_DEBUG int column = currentColumn(); if ( column < 0 ) return; QMenu *menu = new QMenu ( this ); /// Lanzamos el evento para que pueda ser capturado por terceros. emit pintaMenu ( menu ); /// Lanzamos la propagación del menú a través de las clases derivadas. createMenu ( menu ); QAction *adjustColumnSize = menu->addAction ( _ ( "Ajustar columa" ) ); QAction *adjustAllColumnsSize = menu->addAction ( _ ( "Ajustar columnas" ) ); QAction *menuOption = menu->exec ( QCursor::pos() ); /// Si no hay ninguna opción pulsada se sale sin hacer nada. if ( !menuOption ) return; if ( menuOption == adjustAllColumnsSize ) { for (int i = 0; i < columnCount(); i++) { resizeColumnToContents (i); } // end for } else if ( menuOption == adjustColumnSize ) { resizeColumnToContents ( column ); } // end if emit trataMenu ( menuOption ); /// Activamos las herederas. execMenuAction ( menuOption ); delete menu; }
void Billboard::create() { clearObject(); object_.header.frame_id = frame_id_; object_.name = name_; // object_.description = name_ + " billboard"; object_.pose.position.x = pose_.position.x; object_.pose.position.y = pose_.position.y; object_.pose.position.z = pose_.position.z; createMesh(); control_.name = "billboard_control"; control_.always_visible = true; control_.orientation_mode = InteractiveMarkerControl::VIEW_FACING; control_.interaction_mode = InteractiveMarkerControl::BUTTON; control_.markers.push_back(mesh_); object_.controls.push_back(control_); createMenu(); }
MainWindow::MainWindow() { model = NULL; view = NULL; openBase = closeBase = createBase = clearBase = addRecord = deleteRecord = editRecord = showRecord = selectRecord = diagram = NULL; createMenu(); createWidgets(); setSize(); setButtonGroupLeftLayout(); setButtonsGroupRightLayout(); setMainLayout(); box = new QWidget; box->setLayout(mainLayout); setCentralWidget(box); setConnect(); }
void SearchTeamResultLayer::initLayer() { //±³¾° CCSprite* background=CCSprite::create(PVE_FIELD_POPWIN_BACKGROUND); this->addChild(background); background->setPosition(ccp(480,320)); CCLabelTTF* lbResult=ToolsFun::createLabel(LanguageManager::shareManager()->getContentByKey("SEARCH_RESULT").c_str(),DEF_FONT_NAME,30,ccp(495,525),this); CCLabelTTF* lbTeamID=ToolsFun::createLabel(LanguageManager::shareManager()->getContentByKey("TEAM_ID").c_str(),DEF_FONT_NAME,28,ccp(421,440),this); CCLabelTTF* lbTeamName=ToolsFun::createLabel(LanguageManager::shareManager()->getContentByKey("TEAM_NAME").c_str(),DEF_FONT_NAME,28,ccp(421,368),this); CCLabelTTF* lbPlayerNum=ToolsFun::createLabel(LanguageManager::shareManager()->getContentByKey("PLAYER_NUM").c_str(),DEF_FONT_NAME,28,ccp(388,297),this); m_LbTeamID=ToolsFun::createLabel("111",DEF_FONT_NAME,30,ccp(490,440),this); m_LbTeamName=ToolsFun::createLabel("111",DEF_FONT_NAME,30,ccp(490,368),this); m_LbPlayerNum=ToolsFun::createLabel("11/11",DEF_FONT_NAME,30,ccp(435,297),this); m_LbTeamID->setAnchorPoint(ccp(0.0f,0.5f)); m_LbTeamName->setAnchorPoint(ccp(0.0f,0.5f)); m_LbPlayerNum->setAnchorPoint(ccp(0.0f,0.5f)); createMenu(); this->setTouchEnabled(true); }
FaceFrame::FaceFrame() : wxFrame(NULL, -1, _T("XFaceEd"), wxDefaultPosition, wxSize(1024, 768)), m_dictionaryDlg(0) { wxFileSystem::AddHandler(new wxZipFSHandler); m_help.AddBook(wxFileName(_T("./help.zip"))); wxImage::AddHandler(new wxPNGHandler()); wxIcon icon; bool test = icon.LoadFile(_T("./res/XFaceLogo.ico"), wxBITMAP_TYPE_ICO ); SetIcons(wxIconBundle(icon)); // set the frame icon // SetIcon(icon); SetStatusBar(CreateStatusBar(2)); createMenu(); m_splitter = new Splitter(this); try{ m_GLwnd = new FaceView(m_splitter); m_GLwnd->Refresh(); Mediator::getInstance()->regFaceView(m_GLwnd); } catch(...) { wxMessageBox(_T("Unable to create OpenGL window, you might have a problem with your video card drivers!"), _T("Exception")); Close(true); } m_panel = new LeftPanel(m_splitter, 0, 0, 350, 768); m_panel->InitDialog(); m_splitter->SplitVertically(m_panel, m_GLwnd, 350); //m_splitter->SetMinimumPaneSize(300); SetDropTarget(new DropFDPFileTarget); SetTitle(_T("XfaceEd - No file loaded!")); }
StatusWidget::StatusWidget( QWidget *parent ) : QWidget(parent), replyAction(0), gotohomepageAction(0), gototwitterpageAction(0), deleteAction(0), statusState( StatusModel::STATE_DISABLED ), statusData(0), m_ui(new Ui::StatusWidget) { m_ui->setupUi( this ); m_ui->favoriteReplyButton->hide(); m_ui->infoButton->hide(); m_ui->replyDeleteButton->hide(); m_ui->favoriteReplyButton->setToolTip( tr( "Add to Favorites" ) ); QFont timeStampFont = m_ui->timeStamp->font(); #ifdef Q_WS_MAC timeStampFont.setPointSize( timeStampFont.pointSize() - 2 ); #else timeStampFont.setPointSize( timeStampFont.pointSize() - 1 ); #endif m_ui->timeStamp->setFont( timeStampFont ); connect( m_ui->replyDeleteButton, SIGNAL(clicked()), this, SLOT(handleReplyDeleteButton())); connect( m_ui->userStatus, SIGNAL(mousePressed()), this, SLOT(focusRequest()) ); connect( this, SIGNAL(selectMe(StatusWidget*)), StatusModel::instance(), SLOT(selectStatus(StatusWidget*)) ); applyTheme(); m_ui->userName->setText( "" ); m_ui->userStatus->setHtml( "" ); m_ui->timeStamp->setText( "" ); resize( currentWidth, height() ); adjustSize(); createMenu(); m_ui->userStatus->setMenu( menu ); }
Window::Window(Controller * c, QWidget *parent) : QWidget(parent), IView(c) { int width = controller->getWidth(); int height = controller->getHeight(); trace_run = false; menu = new QMenuBar(this); createMenu(); area = new ImageArea(controller, this); connect(area, SIGNAL(pixelPainted()), this, SLOT(incProgress())); connect(area, SIGNAL(finish()), this, SLOT(finish())); pr_bar = new QProgressBar(this); pr_bar->setRange(0, width*height); pr_bar->setValue(0); pr_bar->setDisabled(true); render_button = new QPushButton(tr("&Render"), this); render_button->setDefault(true); connect(render_button, SIGNAL(clicked()), this, SLOT(render())); QHBoxLayout * hlayot = new QHBoxLayout; hlayot->setMargin(5); hlayot->addWidget(pr_bar); hlayot->addWidget(render_button); QVBoxLayout * vlayout = new QVBoxLayout(this); vlayout->setMargin(0); vlayout->setSpacing(0); vlayout->setSizeConstraint(QLayout::SetFixedSize); vlayout->setMenuBar(menu); vlayout->addWidget(area); vlayout->addLayout(hlayot); setWindowTitle(tr("Ray Tracer")); }
Dialog::Dialog(QWidget *parent, Qt::WFlags f) { mainLayout = new QVBoxLayout; createMenu(); createSamplingRate(); createCheckGroup(); createDeviceGroup(); createFrequencyGroup(); createConfigGroup(); QLineEdit *myTest = new QLineEdit(); myTest->setText("bla"); myTest->setReadOnly(true); myTest->setEnabled(false); mainLayout->addWidget(myTest); createButtonGroup(); setLayout (mainLayout); //setFixedSize (350, 400); setWindowTitle(tr("QS1R 7 channel audio relay")); }
QtSyncStatusLogView::QtSyncStatusLogView(QtSyncStatusLog& log, QGraphicsItem *parent) : HbView(parent), mSyncLog(log) { setTitle("QtSyncStatusSpy"); createMenu(); QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); HbScrollArea* scrollArea = new HbScrollArea(this); scrollArea->setScrollDirections(Qt::Vertical); QGraphicsLinearLayout* layout2 = new QGraphicsLinearLayout(Qt::Vertical); QGraphicsWidget* content = new QGraphicsWidget(this); mTextItem = new HbTextItem(); layout2->addItem(mTextItem); layout2->setContentsMargins(5, 5, 5, 5); content->setLayout(layout2); scrollArea->setContentWidget(content); layout->addItem(scrollArea); layout->setStretchFactor(scrollArea, 1); setLayout(layout); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { this->setWindowTitle(tr("记账本")); input = new InputWindow; connect(input,SIGNAL(updateCost()),this,SLOT(updateStatusBar())); queryWnd = new QueryWnd; connect(queryWnd,SIGNAL(updateCost()),this,SLOT(updateStatusBar())); tab = new QTabWidget; tab->addTab(input,QIcon("images/input.png"),tr("输入")); tab->addTab(queryWnd,tr("查看详细")); this->setCentralWidget(tab); this->setGeometry((qApp->desktop()->width()-1150)/2,(qApp->desktop()->height()-600)/2,1150,600); status_bar = new StatusBar("Account"); statusBar()->addWidget(status_bar,12); statusBar()->setMaximumHeight(80); createMenu(); }
int main(int argc, char ** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH); glutInitWindowSize(g_TextureWidth, g_TextureHeight); glutInitWindowPosition(0, 0); win = glutCreateWindow(TITLE); createMenu(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMouseFunc(mouse); glutMotionFunc(motion); glutIdleFunc(idle); if (initEnvironment()) { glutMainLoop(); } return 0; }
/* Initialises and creates the opengl window */ bool initGLWindow(void) { if(Settings::stereoMode==STEREOMODE) { glutInitDisplayMode(GLUT_DOUBLE|GLUT_ACCUM|GLUT_RGB|GLUT_DEPTH|GLUT_STEREO); } else { glutInitDisplayMode(GLUT_DOUBLE|GLUT_ACCUM|GLUT_RGB|GLUT_DEPTH); } glutInitWindowSize(Settings::pixelWidth, Settings::pixelHeight); mainWindow = glutCreateWindow(WINTITLE); glutDisplayFunc(&display); glutReshapeFunc(&reshape); glutIdleFunc(&motionUpdate); // Keyboard controlls glutKeyboardFunc(&Controller::handleKeyboard); glutSpecialFunc(&Controller::handleSpecialKeys); // Mouse controlls glutMouseFunc(&Controller::processMouseButton); glutMotionFunc(&Controller::processMouseActiveMotion); glutPassiveMotionFunc(&Controller::processMousePassiveMotion); // Tablet controls glutTabletMotionFunc(&Controller::processTabletMotion); glutTabletButtonFunc(&Controller::processTabletButton); Controller::noTabletButtons = glutDeviceGet(GLUT_NUM_TABLET_BUTTONS); // Pop-up menu createMenu(); // Set the cursor glutSetCursor(GLUT_CURSOR_NONE); // Enable anti-aliasing glEnable(GL_LINE_SMOOTH); if(Settings::fullScreen) glutFullScreen(); return true; }
//Sets up layout that combines left and right panes TaskList_Main::TaskList_Main(QWidget *parent) : QMainWindow(parent) { listPane = new tasklist_lists(this); listPane->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding); notePane = new tasklist_notes(this); notePane->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding); optionPane = new tasklist_options(this); optionPane->setHidden(true); expButton = new QPushButton(""); expButton->setAutoFillBackground(true); expButton->setIcon(QIcon(":img/icon/right_arrow.png")); expButton->setIconSize(QSize(15,300)); expButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding); QHBoxLayout *paneLayout = new QHBoxLayout; paneLayout->addWidget(listPane); paneLayout->addWidget(notePane); paneLayout->addWidget(expButton); paneLayout->addWidget(optionPane); //Set the central widget (work-around) QWidget *central = new QWidget(); central->setLayout(paneLayout); this->setCentralWidget(central); createMenu(); setMenuBar(menuBar); //Connect signals between different panes connect(expButton, SIGNAL(clicked()), this, SLOT(expClick())); connect(optionPane, SIGNAL(noteInfoSent(QListWidgetItem&)), notePane, SLOT(applyClicked(QListWidgetItem&))); connect(notePane, SIGNAL(itemSelectEmit(QListWidgetItem&)), optionPane, SLOT(itemSelectDataIn(QListWidgetItem&))); connect(optionPane, SIGNAL(cancelPane()), this, SLOT(expClick())); connect(this, SIGNAL(createList(QString)), listPane, SLOT(newList(const QString &))); connect(listPane, SIGNAL(listSelectEmit(QListWidgetItem*)), notePane, SLOT(listChanged(QListWidgetItem*))); }
AppWindow::AppWindow() { setWindowTitle("488 Assignment Two"); QGLFormat glFormat; glFormat.setVersion(3,3); glFormat.setProfile(QGLFormat::CoreProfile); glFormat.setSampleBuffers(true); QVBoxLayout *layout = new QVBoxLayout; // m_menubar = new QMenuBar; m_viewer = new Viewer(glFormat, this); layout->addWidget(m_viewer); setCentralWidget(new QWidget); centralWidget()->setLayout(layout); QLabel* label = new QLabel(this); statusBar()->addPermanentWidget(label); m_viewer->setLabel(label); createActions(); createMenu(); }