// Swarm library. Copyright (C) 1996 Santa Fe Institute.
// This library is distributed without any warranty; without even the
// implied warranty of merchantability or fitness for a particular purpose.
// See file LICENSE for details and terms of copying.

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#import <swarmgraph.h>
#import <swarmgraph/ButtonPanel.h>
#import <swarmgraph/Button.h>

@implementation ButtonPanel

// a ButtonPanel is itself just a frame.
-createEnd {
  [super createEnd];
#ifdef _TK_
  [globalTkInterp eval: "frame %s", widgetName];
#endif

  return self;
}

// this is atrocious - we should maintain a collection of the buttons.
-addButtonName: (char *) n Command: (char *) c {
  Button * b;

  b = [Button createParent: self];
  [b setText: n];
  [b setCommand: c];
#ifdef _TK_
  // this command is unfortunate.
  [globalTkInterp eval: "%s configure -width 12", [b getWidgetName]];
  [b pack];
  // now save b away in a list. (unimplemented)
#endif

  return self;
}

@end
