mirror of https://github.com/stella-emu/stella.git
Text input is now working in all classes inheriting from EditableWidget
(specifically, DataGridWidget and RomListWidget are now working). More work is required for PromptWidget, since it was created before EditableWidget existed, and hence duplicates a lot of that classes code. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2914 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
90248b2701
commit
aa6c1b3d58
|
@ -282,14 +282,10 @@ int DataGridWidget::findItem(int x, int y)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool DataGridWidget::handleText(char text)
|
bool DataGridWidget::handleText(char text)
|
||||||
{
|
{
|
||||||
if (_editMode)
|
if(_editMode)
|
||||||
{
|
{
|
||||||
// Class EditableWidget handles all text editing related key presses for us
|
// Class EditableWidget handles all text editing related key presses for us
|
||||||
if(EditableWidget::handleText(text))
|
return EditableWidget::handleText(text);
|
||||||
{
|
|
||||||
setDirty(); draw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +301,12 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
if (!_editMode)
|
if (_editMode)
|
||||||
|
{
|
||||||
|
// Class EditableWidget handles all single-key presses for us
|
||||||
|
handled = EditableWidget::handleKeyDown(key, mod);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,14 @@ void PromptWidget::printPrompt()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool PromptWidget::handleText(char text)
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
@ -409,6 +416,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
else if (instance().eventHandler().kbdAlt(mod))
|
else if (instance().eventHandler().kbdAlt(mod))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
else if (isprint(ascii))
|
else if (isprint(ascii))
|
||||||
{
|
{
|
||||||
for (i = _promptEndPos - 1; i >= _currentPos; i--)
|
for (i = _promptEndPos - 1; i >= _currentPos; i--)
|
||||||
|
@ -417,6 +425,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
putchar(ascii);
|
putchar(ascii);
|
||||||
scrollToCurrent();
|
scrollToCurrent();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
handled = false;
|
handled = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -70,7 +70,8 @@ class PromptWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
void handleMouseWheel(int x, int y, int direction);
|
void handleMouseWheel(int x, int y, int direction);
|
||||||
bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
bool handleText(char text);
|
||||||
|
bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
// Account for the extra width of embedded scrollbar
|
// Account for the extra width of embedded scrollbar
|
||||||
|
|
|
@ -292,7 +292,12 @@ bool RomListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
int oldSelectedItem = _selectedItem;
|
int oldSelectedItem = _selectedItem;
|
||||||
|
|
||||||
if(!_editMode)
|
if (_editMode)
|
||||||
|
{
|
||||||
|
// Class EditableWidget handles all single-key presses for us
|
||||||
|
handled = EditableWidget::handleKeyDown(key, mod);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue