From 26ce368256eda6fb90bd79334f2fce5b06520524 Mon Sep 17 00:00:00 2001 From: oakes Date: Sun, 12 Jan 2014 17:16:49 -0500 Subject: [PATCH] Add select-box --- src/play_clj/ui.clj | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/play_clj/ui.clj b/src/play_clj/ui.clj index 40ac81f..37e74fd 100644 --- a/src/play_clj/ui.clj +++ b/src/play_clj/ui.clj @@ -5,8 +5,8 @@ [com.badlogic.gdx.graphics.g2d BitmapFont TextureRegion] [com.badlogic.gdx.scenes.scene2d Actor Stage] [com.badlogic.gdx.scenes.scene2d.ui ButtonGroup CheckBox Dialog - HorizontalGroup Image ImageButton ImageTextButton Label Skin Slider - Table TextButton TextField VerticalGroup WidgetGroup] + HorizontalGroup Image ImageButton ImageTextButton Label SelectBox + Skin Slider Table TextButton TextField VerticalGroup WidgetGroup] [com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align ChangeListener ClickListener DragListener FocusListener NinePatchDrawable SpriteDrawable TextureRegionDrawable @@ -223,6 +223,20 @@ [entity k & options] `(u/call! ^Label (:object ~entity) ~k ~@options)) +(defn select-box* + [items arg] + (u/create-entity (SelectBox. (into-array items) arg))) + +(defmacro select-box + [items arg & options] + `(let [entity# (select-box* ~items ~arg)] + (u/calls! ^SelectBox (:object entity#) ~@options) + entity#)) + +(defmacro select-box! + [entity k & options] + `(u/call! ^SelectBox (:object ~entity) ~k ~@options)) + (defn slider* [{:keys [min max step vertical?] :or {min 0 max 10 step 1 vertical? false}}