1
0
Fork 0

- added functions to set meesages on the info-bar.

This commit is contained in:
cage 2023-02-22 15:58:30 +01:00
parent 393b4b0d29
commit 86adc4638d
3 changed files with 24 additions and 0 deletions

View File

@ -6,6 +6,8 @@
(defparameter *gui-server* nil) (defparameter *gui-server* nil)
(defparameter *main-frame* nil)
(a:define-constant +font-h1+ "sans 20 bold" :test #'string=) (a:define-constant +font-h1+ "sans 20 bold" :test #'string=)
(a:define-constant +font-h2+ "sans 15 bold" :test #'string=) (a:define-constant +font-h2+ "sans 15 bold" :test #'string=)

View File

@ -287,6 +287,7 @@
(setf gemtext-widget (make-instance 'gui:scrolled-text :master object)) (setf gemtext-widget (make-instance 'gui:scrolled-text :master object))
(setf info-frame (make-instance 'gui:frame :master object :relief :sunken :borderwidth 1)) (setf info-frame (make-instance 'gui:frame :master object :relief :sunken :borderwidth 1))
(setf info-text (make-instance 'gui:text :height 1 :wrap :none :master info-frame)) (setf info-text (make-instance 'gui:text :height 1 :wrap :none :master info-frame))
(gui:configure info-text :font gui:+tk-small-caption-font+)
(gui:grid info-text 0 0 :sticky :news) (gui:grid info-text 0 0 :sticky :news)
(gui-goodies:gui-resize-grid-all info-frame) (gui-goodies:gui-resize-grid-all info-frame)
(gui:grid tool-bar 0 0 :sticky :new :columnspan 2) (gui:grid tool-bar 0 0 :sticky :new :columnspan 2)
@ -297,6 +298,25 @@
(gui:grid-rowconfigure object 1 :weight 1) (gui:grid-rowconfigure object 1 :weight 1)
object)) object))
(defun print-info-message (message &key (color (gui-goodies:parse-color "gray")) (bold nil))
(let ((info-widget (info-text gui-goodies:*main-frame*)))
(setf (gui:text info-widget) message)
(let ((color-tag (gui:tag-create info-widget
(nodgui.utils:create-tag-name)
(gui:make-indices-start)
(gui:make-indices-end))))
(if bold
(gui:tag-configure info-widget
color-tag
:foreground color
:font "bold")
(gui:tag-configure info-widget
color-tag
:foreground color)))))
(defun print-error-message (message)
(print-info-message message :color (gui-goodies:parse-color "red") :bold t))
(defun init-main-window () (defun init-main-window ()
(gui:with-nodgui (:title +program-name+) (gui:with-nodgui (:title +program-name+)
(icons:load-icons) (icons:load-icons)
@ -305,5 +325,6 @@
(setf gui-goodies:*gui-server* gui:*wish*) (setf gui-goodies:*gui-server* gui:*wish*)
(client-events:start-events-loop) (client-events:start-events-loop)
(let ((main-frame (make-instance 'main-frame))) (let ((main-frame (make-instance 'main-frame)))
(setf gui-goodies:*main-frame* main-frame)
(gui:grid main-frame 0 0 :sticky :nswe) (gui:grid main-frame 0 0 :sticky :nswe)
(gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*)))) (gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*))))

View File

@ -3323,6 +3323,7 @@
(:export (:export
:*toplevel* :*toplevel*
:*gui-server* :*gui-server*
:*main-frame*
:parse-color :parse-color
:make-font :make-font
:gui-resize-grid-all :gui-resize-grid-all