The Personal Framework
for Object Oriented
Windows Development
Description
Welcome to the homepage of my Personal Framework.
I'm a C/C++ developer and
for hobby I like to develop software using only the Win32 APIs, not MFC or other
frameworks, in this way I can obtain little and fast executables.
But when you have to write applications with a rich and complex user interface the
code you have to write for the window messages handling mixed to the statements for
the logic of the software can make the final code quite hard to read.
So I decided to write a layer to divide the complexity of the controls management from
the other parts of an application, in a object oriented way.
I know that there are many libraries on internet but all of them have too many files to
include in your project, or they use an external dll, an so on. My intention was to create a
simple, thin and little layer of code for my projects.
I hadn't invented the wheel, I put in my framework some code found on internet mixed with some ideas catched from .Net (Items collection) and from MFC (event names).
The result
The framework has 2 files: windev.h and
windev.cpp, there are the following classes:
Object | The base class for all the others |
WindowObject |
A generic window/container class. You use this class for the creation of
the main window of the application (SDI or MDI), a dialog box or a child window
with other controls. If the parent window is a MDI container the child one is a
MDI child window. The class handles all the messages for the client area, position of a toolbar or a status bar if present,etc. |
LabelObject | A label class |
TextBoxObject | A textbox class |
ComboBoxObject | A combobox class with the Items collection |
ListBoxObject | A listbox class with the Items collection |
ListViewObject | A listview class |
ToolbarObject | A toolbar class (management of the toolbar and rebar with different bands). |
TrayAreaObject | A trayarea class (for the little icon near the clock) |
PictureObject | A picture class with support of bmp, jpg and tiff (encapsulation of the OleLoadPicture API) |
StatusBarObject | A statusbar class |
TreeViewObject | A treeview class, you use it with the NodeObject class |
The class Object (and the derived ones) has the following nested classes:
Font | The font for the object |
Position | The position of the object |
Size | The size of the object |
Tag | The tag of the object, a string value (char*) that you can use in many ways |
Text | The text of the object (if present) |
Tooltip | The tooltip of the object (the little yellow description) |
I think that the following piece of code is easier to read than the equivalent SendMessage statements
ComboBoxObject combo;
combo.Create(x,y,width,height,StyleVisible|StyleBorder,id,this);
combo.Font.Set("Arial",FontNormal,10);
combo.Colors.SetForecolor(RGB(0,0,255));
combo.Items.Add("Item 1");
combo.Items.Add("Item 2");
combo.Tooltip.Set("My combo");
combo.Tag.Set("Address");
To add in you code the handling on an event you have only to derive the base class of the object.
class ComboBox:public ComboBoxObject
{
public:
void OnChange(void);
};
Note
You will find in the header file windev.h that I re-define some window styles (StyleVisible is converted
to WS_VISIBLE and so on), because I want to make my layer a little independent from the operative system.
I've begun to port it also on Linux and OpenMotif.
The framework isn't completed, many functions are not developed and I have to add other controls, but it's a starting
point.
Actually I haven't the time to write a full and detailed instructions to use my framework, I suggest to download
the sample project (for VC++ 6.0) I've prepared and read it. However you can find all the instructions I've written
until now by clicking in the left frame. I suggest to check week after week this homepage to verify the progress
of the documentation (I'm writing it in my spare time).
windev.zip
My framework doesn't and won't cover obviously the full complexity of the Win32 APIs but for the most common
situations it can bu useful.
License
You can download this framework, use it where you want (personal or commercial projects),
but you can't upload it in any internet library by changing the author's name :-)
Stefano
For info
My Homepage
Last update: 31 March 2005
Accesses since 06th December 2003