rename highlight style to highlight state

This commit is contained in:
Rasmus Karlsson 2017-12-26 12:05:14 +01:00
parent 03962db367
commit ebd682730a
2 changed files with 11 additions and 13 deletions

View file

@ -110,14 +110,9 @@ void NotebookTab::setSelected(bool value)
this->update();
}
NotebookTab::HighlightStyle NotebookTab::getHighlightStyle() const
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
{
return this->highlightStyle;
}
void NotebookTab::setHighlightStyle(HighlightStyle newHighlightStyle)
{
this->highlightStyle = newHighlightStyle;
this->highlightState = newHighlightStyle;
this->update();
}
@ -174,10 +169,10 @@ void NotebookTab::paintEvent(QPaintEvent *)
} else if (this->mouseOver) {
painter.fillRect(rect(), this->colorScheme.TabHoverBackground);
fg = this->colorScheme.TabHoverText;
} else if (this->highlightStyle == HighlightHighlighted) {
} else if (this->highlightState == HighlightState::Highlighted) {
painter.fillRect(rect(), this->colorScheme.TabHighlightedBackground);
fg = this->colorScheme.TabHighlightedText;
} else if (this->highlightStyle == HighlightNewMessage) {
} else if (this->highlightState == HighlightState::NewMessage) {
painter.fillRect(rect(), this->colorScheme.TabNewMessageBackground);
fg = this->colorScheme.TabHighlightedText;
} else {

View file

@ -23,7 +23,11 @@ class NotebookTab : public BaseWidget
std::string settingRoot;
public:
enum HighlightStyle { HighlightNone, HighlightHighlighted, HighlightNewMessage };
enum class HighlightState {
None,
Highlighted,
NewMessage,
};
explicit NotebookTab(Notebook *_notebook, const std::string &settingPrefix);
@ -36,8 +40,7 @@ public:
bool isSelected() const;
void setSelected(bool value);
HighlightStyle getHighlightStyle() const;
void setHighlightStyle(HighlightStyle style);
void setHighlightState(HighlightState style);
void moveAnimated(QPoint pos, bool animated = true);
@ -77,7 +80,7 @@ private:
bool mouseOverX = false;
bool mouseDownX = false;
HighlightStyle highlightStyle = HighlightStyle::HighlightNone;
HighlightState highlightState = HighlightState::None;
QMenu menu;