outlook 左侧的设计挺好,不确定这种设计是不是从outlook开始的,想到这样的设计的时候,很自然的想到outlook,姑且叫它outlook bar吧!
在学习Clojure和Seesaw,就写了一个,放在这里,有谁需要,随便拿去:
(ns winnertel.gui (:use [seesaw core])) (defn outlook-bar "Create a simple outlook bar. args: coll is a vector like this: [{:index 0, :btn-text 'first-button', :content (button :text 'this is first content.')}, {:index 1, :btn-text 'second-button', :content (button :text 'this is second content.')}] return a outlook bar panel " ([coll] (outlook-bar (border-panel) coll (-> coll first :index ))) ([bar coll index] (let [top (take (inc index) coll), center (nth coll index), bottom (drop (inc index) coll), composer (fn [item] (action :name (:btn-text item), :handler (fn [e] (outlook-bar bar coll (:index item)))))] (doto bar (.removeAll)) (config! bar :north (grid-panel :rows (count top), :columns 1, :items (map composer top)), :center (scrollable (:content center)), :south (grid-panel :rows (count bottom), :columns 1, :items (map composer bottom))) (doto bar (.revalidate) (.repaint))))) ; ==================== test outlook-bar ======================= ;(def nav ; [{:index 0 :btn-text "first", :content (text "this is first content.")}, ; {:index 1 :btn-text "second", :content (label :text "this is second content.")}, ; {:index 2 :btn-text "third", :content (button :text "this is third content.")} ; ]) ; ;(defn olb [] ; (-> (frame :title "Hello world!", :content (outlook-bar nav), ; :on-close :dispose ) ; pack! ; show!)) ; ;(olb) ; ==================== test outlook-bar =======================