removed duplicate _editMode variable

fixed missing redraws when StringListWidgets gain focus
prevent focus for disabled widget
This commit is contained in:
thrust26 2020-11-15 11:03:55 +01:00
parent e01d8e57a5
commit 096ed424e3
7 changed files with 9 additions and 11 deletions

View File

@ -361,7 +361,7 @@ void Dialog::setFocus(Widget* w)
{
// If the click occured inside a widget which is not the currently
// focused one, change the focus to that widget.
if(w && w != _focusedWidget && w->wantsFocus())
if(w && w != _focusedWidget && w->wantsFocus() && w->isEnabled())
{
// Redraw widgets for new focus
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), w, 0);
@ -427,10 +427,10 @@ void Dialog::drawDialog()
FBSurface& s = surface();
cerr << endl << "d";
if(isDirty())
{
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
cerr << "d";
if(clearsBackground())
{

View File

@ -122,10 +122,6 @@ void DialogContainer::render()
if(myDialogStack.empty())
return;
// Make sure we start in a clean state (with zero'ed buffers)
if(!myOSystem.eventHandler().inTIAMode())
myOSystem.frameBuffer().clear();
cerr << "full re-render " << typeid(*this).name() << endl;
// Make sure we start in a clean state (with zero'ed buffers)
@ -174,7 +170,7 @@ void DialogContainer::removeDialog()
{
if(!myDialogStack.empty())
{
cerr << "remove dialog" << endl;
cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl;
myDialogStack.pop();
// Inform the frame buffer that it has to render all surfaces

View File

@ -100,8 +100,6 @@ void EditableWidget::receivedFocusWidget()
{
_caretTimer = 0;
_caretEnabled = true;
Widget::receivedFocusWidget();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -36,6 +36,8 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
_textcolor = kTextColor;
_textcolorhi = kTextColor;
_editMode = false;
_cols = w / _fontWidth;
_rows = h / _lineHeight;

View File

@ -99,7 +99,6 @@ class ListWidget : public EditableWidget
int _currentPos{0};
int _selectedItem{-1};
int _highlightedItem{-1};
bool _editMode{false};
bool _useScrollbar{true};
ScrollBarWidget* _scrollBar{nullptr};

View File

@ -52,7 +52,7 @@ class OptionsDialog : public Dialog
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
unique_ptr<VideoAudioDialog> myVideoDialog;
unique_ptr<VideoAudioDialog> myVideoDialog;
unique_ptr<EmulationDialog> myEmulationDialog;
unique_ptr<InputDialog> myInputDialog;
unique_ptr<UIDialog> myUIDialog;

View File

@ -35,6 +35,9 @@ class StringListWidget : public ListWidget
protected:
void handleMouseEntered() override;
void handleMouseLeft() override;
// display depends on _hasFocus so we have to redraw when focus changes
void receivedFocusWidget() override { setDirty(); }
void lostFocusWidget() override { setDirty(); }
void drawWidget(bool hilite) override;
Common::Rect getEditRect() const override;