2009-10-01 01:10:58 +02:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
* libwiigui
|
|
|
|
|
*
|
|
|
|
|
* Tantric 2009
|
|
|
|
|
*
|
|
|
|
|
* gui_keyboard.cpp
|
|
|
|
|
*
|
|
|
|
|
* GUI class definitions
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
|
#include "../main.h"
|
2010-09-19 22:25:12 +02:00
|
|
|
|
#include "../settings/CSettings.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2011-01-08 13:35:41 +01:00
|
|
|
|
#include "themes/CTheme.h"
|
2010-11-13 23:34:53 +01:00
|
|
|
|
#include "menu.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
|
/**
|
|
|
|
|
* Constructor for the GuiKeyboard class.
|
|
|
|
|
*/
|
|
|
|
|
unsigned int m;
|
|
|
|
|
//const Key thekeys;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
2010-02-09 11:59:55 +01:00
|
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
|
width = 540;
|
|
|
|
|
height = 400;
|
|
|
|
|
shift = 0;
|
|
|
|
|
caps = 0;
|
|
|
|
|
alt = 0;
|
|
|
|
|
alt2 = 0;
|
|
|
|
|
m = min;
|
|
|
|
|
int mode = lang;
|
|
|
|
|
selectable = true;
|
|
|
|
|
focus = 0; // allow focus
|
|
|
|
|
alignmentHor = ALIGN_CENTRE;
|
|
|
|
|
alignmentVert = ALIGN_MIDDLE;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbtextmaxlen = max > sizeof(kbtextstr) ? sizeof(kbtextstr) : max; // limit max up to sizeof(kbtextstr)
|
|
|
|
|
// strlcpy(kbtextstr, t, kbtextmaxlen);
|
|
|
|
|
strncpy(kbtextstr, t, kbtextmaxlen); // strncpy is needed to fill the rest with \0
|
|
|
|
|
kbtextstr[sizeof(kbtextstr) - 1] = 0; // terminate with \0
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//QWERTY//
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 0)
|
2010-02-09 11:59:55 +01:00
|
|
|
|
{
|
2011-02-06 19:36:32 +01:00
|
|
|
|
Key thekeys[4][11] = {
|
|
|
|
|
{
|
|
|
|
|
{ '1', '!', '\0', '\0' },
|
|
|
|
|
{ '2', '@', '\0', '\0' },
|
|
|
|
|
{ '3', '#', '\0', '\0' },
|
|
|
|
|
{ '4', '$', '\0', '\0' },
|
|
|
|
|
{ '5', '%', '\0', '\0' },
|
|
|
|
|
{ '6', '^', '\0', '\0' },
|
|
|
|
|
{ '7', '&', '\0', '\0' },
|
|
|
|
|
{ '8', '*', '\0', '\0' },
|
|
|
|
|
{ '9', '(', '\0', '\0' },
|
|
|
|
|
{ '0', ')', '\0', '\0' },
|
|
|
|
|
{ '\0', '\0', '\0', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ 'q', 'Q', '\0', '\0' },
|
|
|
|
|
{ 'w', 'W', '\0', '\0' },
|
|
|
|
|
{ 'e', 'E', '\0', '\0' },
|
|
|
|
|
{ 'r', 'R', '\0', '\0' },
|
|
|
|
|
{ 't', 'T', '\0', '\0' },
|
|
|
|
|
{ 'y', 'Y', '\0', '\0' },
|
|
|
|
|
{ 'u', 'U', '\0', '\0' },
|
|
|
|
|
{ 'i', 'I', '\0', '\0' },
|
|
|
|
|
{ 'o', 'O', '\0', '\0' },
|
|
|
|
|
{ 'p', 'P', '\0', '\0' },
|
|
|
|
|
{ '-', '_', '\0', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ 'a', 'A', '\0', '\0' },
|
|
|
|
|
{ 's', 'S', '\0', '\0' },
|
|
|
|
|
{ 'd', 'D', '\0', '\0' },
|
|
|
|
|
{ 'f', 'F', '\0', '\0' },
|
|
|
|
|
{ 'g', 'G', '\0', '\0' },
|
|
|
|
|
{ 'h', 'H', '\0', '\0' },
|
|
|
|
|
{ 'j', 'J', '\0', '\0' },
|
|
|
|
|
{ 'k', 'K', '\0', '\0' },
|
|
|
|
|
{ 'l', 'L', '\0', '\0' },
|
|
|
|
|
{ ':', ';', '\0', '\0' },
|
|
|
|
|
{ '\'', '"', '\0', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ 'z', 'Z', '\0', '\0' },
|
|
|
|
|
{ 'x', 'X', '\0', '\0' },
|
|
|
|
|
{ 'c', 'C', '\0', '\0' },
|
|
|
|
|
{ 'v', 'V', '\0', '\0' },
|
|
|
|
|
{ 'b', 'B', '\0', '\0' },
|
|
|
|
|
{ 'n', 'N', '\0', '\0' },
|
|
|
|
|
{ 'm', 'M', '\0', '\0' },
|
|
|
|
|
{ ',', '<', '\0', '\0' },
|
|
|
|
|
{ '.', '>', '\0', '\0' },
|
|
|
|
|
{ '/', '?', '\0', '\0' },
|
|
|
|
|
{ '\0', '\0', '\0', '\0' }
|
|
|
|
|
}
|
|
|
|
|
};
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
memcpy(keys, thekeys, sizeof(thekeys));
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
//DVORAK//
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 1)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2011-02-06 19:36:32 +01:00
|
|
|
|
Key thekeys[4][11] = {
|
|
|
|
|
{
|
|
|
|
|
{ '1', '!', '\0', '\0' },
|
|
|
|
|
{ '2', '@', '\0', '\0' },
|
|
|
|
|
{ '3', '#', '\0', '\0' },
|
|
|
|
|
{ '4', '$', '\0', '\0' },
|
|
|
|
|
{ '5', '%', '\0', '\0' },
|
|
|
|
|
{ '6', '^', '\0', '\0' },
|
|
|
|
|
{ '7', '&', '\0', '\0' },
|
|
|
|
|
{ '8', '*', '\0', '\0' },
|
|
|
|
|
{ '9', '(', '\0', '\0' },
|
|
|
|
|
{ '0', ')', '\0', '\0' },
|
|
|
|
|
{ '\0', '\0', '\0', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ '\'', '"', '\0', '\0' },
|
|
|
|
|
{ ',', '<', '\0', '\0' },
|
|
|
|
|
{ '.', '>', '\0', '\0' },
|
|
|
|
|
{ 'p', 'P', '\0', '\0' },
|
|
|
|
|
{ 'y', 'Y', '\0', '\0' },
|
|
|
|
|
{ 'f', 'F', '\0', '\0' },
|
|
|
|
|
{ 'g', 'G', '\0', '\0' },
|
|
|
|
|
{ 'c', 'C', '\0', '\0' },
|
|
|
|
|
{ 'r', 'R', '\0', '\0' },
|
|
|
|
|
{ 'l', 'L', '\0', '\0' },
|
|
|
|
|
{ '/', '?', '\0', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ 'a', 'A', 'm', '\0' },
|
|
|
|
|
{ 'o', 'O', 'm', '\0' },
|
|
|
|
|
{ 'e', 'E', 'm', '\0' },
|
|
|
|
|
{ 'u', 'U', 'm', '\0' },
|
|
|
|
|
{ 'i', 'I', 'm', '\0' },
|
|
|
|
|
{ 'd', 'D', 'm', '\0' },
|
|
|
|
|
{ 'h', 'H', 'm', '\0' },
|
|
|
|
|
{ 't', 'T', 'm', '\0' },
|
|
|
|
|
{ 'n', 'N', 'm', '\0' },
|
|
|
|
|
{ 's', 'S', 'm', '\0' },
|
|
|
|
|
{ '-', '_', 'm', '\0' }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{ ';', ':', '\0', '\0' },
|
|
|
|
|
{ 'q', 'Q', '\0', '\0' },
|
|
|
|
|
{ 'j', 'J', '\0', '\0' },
|
|
|
|
|
{ 'k', 'K', '\0', '\0' },
|
|
|
|
|
{ 'x', 'X', '\0', '\0' },
|
|
|
|
|
{ 'b', 'B', '\0', '\0' },
|
|
|
|
|
{ 'm', 'M', '\0', '\0' },
|
|
|
|
|
{ 'w', 'W', '\0', '\0' },
|
|
|
|
|
{ 'v', 'V', '\0', '\0' },
|
|
|
|
|
{ 'z', 'Z', '\0', '\0' },
|
|
|
|
|
{ '\0', '\0', '\0', '\0' }
|
|
|
|
|
}
|
|
|
|
|
};
|
2010-09-24 02:48:03 +02:00
|
|
|
|
memcpy(keys, thekeys, sizeof(thekeys));
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
//QWETRZ//
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 2)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
Key thekeys[4][11] = { { { '1', '!', '^', '<EFBFBD>' }, { '2', '"', '<EFBFBD>', '<EFBFBD>' }, { '3', '#', '<EFBFBD>', '<EFBFBD>' }, { '4', '$',
|
|
|
|
|
'<EFBFBD>', '<EFBFBD>' }, { '5', '%', '<EFBFBD>', '<EFBFBD>' }, { '6', '&', '<EFBFBD>', '<EFBFBD>' }, { '7', '/', '<EFBFBD>', '<EFBFBD>' }, { '8', '(', '[',
|
|
|
|
|
'<EFBFBD>' }, { '9', ')', ']', '<EFBFBD>' }, { '0', '=', '<EFBFBD>', '<EFBFBD>' }, { '<EFBFBD>', '?', '\'', '<EFBFBD>' } }, { { 'q', 'Q', '@',
|
|
|
|
|
'<EFBFBD>' }, { 'w', 'W', '\0', '<EFBFBD>' }, { 'e', 'E', '<EFBFBD>', '<EFBFBD>' }, { 'r', 'R', '\0', '<EFBFBD>' },
|
|
|
|
|
{ 't', 'T', '\0', '<EFBFBD>' }, { 'z', 'Z', '\0', '<EFBFBD>' }, { 'u', 'U', '\0', '<EFBFBD>' }, { 'i', 'I', '\0', '<EFBFBD>' }, {
|
|
|
|
|
'o', 'O', '\0', '<EFBFBD>' }, { 'p', 'P', '\0', '<EFBFBD>' }, { '<EFBFBD>', '<EFBFBD>', '\0', '<EFBFBD>' } }, { { 'a', 'A', '\0',
|
|
|
|
|
'<EFBFBD>' }, { 's', 'S', '\0', '<EFBFBD>' }, { 'd', 'D', '\0', '<EFBFBD>' }, { 'f', 'F', '\0', '<EFBFBD>' },
|
|
|
|
|
{ 'g', 'G', '\0', '<EFBFBD>' }, { 'h', 'H', '\0', '<EFBFBD>' }, { 'j', 'J', '\0', '<EFBFBD>' }, { 'k', 'K', '\0', '<EFBFBD>' }, {
|
|
|
|
|
'l', 'L', '\0', '<EFBFBD>' }, { '<EFBFBD>', '<EFBFBD>', '\0', '<EFBFBD>' }, { '<EFBFBD>', '<EFBFBD>', '\0', '<EFBFBD>' } }, { { '<', '>', '|',
|
|
|
|
|
'<EFBFBD>' }, { 'y', 'Y', '\0', '<EFBFBD>' }, { 'x', 'X', '\0', '<EFBFBD>' }, { 'c', 'C', '<EFBFBD>', '<EFBFBD>' },
|
|
|
|
|
{ 'v', 'V', '<EFBFBD>', '<EFBFBD>' }, { 'b', 'B', '\0', '<EFBFBD>' }, { 'n', 'N', '\0', '<EFBFBD>' }, { 'm', 'M', '<EFBFBD>', '<EFBFBD>' }, {
|
|
|
|
|
',', ';', '\0', '<EFBFBD>' }, { '.', ':', '\0', '\0' }, { '-', '_', '\0', '\0' } } };
|
|
|
|
|
memcpy(keys, thekeys, sizeof(thekeys));
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
//AZERTY//
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 3)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
Key thekeys[4][11] = { { { '1', '&', '<EFBFBD>', '<EFBFBD>' }, { '2', '~', '<EFBFBD>', '<EFBFBD>' }, { '3', '"', '#', '<EFBFBD>' }, { '4', '`',
|
|
|
|
|
'<EFBFBD>', '<EFBFBD>' }, { '5', '(', '[', '<EFBFBD>' }, { '6', '-', '|', '<EFBFBD>' }, { '7', '<EFBFBD>', '<EFBFBD>', '<EFBFBD>' }, { '8', '_', '\'',
|
|
|
|
|
'<EFBFBD>' }, { '9', '+', '^', '<EFBFBD>' }, { '0', '=', '@', '<EFBFBD>' }, { '<EFBFBD>', ')', ']', '<EFBFBD>' } }, {
|
|
|
|
|
{ 'a', 'A', '<EFBFBD>', '<EFBFBD>' }, { 'z', 'Z', '<EFBFBD>', '<EFBFBD>' }, { 'e', 'E', '<EFBFBD>', '<EFBFBD>' }, { 'r', 'R', '<EFBFBD>', '<EFBFBD>' }, { 't',
|
|
|
|
|
'T', '<EFBFBD>', '<EFBFBD>' }, { 'y', 'Y', '<EFBFBD>', '<EFBFBD>' }, { 'u', 'U', '<EFBFBD>', '<EFBFBD>' }, { 'i', 'I', '<EFBFBD>', '<EFBFBD>' }, { 'o',
|
|
|
|
|
'O', '<EFBFBD>', '<EFBFBD>' }, { 'p', 'P', '<EFBFBD>', '<EFBFBD>' }, { '$', '<EFBFBD>', '<EFBFBD>', '<EFBFBD>' } }, { { 'q', 'Q', '<EFBFBD>', '<EFBFBD>' }, {
|
|
|
|
|
's', 'S', '<EFBFBD>', '<EFBFBD>' }, { 'd', 'D', '\0', '<EFBFBD>' }, { 'f', 'F', '<EFBFBD>', '<EFBFBD>' }, { 'g', 'G', '\0', '<EFBFBD>' }, { 'h',
|
|
|
|
|
'H', '\0', '<EFBFBD>' }, { 'j', 'J', '\0', '<EFBFBD>' }, { 'k', 'K', '\0', '<EFBFBD>' }, { 'l', 'L', '\0', '<EFBFBD>' }, { 'm',
|
|
|
|
|
'M', '\0', '<EFBFBD>' }, { '*', '%', '<EFBFBD>', '<EFBFBD>' } }, { { '<', '>', '\0', '<EFBFBD>' }, { 'w', 'W', '\0', '<EFBFBD>' }, { 'x',
|
|
|
|
|
'X', '\0', '<EFBFBD>' }, { 'c', 'C', '<EFBFBD>', '<EFBFBD>' }, { 'v', 'V', '<EFBFBD>', '<EFBFBD>' }, { 'b', 'B', '<EFBFBD>', '<EFBFBD>' }, { 'n', 'N',
|
|
|
|
|
'\0', '<EFBFBD>' }, { '?', ',', '?', '<EFBFBD>' }, { '.', ';', '.', '<EFBFBD>' }, { '/', ':', '/', '<EFBFBD>' }, { '<EFBFBD>', '!', '!',
|
|
|
|
|
'<EFBFBD>' } } };
|
|
|
|
|
memcpy(keys, thekeys, sizeof(thekeys));
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
//QWERTY 2//
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 4)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
Key thekeys[4][11] = { { { '1', '!', '|', '<EFBFBD>' }, { '2', '"', '@', '<EFBFBD>' }, { '3', '<EFBFBD>', '#', '<EFBFBD>' }, { '4', '$',
|
|
|
|
|
'<EFBFBD>', '<EFBFBD>' }, { '5', '%', '~', '<EFBFBD>' }, { '6', '&', '<EFBFBD>', '<EFBFBD>' }, { '7', '/', '\'', '<EFBFBD>' }, { '8', '(', '[',
|
|
|
|
|
'<EFBFBD>' }, { '9', ')', ']', '<EFBFBD>' }, { '0', '=', '<EFBFBD>', '<EFBFBD>' }, { '<EFBFBD>', '?', '<EFBFBD>', '<EFBFBD>' } }, { { 'q', 'Q', '\0',
|
|
|
|
|
'<EFBFBD>' }, { 'w', 'W', '\0', '<EFBFBD>' }, { 'e', 'E', '<EFBFBD>', '<EFBFBD>' }, { 'r', 'R', '<EFBFBD>', '<EFBFBD>' }, { 't', 'T', '<EFBFBD>', '<EFBFBD>' },
|
|
|
|
|
{ 'y', 'Y', '<EFBFBD>', '<EFBFBD>' }, { 'u', 'U', '<EFBFBD>', '<EFBFBD>' }, { 'i', 'I', '<EFBFBD>', '<EFBFBD>' }, { 'o', 'O', '<EFBFBD>', '<EFBFBD>' }, { 'p',
|
|
|
|
|
'P', '<EFBFBD>', '<EFBFBD>' }, { '+', '*', '\0', '<EFBFBD>' } }, { { 'a', 'A', '^', '<EFBFBD>' }, { 's', 'S', '<EFBFBD>', '<EFBFBD>' }, {
|
|
|
|
|
'd', 'D', '<EFBFBD>', '<EFBFBD>' }, { 'f', 'F', '<EFBFBD>', '<EFBFBD>' }, { 'g', 'G', '<EFBFBD>', '<EFBFBD>' }, { 'h', 'H', '<EFBFBD>', '<EFBFBD>' }, { 'j',
|
|
|
|
|
'J', '<EFBFBD>', '<EFBFBD>' }, { 'k', 'K', '<EFBFBD>', '<EFBFBD>' }, { 'l', 'L', '<EFBFBD>', '\0' }, { '<EFBFBD>', '<EFBFBD>', '+', '\0' }, { '<EFBFBD>', '<EFBFBD>',
|
|
|
|
|
'<EFBFBD>', '\0' } }, { { '<', '>', '\0', '<EFBFBD>' }, { 'z', 'Z', '\0', '<EFBFBD>' }, { 'x', 'X', '\0', '<EFBFBD>' }, { 'c', 'C',
|
|
|
|
|
'<EFBFBD>', '<EFBFBD>' }, { 'v', 'V', '\0', '<EFBFBD>' }, { 'b', 'B', '<EFBFBD>', '<EFBFBD>' }, { 'n', 'N', '\0', '<EFBFBD>' }, { 'm', 'M', '\0',
|
|
|
|
|
'<EFBFBD>' }, { ',', ';', '\0', '<EFBFBD>' }, { '.', ':', '\0', '\0' }, { '-', '_', '\0', '\0' } } };
|
|
|
|
|
memcpy(keys, thekeys, sizeof(thekeys));
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyTextbox = Resources::GetImageData("keyboard_textbox.png");
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyTextboxImg = new GuiImage(keyTextbox);
|
|
|
|
|
keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
keyTextboxImg->SetPosition(0, 40);//(0,0);
|
|
|
|
|
this->Append(keyTextboxImg);
|
|
|
|
|
|
|
|
|
|
kbText = new GuiText(kbtextstr, 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
|
|
|
|
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
kbText->SetPosition(0, 53);//(0, 13);
|
|
|
|
|
this->Append(kbText);
|
|
|
|
|
|
2011-01-08 13:35:41 +01:00
|
|
|
|
key = Resources::GetImageData("keyboard_key.png");
|
|
|
|
|
keyOver = Resources::GetImageData("keyboard_key_over.png");
|
|
|
|
|
keyMedium = Resources::GetImageData("keyboard_mediumkey_over.png");
|
|
|
|
|
keyLarge = Resources::GetImageData("keyboard_largekey_over.png");
|
2010-09-24 02:48:03 +02:00
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
|
trigA = new GuiTrigger;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
trigB = new GuiTrigger;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
|
|
int eurocheck = 0;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode > 1)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
eurocheck = -20;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBackImg = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyBackOverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 3)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBackText = new GuiText("Retour", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBackText = new GuiText("Back", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
//keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack = new GuiButton(keyBackImg, keyBackOverImg, 0, 3, 11 * 42 + 40 + eurocheck, 0 * 42 + 120, trigA,
|
2010-11-13 23:34:53 +01:00
|
|
|
|
btnSoundOver, btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyBack->SetImage(keyBackImg);
|
|
|
|
|
//keyBack->SetImageOver(keyBackOverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack->SetLabel(keyBackText);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyBack->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyBack->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyBack->SetTrigger(trigA);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack->SetTrigger(trigB);
|
|
|
|
|
if (mode > 1)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack->SetPosition(11 * 42 + 40 + eurocheck, 0 * 42 + 120);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack->SetPosition(10 * 42 + 40 + eurocheck, 0 * 42 + 120);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}//(10*42+40, 0*42+80);
|
|
|
|
|
//keyBack->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keyBack);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClearImg = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyClearOverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode == 3)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClearText = new GuiText("Effacer", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClearText = new GuiText("Clear", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClear = new GuiButton(keyClearImg, keyClearOverImg, 0, 3, (10 * 42 + 40) + eurocheck, 4 * 42 + 120, trigA,
|
2010-11-28 16:31:08 +01:00
|
|
|
|
btnSoundOver, btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
|
|
|
|
//keyClear->SetImage(keyClearImg);
|
|
|
|
|
//keyClear->SetImageOver(keyClearOverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClear->SetLabel(keyClearText);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyClear->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyClear->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyClear->SetTrigger(trigA);
|
|
|
|
|
//keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80);
|
|
|
|
|
//keyClear->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keyClear);
|
|
|
|
|
|
|
|
|
|
keyAltImg = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyAltOverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyAltText = new GuiText("Alt Gr", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-11-28 16:31:08 +01:00
|
|
|
|
keyAlt = new GuiButton(keyAltImg, keyAltOverImg, 0, 3, 84 + eurocheck, 4 * 42 + 120, trigA, btnSoundOver,
|
|
|
|
|
btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
|
|
|
|
//keyAlt->SetImage(keyAltImg);
|
|
|
|
|
//keyAlt->SetImageOver(keyAltOverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyAlt->SetLabel(keyAltText);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyAlt->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyAlt->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyAlt->SetTrigger(trigA);
|
|
|
|
|
//keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
|
|
|
|
|
//keyAlt->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode > 1)
|
|
|
|
|
{
|
|
|
|
|
this->Append(keyAlt);
|
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyAlt2Img = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyAlt2OverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyAlt2Text = new GuiText("Accent", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
|
|
|
|
keyAlt2 = new GuiButton(keyAlt2Img, keyAlt2OverImg, 0, 3, (8 * 42 + 40) + eurocheck, 4 * 42 + 120, trigA,
|
2010-11-28 16:31:08 +01:00
|
|
|
|
btnSoundOver, btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
|
|
|
|
//keyAlt2->SetImage(keyAlt2Img);
|
|
|
|
|
//keyAlt2->SetImageOver(keyAlt2OverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyAlt2->SetLabel(keyAlt2Text);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyAlt2->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyAlt2->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyAlt2->SetTrigger(trigA);
|
|
|
|
|
//keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
|
|
|
|
|
//keyAlt2->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (mode > 1)
|
|
|
|
|
{
|
|
|
|
|
this->Append(keyAlt2);
|
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyCapsImg = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyCapsOverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyCapsText = new GuiText("Caps", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-11-28 16:31:08 +01:00
|
|
|
|
keyCaps = new GuiButton(keyCapsImg, keyCapsOverImg, 0, 3, 0 + eurocheck, 2 * 42 + 120, trigA, btnSoundOver,
|
|
|
|
|
btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
|
|
|
|
//keyCaps->SetImage(keyCapsImg);
|
|
|
|
|
//keyCaps->SetImageOver(keyCapsOverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyCaps->SetLabel(keyCapsText);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyCaps->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyCaps->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyCaps->SetTrigger(trigA);
|
|
|
|
|
//keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80);
|
|
|
|
|
//keyCaps->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keyCaps);
|
|
|
|
|
|
|
|
|
|
keyShiftImg = new GuiImage(keyMedium);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keyShiftOverImg = new GuiImage(keyMedium);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyShiftText = new GuiText("Shift", 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
2010-11-28 16:31:08 +01:00
|
|
|
|
keyShift = new GuiButton(keyShiftImg, keyShiftOverImg, 0, 3, 21 + eurocheck, 3 * 42 + 120, trigA, btnSoundOver,
|
|
|
|
|
btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
|
|
|
|
//keyShift->SetImage(keyShiftImg);
|
|
|
|
|
//keyShift->SetImageOver(keyShiftOverImg);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyShift->SetLabel(keyShiftText);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyShift->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyShift->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyShift->SetTrigger(trigA);
|
|
|
|
|
//keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80);
|
|
|
|
|
//keyShift->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keyShift);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keySpaceImg = new GuiImage(keyLarge);
|
2011-01-08 13:35:41 +01:00
|
|
|
|
keySpaceOverImg = new GuiImage(keyLarge);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
keySpace = new GuiButton(keySpaceImg, keySpaceOverImg, 2, 3, 0 + eurocheck, 4 * 42 + 120, trigA, btnSoundOver,
|
|
|
|
|
btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight());
|
|
|
|
|
//keySpace->SetImage(keySpaceImg);
|
|
|
|
|
//keySpace->SetImageOver(keySpaceOverImg);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keySpace->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keySpace->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keySpace->SetTrigger(trigA);
|
|
|
|
|
//keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80);
|
|
|
|
|
//keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
//keySpace->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keySpace);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
|
|
char txt[2] = { 0, 0 };
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int j = 0; j < 11; j++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keys[i][j].ch != '\0')
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyImg[i][j] = new GuiImage(key);
|
|
|
|
|
keyImgOver[i][j] = new GuiImage(keyOver);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
txt[0] = keys[i][j].ch;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyTxt[i][j] = new GuiText(txt, 20, ( GXColor )
|
|
|
|
|
{ 0, 0, 0, 0xff});
|
|
|
|
|
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
|
keyTxt[i][j]->SetPosition(0, -10);
|
|
|
|
|
keyBtn[i][j] = new GuiButton(keyImg[i][j], keyImgOver[i][j], 0, 3, (j * 42 + 21 * i + 40) + eurocheck,
|
2010-11-28 16:31:08 +01:00
|
|
|
|
i * 42 + 120, trigA, btnSoundOver, btnSoundClick, 1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
|
|
|
|
|
//keyBtn[i][j]->SetImage(keyImg[i][j]);
|
|
|
|
|
//keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
|
2010-11-28 16:31:08 +01:00
|
|
|
|
//keyBtn[i][j]->SetSoundOver(btnSoundOver);
|
|
|
|
|
//keyBtn[i][j]->SetSoundClick(btnSoundClick);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyBtn[i][j]->SetTrigger(trigA);
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBtn[i][j]->SetLabel(keyTxt[i][j]);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
//keyBtn[i][j]->SetPosition((j*42+21*i+40)+eurocheck, i*42+120);//SetPosition(j*42+21*i+40, i*42+80);
|
|
|
|
|
//keyBtn[i][j]->SetEffectGrow();
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->Append(keyBtn[i][j]);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-01 01:10:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor for the GuiKeyboard class.
|
|
|
|
|
*/
|
2010-02-09 11:59:55 +01:00
|
|
|
|
GuiKeyboard::~GuiKeyboard()
|
|
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
|
delete kbText;
|
|
|
|
|
delete keyTextbox;
|
|
|
|
|
delete keyTextboxImg;
|
|
|
|
|
delete keyCapsText;
|
|
|
|
|
delete keyCapsImg;
|
|
|
|
|
delete keyCapsOverImg;
|
|
|
|
|
delete keyCaps;
|
|
|
|
|
delete keyShiftText;
|
|
|
|
|
delete keyShiftImg;
|
|
|
|
|
delete keyShiftOverImg;
|
|
|
|
|
delete keyShift;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keyAlt)
|
|
|
|
|
{
|
|
|
|
|
delete keyAlt;
|
|
|
|
|
}
|
|
|
|
|
if (keyAlt2)
|
|
|
|
|
{
|
|
|
|
|
delete keyAlt2;
|
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
delete keyBackText;
|
|
|
|
|
delete keyBackImg;
|
|
|
|
|
delete keyBackOverImg;
|
|
|
|
|
delete keyBack;
|
|
|
|
|
delete keySpaceImg;
|
|
|
|
|
delete keySpaceOverImg;
|
|
|
|
|
delete keySpace;
|
|
|
|
|
delete key;
|
|
|
|
|
delete keyOver;
|
|
|
|
|
delete keyMedium;
|
|
|
|
|
delete keyLarge;
|
|
|
|
|
delete trigA;
|
|
|
|
|
delete trigB;
|
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int j = 0; j < 11; j++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keys[i][j].ch != '\0')
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
delete keyImg[i][j];
|
|
|
|
|
delete keyImgOver[i][j];
|
|
|
|
|
delete keyTxt[i][j];
|
|
|
|
|
delete keyBtn[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-01 01:10:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
void GuiKeyboard::Update(GuiTrigger * t)
|
2010-02-09 11:59:55 +01:00
|
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
|
LOCK( this );
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (_elements.size() == 0 || (state == STATE_DISABLED && parentElement)) return;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (u8 i = 0; i < _elements.size(); i++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_elements.at(i)->Update(t);
|
|
|
|
|
}
|
|
|
|
|
catch (const std::exception& e)
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool changedShiftKey = false;
|
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keySpace->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (strlen(kbtextstr) < kbtextmaxlen - 1) // -1 --> kbtextmaxlen means with terminating '\0'
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbtextstr[strlen(kbtextstr)] = ' ';
|
|
|
|
|
kbText->SetText(kbtextstr);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keySpace->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyBack->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (strlen(kbtextstr) > (m))
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbtextstr[strlen(kbtextstr) - 1] = 0;
|
|
|
|
|
kbText->SetText(kbtextstr);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBack->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyClear->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
while (strlen(kbtextstr) > (m))
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbtextstr[strlen(kbtextstr) - 1] = 0;
|
|
|
|
|
kbText->SetText(kbtextstr);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyClear->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyShift->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
changedShiftKey = true;
|
|
|
|
|
shift ^= 1;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (alt) alt ^= 1;
|
|
|
|
|
if (alt2) alt2 ^= 1;
|
|
|
|
|
keyShift->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyAlt->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
changedShiftKey = true;
|
|
|
|
|
alt ^= 1;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (shift) shift ^= 1;
|
|
|
|
|
if (alt2) alt2 ^= 1;
|
|
|
|
|
keyAlt->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyAlt2->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
changedShiftKey = true;
|
|
|
|
|
alt2 ^= 1;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (shift) shift ^= 1;
|
|
|
|
|
if (alt) alt ^= 1;
|
|
|
|
|
keyAlt2->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (keyCaps->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
changedShiftKey = true;
|
|
|
|
|
caps ^= 1;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyCaps->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool update = false;
|
|
|
|
|
|
|
|
|
|
char txt[2] = { 0, 0 };
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
update = false;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
for (int j = 0; j < 11; j++)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keys[i][j].ch != '\0')
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (shift || caps)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
txt[0] = keys[i][j].chShift;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (alt)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
txt[0] = keys[i][j].chalt;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else if (alt2)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
txt[0] = keys[i][j].chalt2;
|
2010-09-24 02:48:03 +02:00
|
|
|
|
else txt[0] = keys[i][j].ch;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (changedShiftKey) // change text only if needed
|
|
|
|
|
keyTxt[i][j]->SetText(txt);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (keyBtn[i][j]->GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (strlen(kbtextstr) < kbtextmaxlen - 1) // -1 --> kbtextmaxlen means with term. '\0'
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbtextstr[strlen(kbtextstr)] = txt[0];
|
|
|
|
|
kbText->SetText(kbtextstr);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
keyBtn[i][j]->SetState(STATE_SELECTED, t->chan);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (shift || alt || alt2)
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (shift) shift ^= 1;
|
|
|
|
|
if (alt) alt ^= 1;
|
|
|
|
|
if (alt2) alt2 ^= 1;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
update = true;
|
|
|
|
|
changedShiftKey = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
|
} while (update);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
kbText->SetPosition(0, 53);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
this->ToggleFocus(t);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (focus) // only send actions to this window if it's in focus
|
2010-09-19 01:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
// pad/joystick navigation
|
2010-09-24 02:48:03 +02:00
|
|
|
|
if (t->Right())
|
|
|
|
|
this->MoveSelectionHor(1);
|
|
|
|
|
else if (t->Left())
|
|
|
|
|
this->MoveSelectionHor(-1);
|
|
|
|
|
else if (t->Down())
|
|
|
|
|
this->MoveSelectionVert(1);
|
|
|
|
|
else if (t->Up()) this->MoveSelectionVert(-1);
|
2010-09-19 01:16:05 +02:00
|
|
|
|
}
|
2009-10-01 01:10:58 +02:00
|
|
|
|
}
|