Buchempfehlung
Windows System Programming
Windows System Programming
Das Kompendium liefert viele interessante Informationen zur Windows-Programmierung auf Englisch. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

GTK - Menü Beispiel - menue_1

Uploader:Mitgliedrieselkalk
Datum/Zeit:22.04.2010 02:35:52

'- rieselkalk 2010
'- menue_1.bas

#include  once  "gtk/gtk.bi"

#define NULL 0
#define GDK_O &H04f

Dim Shared Schalter As Integer
Dim i As Integer

Declare Sub callback cdecl (byval widget as GtkWidget ptr, byval user_data as gpointer)

gtk_init (0, 0)

Schalter = 0

Dim Shared As GtkWidget ptr win_1
Dim Shared As GtkWidget Ptr vbox_1
Dim Shared As GtkWidget Ptr menubar_1
Dim Shared As GtkWidget Ptr menuitem_file
Dim Shared As GtkWidget Ptr menuitem_popup_file
Dim Shared As GtkWidget Ptr menuitem_open
Dim Shared As GtkWidget Ptr image104
Dim Shared As GtkAccelGroup Ptr accel_group

  accel_group = gtk_accel_group_new ()

  win_1 = gtk_window_new (GTK_WINDOW_TOPLEVEL)
  gtk_window_set_title (GTK_WINDOW (win_1), "Test Menue 1")
  gtk_window_move (GTK_WINDOW (win_1), 300, 300)
  gtk_window_resize (GTK_WINDOW (win_1), 300, 30)
  gtk_window_add_accel_group (GTK_WINDOW (win_1), accel_group)

  vbox_1 = gtk_vbox_new(FALSE,0)
  gtk_container_add (GTK_CONTAINER(win_1), vbox_1)

  menubar_1 = gtk_menu_bar_new ()
  gtk_widget_set_name (GTK_WIDGET(menubar_1), "menubar_1")
  gtk_container_add (GTK_CONTAINER(vbox_1), menubar_1)

  menuitem_file = gtk_menu_item_new_with_mnemonic ("_Datei")
  gtk_widget_set_name (GTK_WIDGET(menuitem_file), "menuitem_file")
  gtk_menu_bar_append (GTK_MENU_BAR (menubar_1), GTK_WIDGET(menuitem_file))

  menuitem_popup_file = gtk_menu_new()
  gtk_widget_set_name (GTK_WIDGET(menuitem_popup_file), "menuitem_popup_file")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_file), GTK_WIDGET(menuitem_popup_file))

  menuitem_open = gtk_image_menu_item_new_with_mnemonic (Chr(195)+Chr(150)+"ffnen...")
  gtk_widget_set_name (GTK_WIDGET(menuitem_open), "menuitem_open")
  gtk_container_add (GTK_CONTAINER (menuitem_popup_file), menuitem_open)

  gtk_widget_add_accelerator (GTK_WIDGET(menuitem_open), "activate", accel_group, _
                              GDK_O, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  image104 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(image104), "image104")
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem_open), image104)


  g_signal_connect (GTK_OBJECT (menuitem_open), "activate", _
                    G_CALLBACK (@callback), NULL)



  gtk_widget_show_all (win_1)



gtk_main()


sub callback Cdecl (byval widget as GtkWidget ptr, byval user_data as gpointer)
  '- CP850 (DOS Latin 1) Zeichensatz:   ä 132, ö 148, ü 129, ß 225, Ä 142, Ö 153, Ü 154
  Print "Item " +Chr(153) + "ffnen wurde geklickt! "
end sub