-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/multi line tool tip #1473
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about the impact to the API of this change. Do we want to use a std::vector
of strings, or do we want to support strings with embedded newlines? I'd be tempted to consider strings with embedded newlines. Seems like a more natural API to use. Particularly since sources of multi-line input may come with naturally embedded newlines.
f3d5c6e
to
02dfa90
Compare
This might be of interest to a couple of those comments: // read file line by line
std::istringstream input;
input.str("1\n2\n3\n4\n5\n6\n7\n");
int sum = 0;
for (std::string line; std::getline(input, line);)
sum += std::stoi(line);
std::cout << "\nThe sum is " << sum << ".\n\n"; The use of the |
02dfa90
to
61bc8bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of liking how processLines
cleans up some of that earlier duplication.
c88d306
to
ecd45f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite happy with this. Had a couple of small optional thoughts.
ecd45f6
to
edff544
Compare
edff544
to
fd8bdd2
Compare
forEachLine(mFocusedControl->second, [this, &renderer, &linePosition](const std::string& lineStr) { | ||
renderer.drawText(mFont, lineStr, linePosition); | ||
linePosition.y += mFont.height(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also possible to do a named capture, as an alternative to capturing this
, and everything that has access to:
[&font=mFont, &renderer, &linePosition]
Changes allow the Tool Tip Class to support tool-tips with multiple lines.