Fonctions membres publiques | Liste de tous les membres
Référence de la classe Adafruit_GFX_Button

A simple drawn button UI element. Plus de détails...

#include <Adafruit_GFX.h>

Fonctions membres publiques

 Adafruit_GFX_Button (void)
 Create a simple drawn button UI element. Plus de détails...
 
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. Plus de détails...
 
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. Plus de détails...
 
void drawButton (boolean inverted=false)
 Draw the button on the screen. Plus de détails...
 
boolean contains (int16_t x, int16_t y)
 Helper to let us know if a coordinate is within the bounds of the button. Plus de détails...
 
void press (boolean p)
 Sets the state of the button, should be done by some touch function. Plus de détails...
 
boolean isPressed ()
 Query whether the button is currently pressed. Plus de détails...
 
boolean justPressed ()
 Query whether the button was pressed since we last checked state. Plus de détails...
 
boolean justReleased ()
 Query whether the button was released since we last checked state. Plus de détails...
 

Description détaillée

A simple drawn button UI element.

Documentation des constructeurs et destructeur

◆ Adafruit_GFX_Button()

Adafruit_GFX_Button::Adafruit_GFX_Button ( void  )

Create a simple drawn button UI element.

Documentation des fonctions membres

◆ contains()

boolean Adafruit_GFX_Button::contains ( int16_t  x,
int16_t  y 
)

Helper to let us know if a coordinate is within the bounds of the button.

Paramètres
xThe X coordinate to check
yThe Y coordinate to check
Renvoie
True if within button graphics outline

◆ drawButton()

void Adafruit_GFX_Button::drawButton ( boolean  inverted = false)

Draw the button on the screen.

Paramètres
invertedWhether to draw with fill/text swapped to indicate 'pressed'

◆ initButton()

void Adafruit_GFX_Button::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.

Paramètres
gfxPointer to our display so we can draw to it!
xThe X coordinate of the center of the button
yThe Y coordinate of the center of the button
wWidth of the buttton
hHeight of the buttton
outlineColor of the outline (16-bit 5-6-5 standard)
fillColor of the button fill (16-bit 5-6-5 standard)
textcolorColor of the button label (16-bit 5-6-5 standard)
labelAscii string of the text inside the button
textsizeThe font magnification of the label text

◆ initButtonUL()

void Adafruit_GFX_Button::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.

Paramètres
gfxPointer to our display so we can draw to it!
x1The X coordinate of the Upper-Left corner of the button
y1The Y coordinate of the Upper-Left corner of the button
wWidth of the buttton
hHeight of the buttton
outlineColor of the outline (16-bit 5-6-5 standard)
fillColor of the button fill (16-bit 5-6-5 standard)
textcolorColor of the button label (16-bit 5-6-5 standard)
labelAscii string of the text inside the button
textsizeThe font magnification of the label text

◆ isPressed()

boolean Adafruit_GFX_Button::isPressed ( )

Query whether the button is currently pressed.

Renvoie
True if pressed

◆ justPressed()

boolean Adafruit_GFX_Button::justPressed ( )

Query whether the button was pressed since we last checked state.

Renvoie
True if was not-pressed before, now is.

◆ justReleased()

boolean Adafruit_GFX_Button::justReleased ( )

Query whether the button was released since we last checked state.

Renvoie
True if was pressed before, now is not.

◆ press()

void Adafruit_GFX_Button::press ( boolean  p)

Sets the state of the button, should be done by some touch function.

Paramètres
pTrue for pressed, false for not.