| 22 | } |
| 23 | |
| 24 | void UpdateCheck::paint(Graphics& g) |
| 25 | { |
| 26 | g.setColour(WHITE_SOLID); |
| 27 | g.setFont(UIDefines::LABEL_FONT()); |
| 28 | |
| 29 | String text; |
| 30 | if (mUpdateAvailable) { |
| 31 | text = "A new version of NeuralNote is available:"; |
| 32 | } else { |
| 33 | text = "You are on the latest version of NeuralNote!"; |
| 34 | } |
| 35 | |
| 36 | AttributedString attributed_string(text); |
| 37 | attributed_string.setFont(UIDefines::LABEL_FONT()); |
| 38 | attributed_string.setJustification(Justification::centred); |
| 39 | |
| 40 | TextLayout text_layout; |
| 41 | text_layout.createLayout(attributed_string, static_cast<float>(getWidth()), static_cast<float>(getHeight())); |
| 42 | float text_width = text_layout.getWidth(); |
| 43 | float rectangle_width = text_width + 2 * mPadding; |
| 44 | |
| 45 | if (mUpdateAvailable) { |
| 46 | rectangle_width += static_cast<float>(mUrlButton.getWidth()); |
| 47 | } |
| 48 | |
| 49 | int rect_x_start = getWidth() - static_cast<int>(rectangle_width); |
| 50 | |
| 51 | g.fillRoundedRectangle(getLocalBounds().toFloat().withLeft(static_cast<float>(rect_x_start)), 4.0f); |
| 52 | |
| 53 | g.setColour(BLACK); |
| 54 | text_layout.draw( |
| 55 | g, |
| 56 | Rectangle<float>(static_cast<float>(rect_x_start + mPadding), 0, text_width, static_cast<float>(getHeight()))); |
| 57 | } |
| 58 | |
| 59 | void UpdateCheck::timerCallback() |
| 60 | { |
nothing calls this directly
no test coverage detected