Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TFT_Touch_botao_v1 TFT_Touch_exemplo5_git_touch TESTE_1 TFT_Touch_exemplo6_git_touch_button_3_ ... more
Adafruit_GFX_Button Class Reference
A simple drawn button UI element. More...
#include <Adafruit_GFX.h>
Public Member Functions | |
| Adafruit_GFX_Button (void) | |
| Create a simple drawn button UI element. | |
| void | initButton (Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, char *label, uint8_t textsize) |
| Initialize button with our desired color/size/settings. | |
| void | initButton (Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, char *label, uint8_t textsize_x, uint8_t textsize_y) |
| Initialize button with our desired color/size/settings. | |
| void | initButtonUL (Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, char *label, uint8_t textsize) |
| Initialize button with our desired color/size/settings, with upper-left coordinates. | |
| void | initButtonUL (Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, char *label, uint8_t textsize_x, uint8_t textsize_y) |
| Initialize button with our desired color/size/settings, with upper-left coordinates. | |
| void | drawButton (bool inverted=false) |
| Draw the button on the screen. | |
| bool | contains (int16_t x, int16_t y) |
| Helper to let us know if a coordinate is within the bounds of the button. | |
| void | press (bool p) |
| Sets button state, should be done by some touch function. | |
| bool | justPressed () |
| Query whether the button was pressed since we last checked state. | |
| bool | justReleased () |
| Query whether the button was released since we last checked state. | |
| bool | isPressed (void) |
| Query whether the button is currently pressed. | |
Detailed Description
A simple drawn button UI element.
Definition at line 249 of file Adafruit_GFX.h.
Constructor & Destructor Documentation
| Adafruit_GFX_Button | ( | void | ) |
Create a simple drawn button UI element.
Definition at line 1554 of file Adafruit_GFX.cpp.
Member Function Documentation
| bool contains | ( | int16_t | x, |
| int16_t | y | ||
| ) |
Helper to let us know if a coordinate is within the bounds of the button.
- Parameters:
-
x The X coordinate to check y The Y coordinate to check
- Returns:
- True if within button graphics outline
Definition at line 1708 of file Adafruit_GFX.cpp.
| void drawButton | ( | bool | inverted = false ) |
Draw the button on the screen.
- Parameters:
-
inverted Whether to draw with fill/text swapped to indicate 'pressed'
Definition at line 1675 of file Adafruit_GFX.cpp.
| void initButton | ( | Adafruit_GFX * | gfx, |
| int16_t | x, | ||
| int16_t | y, | ||
| uint16_t | w, | ||
| uint16_t | h, | ||
| uint16_t | outline, | ||
| uint16_t | fill, | ||
| uint16_t | textcolor, | ||
| char * | label, | ||
| uint8_t | textsize | ||
| ) |
Initialize button with our desired color/size/settings.
- Parameters:
-
gfx Pointer to our display so we can draw to it! x The X coordinate of the center of the button y The Y coordinate of the center of the button w Width of the buttton h Height of the buttton outline Color of the outline (16-bit 5-6-5 standard) fill Color of the button fill (16-bit 5-6-5 standard) textcolor Color of the button label (16-bit 5-6-5 standard) label Ascii string of the text inside the button textsize The font magnification of the label text
Definition at line 1572 of file Adafruit_GFX.cpp.
| void initButton | ( | Adafruit_GFX * | gfx, |
| int16_t | x, | ||
| int16_t | y, | ||
| uint16_t | w, | ||
| uint16_t | h, | ||
| uint16_t | outline, | ||
| uint16_t | fill, | ||
| uint16_t | textcolor, | ||
| char * | label, | ||
| uint8_t | textsize_x, | ||
| uint8_t | textsize_y | ||
| ) |
Initialize button with our desired color/size/settings.
- Parameters:
-
gfx Pointer to our display so we can draw to it! x The X coordinate of the center of the button y The Y coordinate of the center of the button w Width of the buttton h Height of the buttton outline Color of the outline (16-bit 5-6-5 standard) fill Color of the button fill (16-bit 5-6-5 standard) textcolor Color of the button label (16-bit 5-6-5 standard) label Ascii string of the text inside the button textsize_x The font magnification in X-axis of the label text textsize_y The font magnification in Y-axis of the label text
Definition at line 1598 of file Adafruit_GFX.cpp.
| void initButtonUL | ( | Adafruit_GFX * | gfx, |
| int16_t | x1, | ||
| int16_t | y1, | ||
| uint16_t | w, | ||
| uint16_t | h, | ||
| uint16_t | outline, | ||
| uint16_t | fill, | ||
| uint16_t | textcolor, | ||
| char * | label, | ||
| uint8_t | textsize_x, | ||
| uint8_t | textsize_y | ||
| ) |
Initialize button with our desired color/size/settings, with upper-left coordinates.
- Parameters:
-
gfx Pointer to our display so we can draw to it! x1 The X coordinate of the Upper-Left corner of the button y1 The Y coordinate of the Upper-Left corner of the button w Width of the buttton h Height of the buttton outline Color of the outline (16-bit 5-6-5 standard) fill Color of the button fill (16-bit 5-6-5 standard) textcolor Color of the button label (16-bit 5-6-5 standard) label Ascii string of the text inside the button textsize_x The font magnification in X-axis of the label text textsize_y The font magnification in Y-axis of the label text
Definition at line 1650 of file Adafruit_GFX.cpp.
| void initButtonUL | ( | Adafruit_GFX * | gfx, |
| int16_t | x1, | ||
| int16_t | y1, | ||
| uint16_t | w, | ||
| uint16_t | h, | ||
| uint16_t | outline, | ||
| uint16_t | fill, | ||
| uint16_t | textcolor, | ||
| char * | label, | ||
| uint8_t | textsize | ||
| ) |
Initialize button with our desired color/size/settings, with upper-left coordinates.
- Parameters:
-
gfx Pointer to our display so we can draw to it! x1 The X coordinate of the Upper-Left corner of the button y1 The Y coordinate of the Upper-Left corner of the button w Width of the buttton h Height of the buttton outline Color of the outline (16-bit 5-6-5 standard) fill Color of the button fill (16-bit 5-6-5 standard) textcolor Color of the button label (16-bit 5-6-5 standard) label Ascii string of the text inside the button textsize The font magnification of the label text
Definition at line 1624 of file Adafruit_GFX.cpp.
| bool isPressed | ( | void | ) |
Query whether the button is currently pressed.
- Returns:
- True if pressed
Definition at line 292 of file Adafruit_GFX.h.
| bool justPressed | ( | ) |
Query whether the button was pressed since we last checked state.
- Returns:
- True if was not-pressed before, now is.
Definition at line 1719 of file Adafruit_GFX.cpp.
| bool justReleased | ( | ) |
Query whether the button was released since we last checked state.
- Returns:
- True if was pressed before, now is not.
Definition at line 1727 of file Adafruit_GFX.cpp.
| void press | ( | bool | p ) |
Sets button state, should be done by some touch function.
- Parameters:
-
p True for pressed, false for not.
Definition at line 278 of file Adafruit_GFX.h.
Generated on Tue Jul 12 2022 22:58:48 by
1.7.2