virtual void DrawContents(){ std::cout << "IconWindow DrawContents" << std::endl; WindowImp* imp = GetWindowImp(); if(imp != NULL){ imp->DeviceBitmap(m_name, 0,0); } }
void Window::DrawRect(const Point& pt1, const Point& pt2) { std::cout << "Window DrawRect" << std::endl; WindowImp* imp =GetWindowImp(); if(imp != NULL){ // imp->DeviceRect(0,0,0,0); imp->DeviceRect(pt1.X(), pt1.Y(), pt2.X(), pt2.Y()); } }
void DocumentWindow::handleMouseMove(EventListenerImp* listener, events::Event event) { if (event.getDefaultPrevented()) return; html::Window defaultView = document.getDefaultView(); if (!defaultView) return; WindowImp* imp = dynamic_cast<WindowImp*>(defaultView.self()); if (!imp) return; ViewCSSImp* view = imp->getView(); if (!view) return; bool canScroll = view->canScroll(); events::MouseEvent mouse = interface_cast<events::MouseEvent>(event); unsigned short buttons = mouse.getButtons(); if ((buttons & 1) && canScroll) defaultView.scrollBy(moveX - mouse.getScreenX(), moveY - mouse.getScreenY()); moveX = mouse.getScreenX(); moveY = mouse.getScreenY(); }
void DocumentWindow::handleClick(EventListenerImp* listener, events::Event event) { if (event.getDefaultPrevented()) return; html::Window defaultView = document.getDefaultView(); if (!defaultView) return; WindowImp* imp = dynamic_cast<WindowImp*>(defaultView.self()); if (!imp) return; ViewCSSImp* view = imp->getView(); if (!view) return; events::MouseEvent mouse = interface_cast<events::MouseEvent>(event); switch (mouse.getButton()) { case 0: moveX = mouse.getScreenX(); moveY = mouse.getScreenY(); break; case 1: imp->setZoom(1.0f); break; case 3: imp->setZoom(imp->getZoom() - 0.1f); break; case 4: imp->setZoom(imp->getZoom() + 0.1f); break; case 7: defaultView.getHistory().back(); break; case 8: defaultView.getHistory().forward(); break; default: break; } }
int main(int argc, char* argv[]) { #ifdef USE_V8 v8::HandleScope handleScope; #endif // USE_V8 if (argc < 3) { std::cout << "usage: " << argv[0] << " navigator_directory profile_directory\n"; return EXIT_FAILURE; } // TODO: display HTML error pages instead of these text messages upon error. Profile profile(argv[2]); switch (profile.hasError()) { case 0: break; case EAGAIN: // TODO: use a named pipe for requesting to open another window. std::cerr << "error: another instance of escort web browser might already be running.\n"; return EXIT_FAILURE; case ENOENT: std::cerr << "error: the specified profile directory '" << profile.getProfilePath() << "' does not exist.\n"; return EXIT_FAILURE; case ENOTDIR: std::cerr << "error: the specified profile '" << profile.getProfilePath() << "' is not a directory.\n"; return EXIT_FAILURE; default: std::cerr << "error: the specified profile directory '" << profile.getProfilePath() << "' appears to be invalid.\n"; return EXIT_FAILURE; } // Check cache directory in the profile. if (profile.createDirectory("cache") == -1) { std::cerr << "error: cannot access to the cache directory '" << profile.createPath("cache") << "'.\n"; return EXIT_FAILURE; } HttpRequest::setCachePath(profile.createPath("cache")); init(&argc, argv); initLogLevel(&argc, argv, 0); initFonts(&argc, argv); setWindowClass("escort", "Escort"); // Load the default style sheet std::string defaultSheet = profile.getProfilePath() + "/default.css"; if (!profile.hasFile(defaultSheet)) defaultSheet = std::string(argv[1]) + "/default.css"; getDOMImplementation()->setDefaultStyleSheet(loadStyleSheet(defaultSheet.c_str())); // Load the presentational hints std::string presHints = profile.getProfilePath() + "/preshint.css"; if (!profile.hasFile(presHints)) presHints = std::string(argv[1]) + "/preshint.css"; getDOMImplementation()->setPresentationalHints(loadStyleSheet(presHints.c_str())); // Load the user style sheet std::string userSheet = profile.getProfilePath() + "/user.css"; if (profile.hasFile(userSheet)) getDOMImplementation()->setUserStyleSheet(loadStyleSheet(userSheet.c_str())); HttpRequest::setAboutPath(argv[1]); std::thread httpService(std::ref(HttpConnectionManager::getInstance())); std::string navigatorPath = profile.getProfilePath() + "/escort.html"; if (!profile.hasFile(navigatorPath)) navigatorPath = std::string(argv[1]) + "/escort.html"; WindowImp* imp = new WindowImp(); window = imp; imp->setFaviconOverridable(true); imp->enableZoom(false); imp->open(utfconv(getFileURL(navigatorPath)), u"_self", u"", true); glutMainLoop(); window = 0; ECMAScriptContext::shutDown(); HttpConnectionManager::getInstance().stop(); httpService.join(); }
void Window::DrawRect(const Point& p1, const Point& p2) { WindowImp* imp = GetWindowImp(); imp->DeviceRect(p1.X(), p1.Y(), p2.X(), p2.Y()); }
void IconWindow::DrawContents() { WindowImp* imp = GetWindowImp(); if (imp != 0) { imp->DeviceBitmap(_bitmapName, 0.0, 0.0); } }