News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Glade

Started by mabdelouahab, August 09, 2024, 01:57:07 AM

Previous topic - Next topic

mabdelouahab

Glade is a powerful tool in the Linux environment used for visually designing graphical user interfaces (GUIs) with the GTK+ programming language. It allows developers to create user interfaces without manually writing the code, simplifying and accelerating the development process. The significance of Glade lies in its ability to separate the design of the interface from the program logic. Interfaces can be saved in XML files, which can then be imported and used within the application, making it easier and more flexible to maintain and modify the interfaces. Glade helps developers focus on the core logic of the application while reducing the time and effort needed to design attractive and responsive user interfaces.

When you finish working with Glade, save the file in the working directory alongside you assembly program
OPTION LITERALS:ON

gtk_builder_new PROTO :vararg
gtk_builder_add_from_string PROTO :QWORD,:QWORD,:QWORD,:QWORD
gtk_builder_get_object PROTO :QWORD,:PTR
g_signal_connect_data PROTO :QWORD,:PTR,:QWORD,:QWORD,:QWORD,:QWORD
gtk_widget_show_all PROTO :QWORD
gtk_main_quit PROTO
printf PROTO :PTR,:vararg
gtk_init PROTO :QWORD,:QWORD
gtk_main PROTO
.code

main  PROC  argc:QWORD, argv:QWORD
local GBuilder :QWORD
local _err :QWORD
local WMainwindow :QWORD
local WMnQuit :QWORD

gtk_init(0,0)
mov GBuilder,rv(gtk_builder_new)
mov _err,0
gtk_builder_add_from_string(GBuilder,addr MainWindowInterface ,MainWindowInterface_sz,addr _err)
.if rax==0
    lea r12,_err
    mov r12,[r12]
    mov r12,QWORD PTR [r12+8]
    printf("\nError loading interface {%s}",r12)
    ret
.endif

mov WMainwindow    ,rv(gtk_builder_get_object ,GBuilder,"MainWindow")
mov WMnQuit  ,rv(gtk_builder_get_object ,GBuilder,"MnQuit")

g_signal_connect_data(WMnQuit    ,"activate",addr On_MnQuit_Activate    ,0,0,0   )
                g_signal_connect_data(WMainwindow,"destroy" ,addr On_MnQuit_Activate    ,0,0,0   )
gtk_widget_show_all (WMainwindow)
gtk_main()
xor rax,rax
ret
main  ENDP

On_MnQuit_Activate PROC  GtkWidget :QWORD, user_data:QWORD
gtk_main_quit()
ret
On_MnQuit_Activate ENDP 
.DATA
MainWindowInterface label qword
incbin <widgets.glade>
MainWindowInterface_sz equ $-MainWindowInterface       
end 
Insallation:
Debian:
  apt install glade
Fedora
  yum install glade
Any distribution with Flatpak
  flatpak install flathub org.gnome.Glade
Windows: Available as a package in MSYS2
  pacman -S mingw-w64-x86_64-glade
OSX: Available as a package in Brew
  brew install glade

Biterider

Hi
Glade is a super professional GUI design tool.
It works perfectly and the use of incbin to include the .glade file is super clever  :thumbsup:

Biterider