packages feed

HGamer3D-GUI 0.3.0 → 0.3.1

raw patch · 2 files changed

+34/−1 lines, 2 files

Files

HGamer3D-GUI.cabal view
@@ -1,5 +1,5 @@ Name:                HGamer3D-GUI
-Version:             0.3.0
+Version:             0.3.1
 Synopsis:            GUI Functionality for HGamer3D
 Description:         
 	HGamer3D is a game engine for developing 3D games in the programming 
HGamer3D/GUI.hs view
@@ -62,6 +62,8 @@ 	listboxAddText, 	listboxGetSelectedText, 	listboxRemoveAllText,+        listboxInitialize,+        listboxStatus, 	comboboxAddText, 	comboboxRemoveAllText,         @@ -307,6 +309,34 @@     else do       return list  +listboxInitialize :: GUIElement -- ^ GUI element, needs to be a listbox+                         -> [(String, Bool)] -- ^ list of entry, selected pairs+                         -> IO ()+listboxInitialize (GUIElement window) pairs = do+	reallistbox <- WindowSF.castWindowToListbox window+	Listbox.resetList reallistbox+        mapM ( \((entry, selected), ind) -> do+                  	ListboxSF.listboxAddItem reallistbox entry+                        item <- Listbox.getListboxItemFromIndex reallistbox ind+                        ListboxItem.setSelected item selected+                        return ()+                  ) (zip pairs [0..])+        return ()+  +listboxStatus :: GUIElement -- ^ GUI element, needs to be a listbox+                         -> IO [(String, Bool)] -- ^ list of entry, selected pairs+listboxStatus (GUIElement window) = do+	reallistbox <- WindowSF.castWindowToListbox window+        count <- Listbox.getItemCount reallistbox+        outlist <- mapM ( \ind -> do+                        item <- Listbox.getListboxItemFromIndex reallistbox ind+                        sel <- ListboxItem.isSelected item+                        txt <- ListboxItem.getText item+                        return (txt, sel)+                  ) [0..(count-1)]+        return outlist+  + -- | return the selected items as an array of strings listboxGetSelectedText :: GUIElement -- ^ the GUI element, needs to be a listbox                           -> IO [String] -- ^ the selected items as an array of strings@@ -323,6 +353,9 @@ 	reallistbox <- WindowSF.castWindowToListbox window 	Listbox.resetList reallistbox 	+++ -- | initialize the GUI system, used internally initGUI :: Bool  -- ^ logging flag            -> Bool -- ^ show graphics cursor flag