            wxCmm version 0.2 Aug 2004


Overview
========

        wxCmm keeps the maximal compatibility with wxWidgets, including
    the same classes and methods. The way of using them was also similar
    except necessary changes.

        This document will show you the difference between wxCmm and
    wxWidgets. Since it is not a wxWidgets tutorial, you may neede to
    read some documents for wxWidgets in order to learn it.
    
        To use this library, You need Sphinx C-- Compiler 0.239c b19 or 
    above. 



Your First Program
==================

        "minimal.c--" is a minimal example using wxCmm:

        #pragma option w32
        #includepath "..\wxCmm"
        #include "wxCmm.h--"

        wxFrame frame;

        void wxMain()
        {
            frame.wxFrame(NULL, -1, "A minimal wxCmm example");
            frame.Show();
        }    

        There are two points.

    1. First, define the path of wxCmm and including "wxCmm.h--".

    2. Program start from wxMain. You can setup windows, menus, and event 
       handlers here. 

        A regular application at least needs one wxFrame object as a main
        window. Or you can use wxDialog object as a main window. You can
        see a example in "dialog2.c--".


Classes, Objects, and Methods
=============================

	Most constructors and methods can accept variable parameters. A good
    example is constructor of wxFrame. You can use it as:

	frame.wxFrame(NULL, -1, "A minimal wxCmm example");

    or

	frame.wxFrame(NULL, -1, "A minimal wxCmm example", 
		new wxPoint(0, 0), new wxSize(400, 400) );

    For detailed usage of all methods, see ClassList.txt.


Garbage Collection and Memory Allocating
========================================

        wxCmm now has a full function garbage collection system. All you need
    to do is calling wxTheApp.gc() or gc.collectGarbage(). 

	Usually we use "new" to new an object, and use gc.alloc() to allocate 
    memory. Both of these block will be collected when nothing point to them.
    To allocate memory blcok won't be collected, you can use Alloc(), Free(),
    and Realloc().


Event Mechanism
===============

        When writing Windows programs, it is difficult to handle event
    messages. wxCmm provides an easy way to do this: using the "connect"
    function to connect among the window, the event, and the event handler.

        There are two main types of the connect function. One of them is
    connect(), and you can use it to connect the objects of wxWindow and
    the event handlers. The other one is connectMenu(), which was used to 
    connect the menu events and the event handlers. For example:

        connect(#frame, wxEVT_RIGHT_DOWN, #onAbout);
        When a frame meets the wxEVT_RIGHT_DOWN event, calls onAbout();

        connectMenu(#frame, wxID_EXIT, #onExit);
        When an item's ID is wxID_EXIT and being selected, calls onExit();

        Here comes a example of event handler:

        void onAbout(dword event)
        {   
            wxMessageBox(#frame, "Hello", "HelloMsg", wxOK);
        }

        All event handlers will get a wxEvent object as its parameter. You 
    can get information about the message type and which object generates
    the message by this parameter. So multiple messages could use the same
    one handler. There are examples in "example.c--".

        Attention! If a event was connected to two or more handlers, only the
    first one will be called, unless you call wxEvent::Skip(). If all handlers
    call Skip(), the default window procedure will be called, for example, 
    show context menu in wxTextCtrl. See "demo.c--".

	There are some inline function can be used in event handler, such as
    SkipEvent(), GetEventObject(), GetEventType(), GetEventId() and so on.
    You can use

	void onMouse(dword event)
	{
	    switch(GetEventId()) { ... }
	}

    Instead of:

	void onMouse(dword event)
	{
	    EBX = event;
	    switch(EBX.wxEvent.GetId()) { ... }
	}

