classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GTK peers


From: John Leuner
Subject: GTK peers
Date: Sun, 12 Aug 2001 00:40:27 +0000
User-agent: Mutt/1.3.18i

I have done a fair amount of work on the AWT files. I have removed AWT 1.0 
specific methods (because they break compiles).

My question is about the GTK peers. I have managed to generate the header files 
for each .c files, and can run up to the point where an GTK frame is created 
with a title. (Mouse events also seem to be handled)

I cannot add any components to the frame because:

Recall that Frame extends Window extends Container

When addNotify is called on the Frame, it does:

setPeer((ComponentPeer)getToolkit().createFrame(this));

This means, the addNotify method for Container is never called (it has been 
overridden):

  if (is_notified)
    return;

  is_notified = true;
  Enumeration e = components.elements();
  while (e.hasMoreElements())
    ((Component)e.nextElement()).addNotify();
  super.addNotify();


This means the is_notified member in Container is never set to true, which 
means the addImpl method will never create a peer for new components:

protected void
addImpl(Component component, Object constraints, int index)
{
  if (index == -1)
    components.addElement(component);
  else
    components.insertElementAt(component, index);

  // Create peer if necessary
  if (is_notified)
    component.addNotify();
...


What should I do? Should we make a method in the Container class that 
initializes it? We could call this from all subclasses of Container? 

John Leuner





reply via email to

[Prev in Thread] Current Thread [Next in Thread]