I am very interested in this project, and would be willing to devote a considerable amount of time to it, depending on how it evolves. (Please forgive me if I focus exclusively on GUI objects, and ignore the connection with STL-containers of non-GUI objects.)
I believe that it is possible to create a flexible, elegant platform-independent user interface system in C++ which serves 90% of most programmers' GUI needs. This should be done in such a way that programmers could fill in the remaining 10%, when necessary, using their favorite platform-specific tools. I have several observations: 1. About three years ago I was interested in designing javascript widgets for the web. Existing collections were disappointing, because the different widgets relied on separate code, and the widgets were only configurable in a limited way. I found, to my surprise, that I was able to write a general toolkit for creating web widgets of all sorts (menus, trees, scrollbars, various sorts of buttons, etc.), with behavior based on simple state machines, which took up only about 27k (after I shortened variable names and removed whitespace using my "javasquish" utility.) It turned out that the widgets built this way did not perform well on the browsers of the time, but it shows how much you can do with almost nothing. 2. Last year I wrote a template-based win32 GUI library, with features inspired by the standard library. All of the significant widgets (tree-views, menus, etc.) have an STL-container-like interface. Also, there is a framework for associating styles with widgets which parallels the locale framework. A style corresponds to a locale; facets include fonts, borders, backgrounds, etc. There is an additional dimension, though: facets are assigned to styles relative to a "style-target", e.g., menu, tree-view, etc. The library is win32 specific, but I think its design could be used as the starting point for a platform-independent library. Each widget inherits from a based class ("Control") which stores information common to all widgets, such as size, position, visibility and list of children. Widgets derive most of their properties from contained policies objects. Each policy object participates in its own delegation hierarchy, which is the main way that behaviour is inherited. The policies in the win32 library are: Properties - corresponds to most the stuff passed to RegisterClassEx and CreateWindowEx, excluding the window procedure Procedure - Corresponds to a window procedure; handlers (in the form of function pointers, pointers to members, ...) can be added for messages, commands and notifications. Style - allows stylistic information to be retrieved via use_facet. Of course these would be different in a general library. Style would subsume Properties, Procedure could be renamed Behavior, and a Layout policy could be added. 3. I believe almost everything can be done using the following ingredients: a. The ability to create, destroy, size, position, show and hide a rectangular window with no children and no decorations. b. The ability to draw an image (bitmap, png, etc.) at a particular point in a window c. The ability to perform simple drawing, possibly limited to filling rectangles and drawing straight lines, but possibly including more sophisticated constructs. d. The ability to draw text, with simple formatting. (Here I am thinking of text only for labels and simple edit controls. Word processing documents would not be supported.) e. A timer facility. f. The ability to harness UI events, such as mouse movements, and direct them to the appropriate widgets. Others have mentioned that item (g) is quite different on different platforms. However, this problem needs to be solved only once in a generic way for each platform, for top-level windows only. Children of top-level windows can be invisible to the native windowing system, so the library can have complete freedom in routing events or invoking callbacks. If one is not careful, one could end up with something that looks like Java Swing or the .NET library. With care, however, I think one could whittle down the set of features which would have to be implemented on each platform to just a few, and still have a useful system. Jonathan "E. Gladyshev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I was thinking about designing a GUI/GDI template > library. > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost