December 11, 2024, 09:09:59 PM

News:

IWBasic runs in Windows 11!


Quick and Dirty Class maker

Started by Ionic Wind Support Team, February 28, 2006, 10:21:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

February 28, 2006, 10:21:50 AM Last Edit: March 11, 2006, 08:57:35 AM by Ionic Wizard
Name says it all.  Generates a derived class from a selected base class and the virtual overrides you want.

Usage:
-Select "File"->"Load" and find "gui.inc" in your bin directory.  Or any other file that has a base class you want to derive from
-Double click on the base class you want to derive from
-Select the methods such as OnClose, OnCreate, etc you want to handle in your derived class
-Click the ">>" button to add the overrides to the derived class.
-Click the "<<" button to remove selected overrides.
-Enter a name for your new class
-Click "Generate".



The source for the new class will be placed on the clipboard for pasting into a source file.  Source and executable attached at the end of this message.

Example output:

//MyWindow definition
class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnClose(),int;
declare virtual OnCommand(unsigned int wparam,unsigned int lparam),int;
declare virtual OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
declare virtual OnCreate(),int;
declare virtual OnDestroy(),int;
declare virtual OnMenuInit(unsigned int hMenu),int;
declare virtual OnMenuPick(int nID),int;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}

MyWindow::_MyWindow()
{
}

MyWindow::OnClose(),int
{
return 0;
}

MyWindow::OnCommand(unsigned int wparam,unsigned int lparam),int
{
return 0;
}

MyWindow::OnControl(int nID, int nNotifyCode, unsigned int hControl),int
{
return 0;
}

MyWindow::OnCreate(),int
{
return 0;
}

MyWindow::OnDestroy(),int
{
return 0;
}

MyWindow::OnMenuInit(unsigned int hMenu),int
{
return 0;
}

MyWindow::OnMenuPick(int nID),int
{
return 0;
}


Download link in last message.
\/ \/ \/
Ionic Wind Support Team

Ionic Wind Support Team

Updated:  Now loads gui.inc as the default on startup, so you don't need to search for it.  The zip file was updated in the previous post and includes the new executable and soruce file.

If you want to compile it yourself you will need to create the "advapi32.lib" import library.  Select "tools" from the IDE and "Create Import Library".

Ionic Wind Support Team

Parker

I've modified it a bit, so now if you type an invalid identifier in the derived name box it lets you know. It accepts any identifier the lexer does, that means they can contain $ and @ if you'd like.

Ionic Wind Support Team

The latest stand alone version of the Class Maker is attached to this message.  A DLL version is now included with the installation and is available from the 'Tools' menu.

Ionic Wind Support Team