[Scummvm-devel] New GUI features. Tooltips, radiobuttons, tab improvement, scroll bar improvement

Eugene Sandulenko sev at scummvm.org
Tue Jun 15 20:11:59 CEST 2010


Hi team,

I implemented 2 new GUI features, that is tooltips and radiobuttons.

Tooltips are displayed in 2 seconds (hardcoded) when no events took
place, and disappear on any even (though there is an unresolved bug
with text being cleared on second and all subsequent calls, the reason
is unclear to me). Another todo is better graphics.

For it I had to modify function footprints, and now tooltip is _first_
non-required parameter. I put my best into updating all such spots, but
unfortunately I cannot test the ports. Those commits are marked by 'NOT
TESTED' (r49791-r49795).

You may specify font used by tooltips in _gfx.stx file for your theme
under 'tooltip_normal' id. Currently it is specified as builtinConsole
(yes, I added names for all built in fonts).

In the theme itself you need to define following global variables:

  Tooltip.MaxWidth -- number of pixels where word wrapping should occur
  Tooptip.[XY]Delta -- offset of tooltip from the cursor. Since cursor
    is drawn as the top layer, use it for preventing it from obscuring
    the tooltip.

All tooltips used in the GUI are marked for translation.

Radiobuttons.

It is specially treated widget, since they live in groups.

First you have to create RadiobuttonGroup().

  RadiobuttonGroup(GuiObject *boss, uint32 cmd);

RadiobuttonGroup is the command sender. It sends the specified command
when some button in the group changes. The buttons themselves do not
send the commands, as that would result in generating N events instead
of one (N is number of buttons).

Then you create RadioButtonWidget object instances and give the group as
one of the parameters:

  RadioButtonWidget(GuiObject *boss, String name, RadiobuttonGroup
   *group, int value, String label, char *tooltip = 0, uint8 hotkey = 0)

You take result from the group, not from the individual widgets:

  int RadiobuttonGroup::getValue()

Similarly you disable whole group in one turn:

   void RadiobuttonGroup::setEnabled(bool ena)

For modern theme I use pixmap. But since my drawing skills are not the
best, and I did not have original PSDs from our GUI theme, the result
is not the best. Feel free to update it anytime. I will probably do it
sooner or later if nobody will dare to do it.

Another small thing added to GUI is that tabs are pronounced
graphically now, that is, you may see the tab body edges. Currently its
aim is to stress that OK and Cancel buttons in our GUI belong to whole
dialog and not to single tab.

And finally scroll bars have autorepeat on their arrows. Adds tons of
usability.


Eugene




More information about the Scummvm-devel mailing list