Vertical tabs (#1815)

* Vertical tabs

* Vertical tab wrapping

* Fix formatting

* Cleanup code

* Updated changelog

* Hide button row if no buttons exist

* Fix tab width expansion

Co-authored-by: fourtf <tf.four@gmail.com>
This commit is contained in:
Daniel
2020-08-13 09:43:08 -04:00
committed by GitHub
parent b52d15b9b4
commit 0e6ca6b097
10 changed files with 278 additions and 77 deletions
+28 -2
View File
@@ -89,7 +89,20 @@ void NotebookTab::themeChangedEvent()
this->setMouseEffectColor(this->theme->tabs.regular.text);
}
void NotebookTab::updateSize()
void NotebookTab::growWidth(int width)
{
if (this->growWidth_ != width)
{
this->growWidth_ = width;
this->updateSize();
}
else
{
this->growWidth_ = width;
}
}
int NotebookTab::normalTabWidth()
{
float scale = this->scale();
int width;
@@ -114,8 +127,21 @@ void NotebookTab::updateSize()
{
width = clamp(width, this->height(), int(150 * scale));
}
return width;
}
void NotebookTab::updateSize()
{
float scale = this->scale();
int width = this->normalTabWidth();
auto height = int(NOTEBOOK_TAB_HEIGHT * scale);
if (width < this->growWidth_)
{
width = this->growWidth_;
}
if (this->width() != width || this->height() != height)
{
this->resize(width, height);
@@ -175,7 +201,7 @@ void NotebookTab::titleUpdated()
{
// Queue up save because: Tab title changed
getApp()->windows->queueSave();
this->notebook_->performLayout();
this->updateSize();
this->update();
}