Click here to Skip to main content
11,640,297 members (66,313 online)
Click here to Skip to main content

OpenTheme : An open source graphic user interface (GUI) toolkit

, 22 Oct 2004 350.9K 295
Rate this:
Please Sign up or sign in to vote.
An innovative alternative to XAML and XUL

Sample Image - maximum width is 600 pixels

Introduction

OpenTheme is an XML based GUI toolkit with a set of foundation class and WYSIWYG editor. Although it's originally designed for full screen GUI, it is also good for Windowed user interface, with full localization support and arbitary look-and-feel.

I prepared a full tutorial at

Background

When I was developing my OpenHTPC project, I was always thinking about how to make it looking cool. Since I'm not a graphic designer, I know I will never actually design any 'cool' graphics. That brought up an interesting old question, is there a way to completely separate the design of graphic user interface from the design of the business logic?

Well, since I'm confident I'm a fairly good software architect, I think I can do this job better. Finally, I designed this OpenTheme project. In this project, I tried some new technics. And finally I had chance to express my own opinion about software design and implementation in this project.

Using the code

It is still the preliminary Alpha release. So some of the design is still subject to changes. The best way to understand the design is to read the tutorial from a user's point of view.

But this release is already stable enough. The ThemeEditor can be used to design the entire ThemePack. In your code, just use the following code to load a Themepack.

// Create a ThemePack
ThemePack tp = ThemePack.FromXml(fileName, null);
// Run through Themes contained in the ThemePack

foreach (Theme curTheme in tp)
{
   // ........
}

// Get a Top Level page from Theme
ThemeObject themeObj = curTheme.GetThemeObject(ID);
// Draw this ThemeObject with a Graphics
themeObj.SetBounds(......);
themeObj.RecalculateLayout(Graphics g);
themeObj.Invalidate(Graphics g);

Points of Interest

A Theme is a collection of layered graphics (with alpha transparancy) with layout manager. System provides a set of 'atomic' components such as Images (OpenThemePictureBox), Text (OpenThemeTextBox), Color block (OpenThemeColorBox). Components can contain sub components within their bounds. The sub-components may contain other sub-components.

System also provides some more complicated components with custom code to determine the bounds of its sub-components for more complicated layout management. Those are called 'container' components.

Programmers can easily implement their own 'atomic' components and 'container' components. For example, the system provides a button component to support buttons with absolutly ARBITARY user designed look and feel. Below are the look and feels of that button with different state.

Disabled

Enabled

Active

Focused

Toggled

Another example is the horizontal scrollbar.

The logic is complete to define any popular components (such as button, radio, scrollbar, menu etc) with completely user defined look and feel, for full screen or windowed applications.

The system is very light-weighted. The core part only have barely more than 2000 lines of code and only dependent on some very basic GDI+ functions and XML library. And it doesn't even depend on Windows Forms classes. I would expect it to be ported to Linux platform and .Net compact framework with very little or no modification in the near future.

History

  • Oct. 20, Initial Alpha release.

TODO List:

  • Event model
  • Finish all common controls
  • Visual Studio .Net extensibility integration

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

weiqj
Web Developer
United States United States
Hello All!

You may also be interested in...

