Commit Graph

45 Commits

Author SHA1 Message Date
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(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson 08dfe35442 Codechange: Move DropDownList height and width calculation to helper. 2023-11-13 21:30:46 +00:00
Peter Nelson 136551408c
Change: Show empty string drop down entries as divider. (#11447) 2023-11-06 22:35:01 +00:00
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.
2023-10-28 16:08:44 +01:00
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>
2023-10-21 18:53:35 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
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.
2023-06-23 08:30:13 +00:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 2023-05-14 23:31:03 +02:00
Peter Nelson e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
2023-04-13 20:57:47 +01:00
Peter Nelson 632464a623 Codechange: Use Rect in DropDownListItem::Draw(). 2022-11-12 18:28:39 +00:00
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.
2021-04-28 22:32:43 +01:00
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.
2021-03-09 10:58:33 +01:00
Michael Lutz a49fdb7ebb Codechange: Store base set related texts in std::strings. 2020-05-21 20:02:34 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx22 3b4f224c0b
Fix #7494: std::sort() and qsort() use different comparators (#7495) 2019-04-10 20:55:53 +02:00
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.
2019-04-09 22:45:15 +02:00
Michael Lutz 9325d63d8e Fix: Forgotten override keywords for DropDownListIconItem. 2019-04-09 22:45:15 +02:00
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
peter1138 aafce47596 Codechange: Use override specifier for DropDownListItem classes. 2019-03-24 16:10:04 +01:00
peter1138 b56ea5ca27 Add: Generic drop down list string item with icon. 2019-03-10 10:31:37 +00:00
peter1138 fb35cb5ed2 Remove: Unnecessary virtual destructors on drop down list items. 2019-03-10 09:20:11 +00:00
peter1138 811bf22620 Codechange: Use Colours type instead of byte. 2019-03-10 09:20:11 +00:00
rubidium 2fc10b7e04 (svn r26088) -Fix (r26086): Windows compilation 2013-11-24 15:17:53 +00:00
rubidium 83eeba28b7 (svn r26086) -Codechange: use AutoDeleteSmallVector instead std::list for dropdowns 2013-11-24 14:46:26 +00:00
frosch 88fff21b93 (svn r24308) -Add: ShowDropDownListAt() for drawing dropdown windows independent of dropdown widgets. 2012-06-01 10:43:50 +00:00
frosch ea1ca5bf1e (svn r22311) -Add: DropDownListStringItem::NatSortFunc() which can be used as comparator function in DropDownList::sort(). 2011-04-10 15:01:14 +00:00
frosch 18f0add50a (svn r22310) -Codechange: Derive DropDownListCharStringItem from DropDownListStringItem. 2011-04-10 14:56:14 +00:00
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 2010-01-15 16:41:15 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
peter1138 f30f5607e3 (svn r15877) -Codechange: Let drop down lists know about font height. 2009-03-28 12:47:29 +00:00
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. 2009-03-21 19:31:47 +00:00
peter1138 77760a62fd (svn r15387) -Codechange: Add a drop down list item type for char* strings. 2009-02-07 00:37:35 +00:00
peter1138 cf52b683c0 (svn r14168) -Codechange: Make dropdown 'auto_width' a separate parameter, so that a minimum width can be specified. 2008-08-25 16:07:10 +00:00
peter1138 3c2f69bf62 (svn r14015) -Codechange: Add facility for a drop down list to always close (if requested) when the mouse button is released. 2008-08-07 18:26:13 +00:00
peter1138 6bae045b4a (svn r14014) -Codechange: Add support for automatically sizing drop down lists to the widest list item. 2008-08-07 18:11:09 +00:00
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().
2008-08-06 07:10:40 +00:00
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. 2008-05-06 15:11:33 +00:00
peter1138 447a31b702 (svn r12675) -Codechange: Add support for custom drawing of drop down list items. 2008-04-12 22:12:27 +00:00
peter1138 711909fa0c (svn r12672) -Codechange: Add support for variably-sized drop down list items. 2008-04-12 20:32:18 +00:00
rubidium 2ac6af4e48 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes. 2008-04-09 23:00:12 +00:00
rubidium c1108bd293 (svn r11857) -Fix: some compile time warnings. 2008-01-15 00:48:14 +00:00
peter1138 1bcca5aae2 (svn r11854) -Fix (r11848): Nightly build farm showed up more compiler warnings... c++ is fun 2008-01-14 20:52:43 +00:00
peter1138 bf0a7ae4fb (svn r11849) -Fix (r11848): Incomplete(?) class broke MSVC/mingw compilation 2008-01-14 16:35:49 +00:00
peter1138 e4c05f8d78 (svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed. 2008-01-14 16:10:58 +00:00