Browse Source

update text size prototypes

master
Odilitime 5 years ago
parent
commit
402fa8ad79
  1. 10
      src/graphics/components/TabbedComponent.cpp
  2. 1
      src/graphics/components/TabbedComponent.h

10
src/graphics/components/TabbedComponent.cpp

@ -67,9 +67,9 @@ void TabbedComponent::addTab(std::string passedTitle) { @@ -67,9 +67,9 @@ void TabbedComponent::addTab(std::string passedTitle) {
std::shared_ptr<TextComponent> newTabTitle = std::make_shared<TextComponent>(passedTitle, 0, 0, 12, false, this->tabTextColor, windowWidth, windowHeight);
size_t textWidth = 0;
newTabTitle->win = this->win;
std::unique_ptr<std::pair<int, int>> textInfo = newTabTitle->size();
std::unique_ptr<sizeResponse> textInfo = newTabTitle->size();
if (textInfo) {
textWidth = static_cast<size_t>(textInfo->first);
textWidth = static_cast<size_t>(textInfo->width);
//std::cout << "tab text width: " << textWidth << std::endl;
}
textWidth += 10; // 5px padding each side
@ -182,6 +182,8 @@ void TabbedComponent::addTab(std::string passedTitle) { @@ -182,6 +182,8 @@ void TabbedComponent::addTab(std::string passedTitle) {
// recalc what that just did to our fellow tabs
this->layoutTabs(this->selectedTab, 0);
this->selectedTab->get()->history->pushState(nullptr, url, url);
}
} else {
std::cout << "tabbedComponent::addTab:::docComponent->onBeforeLoad - document component but no tab selected" << std::endl;
@ -433,9 +435,9 @@ void TabbedComponent::layoutTab(std::vector<std::shared_ptr<Tab>>::iterator tab) @@ -433,9 +435,9 @@ void TabbedComponent::layoutTab(std::vector<std::shared_ptr<Tab>>::iterator tab)
// get text size for it's current string
// we don't always need to adjust textWidth, only on text change
int textWidthWPad = 0;
std::unique_ptr<std::pair<int, int>> textInfo = textComponent->size();
std::unique_ptr<sizeResponse> textInfo = textComponent->size();
if (textInfo) {
textWidthWPad = textInfo->first;
textWidthWPad = textInfo->width;
//std::cout << "tab text width: " << textWidth << std::endl;
}
// pad

1
src/graphics/components/TabbedComponent.h

@ -28,6 +28,7 @@ struct Tab { @@ -28,6 +28,7 @@ struct Tab {
std::shared_ptr<Node> domRootNode = nullptr;
//BrowsingHistory history;
// FIXME: we should move this into document component
// but then you can't unloaded delete the document component if you do that...
std::unique_ptr<BrowsingHistory> history = nullptr;
std::shared_ptr<Tab> previousTab = nullptr;
};

Loading…
Cancel
Save