Ooops, I forgot the files ;-)




Hi again, I just forgot to put the files in the e-mail. Here they
are:

- camera.h  - 8< - - - - 8< - - - - - - - 8< - - - - 8< - - - - -
/* 
 * Camera Widget
 */
#ifndef __CAMERA_H__
#define __CAMERA_H__


#include <gdk/gdk.h>
#include <gtk/gtkframe.h>


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


#define CAMERA(obj)          GTK_CHECK_CAST (obj, camera_get_type(), Camera)
#define CAMERA_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, camera_get_type(), CameraClass)
#define IS_CAMERA(obj)       GTK_CHECK_TYPE (obj, camera_get_type())


typedef struct _Camera       Camera;
typedef struct _CameraClass  CameraClass;

struct _Camera
{
  GtkFrame frame;

  GtkWidget **pix;
  GtkWidget *btn;

  gfloat radius;
  gint npixels;
  gint *nphe;
  guint *trigger;
  guint *tailcut;
  guint *mainisland;

  guint8 button;
};

struct _CameraClass
{
  GtkFrame parent_class;
  
  void (* camera) (Camera *ccc);
};

guint      camera_get_type   (void);
GtkWidget* camera_new        (void);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __CAMERA_H__ */
- - - - - - - 8< - - - - 8< - - - - - - - 8< - - - - 8< - - - - -

- camera.c  - 8< - - - - 8< - - - - - - - 8< - - - - 8< - - - - -
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gtk/gtk.h>

#include <camera.h>

#define CAMERA_DEFAULT_WIDTH   500
#define CAMERA_DEFAULT_HEIGHT  500

enum {
  CAMERA_SIGNAL,
  LAST_SIGNAL
};

static gint camera_signals[LAST_SIGNAL] = { 0 };

static GtkFrameClass *parent_class = NULL;

static void camera_class_init (CameraClass *class);
static void camera_init(Camera *ccc);

guint
camera_get_type ()
{
  static guint camera_type = 0;

  if (!camera_type) {
    GtkTypeInfo camera_info = 
    {
      "Camera",
      sizeof(Camera),
      sizeof(CameraClass),
      (GtkClassInitFunc) camera_class_init,
      (GtkObjectInitFunc) camera_init,
      (GtkArgSetFunc) NULL,
      (GtkArgGetFunc) NULL,
    };

    camera_type = gtk_type_unique (gtk_frame_get_type(), &camera_info);
  }
  
  return camera_type;
}

static void
camera_class_init (CameraClass *class)
{
  GtkObjectClass *object_class;

  object_class = (GtkObjectClass*) class;

  camera_signals[CAMERA_SIGNAL] = 
    gtk_signal_new ("camera",
                    GTK_RUN_FIRST,
                    object_class->type,
                    GTK_SIGNAL_OFFSET (CameraClass, camera),
                    gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);

  gtk_object_class_add_signals (object_class, camera_signals, LAST_SIGNAL);

  class->camera = NULL;
}

static void
camera_init(Camera *ccc)
{
  GtkWidget *k;
  GtkWidget *fr;

  k = gtk_button_new();
  gtk_container_add(GTK_CONTAINER(ccc), k);
  gtk_widget_show( k );
  ccc->btn = GTK_WIDGET( k );
}

GtkWidget*
camera_new (void)
{
  return ( GTK_WIDGET( gtk_type_new( camera_get_type() ) ) );
}
- - - - - - - 8< - - - - 8< - - - - - - - 8< - - - - 8< - - - - -

Cheers,

  J C 
--
602-"Well, he's got the arrow point cocked against my
temple, so when he lets go of the drawstring, it should
just stay there, right?"
	("FAMOUS LAST WORDS", collected by O.Rosenkranz)
====================================================================
   *    J. C. Gonzalez                   
  .     ------------------------------------------------------------  
  .     Max-Planck-Institut fuer Physik        Tel.: +49 89 32354445
   .    (Werner-Heisenberg-Institut)           Fax : +49 89 3226704   
     *  Foehringer Ring, 6          ... . .... . ..... ......... .. 
 .      D-80805 Muenchen            E-mail: gonzalez@mppmu.mpg.de
   .    Deutschland                    WWW: www.gae.ucm.es/~gonzalez
====================================================================



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