|
|
|
@ -503,9 +503,9 @@ public:
|
|
|
|
|
*/
|
|
|
|
|
inline bool SetFocusedWidget(byte widget_index)
|
|
|
|
|
{
|
|
|
|
|
if (widget_index >= this->widget_count || this->widget + widget_index == this->focused_widget) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (this->widget != NULL) {
|
|
|
|
|
/* Do nothing if widget_index is already focused, or if it wasn't a valid widget. */
|
|
|
|
|
if (widget_index >= this->widget_count || this->widget + widget_index == this->focused_widget) return false;
|
|
|
|
|
|
|
|
|
|
if (this->focused_widget != NULL) {
|
|
|
|
|
/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
|
|
|
|
@ -515,6 +515,23 @@ public:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->nested_array != NULL) {
|
|
|
|
|
/* Do nothing if widget_index is already focused, or if it wasn't a valid widget. */
|
|
|
|
|
if (widget_index >= this->nested_array_size) return false;
|
|
|
|
|
|
|
|
|
|
assert(this->nested_array[widget_index] != NULL); // Setting focus to a non-existing widget is a bad idea.
|
|
|
|
|
if (this->nested_focus != NULL) {
|
|
|
|
|
if (this->nested_array[widget_index] == this->nested_focus) return false;
|
|
|
|
|
|
|
|
|
|
/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
|
|
|
|
|
this->nested_focus->Invalidate(this);
|
|
|
|
|
}
|
|
|
|
|
this->nested_focus = this->nested_array[widget_index];
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
NOT_REACHED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if given widget is focused within this window
|
|
|
|
|
* @param widget_index : index of the widget in the window to check
|
|
|
|
|