Skip to content
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

Adafruit_GFX_Button & Adafruit_GFX changes: pressedcolor, radius, custom fonts. #347

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

IanBUK
Copy link

@IanBUK IanBUK commented Apr 18, 2021

This pull request adds functionality to Adafruit_GFX_Button: setting a custom backcolour for when the button is pressed; setting the radius of the rounded corners and fixes an issue with using custom fonts on labels, along with allowing more than 9 characters on a label. The Adafruit_GFX class has been extended to include a getFont() function that exposes the current font.

Adafruit_GFX_Button:

  • radius property to Adafruit_GFX_Button, to allow buttons to have different sized radius corners. 0 or less results in sharp corners
  • getLabel() function, exposes the current label.
  • drawButton can now show a different colour background when the button is pressed.
  • _pressedcolor field added to hold the background colour of a pressed button..
  • new overrides to initButton to allow setting of pressedColor.
  • _maxlabellength used to hold the maximum length of the label - here increased to 40 characters. The property is used in the drawButton function, so changes need making purely to the static const int in the .h file.
  • drawButton now respects the current font, so the label is positioned correctly.

Adafuit_GFX

getFont() function to get the current font. This allows the Button etc to change behaviour based on the font. e.g. in the Button, we can now better calculate the width of the label correctly and therefore position it better.

MrIBrown and others added 6 commits April 18, 2021 14:59
 - radius property to Adafruit_GFX_Button, to allow buttons to have different sized radius corners. 0 or less results in sharp corners
- getLabel() function, exposes the current label.
- drawButton can now show a different colour background when the button is pressed.
- _pressedcolor field added to hold the background colour of a pressed button..
- new overrides to initButton to allow setting of pressedColor.
- _maxlabellength used to hold the maximum length of the label  - here increased to 40 characters. The property is used in the drawButton function, so changes need making purely to the static const int in the .h file.
-  drawButton now respects the current font, so the label is positioned correctly.

Adafuit_GFX
- getFont() function to get the current font.  This allows the Button etc to change behaviour based on the font. e.g. in the Button, we can now better calculate the width of the label correctly and therefore position it better.
@IanBUK
Copy link
Author

IanBUK commented Apr 18, 2021

The build error is produced by clang, but it doesn't give any actual error detail. This code runs locally!

How do I find out what clang is failing on?

@ZinggJM
Copy link
Contributor

ZinggJM commented Apr 19, 2021

finally decided to watch no longer

@IanBUK
Copy link
Author

IanBUK commented Apr 19, 2021

finally decided to watch no longer

Finally...sorted it. I’m new to GitHub, I normally work with the MS stack and so had never heard of clang or doxygen. Apologies if I bored or frustrated you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants