Made the layout pretties

This commit is contained in:
Emin Arslan 2025-01-17 23:18:06 +03:00
parent e4a32c0ca2
commit 5780e059de

View File

@ -22,6 +22,8 @@
(gtk-widget-show-all row)
row))
(defun my-app ()
(within-main-loop
(let ((win (make-instance 'gtk-window
@ -31,10 +33,15 @@
:default-height 600
)))
(g-signal-connect win "destroy" (lambda (widget) widget (leave-gtk-main)))
(let ((frame (make-instance 'gtk-frame :label "Todo" :shadow-type :etched-in))
(box (make-instance 'gtk-box :orientation :vertical :spacing 6
(let ((box (make-instance 'gtk-box :orientation :vertical :spacing 6
:homogeneous nil))
(todo-box (make-instance 'gtk-box :orientation :vertical :spacing 6
:homogeneous nil))
(completed-frame (make-instance 'gtk-frame :label "Completed"
:shadow-type :etched-in))
(completed (gtk-list-box-new))
(todo-frame (make-instance 'gtk-frame :label "Todo"
:shadow-type :etched-in))
(todo (gtk-list-box-new))
(add-button (gtk-button-new-with-label "Add"))
(entry (gtk-entry-new)))
@ -42,10 +49,10 @@
(lambda (widget)
(declare (ignore widget))
(gtk-container-add todo
(make-todo-item
(gtk-entry-text entry)
completed
todo))
(make-todo-item
(gtk-entry-text entry)
completed
todo))
(setf (gtk-entry-text entry) "")))
(g-signal-connect entry "activate"
(lambda (widget)
@ -54,14 +61,15 @@
(gtk-entry-text widget)
completed todo))
(setf (gtk-entry-text widget) "")))
(gtk-box-pack-start box (gtk-label-new "Completed:") :expand nil :fill nil)
(gtk-box-pack-start box completed :expand nil :fill nil)
(gtk-box-pack-start box (gtk-label-new "Todo:") :expand nil :fill nil)
(gtk-box-pack-start box todo :expand t :fill t)
(gtk-box-pack-start box entry :expand nil :fill nil)
(gtk-box-pack-start box add-button :expand nil :fill nil)
(gtk-container-add completed-frame completed)
(gtk-box-pack-start todo-box todo :expand t :fill t)
(gtk-box-pack-start todo-box entry :expand nil :fill nil)
(gtk-box-pack-start todo-box add-button :expand nil :fill nil)
(gtk-container-add frame box)
(gtk-container-add win frame)
(gtk-container-add todo-frame todo-box)
(gtk-box-pack-start box completed-frame :expand nil :fill nil)
(gtk-box-pack-start box todo-frame :expand t :fill t)
(gtk-container-add win box)
)
(gtk-widget-show-all win))))
(my-app)