One gadget on the go, one proposed. The ScrollingTextBox class is the first one. It’s a combination of a MultiLineTextBox and ScrollbarVertical. All of the event wiring up is handled for you, and it presents the same API as the MultiLineTextBox. The two are completely interchangeable. There are a few things I need to do to it before it’s finished, including a resize function, adding in wrapper functions to mimic the scrollbar API and raising events, but it’s coming along. It’s in the SVN repository and is used in the Debug class.
Note that the MultiLineTextBox also supports horizontal scrolling, should you need it. I just haven’t added a horizontal scrollbar to the ScrollingTextBox class, as I’m guessing that vertical scrolling will be considerably more in demand.
Next is the proposed ContextMenu class. A right-mouse menu has been on the feature list since I started Woopsi, and I’ve been planning out how it will work. The ContextMenu will exist as a singleton within the Woopsi instance (putting it there ensures that it’s fairly easy to ensure that it always appears at the top of the gadget stack). Users can open it by clicking one of the shoulder buttons and tapping a gadget. If that gadget wants to use the context menu, it will:
- Call the ContextMenu::clear() method
- Add as many ContextMenuItems into the menu as it needs to
- Set the ContextMenu’s event handler to be the current gadget
- Show the menu
The menu will automatically hide itself if it loses focus (ie. user clicks elsewhere) or an item is selected. In order to make this work, gadgets need to be able to interrogate the status of the DS’ buttons. I don’t think there’s a supported way to do that yet, so I’ll need to add it in. That should also allow developers to check for multiple keypresses/chording.