|
|
|
@ -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
|
|
|
|
|