ghellopcb.c

Go to the documentation of this file.
00001 
00037 #include <config.h>
00038 #include <gtk/gtk.h>
00039 #include <stdio.h>
00040 #include <math.h>
00041 
00042 #include "global.h"
00043 #include "data.h"
00044 #include "hid.h"
00045 #include "misc.h"
00046 #include "create.h"
00047 #include "rtree.h"
00048 #include "undo.h"
00049 #include "set.h"
00050 
00054 static void
00055 on_destroy (GtkWidget * widget, gpointer data)
00056 {
00057         gtk_main_quit ();
00058 }
00059 
00065 static int
00066 ghellopcb (int argc, char **argv)
00067 {
00068         GtkWidget *window;
00069         GtkWidget *label;
00070         gtk_init (&argc, &argv);
00071         /* create a new top level window */
00072         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00073         /* give the window a 20px wide border */
00074         gtk_container_set_border_width (GTK_CONTAINER (window), 20);
00075         /* give it the title */
00076         gtk_window_set_title (GTK_WINDOW (window), PACKAGE " " VERSION);
00077         /* open it a bit wider so that both the label and title show up */
00078         gtk_window_set_default_size (GTK_WINDOW (window), 200, 50);
00079         /* Connect the destroy event of the window with our on_destroy function
00080          * When the window is about to be destroyed we get a notificaton and
00081          * stop the main GTK loop
00082          */
00083         g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy), NULL);
00084         /* Create the "Hello, PCB World" label  */
00085         label = gtk_label_new ("Hello, PCB World");
00086         /* and insert it into the main window  */
00087         gtk_container_add (GTK_CONTAINER (window), label);
00088         /* make sure that everything, window and label, are visible */
00089         gtk_widget_show_all (window);
00090         /* start the main loop */
00091         gtk_main ();
00092         return 0;
00093 }
00094 
00095 
00096 static HID_Action ghellopcb_action_list[] =
00097 {
00098         {"gHelloPCB", NULL, ghellopcb, "show a GTK dialog with a Hello world message on the screen", NULL}
00099 };
00100 
00101 
00102 REGISTER_ACTIONS (ghellopcb_action_list)
00103 
00104 
00105 void
00106 pcb_plugin_init()
00107 {
00108         register_ghellopcb_action_list();
00109 }
00110 
00111 /* EOF */

Generated on Tue Aug 17 15:28:04 2010 for pcb-plugins by  doxygen 1.4.6-NO