Re: GTK3 HeaderBar Example
Posted: Thu Oct 01, 2015 8:36 pm
fsw,
thank you for your nice GtkHeaderBar example which uses only Gtk3 API functions. I have tried to program a stripped down version which uses a PB window and PB menu bar so that the event handling becomes much easier. I am currently only able to test my example successfully on Ubuntu 14.04 x64 with KDE and PB 5.40 Beta 8 (Unity and Enlightenment don't display or handle the GtkHeaderBar correctly as documented in this thread).
My example has one improvement to your example: the menu bar is fully integrated into the header bar while your example displays the menu bar below the header bar.
thank you for your nice GtkHeaderBar example which uses only Gtk3 API functions. I have tried to program a stripped down version which uses a PB window and PB menu bar so that the event handling becomes much easier. I am currently only able to test my example successfully on Ubuntu 14.04 x64 with KDE and PB 5.40 Beta 8 (Unity and Enlightenment don't display or handle the GtkHeaderBar correctly as documented in this thread).
My example has one improvement to your example: the menu bar is fully integrated into the header bar while your example displays the menu bar below the header bar.
Code: Select all
EnableExplicit
ImportC ""
gtk_header_bar_new()
gtk_header_bar_pack_start (*HeaderBar, *Child)
gtk_header_bar_set_show_close_button(*HeaderBar, ShowCloseButton.I)
gtk_header_bar_set_subtitle(*HeaderBar, Title.P-UTF8)
gtk_header_bar_set_title(*HeaderBar, Subtitle.P-UTF8)
gtk_window_set_titlebar(*Window.GtkWindow, *Titlebar)
EndImport
Define HeaderBar.I
OpenWindow(0, 0, 0, 275, 275, "GtkHeaderBar demo",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateMenu(0, WindowID(0))
MenuTitle("Application")
MenuItem(0, "Preferences")
MenuBar()
MenuItem(1, "Quit")
HeaderBar = gtk_header_bar_new()
If HeaderBar
gtk_header_bar_set_title(HeaderBar, "GTK3")
gtk_header_bar_set_subtitle(HeaderBar, "Test")
gtk_header_bar_set_show_close_button(HeaderBar, #True)
gtk_window_set_titlebar(WindowID(0), HeaderBar)
gtk_widget_reparent_(MenuID(0), HeaderBar)
EndIf
gtk_widget_show_all_(WindowID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow