| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 
 |  
#include <stdlib.h>
#include <gtk/gtk.h>
 
void OnDestroy(GtkWidget *pWidget, gpointer pData);
int main(int argc,char **argv)
{
    // Declaration du widget
    GtkWidget * pWindow;
    GtkWidget * pVbox;
    GtkWidget * pCurve;
    int veclen=10;
    gfloat vector[10]={1,10,2,5,5,1,10,2,5,5};
 
    gtk_init(&argc,&argv);
 
    // Creation de la fenetre
    pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(pWindow), 500, 300);
    // Connexion du signal "destroy"
    g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(OnDestroy), NULL);
 
    pVbox=gtk_vbox_new(TRUE,10);
    // Ajout de la GtkVBox dans la fenetre
    gtk_container_add(GTK_CONTAINER(pWindow), pVbox);
 
    pCurve=gtk_curve_new();
    gtk_box_pack_start(GTK_BOX(pVbox), pCurve, TRUE, TRUE, 0);
 
    //gtk_curve_set_curve_type(GTK_CURVE(pCurve),GTK_CURVE_TYPE_LINEAR);
    gtk_curve_reset(GTK_CURVE(pCurve));
    gtk_curve_set_range(GTK_CURVE(pCurve),0,10,0,10);
    //gtk_curve_reset(GTK_CURVE(pCurve));
    gtk_widget_set_sensitive(pCurve,FALSE);
    //gtk_curve_get_vector(GTK_CURVE(pCurve),veclen,vector);
    gtk_curve_set_vector(GTK_CURVE(pCurve),veclen,vector);
 
 
 //   GTK_CURVE_TYPE_LINEAR,       /* linear interpolation
 // GTK_CURVE_TYPE_SPLINE,       /* spline interpolation
 // GTK_CURVE_TYPE_FREE          /* free form curve
 
    gtk_widget_show_all(pWindow);
    // Demarrage de la boucle evenementielle
    gtk_main();
    return EXIT_SUCCESS;
}
void OnDestroy(GtkWidget *pWidget, gpointer pData)
{
    gtk_main_quit();
} | 
Partager