From: Axel S. <si...@co...> - 2008-09-15 21:27:43
|
Sat Sep 13 16:52:04 EDT 2008 A....@ke... * Remove the prefix New. Add automatic search. hunk ./demo/treeList/ListDemo.hs 4 -import Graphics.UI.Gtk.ModelView as New hunk ./demo/treeList/ListDemo.hs 5 +import Data.List ( isPrefixOf ) +import Data.Char ( toLower ) hunk ./demo/treeList/ListDemo.hs 17 - model <- New.listStoreNew + model <- listStoreNew hunk ./demo/treeList/ListDemo.hs 21 - view <- New.treeViewNewWithModel model - - New.treeViewSetHeadersVisible view True + view <- treeViewNewWithModel model + [_$_] + treeViewSetHeadersVisible view True hunk ./demo/treeList/ListDemo.hs 26 - col1 <- New.treeViewColumnNew - col2 <- New.treeViewColumnNew - col3 <- New.treeViewColumnNew + col1 <- treeViewColumnNew + col2 <- treeViewColumnNew + col3 <- treeViewColumnNew hunk ./demo/treeList/ListDemo.hs 30 - New.treeViewColumnSetTitle col1 "String column" - New.treeViewColumnSetTitle col2 "Int column" - New.treeViewColumnSetTitle col3 "Bool column" + treeViewColumnSetTitle col1 "String column" + treeViewColumnSetTitle col2 "Int column" + treeViewColumnSetTitle col3 "Bool column" hunk ./demo/treeList/ListDemo.hs 34 - renderer1 <- New.cellRendererTextNew - renderer2 <- New.cellRendererTextNew - renderer3 <- New.cellRendererToggleNew + renderer1 <- cellRendererTextNew + renderer2 <- cellRendererTextNew + renderer3 <- cellRendererToggleNew hunk ./demo/treeList/ListDemo.hs 38 - New.cellLayoutPackStart col1 renderer1 True - New.cellLayoutPackStart col2 renderer2 True - New.cellLayoutPackStart col3 renderer3 True + cellLayoutPackStart col1 renderer1 True + cellLayoutPackStart col2 renderer2 True + cellLayoutPackStart col3 renderer3 True hunk ./demo/treeList/ListDemo.hs 42 - New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ] - New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ] - New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ] + cellLayoutSetAttributes col1 renderer1 model $ \row -> [ cellText := name row ] + cellLayoutSetAttributes col2 renderer2 model $ \row -> [ cellText := show (number row) ] + cellLayoutSetAttributes col3 renderer3 model $ \row -> [ cellToggleActive := marked row ] hunk ./demo/treeList/ListDemo.hs 46 - New.treeViewAppendColumn view col1 - New.treeViewAppendColumn view col2 - New.treeViewAppendColumn view col3 + treeViewAppendColumn view col1 + treeViewAppendColumn view col2 + treeViewAppendColumn view col3 hunk ./demo/treeList/ListDemo.hs 51 - on renderer3 New.toggled $ \pathStr -> do - let (i:_) = New.stringToTreePath pathStr - val <- New.listStoreGetValue model i - New.listStoreSetValue model i val { marked = not (marked val) } + on renderer3 cellToggled $ \pathStr -> do + let (i:_) = stringToTreePath pathStr + val <- listStoreGetValue model i + listStoreSetValue model i val { marked = not (marked val) } + hunk ./demo/treeList/ListDemo.hs 57 + -- enable interactive search + treeViewSetEnableSearch view True + treeViewSetSearchEqualFunc view $ Just $ \str iter -> do + (i:_) <- treeModelGetPath model iter + row <- listStoreGetValue model i + return (map toLower str `isPrefixOf` map toLower (name row)) + [_$_] |