Commit Graph

57 Commits (jgrpp)

Author SHA1 Message Date
Peter Nelson d683ec0183
Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2 months ago
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 3 months ago
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 3 months ago
Peter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
3 months ago
Peter Nelson 0ce30d05c8 Codechange: Add method to replace the content of a dropdown menu.
If necessary the dropdown list window will be resized and scrollbar enabled/disabled.
4 months ago
Peter Nelson 4c44e1eae0 Codechange: Add parameter to persist dropdown menus.
If a dropdown menu is set to persist, it will not close when an item is selected. It will close as normal if the window loses focus.

Closing the list is the responsibility of the caller.
4 months ago
Rubidium e3f49ee7a0 Codechange: coding style fixes 5 months ago
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
5 months ago
Peter Nelson daec0e2ca4 Codechange: Split palette handling to separate file. 5 months ago
Peter Nelson 8db7c79e79 Codechange: Add DropDownIcon constructor to override dimension.
This avoids the need to construct a DropDownIcon and set the dimension after.
6 months ago
Peter Nelson 49532914dd Change: Use CRTP-mixins to compose dropdown list items.
This allows list items to built from component parts as required, and additional
functionality is added:

* Icons and text can be positioned at the start or end of the space (templated.)
* Font size of text can be changed (templated.)
* Palette of sprites can be set (runtime.)
6 months ago
Peter Nelson 5489b9fc0c Codechange: Undo #11447, drop down list divider lines are now explicit. 6 months ago
Peter Nelson c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
6 months ago
Peter Nelson 08dfe35442 Codechange: Move DropDownList height and width calculation to helper. 7 months ago
Peter Nelson 136551408c
Change: Show empty string drop down entries as divider. (#11447) 7 months ago
Peter Nelson 129e98fbab
Fix d42a78f: Some raw drop down list strings may need token processing. (#11400)
Storing the raw string without processing though GetString() caused token
processing to be skipped.
7 months ago
Bernhard Reutner-Fischer ac42dea7b2 Codechange: Remove unused parameter for Height()
DropDownListItem::Height does not need to take an argument so remove it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
7 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
PeterN d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. (#11063)
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.

Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.

This also means that strings no longer need to be formatted on every draw.
11 months ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 1 year ago
Peter Nelson e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
1 year ago
Peter Nelson 632464a623 Codechange: Use Rect in DropDownListItem::Draw(). 2 years ago
PeterN ae7f07de74
Fix: Incorrect vertical alignment of icon and text in DropDownListIconItem. (#9133)
This happens if the bounding dimensions are changed so that each item is the same size, as happens on the railtype/roadtype dropdown lists, as the vertical offset was calculated before this dimension is changed.
3 years ago
Patric Stout b21ba566ae
Codechange: remove special strings for language and resolutions (#8824)
As OpenTTD grew, we found other ways to do this, and we are no
longer in need for a hack like this.
3 years ago
Michael Lutz a49fdb7ebb Codechange: Store base set related texts in std::strings. 4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
glx22 3b4f224c0b
Fix #7494: std::sort() and qsort() use different comparators (#7495) 5 years ago
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
5 years ago
Michael Lutz 9325d63d8e Fix: Forgotten override keywords for DropDownListIconItem. 5 years ago
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 5 years ago
peter1138 aafce47596 Codechange: Use override specifier for DropDownListItem classes. 5 years ago
peter1138 b56ea5ca27 Add: Generic drop down list string item with icon. 5 years ago
peter1138 fb35cb5ed2 Remove: Unnecessary virtual destructors on drop down list items. 5 years ago
peter1138 811bf22620 Codechange: Use Colours type instead of byte. 5 years ago
rubidium 2fc10b7e04 (svn r26088) -Fix (r26086): Windows compilation 11 years ago
rubidium 83eeba28b7 (svn r26086) -Codechange: use AutoDeleteSmallVector instead std::list for dropdowns 11 years ago
frosch 88fff21b93 (svn r24308) -Add: ShowDropDownListAt() for drawing dropdown windows independent of dropdown widgets. 12 years ago
frosch ea1ca5bf1e (svn r22311) -Add: DropDownListStringItem::NatSortFunc() which can be used as comparator function in DropDownList::sort(). 13 years ago
frosch 18f0add50a (svn r22310) -Codechange: Derive DropDownListCharStringItem from DropDownListStringItem. 13 years ago
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 15 years ago
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
peter1138 f30f5607e3 (svn r15877) -Codechange: Let drop down lists know about font height. 15 years ago
rubidium 93fe44a3c5 (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier. 15 years ago
peter1138 77760a62fd (svn r15387) -Codechange: Add a drop down list item type for char* strings. 16 years ago
peter1138 cf52b683c0 (svn r14168) -Codechange: Make dropdown 'auto_width' a separate parameter, so that a minimum width can be specified. 16 years ago
peter1138 3c2f69bf62 (svn r14015) -Codechange: Add facility for a drop down list to always close (if requested) when the mouse button is released. 16 years ago
peter1138 6bae045b4a (svn r14014) -Codechange: Add support for automatically sizing drop down lists to the widest list item. 16 years ago
peter1138 98d3d86004 (svn r14004) -Codechange: Clean of drop down lists.
Move empty item drawing to base ListItem Draw() function.
  Remove String() from base class.
  Pass correct width to Draw().
16 years ago
rubidium d03994098b (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description. 16 years ago