Comments and Discussions

 
GeneralRe: where can i download the ThemeEditor? Pin
Your details have been updated14-Aug-05 16:53
memberYour details have been updated14-Aug-05 16:53 
GeneralRe: where can i download the ThemeEditor? Pin
weiqj15-Aug-05 9:53
memberweiqj15-Aug-05 9:53 
GeneralRe: where can i download the ThemeEditor? Pin
Your details have been updated15-Aug-05 15:15
memberYour details have been updated15-Aug-05 15:15 
Generalhelp running this program Pin
reb010123-Jul-05 18:12
memberreb010123-Jul-05 18:12 
GeneralRe: help running this program Pin
weiqj26-Jul-05 9:14
memberweiqj26-Jul-05 9:14 
GeneralRe: help running this program Pin
reb010126-Jul-05 15:25
memberreb010126-Jul-05 15:25 
GeneralRe: help running this program Pin
weiqj14-Aug-05 4:05
memberweiqj14-Aug-05 4:05 
QuestionWhat do I d Wrong? Pin
Nektov11-Jul-05 0:35
memberNektov11-Jul-05 0:35 
AnswerRe: What do I d Wrong? Pin
weiqj11-Jul-05 17:17
memberweiqj11-Jul-05 17:17 
GeneralRe: What do I d Wrong? Pin
Nektov11-Jul-05 18:15
memberNektov11-Jul-05 18:15 
GeneralRe: What do I d Wrong? Pin
weiqj13-Jul-05 7:43
memberweiqj13-Jul-05 7:43 
GeneralRe: What do I d Wrong? Pin
Nektov13-Jul-05 10:33
memberNektov13-Jul-05 10:33 
GeneralRe: What do I d Wrong? Pin
weiqj13-Jul-05 13:05
memberweiqj13-Jul-05 13:05 
GeneralRe: What do I d Wrong? Pin
Nektov13-Jul-05 22:56
memberNektov13-Jul-05 22:56 
QuestionCan I Use it in VB.NET Pin
Nektov8-Jul-05 5:28
memberNektov8-Jul-05 5:28 
AnswerRe: Can I Use it in VB.NET Pin
weiqj9-Jul-05 13:27
memberweiqj9-Jul-05 13:27 
GeneralRe: Can I Use it in VB.NET Pin
Anonymous10-Jul-05 3:11
sussAnonymous10-Jul-05 3:11 
GeneralRe: Can I Use it in VB.NET Pin
Anonymous10-Jul-05 3:56
sussAnonymous10-Jul-05 3:56 
Questionhow to use it ? Pin
geoneo2-Mar-05 9:30
sussgeoneo2-Mar-05 9:30 
AnswerRe: how to use it ? Pin
weiqj3-Mar-05 4:41
memberweiqj3-Mar-05 4:41 
Generalsweet Pin
superman9529-Jan-05 19:19
membersuperman9529-Jan-05 19:19 
GeneralRe: sweet Pin
weiqj29-Jan-05 20:00
memberweiqj29-Jan-05 20:00 
GeneralRe: sweet Pin
superman9530-Jan-05 18:20
membersuperman9530-Jan-05 18:20 
GeneralRe: sweet Pin
Preky29-Jun-05 23:43
memberPreky29-Jun-05 23:43 
GeneralPlugable graphics renderer Pin
Mahdi Jeddi19-Dec-04 5:43
sussMahdi Jeddi19-Dec-04 5:43 
GeneralRe: Plugable graphics renderer Pin
weiqj19-Dec-04 6:34
memberweiqj19-Dec-04 6:34 
GeneralRe: Plugable graphics renderer Pin
Mahdi Jeddi20-Dec-04 2:45
memberMahdi Jeddi20-Dec-04 2:45 
GeneralRe: Plugable graphics renderer Pin
weiqj20-Dec-04 3:32
memberweiqj20-Dec-04 3:32 
GeneralRe: Plugable graphics renderer Pin
Mahdi Jeddi20-Dec-04 19:16
memberMahdi Jeddi20-Dec-04 19:16 
GeneralRe: Plugable graphics renderer Pin
weiqj21-Dec-04 8:08
memberweiqj21-Dec-04 8:08 
GeneralRe: Plugable graphics renderer Pin
Mahdi Jeddi22-Dec-04 3:02
memberMahdi Jeddi22-Dec-04 3:02 
GeneralRe: Plugable graphics renderer Pin
weiqj22-Dec-04 3:22
memberweiqj22-Dec-04 3:22 
GeneralOpenTheme and Avalon/XAML Pin
code26310-Dec-04 15:56
membercode26310-Dec-04 15:56 
GeneralRe: OpenTheme and Avalon/XAML Pin
weiqj10-Dec-04 16:00
memberweiqj10-Dec-04 16:00 
GeneralEvents model Pin
z8z827-Nov-04 23:38
memberz8z827-Nov-04 23:38 
GeneralRe: Events model Pin
weiqj29-Nov-04 9:37
memberweiqj29-Nov-04 9:37 
GeneralReall impressive, got an idea :P Pin
FocusedWolf22-Nov-04 5:28
sussFocusedWolf22-Nov-04 5:28 
GeneralRe: Reall impressive, got an idea :P Pin
weiqj23-Nov-04 3:37
memberweiqj23-Nov-04 3:37 
GeneralDemo Project Pin
luckystar3-Nov-04 1:58
memberluckystar3-Nov-04 1:58 
GeneralRe: Demo Project Pin
weiqj3-Nov-04 5:34
memberweiqj3-Nov-04 5:34 
GeneralRe: Demo Project Pin
Luckystar8-Nov-04 1:30
memberLuckystar8-Nov-04 1:30 
GeneralRe: Demo Project Pin
weiqj8-Nov-04 7:23
memberweiqj8-Nov-04 7:23 
QuestionHow do I get it to build and use it Pin
Anonymous2-Nov-04 1:42
sussAnonymous2-Nov-04 1:42 
AnswerRe: How do I get it to build and use it Pin
weiqj2-Nov-04 3:19
memberweiqj2-Nov-04 3:19 
GeneralHow do I get it to build and use it, still error occurs doing as your tips Pin
silas_yao17-May-05 23:35
membersilas_yao17-May-05 23:35 
GeneralOpenTheme Alpha 20041101 released Pin
weiqj1-Nov-04 14:24
memberweiqj1-Nov-04 14:24 
GeneralOpenTheme Alpha 20041031 released Pin
weiqj31-Oct-04 5:30
memberweiqj31-Oct-04 5:30 
GeneralOpenTheme Alpha 20041030 Released Pin
weiqj29-Oct-04 18:27
memberweiqj29-Oct-04 18:27 
GeneralVB .NET Pin
Anonymous28-Oct-04 10:49
sussAnonymous28-Oct-04 10:49 
GeneralAlpha version 20041027 released Pin
weiqj27-Oct-04 16:46
memberweiqj27-Oct-04 16:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150731.1 | Last Updated 22 Oct 2004
Article Copyright 2004 by weiqj
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid