ET++: A sample application: iconedit

Every ET++ application which uses the document metaphore must subclass the Document class. IconDocument is the iconedit document class.

This method handles a menu selection. Each menu item in the application has an associated integer as defined in IconDocument::DoMakeMenuBar(); this maps these integers to appropriate action.


Command *IconDocument::DoMenuCommand(int cmd)
{
	RGB c;

	switch(cmd-IconEditRange()) {
	case cZOOMIN:
		fat->SetScale(fat->GetScale()*2);
		break;
	case cZOOMOUT:
		fat->SetScale(fat->GetScale()/2);
		break;
	case cZOOM100:
		fat->SetScale(1);
		break;

	[ ... other menu choices ... ]
	
	default:
		return Document::DoMenuCommand(cmd);
	}
	return gNoChanges;
}

Back to the top of the IconEdit description

Back to the top of the ET++ pages