Programmation GTK2 en Pascal/GtkVSeparator

Programmation GTK2 en Pascal

Présentation modifier

Le contrôle GtkVSeparator permet de dessiner une ligne verticale entre des contrôles.

Hiérarchie modifier

Hiérarchie
GObject
  └─GtkObject
      └─GtkWidget
          └─GtkSeparator
              └─GtkVSeparator

Utilisation de base modifier

Création modifier

Ce contrôle n'a qu'une seule fonction : sa fonction de création :

function gtk_vseparator_new : PGtkWidget;

Il n'y a rien de plus à dire à propos de ce contrôle.

Programme exemple modifier

Voilà le fichier gtk041.pas :

program gtk041;

uses glib2, gtk2;

var
  pFenetre   : PGtkWidget;
  pHBox      : PGtkWidget;
  pLabel1    : PGtkWidget;
  pSeparateur : PGtkWidget;
  pLabel2    : PGtkWidget;

begin
  gtk_init(@argc, @argv);
  pFenetre := gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(pFenetre), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(pFenetre), 320, 200);
  gtk_window_set_title(GTK_WINDOW(pFenetre), 'Gtk041 : Séparateur');
  gtk_signal_connect(pGTKOBJECT(pFenetre), 'destroy', G_CALLBACK(@gtk_main_quit), NULL);

  // Création de la GtkHBox
  pHBox := gtk_hbox_new(FALSE, 5);
  gtk_container_add(GTK_CONTAINER(pFenetre), pHBox);

  // Création du label 1
  pLabel1 := gtk_label_new('Label 1');
  gtk_box_pack_start(GTK_BOX(pHBox), pLabel1, FALSE, FALSE, 0);

  // Création du séparateur
  pSeparateur := gtk_vseparator_new;
  gtk_box_pack_start(GTK_BOX(pHBox), pSeparateur, FALSE, FALSE, 0);
    
  // Création du label 2
  pLabel2 := gtk_label_new('Label 2');
  gtk_box_pack_start(GTK_BOX(pHBox), pLabel2, FALSE, FALSE, 0);

  gtk_widget_show_all(pFenetre);
  gtk_main;
end.

Voilà ce que donne l'exécution du programme gtk041 :

 


Décorations : GtkFrame ~ GtkHSeparator ~ GtkVSeparator