$Id: Writer.txt,v 1.1 1999/10/25 08:04:15 christof Exp $

Some notes on how the various Writer callbacks are called:

'=' lines denote recommended contents


void Include(File &f,const Widget &w)
- include corresponding file(s)
= f.include("gtk--/label.h");


void Declare(File &f,const Widget &w)
- on compound widgets (w.isCompound()) connected to StandardWriter::DeclareCompound()
	this declares this instance as an user-defined-type (compound)
	"Window2 window2;"
- simply a string like
	"Gtk_Label lbl;"
	"Gtk_Button *bt;"
- called in the class definition of the enclosing type
= StandardWriter::Declare(f,w,"type");


void DeclareNeeded(File &f,const Widget &w)
- declares any Customization needed Variables
- simply a string like
	"Gtk_Label foo_lbl;"
- called in the class definition (either enclosing or self)


void Derive(File &f,const Widget &w)
- not applicable to pointer to widgets ! (FIXME: test it)
- called in the class declaration of the enclosing type
- no special handling for compound widgets needed
- a string like
	"Gtk_HBox"
= f << "Gtk_Hbox";

	
void Construct(File &f,const Widget &w,bool is_member)
- Construct is never called if w is a pointer, so needed widgets must be
	pointers, too
- if (w.isCompound() && is_member) only needed for parametrized subwidgets !
	not passed to writers
- is_member indicates whether this is an member constructor
	"label(...)"  [", label2(...)"]
  or an direct constructor (which is also called for compound widgets
  		during the compound widget's definition and
  		for pointer initialization (new))
  	"Gtk_Label(...)"  [", label2(...)"]
= f << StandardWriter::ConstructName(f,w,is_member,"Gtk_Label");
= f << "(" << ... << ")";


void ConstructPointer(File &f,const Widget &w)
- if you need to construct more than one variable please submit this
  	function
= f << "\t" << f.InstanceName(w.Name()) << " = new Gtk_Label(" << ... << ");\n"


bool NeedConstruct(const Widget &w,bool is_member)
- return whether you need an explicit constructor (true) (see above)
	foo(something)
  or
	foo()
  is sufficient (false) (implicit constructors are not needed)


void Customize(File &f,const Widget &w,const string instance)
- for containers Customize falls into two parts:
	customizing itself
	adding contained widgets
- instance points to the instance ("" (member), "parent.", "parent->")

e.g
= Gtk_Widget::Customize(f,w,instance);
= f << instance << "do_something(...);\n\t";

= StandardWriter::AddChildren(f,w,[add_instance,]instance);
for containers, see table for a complex example


WriterType::Subwidget IsSubwidget(const Widget &w,const Widget &child)
- whether this widget has implicit children
  (return WriterType::{no_Subwidgets|not_Subwidget|IgnoreButAcceptChildren|
  			IgnoreTree|IgnoreButTestChildren}; )
see dialog for a complex example


bool SampleCode(File &f, const Widget &w, enum CodePosition pos,const string misc)
- is not documented.
- See clist, optionmenu for good examples, menubar for an abuse

Problems:
- if deriving is not possible (constructor might depend on other widgets),
  'Solution': derive from one of the dependant widgets.
              remember to customize with prefix!
              This will impose needs within the corresponding Foo class methods.

bool IsBasic(const Widget &w)
- whether this widget should introduce a new class or not
