mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +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;
|
||||
hint_1 = Hint_1;
|
||||
hint_2 = Hint_2;
|
||||
inputString = new CInputString(inputSize);
|
||||
inputString = NULL;
|
||||
layout = NULL;
|
||||
selected = 0;
|
||||
caps = 0;
|
||||
@@ -204,14 +204,14 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
|
||||
name = NONEXISTANT_LOCALE;
|
||||
head = Name;
|
||||
valueString = Value;
|
||||
inputSize = Size;
|
||||
inputSize = Size;
|
||||
|
||||
iconfile = Icon ? Icon : "";
|
||||
|
||||
observ = Observ;
|
||||
hint_1 = Hint_1;
|
||||
hint_2 = Hint_2;
|
||||
inputString = new CInputString(inputSize);
|
||||
inputString = NULL;
|
||||
layout = NULL;
|
||||
selected = 0;
|
||||
caps = 0;
|
||||
@@ -221,7 +221,6 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
|
||||
|
||||
CKeyboardInput::~CKeyboardInput()
|
||||
{
|
||||
delete inputString;
|
||||
}
|
||||
|
||||
#define BORDER_OFFSET 20
|
||||
@@ -249,6 +248,12 @@ void CKeyboardInput::init()
|
||||
width = std::max(iwidth, kwidth);
|
||||
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);
|
||||
if (!(iconfile.empty()))
|
||||
{
|
||||
@@ -596,6 +601,9 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
|
||||
|
||||
*valueString = inputString->getValue();
|
||||
|
||||
delete inputString;
|
||||
inputString = NULL;
|
||||
|
||||
if ((observ) && (msg == CRCInput::RC_red))
|
||||
observ->changeNotify(name, (void *) valueString->c_str());
|
||||
|
||||
|
@@ -124,8 +124,8 @@ class CKeyboardInput : public CMenuTarget
|
||||
virtual void setLayout();
|
||||
|
||||
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 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 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 = 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();
|
||||
|
||||
void hide();
|
||||
|
Reference in New Issue
Block a user