Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I know there are several respected frameworks for C++ and C#, but I was really wondering if someone could point me to any books or online tutorials for creating my own framework for a custom graphical user-interface (or any type of framework, for that matter). Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 8-Aug-13 23:40pm    
Books? Hardly. In principle, I can quickly explain the idea on how to make such framework based on raw Windows API. I used to start one with X-Windows (Linux) on a very similar idea (raw APIs have something in common, right?), but hardly can remember the detail. On Windows this thing is pretty obvious.
—SA
pasztorpisti 9-Aug-13 3:16am    
I doubt the "quickly" and "obvious", but telling a few hints is possible for sure. :-) There is a technical and a design aspect of this: the technical requires a lot of experience of creating gui and custom controls and hacking around with at least one but rather more frameworks (and knowing the raw gui api of at least one OS). Without custom control creation and raw api programming experience its not that easy... It's also important to model the framework by stealing from the right places like .Net, Delphi, java swing,... and not from the wrong ones (like mfc).
Sergey Alexandrovich Kryukov 9-Aug-13 10:39am    
Well, relatively. "Obvious" means that in Windows I can tell where to start from right now, but hardly in X-Windows...
Here is what I mean: how to bind instances of C++ classes with instances of API windows. Then you can use all available windows classes (through Microsoft-predefined class names) and derive your own types from them, and add functionality based on the same window class by providing specialized message handling, in particular, via virtual function. From this point, Windows API is majorly wrapped...
—SA
pasztorpisti 9-Aug-13 11:10am    
That is most important trick for sure. Another windows specific problem if we want to use native-looking controls is the forwarding of child window messages/notifications (received by the parent window) back to the child control objects (like WM_CTLCOLOR, WM_NOTIFY, ...). The next level is implementing windowed custom control base class (TCustomControl in delphi) and windowless custom control base (TGraphicControl in delphi) with which the creation of custom controls is a breeze. Another important info is that a normal gui framework is single threaded and its thread drives the gui and other things by processing a message queue in a loop. Everything in the gui framework is a message placed in the queue for processing (including button clicks, control painting, ...) and it is possible to inject custom messages from other threads in order to be able to communicate with worker threads. Of course this info is for OP and not for you. :-)

Besides the previously mentioned important technical details I'm quite concerned with the high level OO design of the framework but that is something to discover for OP by checking out as many frameworks as time allows. The best would be trying them as this helps in deciding which one is easier to use. I'm sad seeing that some people learn using just one framework and they worship/advertise it as the best or at least a good one even if this isn't true at all.
Sergey Alexandrovich Kryukov 9-Aug-13 11:18am    
So true...
—SA

1 solution

Let's try to read the Framework-Based Software Development in C++[^] book.
This book provides a detailed methodology for implementing frameworks -- today's most important advance in object technology to solve real business problems. This book introduces a new methodology for building frameworks that reflect the needs of a business. It provides a step-by-step procedure for performing domain analysis, which is critical to developing reusable software. It presents design patterns and rules, as well as metrics that can be used to assess the relative quality and usefulness of frameworks. It introduces procedures to be followed in developing a framework, including pattern selection, documentation and testing -- and shows the role of management in framework development. Using the new methodology, the book walks through the construction of two frameworks, one to automate workflow, and another to develop a global risk measurement application. This book is for virtually all software developers, engineers and managers, because it provides the first practical methodology for developing object frameworks, which will be increasingly central in object-oriented software development.

Good luck.
Alex.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900