1.2
Public Member Functions | Protected Attributes | Friends | List of all members
VirtualKeyboard::Key Class Reference

Key widget for the Keyboard widget. More...

Public Member Functions

 Key (const Image &img, int link, double length=1.0) noexcept
 
 Key (const Image &img, KeyboardCode keycode, double length=1.0) noexcept
 
 Key (const std::string &label, int link, double length=1.0) noexcept
 
 Key (const std::string &label, KeyboardCode keycode, double length=1.0) noexcept
 
 Key (uint32_t unicode, double length=1.0) noexcept
 
 Key (uint32_t unicode, PanelKeys keys_multichoice, double length=1.0) noexcept
 
void color (Palette::ColorId id, const Pattern &color, Palette::GroupId group=Palette::GroupId::normal)
 Set the key color. More...
 
void font (const Font &font)
 Set the key font. More...
 

Protected Attributes

std::shared_ptr< Buttonm_button {nullptr}
 Button associated with the key. More...
 
KeyboardCode m_keycode {EKEY_UNKNOWN}
 Code of the key. More...
 
PanelKeys m_keys_multichoice
 Keys for the multichoice panel. More...
 
double m_length
 Length multiplicator of the panel default key size. More...
 
int m_link {-1}
 Id of the MainPanel to display when clicking on this button. More...
 
std::shared_ptr< Panel > m_multichoice_panel {nullptr}
 Multichoice panel to display on long press event. More...
 
uint32_t m_unicode {0}
 UTF32 code point for the key. More...
 

Friends

class VirtualKeyboard
 

Detailed Description

Key widget for the Keyboard widget.

This widget allows to describe a key that will be used by the Keyboard widget. There are different kinds of keys:

Even if the VirtualKeyboard class automatically computes the base size of the keys, it's still possible to customize the size of a key by setting its length which is a factor for the base size width.

Constructor & Destructor Documentation

◆ Key() [1/6]

Key ( uint32_t  unicode,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]unicodeUTF32 code point for the key. It's also the label of the key.
[in]lengthLength of the key.

◆ Key() [2/6]

Key ( const std::string &  label,
KeyboardCode  keycode,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]labelLabel of the key.
[in]keycodeCode of the key.
[in]lengthLength of the key.

◆ Key() [3/6]

Key ( const Image img,
KeyboardCode  keycode,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]imgImage of the key.
[in]keycodeCode of the key.
[in]lengthLength of the key.

◆ Key() [4/6]

Key ( const std::string &  label,
int  link,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]labelLabel of the key.
[in]linkId of the main panel to display when clicking on this key. The id depends on the order of registration of the main panels. It starts from 0.
[in]lengthLength of the key.

◆ Key() [5/6]

Key ( const Image img,
int  link,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]imgImage of the key.
[in]linkId of the main panel to display when clicking on this key. The id depends on the order of registration of the main panels. It starts from 0.
[in]lengthLength of the key.

◆ Key() [6/6]

Key ( uint32_t  unicode,
PanelKeys  keys_multichoice,
double  length = 1.0 
)
explicitnoexcept
Parameters
[in]unicodeUTF32 code point for the key.
[in]keys_multichoiceMultichoice panel that has to be displayed after a long touch event.
[in]lengthLength of the key.

Member Function Documentation

◆ color()

void color ( Palette::ColorId  id,
const Pattern color,
Palette::GroupId  group = Palette::GroupId::normal 
)

Set the key color.

◆ font()

void font ( const Font font)

Set the key font.

Friends And Related Function Documentation

◆ VirtualKeyboard

friend class VirtualKeyboard
friend

Member Data Documentation

◆ m_button

std::shared_ptr<Button> m_button {nullptr}
protected

Button associated with the key.

◆ m_keycode

KeyboardCode m_keycode {EKEY_UNKNOWN}
protected

Code of the key.

◆ m_keys_multichoice

PanelKeys m_keys_multichoice
protected

Keys for the multichoice panel.

◆ m_length

double m_length
protected

Length multiplicator of the panel default key size.

◆ m_link

int m_link {-1}
protected

Id of the MainPanel to display when clicking on this button.

◆ m_multichoice_panel

std::shared_ptr<Panel> m_multichoice_panel {nullptr}
protected

Multichoice panel to display on long press event.

◆ m_unicode

uint32_t m_unicode {0}
protected

UTF32 code point for the key.