mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
- keyboard_input: auto calculate size of input-field ...
... if size is 0 or not given.
This commit is contained in:
@@ -191,7 +191,7 @@ CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value,
|
|||||||
observ = Observ;
|
observ = Observ;
|
||||||
hint_1 = Hint_1;
|
hint_1 = Hint_1;
|
||||||
hint_2 = Hint_2;
|
hint_2 = Hint_2;
|
||||||
inputString = new CInputString(inputSize);
|
inputString = NULL;
|
||||||
layout = NULL;
|
layout = NULL;
|
||||||
selected = 0;
|
selected = 0;
|
||||||
caps = 0;
|
caps = 0;
|
||||||
@@ -204,14 +204,14 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
|
|||||||
name = NONEXISTANT_LOCALE;
|
name = NONEXISTANT_LOCALE;
|
||||||
head = Name;
|
head = Name;
|
||||||
valueString = Value;
|
valueString = Value;
|
||||||
inputSize = Size;
|
inputSize = Size;
|
||||||
|
|
||||||
iconfile = Icon ? Icon : "";
|
iconfile = Icon ? Icon : "";
|
||||||
|
|
||||||
observ = Observ;
|
observ = Observ;
|
||||||
hint_1 = Hint_1;
|
hint_1 = Hint_1;
|
||||||
hint_2 = Hint_2;
|
hint_2 = Hint_2;
|
||||||
inputString = new CInputString(inputSize);
|
inputString = NULL;
|
||||||
layout = NULL;
|
layout = NULL;
|
||||||
selected = 0;
|
selected = 0;
|
||||||
caps = 0;
|
caps = 0;
|
||||||
@@ -221,7 +221,6 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
|
|||||||
|
|
||||||
CKeyboardInput::~CKeyboardInput()
|
CKeyboardInput::~CKeyboardInput()
|
||||||
{
|
{
|
||||||
delete inputString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BORDER_OFFSET 20
|
#define BORDER_OFFSET 20
|
||||||
@@ -249,6 +248,12 @@ void CKeyboardInput::init()
|
|||||||
width = std::max(iwidth, kwidth);
|
width = std::max(iwidth, kwidth);
|
||||||
width = std::min(width, (int) frameBuffer->getScreenWidth());
|
width = std::min(width, (int) frameBuffer->getScreenWidth());
|
||||||
|
|
||||||
|
if (!inputSize || (iwidth > width)) { /* auto calc inputSize */
|
||||||
|
inputSize = (width - 2*offset) / input_w;
|
||||||
|
iwidth = inputSize*input_w + 2*offset;
|
||||||
|
}
|
||||||
|
inputString = new CInputString(inputSize);
|
||||||
|
|
||||||
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head);
|
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head);
|
||||||
if (!(iconfile.empty()))
|
if (!(iconfile.empty()))
|
||||||
{
|
{
|
||||||
@@ -596,6 +601,9 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
|
|||||||
|
|
||||||
*valueString = inputString->getValue();
|
*valueString = inputString->getValue();
|
||||||
|
|
||||||
|
delete inputString;
|
||||||
|
inputString = NULL;
|
||||||
|
|
||||||
if ((observ) && (msg == CRCInput::RC_red))
|
if ((observ) && (msg == CRCInput::RC_red))
|
||||||
observ->changeNotify(name, (void *) valueString->c_str());
|
observ->changeNotify(name, (void *) valueString->c_str());
|
||||||
|
|
||||||
|
@@ -124,8 +124,8 @@ class CKeyboardInput : public CMenuTarget
|
|||||||
virtual void setLayout();
|
virtual void setLayout();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CKeyboardInput(const neutrino_locale_t Name, std::string* Value, int Size, CChangeObserver* Observ = NULL, const char * const Icon = NULL, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE);
|
CKeyboardInput(const neutrino_locale_t Name, std::string* Value, int Size = 0, CChangeObserver* Observ = NULL, const char * const Icon = NULL, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE);
|
||||||
CKeyboardInput(const std::string &Name, std::string* Value, int Size, CChangeObserver* Observ = NULL, const char * const Icon = NULL, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE);
|
CKeyboardInput(const std::string &Name, std::string* Value, int Size = 0, CChangeObserver* Observ = NULL, const char * const Icon = NULL, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE);
|
||||||
~CKeyboardInput();
|
~CKeyboardInput();
|
||||||
|
|
||||||
void hide();
|
void hide();
|
||||||
|
Reference in New Issue
Block a user