Monday, November 29, 2004

GBPVR Widgets

As I began writing plugins for GB-PVR, I noticed that some things were being done in code that seemed to be repeated over and over between the plugins (and even within a plugin). Specifically, the creation of listboxes within a plugin seemed to really bloat the code, because the plugin author has to maintain the list, handle navigation, and then render the list.

So, I thought it would be handy if plugin authors could have a reusable library of widgets (controls, functions, data structures, etc) that would handle a lot of the harder stuff, and allow the coders to really concentrate on the "business" logic.

A design challenge was how to make these things skin-friendly. Sub has put a lot of effort in making GB-PVR skinnable, so I want the widget controls to make it even easier, if anything. I decided that the controls themselves would not be skin-aware. That is, they have properties like "Font", "BackgroundColor", etc, that the MenuTask item (a.k.a., the plugin) will control. In this way, someone could use a widget control "out of the box".

However, by adding a layer between the MenuTask and the WidgetControl, I can have a totally skin-aware container to hold the controls, and offset some of the user-interface functions (like navigation, focus handling, messaging, etc) to this middle layer. I'm calling this layer the WidgetForm, and it will also have the ability to deserialize WidgetControls from XML representations. This will hopefully enhance the skinning (by giving the ability to totally change control look-and-feel outside of code), and what's even better, is that it could be extended to allow for some design-time manipulation of the controls (i.e., a skin designer).

I've started a Sourceforge project to contain this effort. For now, I'm taking on a lot of the design and development in order to establish the initial direction of the project. But, once I have a solid start and a beta release, I'll gladly give up control if a team wants to continue to expand the library.

I welcome any .NET developers to join the development team. I've brought Jorm on to assist when he's got time (he's already helped me test how CVS works). Just shoot me an email or PM on the GBPVR forum, and I'll give you details.