Here is where I face my first real design challenge in this project.
The ToolStrip Controls have a "Theming engine" built in called
ToolStripRenderer. This Renderer has all of the drawing code for the
ToolStrip. Mono also has it's own theming engine, which accounts for
which OS and which theme you are running under. I want to take
advantage off, and integrate with the Theming capabilities of the Mono
engine, but I also want to be binary compatible with the Microsoft
Libraries, which means the user, can override the Renderer, or write
their own.
My first thought, was that I would put the drawing code in the
Appropriate Themes in Mono, and the ToolStripRenderer will just make
calls to the Theme. However, this begs the question of what happens
when The user wants to override the behavior of an existing theme. If
he/she overrides a few functions in the ToolStripSystemRenderer in
thier own class, the user can change some of the drawing code.
However, if the actual drawing is handled by the Mono theme engine,
then the user won't know whether the code is running on windows or
Linux and won't know what Theme he/she is overriding. If the user
want's it to run on both Windows and Linux, they would need to make
changes which look good on both, which is not very user friendly.
I'm going to keep working on this this upcomming week, I'll make
further posts here during the week as I make decisions, just to make
sure they are not too off the wall. If anyone has suggestions, I would
appreciate any help I can get.
Matt
Miguel: Earlier you sounded like you would like me to host my code
somewhere. I would be happy to do so. Where would you recommend? I
don't really have any web space my self. Thanks.
Managed
System
Professional
Custom
Managed render mode means the ToolStrip uses the static
ToolStripRenderer from the ToolStripManager. This way you can be sure
that all ToolStrips on a form use the same renderer. This is the
default RenderMode. System and Professional corespond to the
respective renderers and Custom is use if the user sets their own
renderer.
What I would like to do is to put all of the Drawing code into the
ToolStripRenderers. Then Theme will have a property called
ToolStripRenderer. Each theme (Win32Classic, Clearlooks, etc.) will
return an instance of the appropriate renderer for that theme. When
the ToolStrip is in Managed render mode, The ToolStripManager will
return ThemeEngine.Current.ToolStripManager, and the ToolStrip will use
this renderer to do its rendering. That way, by default, each
ToolStrip will be rendered appropriately for the environment it is in
(Windows, Linux, Clearlooks, etc.) However under this system, if the
user want's to override any of the default behavior, all of the drawing
code is in the individual renderers so there is no problem there.
If anyone has any comments, suggestions, or problems with this solution
please let me know. Otherwise, I'd like to start working this into my
code. Thanks.
Matt