gui: keyboard: support longpress label offset, code cleanup

To position the longpress label:
<longpress font="..." textcolor="..." x="5" y="0"/>
x and y is the distance from the upper right corner.

- extract method GUIKeyboard::DrawKey
- clean up handling of currently pressed key
- integrate key highlighting into main key drawing loops

Change-Id: I80ccf2975d30cffa2a48627a74ab3693c84e4fa4
This commit is contained in:
that
2015-07-14 16:00:35 +02:00
committed by Dees Troy
parent 983be2a3fb
commit f6b2066ff3
2 changed files with 119 additions and 149 deletions
+4 -1
View File
@@ -853,6 +853,7 @@ protected:
};
int ParseKey(const char* keyinfo, Key& key, int& Xindex, int keyWidth, bool longpress);
void LoadKeyLabels(xml_node<>* parent, int layout);
void DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH);
enum {
MAX_KEYBOARD_LAYOUTS = 5,
@@ -886,7 +887,8 @@ protected:
std::string mVariable;
int currentLayout;
bool CapsLockOn;
int rowY, colX, highlightRenderCount;
int highlightRenderCount;
Key* currentKey;
bool hasHighlight, hasCapsHighlight;
COLOR mHighlightColor;
COLOR mCapsHighlightColor;
@@ -895,6 +897,7 @@ protected:
FontResource* mFont; // for main key labels
FontResource* mSmallFont; // for key labels like "?123"
FontResource* mLongpressFont; // for the small longpress label in the upper right corner
int longpressOffsetX, longpressOffsetY; // distance of the longpress label from the key corner
COLOR mLongpressFontColor;
COLOR mBackgroundColor; // keyboard background color
COLOR mKeyColorAlphanumeric; // key background color