|
|
|
@ -1,9 +1,11 @@
@@ -1,9 +1,11 @@
|
|
|
|
|
#include "browser.h" |
|
|
|
|
#include "app.h" |
|
|
|
|
#include "scheduler.h" |
|
|
|
|
#include "interfaces/components/TabbedComponent.h" |
|
|
|
|
#include "parsers/markup/ntrml/NTRMLParser.h" |
|
|
|
|
#include "parsers/markup/html/HTMLParser.h" |
|
|
|
|
|
|
|
|
|
#include "interfaces/components/DocumentComponent.h" |
|
|
|
|
//#include "interfaces/components/ComponentBuilder.h"
|
|
|
|
|
#include "interfaces/components/InputComponent.h" |
|
|
|
|
#include "interfaces/components/ImageComponent.h" |
|
|
|
|
#include "interfaces/components/TabbedComponent.h" |
|
|
|
@ -15,12 +17,6 @@
@@ -15,12 +17,6 @@
|
|
|
|
|
// why can't I const this?
|
|
|
|
|
std::unique_ptr<Scheduler> scheduler = std::make_unique<Scheduler>(); |
|
|
|
|
|
|
|
|
|
// Previously defined components with functionality
|
|
|
|
|
// 1+ image (no functionality)
|
|
|
|
|
// 1+ tabbed document
|
|
|
|
|
// 1+ back/fwd/reload/stop components
|
|
|
|
|
// 1+ address bar
|
|
|
|
|
|
|
|
|
|
void doOnClick(std::string type, Component *component, Window *win) { |
|
|
|
|
if (type=="back") { |
|
|
|
|
component->onClick=[win]() { |
|
|
|
@ -334,26 +330,11 @@ void App::NextTheme() {
@@ -334,26 +330,11 @@ void App::NextTheme() {
|
|
|
|
|
// and replacing with new version of existing theme
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Browser::Browser() { |
|
|
|
|
/*
|
|
|
|
|
std::string ntrml, line; |
|
|
|
|
std::ifstream myfile("browser.ntrml"); |
|
|
|
|
if (myfile.is_open()) { |
|
|
|
|
while(getline(myfile, line)) { |
|
|
|
|
ntrml += line; |
|
|
|
|
} |
|
|
|
|
myfile.close(); |
|
|
|
|
} else { |
|
|
|
|
std::cout << "Couldnt read browser.ntrml" << std::endl; |
|
|
|
|
} |
|
|
|
|
NTRMLParser uiParser; |
|
|
|
|
//std::cout << "Browser read [" << ntrml << "]" << std::endl;
|
|
|
|
|
*/ |
|
|
|
|
//this->uiRootNode = uiParser.parse(ntrml);
|
|
|
|
|
this->uiRootNode = this->loadTheme("browser.ntrml"); |
|
|
|
|
//printNode(this->uiRootNode, 0);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Previously defined components with functionality
|
|
|
|
|
// 1+ image (no functionality)
|
|
|
|
|
// 1+ tabbed document
|
|
|
|
|
// 1+ back/fwd/reload/stop components
|
|
|
|
|
// 1+ address bar
|
|
|
|
|
void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<Component> &parentComponent, std::shared_ptr<Window> win) { |
|
|
|
|
// FIXME: remove these 2 vars
|
|
|
|
|
int winWidth = win->windowWidth; |
|
|
|
@ -639,14 +620,6 @@ void App::addWindow() {
@@ -639,14 +620,6 @@ void App::addWindow() {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::shared_ptr<DocumentComponent> Browser::getActiveDocumentComponent() { |
|
|
|
|
if (!activeWindow) { |
|
|
|
|
std::cout << "Browser::getActiveDocumentComponent - No active window" << std::endl; |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
return this->activeWindow->getActiveDocumentComponent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// FIXME: put quit check in here and clean up windows
|
|
|
|
|
void App::render() { |
|
|
|
|
// guessing during render this iterator can be invalidated
|
|
|
|
|