Kp
1c2e1c6946
Tighten type info for d_strdup
...
The allocated block is part of the dmem subsystem, so return a type that
reflects that.
2022-04-24 20:42:01 +00:00
Kp
f51755c2e6
Use enum class for MBTN_* constants
2022-02-27 14:23:53 +00:00
Kp
d2478d0708
Require support for C++17 attribute [[fallthrough]]
2022-01-09 15:25:42 +00:00
Kp
dfc51fd822
Remove newmenu updates of grd_curcanv
...
They are no longer needed.
2021-09-19 10:53:48 +00:00
Kp
aba5fce3a9
Use enum class for gr fade_level
2021-09-19 10:53:48 +00:00
Kp
07c52f14f9
Save parent canvas in listbox_layout
2021-09-12 16:20:52 +00:00
Kp
bef23a3894
Use newmenu's parent canvas in newmenu_draw
...
Avoid resetting to screen canvas.
2021-09-12 16:20:52 +00:00
Kp
8d67bcddb0
Record parent canvas in newmenu
...
Use it to avoid resetting to the screen canvas when preparing the
layout.
2021-09-12 16:20:52 +00:00
Kp
bb29e6fca8
Propagate canvas through more layers
2021-09-12 16:20:52 +00:00
Kp
e7aa9855e0
Compute menu border widths from screen canvas instead of screen
...
In practice, this should be the same result. However, this allows the
flexibility to use a canvas other than the screen.
2021-09-12 16:20:52 +00:00
Kp
21241471c6
Return string width/height from gr_get_string_size
...
Use structured bindings to capture the values on return, so that they
can be declared as `const` if they are immutable after initial
computation.
2021-09-12 16:20:52 +00:00
Kp
0750046bc1
Move retrieval of font average width out of gr_get_string_size
...
Most callers do not need it, and it is only vaguely related to the
purpose of measuring a particular string. For those callers that need
it, lift it out.
2021-09-12 16:20:52 +00:00
Kp
21f736ec37
Require grs_subcanvas for gr_init_sub_canvas
...
Prevent passing a canvas that is not specifically typed as a
grs_subcanvas.
2021-09-04 12:17:14 +00:00
Kp
212400d140
Convert nm_messagebox_str to use messagebox_newmenu
2021-06-28 03:37:50 +00:00
Kp
4c34875c84
Remove unused subfunction_handler
...
Previous commits eliminated all uses of it. Remove the unused stubs.
2021-06-28 03:37:50 +00:00
Kp
55ea87ca3f
Move callback_newmenu handling into event_handler
2021-06-28 03:37:50 +00:00
Kp
cfb75c221f
Inline newmenu_do4 into its sole caller, newmenu_do2
2021-06-28 03:37:50 +00:00
Kp
ce8a5d4275
Pass EVENT_NEWMENU_SELECTED through full event_handler
...
This makes the path slightly longer now, but allows derived types to
switch away from subfunction_handler individually.
2021-06-28 03:37:49 +00:00
Dmitry Grigoryev
fbd05a1592
optimize include files (include what you use)
2021-02-06 21:38:50 +01:00
Kp
747a0f531d
Factor out mouse button scroll processing
2021-02-06 17:53:53 +00:00
Kp
ed2bc8e213
Use enum class for nm_type
2020-12-27 22:03:09 +00:00
Kp
80fc124a63
Remove unnecessary definitions of static member variables
...
C++17 permits, but deprecates, this form. Remove it to simplify the
code.
2020-12-27 22:03:09 +00:00
Kp
e7629f35ee
Move newmenu_item::saved_text into the two sub-types that need it
2020-12-27 22:03:09 +00:00
Kp
e6875641c9
Move Newmenu_allowed_chars into individual newmenu_item
...
Allowed characters are more properly scoped to a specific text entry
field. Move them there to eliminate a global.
2020-12-27 22:03:09 +00:00
Kp
1f8c8e355b
Allow newmenu callers to choose whether to use a background box
...
Previously, callers chose whether to use a fullscreen background image,
and the newmenu code inferred that callers without a background image
wanted a background box, while those with a background image wanted no
box. Change newmenu_layout to take a parameter specifying the caller's
intent, so that a caller can choose to have any combination of a
background image and a background box.
2020-12-27 22:03:09 +00:00
Kp
2b9c146ff2
Convert glitz menu to inherit from newmenu
...
Add a static method to block until the menu closes, so that the glitz
menu can continue to block its caller.
2020-12-27 22:03:09 +00:00
Kp
9dd3f0dbf4
Pass grs_font& to nm_rstring
2020-12-27 22:03:09 +00:00
Kp
135ba07db4
Pass grs_font& to nm_string_inputbox
2020-12-27 22:03:09 +00:00
Kp
8b7e5ba04d
Pass grs_font& to nm_string
2020-12-27 22:03:09 +00:00
Kp
0fa2afb6a6
Pass grs_font& to nm_string_slider
2020-12-27 22:03:09 +00:00
Kp
d11f5c0cab
Simplify newmenu font setup
2020-12-27 22:03:09 +00:00
Kp
c1d6150015
Pass grs_font& to gr_set_curfont
2020-12-27 22:03:09 +00:00
Kp
effa7435c2
Remove newmenu_listbox1
...
It is no longer used.
2020-12-27 22:03:09 +00:00
Kp
095d660c55
Inline listbox_get_window
...
It is only used once.
2020-12-26 21:17:29 +00:00
Kp
def7e03260
Move listbox callback handling to a derived class
2020-12-26 21:17:29 +00:00
Kp
f43e98764a
Move listbox to newmenu.h
2020-12-26 21:17:29 +00:00
Kp
f01c29c779
Flatten newmenu_do* hierarchy
...
There is now a single caller for newmenu_do3. Inline do3 into do2, so
that do2 calls do4. Mark do4 as static.
2020-12-26 21:17:29 +00:00
Kp
d1ff6becb4
Move listbox_layout to newmenu.h
...
Rename listbox_create_structure to listbox_layout::create_structure.
2020-12-26 21:17:29 +00:00
Kp
2ded2b2d0c
Make kmatrix background optional
...
Previously, if the background failed to load, the kmatrix window was
immediately aborted. Change the logic so that a failure to load uses a
blank black background, but still shows the kmatrix window.
2020-12-26 21:17:29 +00:00
Kp
1cc7be6b11
Construct listbox_layout directly in listbox
2020-12-26 21:17:29 +00:00
Kp
b9a27094eb
Pass menu_title through listbox functions
2020-12-26 21:17:29 +00:00
Kp
479884288c
Always delegate to window_create for send_creation_events
2020-12-20 20:39:07 +00:00
Kp
a56ff84fd5
Make listbox callback const
2020-12-20 20:39:07 +00:00
Kp
df1ee5e671
Make weapon reorder menu inherit from newmenu
2020-12-20 20:39:07 +00:00
Kp
e57c9efa7e
Change main F1 help menu to inherit from newmenu
2020-12-19 16:13:26 +00:00
Kp
76acfdd38f
Convert main menu to inherit from newmenu
2020-12-19 16:13:26 +00:00
Kp
8e65573c56
Eliminate move construction of newmenu_layout
...
Construct one in place, update it, and then use it to initialize the
rest of the newmenu.
2020-12-19 16:13:26 +00:00
Kp
56122687d1
Delegate newmenu subfunction handling into virtual function
2020-12-19 16:13:26 +00:00
Kp
d4cf9943c5
Make newmenu subfunction const
2020-12-19 16:13:26 +00:00
Kp
1032462988
Make newmenu max_displayable const
2020-12-19 16:13:26 +00:00