IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GTK+ avec C & C++ Discussion :

Création de widgets


Sujet :

GTK+ avec C & C++

  1. #1
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut Création de widgets
    Bonjour,

    Après des heures sur le tuto de Franck.H : http://franckh.developpez.com/tutori...eation-widget/ il m'est toujours impossible d'arriver à modifier ce code...

    Le principe est très simple, pour être sur d'avoir tout bien compris (et c'est la que je me suis heurté à un problème) j'ai voulu reproduire exactement ce même script mais en souhaitant que cette LED ne soit pas un GtkWidget mais un GtkButton, j'ai besoin que cette led hérite des propriétés : enter, leave... afin de créer un nouveau widget révolutionnaire !!! =P

    Bref, c'est désespéré que je m'adresse à vous...

    VOici les modifications que j'ai apporté :

    gtkled.h :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    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
    #ifndef __GTK_LED_H
    #define __GTK_LED_H
    #include <gtk/gtk.h>
    #include <gtk/gtkbutton.h>
     
    G_BEGIN_DECLS
     
    #define GTK_LED(obj) \
       GTK_CHECK_CAST(obj, gtk_led_get_type (), GtkLed)
    #define GTK_LED_CLASS(klass) \
       GTK_CHECK_CLASS_CAST(klass, gtk_led_get_type (), GtkLedClass)
    #define GTK_IS_LED(obj) \
       GTK_CHECK_TYPE(obj, gtk_led_get_type ())
     
    typedef struct _GtkLed GtkLed;
    typedef struct _GtkLedClass GtkLedClass;
     
    struct _GtkLed
    {
       GtkButton widget;
     
       const gchar * on_image;
       const gchar * off_image;
       const gchar * clic_image;
     
       GdkPixbuf * on_pixbuf;
       GdkPixbuf * off_pixbuf;
       GdkPixbuf * clic_pixbuf;
     
       gint width;
       gint height;
     
       gboolean state;
    };
     
    struct _GtkLedClass
    {
       GtkButtonClass parent_class;
    };
     
    GtkType gtk_led_get_type (void);
    gboolean gtk_led_get_state (GtkLed * led);
    void gtk_led_set_state (GtkLed * led, gboolean state);
    GtkButton * gtk_led_new (const gchar * off_image, const gchar * on_image, const gchar * clic_image);
     
    G_END_DECLS
     
    #endif
    gtkled.c :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    #include "gtkled.h"
     
    static void gtk_led_class_init (GtkLedClass * klass);
    static void gtk_led_init (GtkLed * led);
    static void gtk_led_load_image (GtkLed * led);
    static void gtk_led_size_request (GtkWidget * widget, GtkRequisition * requisition);
    static void gtk_led_size_allocate (GtkWidget * widget, GtkAllocation * allocation);
    static void gtk_led_realize (GtkWidget * widget);
    static gboolean gtk_led_expose (GtkWidget * widget, GdkEventExpose * event);
    static void gtk_led_paint (GtkWidget * widget);
    static void gtk_led_destroy (GtkObject * object);
     
    static void test (GtkButton * widget)
    {
           printf("okokokok");
    }
     
    GtkType gtk_led_get_type (void)
    {
       static GtkType gtk_led_type = 0;
       if (! gtk_led_type)
       {
          static const GtkTypeInfo gtk_led_info = {
             "GtkLed",
             sizeof (GtkLed),
             sizeof (GtkLedClass),
             (GtkClassInitFunc) gtk_led_class_init,
             (GtkObjectInitFunc) gtk_led_init,
             NULL,
             NULL,
             (GtkClassInitFunc) NULL
          };
          gtk_led_type = gtk_type_unique (GTK_TYPE_WIDGET, &gtk_led_info);
       }
       return gtk_led_type;
    }
     
    int gtk_led_get_state (GtkLed * led)
    {
       return led->state;
    }
     
    void gtk_led_set_state (GtkLed * led, int state)
    {
       led->state = state;
       gtk_led_paint (GTK_WIDGET (led));
    }
     
    GtkButton * gtk_led_new (const gchar * off_image, const gchar * on_image, const gchar * clic_image)
    {
       GtkLed * led = NULL;
       if (off_image != NULL && on_image != NULL && clic_image != NULL)
       {
          led = gtk_type_new (gtk_led_get_type ());
          if (led != NULL)
          {
             led->off_image = off_image;
             led->on_image = on_image;
             led->clic_image = clic_image;
             led->state = 0;
             gtk_led_load_image (led);
          }
       }
       return GTK_BUTTON (led);
    }
     
    static void gtk_led_class_init (GtkLedClass * klass)
    {
       GtkButtonClass * button_class;
       GtkWidgetClass * widget_class;
       GtkObjectClass * object_class;
       button_class = (GtkButtonClass *) klass;
       widget_class = (GtkWidgetClass *) klass;
       object_class = (GtkObjectClass *) klass;
       button_class->enter = test;
       widget_class->realize = gtk_led_realize;
       widget_class->size_request = gtk_led_size_request;
       widget_class->size_allocate = gtk_led_size_allocate;
       widget_class->expose_event = gtk_led_expose;
       object_class->destroy = gtk_led_destroy;
    }
     
    static void gtk_led_init (GtkLed * led)
    {
       led->on_image = NULL;
       led->off_image = NULL;
       led->clic_image = NULL;
       led->on_pixbuf = NULL;
       led->off_pixbuf = NULL;
       led->clic_pixbuf = NULL;
       led->width = 0;
       led->height = 0;
       led->state = 0;
    }
     
    static void gtk_led_load_image (GtkLed * led)
    {
       led->on_pixbuf = gdk_pixbuf_new_from_file (led->on_image, NULL);
       led->off_pixbuf = gdk_pixbuf_new_from_file (led->off_image, NULL);
       led->clic_pixbuf = gdk_pixbuf_new_from_file (led->clic_image, NULL);
       led->width = gdk_pixbuf_get_width (led->on_pixbuf);
       led->height = gdk_pixbuf_get_height (led->on_pixbuf);
    }
     
    static void gtk_led_size_request (GtkWidget * widget, GtkRequisition * requisition)
    {
       g_return_if_fail (widget != NULL);
       g_return_if_fail (GTK_IS_LED (widget));
       g_return_if_fail (requisition != NULL);
       requisition->width = GTK_LED (widget)->width;
       requisition->height = GTK_LED (widget)->height;
    }
     
    static void gtk_led_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
    {
       g_return_if_fail (widget != NULL);
       g_return_if_fail (GTK_IS_LED (widget));
       g_return_if_fail (allocation != NULL);
       widget->allocation = *allocation;
       if (GTK_WIDGET_REALIZED (widget))
       {
          gdk_window_move_resize (
             widget->window,
             allocation->x, allocation->y,
             allocation->width, allocation->height
          );
       }
    }
     
    static void gtk_led_realize (GtkWidget * widget)
    {
       GdkWindowAttr attributes;
       guint attributes_mask;
       g_return_if_fail (widget != NULL);
       g_return_if_fail (GTK_IS_LED (widget));
       GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
       attributes.window_type = GDK_WINDOW_CHILD;
       attributes.x = widget->allocation.x;
       attributes.y = widget->allocation.y;
       attributes.width = widget->allocation.width;
       attributes.height = widget->allocation.height;
       attributes.wclass = GDK_INPUT_OUTPUT;
       attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
       attributes_mask = GDK_WA_X | GDK_WA_Y;
       widget->window = gdk_window_new (
          gtk_widget_get_parent_window (widget),
          & attributes, attributes_mask
       );
       gdk_window_set_user_data (widget->window, widget);
       widget->style = gtk_style_attach (widget->style, widget->window);
       gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
    }
     
    static gboolean gtk_led_expose (GtkWidget * widget, GdkEventExpose * event)
    {
       g_return_val_if_fail (widget != NULL, FALSE);
       g_return_val_if_fail (GTK_IS_LED (widget), FALSE);
       g_return_val_if_fail (event != NULL, FALSE);
       gtk_led_paint (widget);
       return FALSE;
    }
     
    static void gtk_led_paint (GtkWidget * widget)
    {
       GdkPixbuf * pixbuf = NULL;
       gint center_x = 0;
       gint center_y = 0;
       gdk_window_clear_area (
          widget->window,
          0, 0,
          widget->allocation.width,
          widget->allocation.height
       );
       center_x = (widget->allocation.width / 2) - (GTK_LED (widget)->width / 2);
       center_y = (widget->allocation.height / 2) - (GTK_LED (widget)->height / 2);
       if (GTK_LED (widget)->state ==  0)
          pixbuf = GTK_LED (widget)->off_pixbuf;
       else if (GTK_LED (widget)->state == 1)
          pixbuf = GTK_LED (widget)->on_pixbuf;
       else
          pixbuf = GTK_LED (widget)->clic_pixbuf;
       gdk_pixbuf_render_to_drawable (
          pixbuf,
          GDK_DRAWABLE (widget->window),
          NULL,
          0, 0, center_x, center_y,
          GTK_LED (widget)->width, GTK_LED (widget)->height,
          GDK_RGB_DITHER_NORMAL, 1, 1
       );
    }
     
    static void gtk_led_destroy (GtkObject * object)
    {
       GtkLed * led;
       GtkLedClass * klass;
       g_return_if_fail (object != NULL);
       g_return_if_fail (GTK_IS_LED (object));
       led = GTK_LED (object);
       if (led->on_pixbuf != NULL && led->off_pixbuf != NULL && led->clic_pixbuf != NULL)
       {
          gdk_pixbuf_unref (led->on_pixbuf);
          gdk_pixbuf_unref (led->off_pixbuf);
          gdk_pixbuf_unref (led->clic_pixbuf);
     
          led->on_pixbuf = NULL;
          led->off_pixbuf = NULL;
          led->clic_pixbuf = NULL;
       }
       klass = gtk_type_class (gtk_widget_get_type ());
       if (GTK_OBJECT_CLASS (klass)->destroy)
       {
          (* GTK_OBJECT_CLASS (klass)->destroy) (object);
       }
    }
    Le main est resté inchangé...

    SI vous avez besoin d'infos n'hésitez pas...

    Merci d'avance a tous...

    Mickael

  2. #2
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Le problème c'est que ce tutoriel est obsolète, il faudrait penser à le réécrire

  3. #3
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    Je vous remercie de votre réponse, en effet si le tuto est obsolète c'est pas très utile ^.^

    Quoi qu'il en soit, je vais potasser votre lien et je vous tiendrai au courant lorsque cela sera terminé...

    J'en profiterai si j'ai tout bien compris pour réécrire le tutoriel sur developpez...

    Merci beaucoup.

    Mickael

  4. #4
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Re-Bonjour,

    Rien de très concluant...
    Le code trouvé sur le site ne fonctionne pas :s
    Après avoir dépouillé les recherches de Google... toutes les personnes qui ont créé de nouveaux widgets en Gtk+ ont pris pour parent : GtkWidget... Mais je veux juste créer un enfant du bouton, à moins qu'il y est une autre méthode pour faire dépendre à un GtkImage les signaux : enter, leave...

    Merci de votre aide par avance...

    Mickael

  5. #5
    Expert confirmé
    Avatar de gerald3d
    Homme Profil pro
    Conducteur de train
    Inscrit en
    Février 2008
    Messages
    2 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Conducteur de train
    Secteur : Transports

    Informations forums :
    Inscription : Février 2008
    Messages : 2 308
    Billets dans le blog
    5
    Par défaut
    Peut être un GtkEventBox dans lequel tu insères ton GtkImage.

  6. #6
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    Malheureusement GtkEventBox ne possède aucun signal
    Impossible d'y relier les signaux de bouton ...

    Merci en tout cas à tous de m'aider

    Mickael

  7. #7
    Rédacteur
    Avatar de Franck.H
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2004
    Messages
    6 951
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Haut Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Service public

    Informations forums :
    Inscription : Janvier 2004
    Messages : 6 951
    Par défaut
    Citation Envoyé par artificier59 Voir le message
    Le problème c'est que ce tutoriel est obsolète, il faudrait penser à le réécrire
    Ouais c'est clair c'est dépassé, y'a une nouvelle façon d'écrire des widgets... enfin deux à vrai dire, la seconde c'est avec le langage Vala
    Mon Site
    Ma bibliothèque de gestion des chaînes de caractères en C

    L'imagination est plus importante que le savoir. A. Einstein

    Je ne répond à aucune question technique par MP, merci d'avance !

  8. #8
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    Qu'il soit obsolète ou non, je vous avoue que jusque la c'est le seul qui est bien marché, d'ailleurs sur internet on ne retrouve que votre tutoriel, et tous les scriptes que j'ai trouvé ont été basé sur le votre... Ne pourriez vous me donner un petit coup de pousse Je suis repartie sur la base de votre code mais à chaque fois que je tente de remplacer le GtkWidget en GtkButton apres j'ai un problème de pointer me disant que c'est plus compatible

    Merci d'avance à tous...

    Mickael

  9. #9
    Modérateur

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2009
    Messages
    1 395
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2009
    Messages : 1 395
    Par défaut
    Ce tutoriel devrait faire l'affaire, même s'il date de 2005:
    http://gnomejournal.org/article/34/w...airo-and-gtk28

    Je pense qu'il te suffit de dériver de GtkButton plutôt que GtkDrawingArea...

  10. #10
    Modérateur

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2009
    Messages
    1 395
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2009
    Messages : 1 395
    Par défaut
    Citation Envoyé par Franck.H Voir le message
    enfin deux à vrai dire, la seconde c'est avec le langage Vala
    Tu as une syntaxe par langage, m'enfin la méthode est la même...

  11. #11
    Rédacteur

    Avatar de gege2061
    Femme Profil pro
    Administrateur de base de données
    Inscrit en
    Juin 2004
    Messages
    5 840
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juin 2004
    Messages : 5 840
    Par défaut
    Bonjour,

    Citation Envoyé par Apocalypses Voir le message
    Malheureusement GtkEventBox ne possède aucun signal
    Impossible d'y relier les signaux de bouton ...
    Si, il hérite de tous les signaux de ses parents, en particulier ceux de GtkWidget. Mais il me semble que tu te complique, un GtkButton doit proposer tout ce dont tu as besoin.

    Citation Envoyé par liberforce Voir le message
    Tu as une syntaxe par langage, m'enfin la méthode est la même...
    Sauf que tu peux demander au compilateur de garder les fichiers C générer pour les analyser

  12. #12
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    il hérite de tous les signaux de ses parents, en particulier ceux de GtkWidget.
    Je m'etais compris, le widget en lui même n'a pas de signaux en plus par rapport au GtkWidget qui ne répond pas non plus à mes attentes...

    Pourquoi je veux hériter des signaux du GtkButton ?

    Je souhaiterai créer une nouvelle forme de bouton, jusque la nous avons des boutons qui lorsque l'on passe dessus un thème peu commode et dans de nombreux projets, j'utilisais les boutons pour mettre des images.

    Je souhaiterai donc créer un "IButton", c'est comme un bouton sauf que c'est une image qui lorsque l'on passe sur le bouton et l'on clic dessus, l'image se change en fonction de ce que l'utilisateur a choisis sans pour autant avoir le vieux rectangle des boutons (une simple image qui se change), cela permettrait facilement de créer de joli boutons avec 3 images

    btn = gtk_ibutton_new("normal.png","actif.png","clic.png");

    Le principe est vraiment bete, il faut juste relier le widget (image) au signal : enter, leave, pressed... et modifier l'image affiché.

    Si vous avez une autre solution pour réaliser cela, n'hésitez pas...

    Merci à tous en tout cas...

    Mickael

    Ps :

    Ce tutoriel devrait faire l'affaire, même s'il date de 2005:
    http://gnomejournal.org/article/34/w...airo-and-gtk28
    Je n'ai pas réussis à obtenir ce que je voulai mal expliqué et ne marche pas super bien...

  13. #13
    Rédacteur

    Avatar de gege2061
    Femme Profil pro
    Administrateur de base de données
    Inscrit en
    Juin 2004
    Messages
    5 840
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juin 2004
    Messages : 5 840
    Par défaut
    Citation Envoyé par Apocalypses Voir le message
    Je m'etais compris, le widget en lui même n'a pas de signaux en plus par rapport au GtkWidget qui ne répond pas non plus à mes attentes...
    enter-notify-event, leave-notify-event ce n'est pas ce que tu cherche ?

    Citation Envoyé par Apocalypses Voir le message
    Pourquoi je veux hériter des signaux du GtkButton ?

    Je souhaiterai créer une nouvelle forme de bouton, jusque la nous avons des boutons qui lorsque l'on passe dessus un thème peu commode et dans de nombreux projets, j'utilisais les boutons pour mettre des images.

    Je souhaiterai donc créer un "IButton", c'est comme un bouton sauf que c'est une image qui lorsque l'on passe sur le bouton et l'on clic dessus, l'image se change en fonction de ce que l'utilisateur a choisis sans pour autant avoir le vieux rectangle des boutons (une simple image qui se change), cela permettrait facilement de créer de joli boutons avec 3 images

    btn = gtk_ibutton_new("normal.png","actif.png","clic.png");

    Le principe est vraiment bete, il faut juste relier le widget (image) au signal : enter, leave, pressed... et modifier l'image affiché.

    Si vous avez une autre solution pour réaliser cela, n'hésitez pas...

    Merci à tous en tout cas...
    Voilà ce que ça donne en vala :

    Code vala : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    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
    class iButton : Gtk.Button
    {
      private new Gtk.Image image;
     
      public string normal {get; construct;}
      public string actif {get; construct;}
      public string clic {get; construct;}
     
      public iButton (string normal, string actif, string clic)
      {
        Object (normal: normal, actif: actif, clic: clic);
      }
     
      construct
      {
        this.set_relief (Gtk.ReliefStyle.NONE);
     
        this.image = new Gtk.Image.from_stock (this.normal, Gtk.IconSize.BUTTON);
        this.add (this.image);
     
        this.enter_notify_event.connect (() => {
          this.image.set_from_stock (this.actif, Gtk.IconSize.BUTTON);
        });
        this.leave_notify_event.connect (() => {
          this.image.set_from_stock (this.normal, Gtk.IconSize.BUTTON);
        });
     
        this.button_press_event.connect (() => {
          this.image.set_from_stock (this.clic, Gtk.IconSize.BUTTON);
        });
        this.button_release_event.connect (() => {
          this.image.set_from_stock (this.normal, Gtk.IconSize.BUTTON);
        });
      }
    }
     
    class Window : Gtk.Window
    {
      construct
      {
        this.destroy.connect (Gtk.main_quit);
        this.add (new iButton (Gtk.STOCK_FILE, Gtk.STOCK_NEW, Gtk.STOCK_QUIT));
      }
    }
     
    void main (string[] args)
    {
      Gtk.init (ref args);
      new Window ().show_all ();
      Gtk.main ();
    }


  14. #14
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    enter-notify-event, leave-notify-event
    Je vous avoue que je n'avais pas testé ceux la... Mais après reflexion il me faudra quand même toutes les fonctions d'un bouton puisque je voudrai le renommer IButton ^^ (il faut qu'il capte le clic de souris)...

    Pour ce qui est de votre code... Je dois avoir la pouasse, des erreurs partout, c'est bien du C ? (j'ai surement l'air bete mais je ne connais pas le C++). Quoi qu'il en soit à chaque ligne une erreur :

    "syntax error before "iButton""

    Merci je vais quand même regardé cela de plus pret

    Mickael

  15. #15
    Modérateur

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2009
    Messages
    1 395
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2009
    Messages : 1 395
    Par défaut
    Son exemple de code est en Vala.

  16. #16
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonsoir,

    En effet je n'avais pas remarqué l'annotation "Code : Vala"... Mais du coup je ne sais pas trop quoi en faire, il me le faudrait en C pour pouvoir vraiment l'utiliser...

    Merci à tous pour votre soutient

    Mickael

  17. #17
    Rédacteur

    Avatar de gege2061
    Femme Profil pro
    Administrateur de base de données
    Inscrit en
    Juin 2004
    Messages
    5 840
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juin 2004
    Messages : 5 840
    Par défaut
    Citation Envoyé par Apocalypses Voir le message
    En effet je n'avais pas remarqué l'annotation "Code : Vala"... Mais du coup je ne sais pas trop quoi en faire, il me le faudrait en C pour pouvoir vraiment l'utiliser...
    Comme je l'ai dit, tu peux demander au compilateur de te donner du code C, voilà le résultat :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    /* main.c generated by valac, the Vala compiler
     * generated from main.vala, do not modify */
     
     
    #include <glib.h>
    #include <glib-object.h>
    #include <gtk/gtk.h>
    #include <stdlib.h>
    #include <string.h>
    #include <gdk/gdk.h>
     
     
    #define TYPE_IBUTTON (ibutton_get_type ())
    #define IBUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBUTTON, iButton))
    #define IBUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IBUTTON, iButtonClass))
    #define IS_IBUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBUTTON))
    #define IS_IBUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IBUTTON))
    #define IBUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IBUTTON, iButtonClass))
     
    typedef struct _iButton iButton;
    typedef struct _iButtonClass iButtonClass;
    typedef struct _iButtonPrivate iButtonPrivate;
    #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
    #define _g_free0(var) (var = (g_free (var), NULL))
     
    #define TYPE_WINDOW (window_get_type ())
    #define WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WINDOW, Window))
    #define WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WINDOW, WindowClass))
    #define IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WINDOW))
    #define IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WINDOW))
    #define WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WINDOW, WindowClass))
     
    typedef struct _Window Window;
    typedef struct _WindowClass WindowClass;
    typedef struct _WindowPrivate WindowPrivate;
     
    struct _iButton {
    	GtkButton parent_instance;
    	iButtonPrivate * priv;
    };
     
    struct _iButtonClass {
    	GtkButtonClass parent_class;
    };
     
    struct _iButtonPrivate {
    	GtkImage* image;
    	char* _normal;
    	char* _actif;
    	char* _clic;
    };
     
    struct _Window {
    	GtkWindow parent_instance;
    	WindowPrivate * priv;
    };
     
    struct _WindowClass {
    	GtkWindowClass parent_class;
    };
     
     
    static gpointer ibutton_parent_class = NULL;
    static gpointer window_parent_class = NULL;
     
    GType ibutton_get_type (void);
    #define IBUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IBUTTON, iButtonPrivate))
    enum  {
    	IBUTTON_DUMMY_PROPERTY,
    	IBUTTON_NORMAL,
    	IBUTTON_ACTIF,
    	IBUTTON_CLIC
    };
    iButton* ibutton_new (const char* normal, const char* actif, const char* clic);
    iButton* ibutton_construct (GType object_type, const char* normal, const char* actif, const char* clic);
    const char* ibutton_get_normal (iButton* self);
    static void ibutton_set_normal (iButton* self, const char* value);
    const char* ibutton_get_actif (iButton* self);
    static void ibutton_set_actif (iButton* self, const char* value);
    const char* ibutton_get_clic (iButton* self);
    static void ibutton_set_clic (iButton* self, const char* value);
    static gboolean _lambda0_ (iButton* self);
    static gboolean __lambda0__gtk_widget_enter_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self);
    static gboolean _lambda1_ (iButton* self);
    static gboolean __lambda1__gtk_widget_leave_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self);
    static gboolean _lambda2_ (iButton* self);
    static gboolean __lambda2__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
    static gboolean _lambda3_ (iButton* self);
    static gboolean __lambda3__gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
    static GObject * ibutton_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
    static void ibutton_finalize (GObject* obj);
    static void ibutton_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
    static void ibutton_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
    GType window_get_type (void);
    enum  {
    	WINDOW_DUMMY_PROPERTY
    };
    Window* window_new (void);
    Window* window_construct (GType object_type);
    static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self);
    static GObject * window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
    void _vala_main (char** args, int args_length1);
     
     
     
    iButton* ibutton_construct (GType object_type, const char* normal, const char* actif, const char* clic) {
    	iButton * self;
    	g_return_val_if_fail (normal != NULL, NULL);
    	g_return_val_if_fail (actif != NULL, NULL);
    	g_return_val_if_fail (clic != NULL, NULL);
    	self = (iButton*) g_object_new (object_type, "normal", normal, "actif", actif, "clic", clic, NULL);
    	return self;
    }
     
     
    iButton* ibutton_new (const char* normal, const char* actif, const char* clic) {
    	return ibutton_construct (TYPE_IBUTTON, normal, actif, clic);
    }
     
     
    const char* ibutton_get_normal (iButton* self) {
    	const char* result;
    	g_return_val_if_fail (self != NULL, NULL);
    	result = self->priv->_normal;
    	return result;
    }
     
     
    static void ibutton_set_normal (iButton* self, const char* value) {
    	char* _tmp0_;
    	g_return_if_fail (self != NULL);
    	self->priv->_normal = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_normal), _tmp0_);
    	g_object_notify ((GObject *) self, "normal");
    }
     
     
    const char* ibutton_get_actif (iButton* self) {
    	const char* result;
    	g_return_val_if_fail (self != NULL, NULL);
    	result = self->priv->_actif;
    	return result;
    }
     
     
    static void ibutton_set_actif (iButton* self, const char* value) {
    	char* _tmp0_;
    	g_return_if_fail (self != NULL);
    	self->priv->_actif = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_actif), _tmp0_);
    	g_object_notify ((GObject *) self, "actif");
    }
     
     
    const char* ibutton_get_clic (iButton* self) {
    	const char* result;
    	g_return_val_if_fail (self != NULL, NULL);
    	result = self->priv->_clic;
    	return result;
    }
     
     
    static void ibutton_set_clic (iButton* self, const char* value) {
    	char* _tmp0_;
    	g_return_if_fail (self != NULL);
    	self->priv->_clic = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_clic), _tmp0_);
    	g_object_notify ((GObject *) self, "clic");
    }
     
     
    static gboolean _lambda0_ (iButton* self) {
    	gboolean result = FALSE;
    	gtk_image_set_from_stock (self->priv->image, self->priv->_actif, GTK_ICON_SIZE_BUTTON);
    }
     
     
    static gboolean __lambda0__gtk_widget_enter_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self) {
    	return _lambda0_ (self);
    }
     
     
    static gboolean _lambda1_ (iButton* self) {
    	gboolean result = FALSE;
    	gtk_image_set_from_stock (self->priv->image, self->priv->_normal, GTK_ICON_SIZE_BUTTON);
    }
     
     
    static gboolean __lambda1__gtk_widget_leave_notify_event (GtkWidget* _sender, GdkEventCrossing* event, gpointer self) {
    	return _lambda1_ (self);
    }
     
     
    static gboolean _lambda2_ (iButton* self) {
    	gboolean result = FALSE;
    	gtk_image_set_from_stock (self->priv->image, self->priv->_clic, GTK_ICON_SIZE_BUTTON);
    }
     
     
    static gboolean __lambda2__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
    	return _lambda2_ (self);
    }
     
     
    static gboolean _lambda3_ (iButton* self) {
    	gboolean result = FALSE;
    	gtk_image_set_from_stock (self->priv->image, self->priv->_normal, GTK_ICON_SIZE_BUTTON);
    }
     
     
    static gboolean __lambda3__gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
    	return _lambda3_ (self);
    }
     
     
    static GObject * ibutton_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
    	GObject * obj;
    	GObjectClass * parent_class;
    	iButton * self;
    	parent_class = G_OBJECT_CLASS (ibutton_parent_class);
    	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
    	self = IBUTTON (obj);
    	{
    		GtkImage* _tmp0_;
    		gtk_button_set_relief ((GtkButton*) self, GTK_RELIEF_NONE);
    		self->priv->image = (_tmp0_ = g_object_ref_sink ((GtkImage*) gtk_image_new_from_stock (self->priv->_normal, GTK_ICON_SIZE_BUTTON)), _g_object_unref0 (self->priv->image), _tmp0_);
    		gtk_container_add ((GtkContainer*) self, (GtkWidget*) self->priv->image);
    		g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) __lambda0__gtk_widget_enter_notify_event, self, 0);
    		g_signal_connect_object ((GtkWidget*) self, "leave-notify-event", (GCallback) __lambda1__gtk_widget_leave_notify_event, self, 0);
    		g_signal_connect_object ((GtkWidget*) self, "button-press-event", (GCallback) __lambda2__gtk_widget_button_press_event, self, 0);
    		g_signal_connect_object ((GtkWidget*) self, "button-release-event", (GCallback) __lambda3__gtk_widget_button_release_event, self, 0);
    	}
    	return obj;
    }
     
     
    static void ibutton_class_init (iButtonClass * klass) {
    	ibutton_parent_class = g_type_class_peek_parent (klass);
    	g_type_class_add_private (klass, sizeof (iButtonPrivate));
    	G_OBJECT_CLASS (klass)->get_property = ibutton_get_property;
    	G_OBJECT_CLASS (klass)->set_property = ibutton_set_property;
    	G_OBJECT_CLASS (klass)->constructor = ibutton_constructor;
    	G_OBJECT_CLASS (klass)->finalize = ibutton_finalize;
    	g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_NORMAL, g_param_spec_string ("normal", "normal", "normal", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
    	g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_ACTIF, g_param_spec_string ("actif", "actif", "actif", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
    	g_object_class_install_property (G_OBJECT_CLASS (klass), IBUTTON_CLIC, g_param_spec_string ("clic", "clic", "clic", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
    }
     
     
    static void ibutton_instance_init (iButton * self) {
    	self->priv = IBUTTON_GET_PRIVATE (self);
    }
     
     
    static void ibutton_finalize (GObject* obj) {
    	iButton * self;
    	self = IBUTTON (obj);
    	_g_object_unref0 (self->priv->image);
    	_g_free0 (self->priv->_normal);
    	_g_free0 (self->priv->_actif);
    	_g_free0 (self->priv->_clic);
    	G_OBJECT_CLASS (ibutton_parent_class)->finalize (obj);
    }
     
     
    GType ibutton_get_type (void) {
    	static volatile gsize ibutton_type_id__volatile = 0;
    	if (g_once_init_enter (&ibutton_type_id__volatile)) {
    		static const GTypeInfo g_define_type_info = { sizeof (iButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ibutton_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (iButton), 0, (GInstanceInitFunc) ibutton_instance_init, NULL };
    		GType ibutton_type_id;
    		ibutton_type_id = g_type_register_static (GTK_TYPE_BUTTON, "iButton", &g_define_type_info, 0);
    		g_once_init_leave (&ibutton_type_id__volatile, ibutton_type_id);
    	}
    	return ibutton_type_id__volatile;
    }
     
     
    static void ibutton_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
    	iButton * self;
    	self = IBUTTON (object);
    	switch (property_id) {
    		case IBUTTON_NORMAL:
    		g_value_set_string (value, ibutton_get_normal (self));
    		break;
    		case IBUTTON_ACTIF:
    		g_value_set_string (value, ibutton_get_actif (self));
    		break;
    		case IBUTTON_CLIC:
    		g_value_set_string (value, ibutton_get_clic (self));
    		break;
    		default:
    		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    		break;
    	}
    }
     
     
    static void ibutton_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
    	iButton * self;
    	self = IBUTTON (object);
    	switch (property_id) {
    		case IBUTTON_NORMAL:
    		ibutton_set_normal (self, g_value_get_string (value));
    		break;
    		case IBUTTON_ACTIF:
    		ibutton_set_actif (self, g_value_get_string (value));
    		break;
    		case IBUTTON_CLIC:
    		ibutton_set_clic (self, g_value_get_string (value));
    		break;
    		default:
    		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    		break;
    	}
    }
     
     
    Window* window_construct (GType object_type) {
    	Window * self;
    	self = g_object_newv (object_type, 0, NULL);
    	return self;
    }
     
     
    Window* window_new (void) {
    	return window_construct (TYPE_WINDOW);
    }
     
     
    static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self) {
    	gtk_main_quit ();
    }
     
     
    static GObject * window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
    	GObject * obj;
    	GObjectClass * parent_class;
    	Window * self;
    	parent_class = G_OBJECT_CLASS (window_parent_class);
    	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
    	self = WINDOW (obj);
    	{
    		iButton* _tmp1_;
    		g_signal_connect ((GtkObject*) self, "destroy", (GCallback) _gtk_main_quit_gtk_object_destroy, NULL);
    		gtk_container_add ((GtkContainer*) self, (GtkWidget*) (_tmp1_ = g_object_ref_sink (ibutton_new (GTK_STOCK_FILE, GTK_STOCK_NEW, GTK_STOCK_QUIT))));
    		_g_object_unref0 (_tmp1_);
    	}
    	return obj;
    }
     
     
    static void window_class_init (WindowClass * klass) {
    	window_parent_class = g_type_class_peek_parent (klass);
    	G_OBJECT_CLASS (klass)->constructor = window_constructor;
    }
     
     
    static void window_instance_init (Window * self) {
    }
     
     
    GType window_get_type (void) {
    	static volatile gsize window_type_id__volatile = 0;
    	if (g_once_init_enter (&window_type_id__volatile)) {
    		static const GTypeInfo g_define_type_info = { sizeof (WindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Window), 0, (GInstanceInitFunc) window_instance_init, NULL };
    		GType window_type_id;
    		window_type_id = g_type_register_static (GTK_TYPE_WINDOW, "Window", &g_define_type_info, 0);
    		g_once_init_leave (&window_type_id__volatile, window_type_id);
    	}
    	return window_type_id__volatile;
    }
     
     
    void _vala_main (char** args, int args_length1) {
    	Window* _tmp0_;
    	gtk_init (&args_length1, &args);
    	gtk_widget_show_all ((GtkWidget*) (_tmp0_ = g_object_ref_sink (window_new ())));
    	_g_object_unref0 (_tmp0_);
    	gtk_main ();
    }
     
     
    int main (int argc, char ** argv) {
    	g_type_init ();
    	_vala_main (argv, argc);
    	return 0;
    }
    La première version me semblais plus claire pour t'expliquer comment faire à partir d'un GtkButton.

  18. #18
    Membre éclairé
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2008
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2008
    Messages : 327
    Par défaut
    Bonjour,

    Je vous remercie, je vais regarder sa dès que possible, je vous tiendrai au courant

    Mickael

Discussions similaires

  1. Interface de création de widget
    Par chuckichucki dans le forum Développement Web avec .NET
    Réponses: 0
    Dernier message: 02/02/2011, 12h10
  2. Réponses: 1
    Dernier message: 18/08/2009, 15h22
  3. GWT pour création de widgets iGoogle ?
    Par samoussa dans le forum Général Conception Web
    Réponses: 6
    Dernier message: 07/05/2009, 10h17
  4. Création des widgets avec le ODP SDK
    Par raz2008 dans le forum Développement Mobile en Java
    Réponses: 3
    Dernier message: 02/04/2009, 20h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo