bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor, bool resizable) { setViewName(viewName); _frameZoomFactor = frameZoomFactor; _resizable = resizable; glfwWindowHint(GLFW_RESIZABLE, resizable ? GL_TRUE : GL_FALSE); glfwWindowHint(GLFW_RED_BITS,_glContextAttrs.redBits); glfwWindowHint(GLFW_GREEN_BITS,_glContextAttrs.greenBits); glfwWindowHint(GLFW_BLUE_BITS,_glContextAttrs.blueBits); glfwWindowHint(GLFW_ALPHA_BITS,_glContextAttrs.alphaBits); glfwWindowHint(GLFW_DEPTH_BITS,_glContextAttrs.depthBits); glfwWindowHint(GLFW_STENCIL_BITS,_glContextAttrs.stencilBits); _mainWindow = glfwCreateWindow(rect.size.width * _frameZoomFactor, rect.size.height * _frameZoomFactor, _viewName.c_str(), _monitor, nullptr); glfwMakeContextCurrent(_mainWindow); glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack); glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack); glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback); glfwSetCharCallback(_mainWindow, GLFWEventHandler::onGLFWCharCallback); glfwSetKeyCallback(_mainWindow, GLFWEventHandler::onGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, GLFWEventHandler::onGLFWWindowPosCallback); glfwSetFramebufferSizeCallback(_mainWindow, GLFWEventHandler::onGLFWframebuffersize); glfwSetWindowSizeCallback(_mainWindow, GLFWEventHandler::onGLFWWindowSizeFunCallback); glfwSetWindowIconifyCallback(_mainWindow, GLFWEventHandler::onGLFWWindowIconifyCallback); //glfwSetWindowCloseCallback(_mainWindow, GLFWEventHandler::onGLFWWindowCloseCallback); setFrameSize(rect.size.width, rect.size.height); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); if ( utils::atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); MessageBox(strComplain, "OpenGL version too old"); return false; } initGlew(); // Enable point size by default. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); return true; }
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) { setViewName(viewName); setFrameSize(rect.size.width, rect.size.height); setFrameZoomFactor(frameZoomFactor); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); _mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName.c_str(), _primaryMonitor, NULL); glfwMakeContextCurrent(_mainWindow); int w, h; glfwGetWindowSize(_mainWindow, &w, &h); int frameBufferW, frameBufferH; glfwGetFramebufferSize(_mainWindow, &frameBufferW, &frameBufferH); if (frameBufferW == 2 * w && frameBufferH == 2 * h) { _isRetina = true; setFrameZoomFactor(frameZoomFactor * 2); glfwSetWindowSize(_mainWindow, rect.size.width/2 * _frameZoomFactor, rect.size.height/2 * _frameZoomFactor); } glfwSetMouseButtonCallback(_mainWindow, GLViewEventHandler::onGLFWMouseCallBack); glfwSetCursorPosCallback(_mainWindow, GLViewEventHandler::onGLFWMouseMoveCallBack); glfwSetScrollCallback(_mainWindow, GLViewEventHandler::onGLFWMouseScrollCallback); glfwSetCharCallback(_mainWindow, GLViewEventHandler::onGLFWCharCallback); glfwSetKeyCallback(_mainWindow, GLViewEventHandler::onGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, GLViewEventHandler::onGLFWWindowPosCallback); glfwSetFramebufferSizeCallback(_mainWindow, GLViewEventHandler::onGLFWframebuffersize); glfwSetWindowSizeCallback(_mainWindow, GLViewEventHandler::OnGLFWWindowSizeFunCallback); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); if ( atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); MessageBox(strComplain, "OpenGL version too old"); return false; } initGlew(); // Enable point size by default. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); return true; }
void KCombiView::setRight(KFileView *view) { delete right; right = view; right->KFileView::setViewMode( Files ); setViewName( right->viewName() ); TQValueList<int> lst; lst << left->gridX() + 2 * left->spacing(); setSizes( lst ); setResizeMode( left, TQSplitter::KeepSize ); right->setParentView( this ); right->widget()->setAcceptDrops(acceptDrops()); right->setDropOptions(dropOptions()); right->widget()->installEventFilter( this ); }
void KFilePreview::init( KFileView *view ) { setViewName( i18n("Preview") ); left = 0L; setFileView( view ); preview = new QWidget((QSplitter*)this, "preview"); QString tmp = i18n("No preview available."); QLabel *l = new QLabel(tmp, preview); l->setMinimumSize(l->sizeHint()); l->move(10, 5); preview->setMinimumWidth(l->sizeHint().width()+20); setResizeMode(preview, QSplitter::KeepSize); // Why copy the actions? --ellis, 13 Jan 02. //for ( uint i = 0; i < view->actionCollection()->count(); i++ ) // actionCollection()->insert( view->actionCollection()->action( i )); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // create the application instance AppDelegate app; auto director = Director::getInstance(); auto eglView = director->getOpenGLView(); if (!eglView) { eglView = GLView::create("2048"); director->setOpenGLView(eglView); } eglView->setViewName("resolution"); eglView->setFrameSize(480,800); return Application::getInstance()->run(); }
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) { setViewName(viewName); _frameZoomFactor = frameZoomFactor; if (s_intriGdipCanvasEnabled) IrregularGL::thisObject()->setupGL(); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_RED_BITS,_glContextAttrs.redBits); glfwWindowHint(GLFW_GREEN_BITS,_glContextAttrs.greenBits); glfwWindowHint(GLFW_BLUE_BITS,_glContextAttrs.blueBits); glfwWindowHint(GLFW_ALPHA_BITS,_glContextAttrs.alphaBits); glfwWindowHint(GLFW_DEPTH_BITS,_glContextAttrs.depthBits); glfwWindowHint(GLFW_STENCIL_BITS,_glContextAttrs.stencilBits); // x-studio365 spec hints glfwWindowHint(GLFW_DECORATED, !s_intriWindowNoB); glfwWindowHint(GLFW_VISIBLE, s_intriWindowVisible); glfwWindowHint(GLFW_ALPHA_MASK, s_intriWindowAlphaEnabled); glfwxSetParent(s_intriWindowParent); int needWidth = rect.size.width * _frameZoomFactor; int neeHeight = rect.size.height * _frameZoomFactor; _mainWindow = glfwCreateWindow(needWidth, neeHeight, _viewName.c_str(), _monitor, nullptr); if (_mainWindow == nullptr) { std::string message = "Can't create window"; if (!_glfwError.empty()) { message.append("\nMore info: \n"); message.append(_glfwError); } ccMessageBox(message.c_str(), "Error launch application"); return false; } /* * Note that the created window and context may differ from what you requested, * as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the * window, especially for full screen windows. To retrieve the actual * attributes of the created window and context, use queries like @ref * glfwGetWindowAttrib and @ref glfwGetWindowSize. * * see declaration glfwCreateWindow */ int realW = 0, realH = 0; glfwGetWindowSize(_mainWindow, &realW, &realH); if (realW != needWidth) { rect.size.width = realW / _frameZoomFactor; } if (realH != neeHeight) { rect.size.height = realH / _frameZoomFactor; } glfwMakeContextCurrent(_mainWindow); // x-studio365 spec: use glfwx setMouseButtonCallback ensure update mouse coord immediately. glfwxSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBackEx); glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack); glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback); glfwSetCharCallback(_mainWindow, GLFWEventHandler::onGLFWCharCallback); glfwSetKeyCallback(_mainWindow, GLFWEventHandler::onGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, GLFWEventHandler::onGLFWWindowPosCallback); glfwSetFramebufferSizeCallback(_mainWindow, GLFWEventHandler::onGLFWframebuffersize); glfwSetWindowSizeCallback(_mainWindow, GLFWEventHandler::onGLFWWindowSizeFunCallback); glfwSetWindowIconifyCallback(_mainWindow, GLFWEventHandler::onGLFWWindowIconifyCallback); setFrameSize(rect.size.width, rect.size.height); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); if ( utils::atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); ccMessageBox(strComplain, "OpenGL version too old"); return false; } initGlew(); // Enable point size by default. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); return true; }
bool EGLView::init(const char* viewName, float width, float height, float frameZoomFactor) { if(nullptr != _mainWindow) return true; setViewName(viewName); setFrameSize(width, height); setFrameZoomFactor(frameZoomFactor); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); _mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr); glfwMakeContextCurrent(_mainWindow); glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]); glfwSetMouseButtonCallback(_mainWindow,EGLViewEventHandler::OnGLFWMouseCallBack); glfwSetCursorPosCallback(_mainWindow,EGLViewEventHandler::OnGLFWMouseMoveCallBack); glfwSetCharCallback(_mainWindow, EGLViewEventHandler::OnGLFWCharCallback); glfwSetKeyCallback(_mainWindow, EGLViewEventHandler::OnGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, EGLViewEventHandler::OnGLFWWindowPosCallback); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); CCLOG("OpenGL version = %s", glVersion); if ( atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); MessageBox(strComplain, "OpenGL version too old"); return false; } GLenum GlewInitResult = glewInit(); if (GLEW_OK != GlewInitResult) { MessageBox((char *)glewGetErrorString(GlewInitResult), "OpenGL error"); return false; } if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader) { log("Ready for GLSL"); } else { log("Not totally ready :("); } if (glewIsSupported("GL_VERSION_2_0")) { log("Ready for OpenGL 2.0"); } else { log("OpenGL 2.0 not supported"); } // if(glew_dynamic_binding() == false) // { // MessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error"); // return false; // } // // Enable point size by default on windows. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); return true; }
void TrackView::setDefaultName()/*{{{*/ { QString base = QString("Track View"); setViewName(getValidName(base)); }/*}}}*/
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor, HWND hParentWnd) { setViewName(viewName); _frameZoomFactor = frameZoomFactor; glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_RED_BITS,_glContextAttrs.redBits); glfwWindowHint(GLFW_GREEN_BITS,_glContextAttrs.greenBits); glfwWindowHint(GLFW_BLUE_BITS,_glContextAttrs.blueBits); glfwWindowHint(GLFW_ALPHA_BITS,_glContextAttrs.alphaBits); glfwWindowHint(GLFW_DEPTH_BITS,_glContextAttrs.depthBits); glfwWindowHint(GLFW_STENCIL_BITS,_glContextAttrs.stencilBits); if (hParentWnd){ glfwWindowHint(GLFW_VISIBLE, GL_FALSE); } int needWidth = rect.size.width * _frameZoomFactor; int neeHeight = rect.size.height * _frameZoomFactor; _mainWindow = glfwCreateWindow(needWidth, neeHeight, _viewName.c_str(), _monitor, nullptr); if (_mainWindow == nullptr) { std::string message = "Can't create window"; if (!_glfwError.empty()) { message.append("\nMore info: \n"); message.append(_glfwError); } MessageBox(message.c_str(), "Error launch application"); return false; } /* * Note that the created window and context may differ from what you requested, * as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the * window, especially for full screen windows. To retrieve the actual * attributes of the created window and context, use queries like @ref * glfwGetWindowAttrib and @ref glfwGetWindowSize. * * see declaration glfwCreateWindow */ int realW = 0, realH = 0; glfwGetWindowSize(_mainWindow, &realW, &realH); if (realW != needWidth) { rect.size.width = realW / _frameZoomFactor; } if (realH != neeHeight) { rect.size.height = realH / _frameZoomFactor; } glfwMakeContextCurrent(_mainWindow); glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack); glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack); glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback); glfwSetCharCallback(_mainWindow, GLFWEventHandler::onGLFWCharCallback); glfwSetKeyCallback(_mainWindow, GLFWEventHandler::onGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, GLFWEventHandler::onGLFWWindowPosCallback); glfwSetFramebufferSizeCallback(_mainWindow, GLFWEventHandler::onGLFWframebuffersize); glfwSetWindowSizeCallback(_mainWindow, GLFWEventHandler::onGLFWWindowSizeFunCallback); glfwSetWindowIconifyCallback(_mainWindow, GLFWEventHandler::onGLFWWindowIconifyCallback); setFrameSize(rect.size.width, rect.size.height); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); if ( utils::atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); MessageBox(strComplain, "OpenGL version too old"); return false; } initGlew(); // Enable point size by default. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); m_hwnd = glfwGetWin32Window(_mainWindow); if (hParentWnd){ ::SetParent(m_hwnd, hParentWnd); //改变当前窗口的样式,去掉标题 SetWindowLong(m_hwnd, GWL_STYLE, GetWindowLong(m_hwnd, GWL_STYLE) & ~WS_CAPTION); //设置位置 ::SetWindowPos(m_hwnd, HWND_TOP, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, SWP_NOCOPYBITS | SWP_HIDEWINDOW); } return true; }
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) { setViewName(viewName); _frameZoomFactor = frameZoomFactor; glfwWindowHint(GLFW_DECORATED,GL_FALSE); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_RED_BITS,_glContextAttrs.redBits); glfwWindowHint(GLFW_GREEN_BITS,_glContextAttrs.greenBits); glfwWindowHint(GLFW_BLUE_BITS,_glContextAttrs.blueBits); glfwWindowHint(GLFW_ALPHA_BITS,_glContextAttrs.alphaBits); glfwWindowHint(GLFW_DEPTH_BITS,_glContextAttrs.depthBits); glfwWindowHint(GLFW_STENCIL_BITS,_glContextAttrs.stencilBits); int needWidth = rect.size.width * _frameZoomFactor; int neeHeight = rect.size.height * _frameZoomFactor; _mainWindow = glfwCreateWindow(needWidth, neeHeight, _viewName.c_str(), _monitor, nullptr); if (!_mainWindow) { MessageBox("Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.", "Create Window failed"); return false; } /* * Note that the created window and context may differ from what you requested, * as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the * window, especially for full screen windows. To retrieve the actual * attributes of the created window and context, use queries like @ref * glfwGetWindowAttrib and @ref glfwGetWindowSize. * * see declaration glfwCreateWindow */ int realW = 0, realH = 0; glfwGetWindowSize(_mainWindow, &realW, &realH); if (realW != needWidth) { rect.size.width = realW / _frameZoomFactor; } if (realH != neeHeight) { rect.size.height = realH / _frameZoomFactor; } glfwMakeContextCurrent(_mainWindow); glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack); glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack); glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback); glfwSetCharCallback(_mainWindow, GLFWEventHandler::onGLFWCharCallback); glfwSetKeyCallback(_mainWindow, GLFWEventHandler::onGLFWKeyCallback); glfwSetWindowPosCallback(_mainWindow, GLFWEventHandler::onGLFWWindowPosCallback); glfwSetFramebufferSizeCallback(_mainWindow, GLFWEventHandler::onGLFWframebuffersize); glfwSetWindowSizeCallback(_mainWindow, GLFWEventHandler::onGLFWWindowSizeFunCallback); glfwSetWindowIconifyCallback(_mainWindow, GLFWEventHandler::onGLFWWindowIconifyCallback); glfwSetWindowCloseCallback(_mainWindow, GLFWEventHandler::onGLFWWindowCloseCallback); glfwSetCursorEnterCallback(_mainWindow, GLFWEventHandler::onGLFWCursorEnterCallBack); setFrameSize(rect.size.width, rect.size.height); // check OpenGL version at first const GLubyte* glVersion = glGetString(GL_VERSION); if ( utils::atof((const char*)glVersion) < 1.5 ) { char strComplain[256] = {0}; sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); MessageBox(strComplain, "OpenGL version too old"); return false; } initGlew(); // Enable point size by default. glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); return true; }
KFileDetailView::KFileDetailView(TQWidget *parent, const char *name) : TDEListView(parent, name), KFileView(), d(new KFileDetailViewPrivate()) { // this is always the static section, not the index depending on column order m_sortingCol = COL_NAME; m_blockSortingSignal = false; setViewName( i18n("Detailed View") ); addColumn( i18n( "Name" ) ); addColumn( i18n( "Size" ) ); addColumn( i18n( "Date" ) ); addColumn( i18n( "Permissions" ) ); addColumn( i18n( "Owner" ) ); addColumn( i18n( "Group" ) ); setShowSortIndicator( true ); setAllColumnsShowFocus( true ); setDragEnabled(true); connect( header(), TQT_SIGNAL( clicked(int)), TQT_SLOT(slotSortingChanged(int) )); connect( this, TQT_SIGNAL( returnPressed(TQListViewItem *) ), TQT_SLOT( slotActivate( TQListViewItem *) ) ); connect( this, TQT_SIGNAL( clicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT( selected( TQListViewItem *) ) ); connect( this, TQT_SIGNAL( doubleClicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT( slotActivate( TQListViewItem *) ) ); connect( this, TQT_SIGNAL(contextMenuRequested( TQListViewItem *, const TQPoint &, int )), this, TQT_SLOT( slotActivateMenu( TQListViewItem *, const TQPoint& ))); KFile::SelectionMode sm = KFileView::selectionMode(); switch ( sm ) { case KFile::Multi: TQListView::setSelectionMode( TQListView::Multi ); break; case KFile::Extended: TQListView::setSelectionMode( TQListView::Extended ); break; case KFile::NoSelection: TQListView::setSelectionMode( TQListView::NoSelection ); break; default: // fall through case KFile::Single: TQListView::setSelectionMode( TQListView::Single ); break; } // for highlighting if ( sm == KFile::Multi || sm == KFile::Extended ) connect( this, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( slotSelectionChanged() )); else connect( this, TQT_SIGNAL( selectionChanged( TQListViewItem * ) ), TQT_SLOT( highlighted( TQListViewItem * ) )); // DND connect( &(d->autoOpenTimer), TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotAutoOpen() )); setSorting( sorting() ); m_resolver = new KMimeTypeResolver<KFileListViewItem,KFileDetailView>( this ); }