Browse Source

setValue/getValue

master
Odilitime 4 years ago
parent
commit
006553ec0d
1 changed files with 12 additions and 6 deletions
  1. 12
    6
      src/graphics/components/TabbedComponent.cpp

+ 12
- 6
src/graphics/components/TabbedComponent.cpp View File

@@ -195,7 +195,7 @@ void TabbedComponent::addTab(std::string passedTitle) {
// set address bar
InputComponent *ab = dynamic_cast<InputComponent*>(this->win->addressComponent.get());
if (ab) {
ab->value = url;
ab->setValue(url);
ab->updateText();
} else {
std::cout << "No address component" << std::endl;
@@ -248,7 +248,7 @@ void TabbedComponent::updateWindowState(std::string newTitle) {
//std::cout << "TabbedComponent::updateWindowState - newTitle: " << newTitle << std::endl;
InputComponent *inputComponent = dynamic_cast<InputComponent*>(this->win->addressComponent.get());
if (inputComponent) {
inputComponent->value = newTitle;
inputComponent->setValue(newTitle);
inputComponent->updateText();
} else {
std::cout << "TabbedComponent::updateWindowState - Window addressComponent isn't an inputComponent" << std::endl;
@@ -326,15 +326,21 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) {
// select new document
this->rootComponent->children.push_back(tab->contents);
tab->contents->setParent(this->rootComponent);
// resize this content incase the window was resized since last selection
if (tab->contents->windowWidth != this->windowWidth || tab->contents->windowHeight != this->windowHeight) {
std::cout << "detected resize, resizing tab's doc component" << std::endl;
tab->contents->resize(this->windowWidth, this->windowHeight);
}

this->documentComponent = tab->contents;
InputComponent *ab = dynamic_cast<InputComponent*>(this->win->addressComponent.get());
if (ab) {
ab->value = tab->titleBox->text;
ab->setValue(tab->titleBox->text);
//std::cout << "tab->titleBox->text: " << tab->titleBox->text << std::endl;
if (ab->value == "New Tab") {
ab->value = "http://"; // should be "" but we don't have an awesome-bar yet
if (ab->getValue() == "New Tab") {
ab->setValue("http://"); // should be "" but we don't have an awesome-bar yet
}
ab->updateText();
} else {
@@ -402,7 +408,7 @@ void TabbedComponent::selectTab(std::shared_ptr<Tab> tab) {
// doesn't move, will this double free?
this->mpSelectedTab = tab; // pointer
this->updateWindowState(ab->value);
this->updateWindowState(ab->getValue());
}

// we expect the tab to be set up (all components allocated)

Loading…
Cancel
Save