FS#3184 - Support for nested QueryStringBaseWindow

Attached to Project: OpenTTD
Opened by Jose Soler (Terkhen) - Tuesday, 08 September 2009, 20:32 GMT
Last edited by Alberth (Alberth) - Friday, 11 September 2009, 18:53 GMT
Type Patch
Category Interface
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


More precisely, I made the following changes:

- QueryStringBaseWindow::DrawEditBox now accepts nested widgets.

- Window::SetFocusedWidget now accepts nested widgets as parameter.

- Allow OskWindow to have a window with nested widgets as a parent.

You can find an example of a finished nested QueryStringBaseWindow at the "Choose town name before creation" patch, which I'll be submitting shortly after this one.
This task depends upon

Closed by  Alberth (Alberth)
Friday, 11 September 2009, 18:53 GMT
Reason for closing:  Implemented
Additional comments about closing:  in r17502
Comment by Alberth (Alberth) - Wednesday, 09 September 2009, 19:48 GMT
Nice patch, comment attached.
Comment by Jose Soler (Terkhen) - Thursday, 10 September 2009, 08:23 GMT
Thanks, here is a new version.

### No white space at the end of the line!

^ They have been corrected.

### For the quest to eliminate magic constant values from the window code, please replace them with the appropriate WD_* value from window_gui.h (WidgetDrawDistances enum).

^ I'm not sure that I got the vertical parts right (maybe I am mistaking WD_FRAMERECT_TOP and WD_FRAMERECT_BOTTOM). Using (WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) with top and bottom I was able to align the text into the edit box better (see attached screenshots), but since I don't know if the current alignment is motived by fonts other than the standard, I left it as it was.

### The if() throws compiler warnings all over the place (ie for many files):

^ I can't test compilation with other platforms right now, at MSVC it doesn't give any warnings. It should be corrected now anyways.

NULL pointers in the nested_array:
Since the prgrammer has control when this code is used, it may not be bad choice to let the program crash

^ I left them uncorrected, but I added asserts to inform about the problem.