Lockable widgets are those which takes in all input
and if set then no other widget can take any input
its same as them being inactive, no buttons, animations
etc will work.
This is implemented to support `modal` property of window,
which requires a window to take all input and prevent all
others from having any actions.
Modifies border of window by first changing title to "", then updating
window border to borderType 2 `ThinNoTitle`.
`titleVisible of window` to verify this behavior.
Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
Added setInnerDimension which calls resize (with bool inner dimension change: true), moveto and finally updateOuterDimension.
This was implemented to match window rectangle size as used by window property `rect`, `rect of window` in `workshop` uses this.
resize function is extracted to new function resize and resizeInner,
also a new private function rebuildSurface is created to handle common
code of refreshing/rebuilding surface after modifying inner or outer
window dimensions.
Smartmenu implementation using offsetY to displace popup such that the previous selected item will fall onto cursor, includes checked item and highlighted.
For `Popup Menu` in theapartment, without this patch the second popmenu was not remembering the last selected item and was opening it from scratch, after this patch popupmenu will open from the last selected item already selected with checkbox.
Additional logic for drawing blinks when closing popup menu is added, closeMenu is overriden because it is called inside eventLoop and therefore need to be captured when closingMenu.
Add blinking animation support for macpopups, affects `Popup Menu` in theapartment, before this there was no animation when selecting item and the menu just used to immediately close, now however there is proper animation for item selection.
Added functions for menu drawing/selections, this uses the base functions of macmenu to implement mac-styled popupmenu's, also return selected item index/text.
Used by 'Popup Menu' in theapartment: With this changes the popupmenu is working with both item selectors, doesn't implement the icon selector.
Exposed MacMenuItem, MacMenuSubMenu, MacMenuItem and MacMenuData to headers and changed visibility of needed functions to protected.
These structs and functions is used in popupmenu for reusing macmenu code.
When text is emptied by user action, e.g. backspace, the formattting
should be preserved.
In the game Majestic a text box for user input would start out with the
correct formatting, i.e. green text on a black background. When the user
would then press backspace till the text was gone, the method
`MacText::getTextChunk` would return an empty string, with the
formatting removed. If the user started typing again the text would use
the default formatting with black text on black background.
Fixes: https://trello.com/c/POQZRCEO/546-text-doesnt-show-in-majestic-in-text-box
The color values went inverted, but in several places they left
untouched.
In general, it is not a good idea to have this hardcoded, but at least
now we have this addressed.
MacFontManager didn't have a mechanism to report which fonts it loaded
from an external resource. It also requires that any fonts that aren't
built-in be explicitly registered by name by the client before they can
be used. This combination meant that a client couldn't load fonts from
an external file and use them by their properties (id / size / style).
SCI contains Mac fonts in its executable along with a table that maps
each SCI font id to a Mac font id and size. The font name isn't a part
of this since the Classic Mac Toolbox API took id / size / style as
input when drawing text.
Now MacFontManager exposes the font families it has loaded along with
their names. This allows a client to see which fonts were loaded,
register them by name, and proceed to use them with the existing API.
Previously the methods would pass by reference, then convert to a
pointer on success and take ownership. This isn't ideal, as a
reference suggests no transferral of ownership, and doesn't suggest
it needs to be a heap resource allocated by new.
References to FOND resource streams are stored in an array.
Font streams were registered by their family name in a hashmap.
When a second font with the same name was encoutered it would replace
the pointer to the previous font.
The only use case for the hashmap was to register the stream to be able
to later close them.