{-| This module exports functionality for working with buttons and images, and generating paths to icon images. -} module Buttons ( iconpath, toolButton, operationButtons, browseButtons, programButtons, searchButton ) where import Graphics.UI.Gtk import Paths_FileManager {-| Returns a path to icons stored locally to to the file manager's modules. i.e. \/haskellFM_dir\/Icons\/iconname.png -} iconpath :: String -- ^ The name to the icon for which a path is to be obtained. -> IO FilePath -- ^ The path to the icon containing the requested name. iconpath name = getDataFileName ("Icons/" ++ name ++ ".png") {-| Creates a 'ToolButton' containing an icon and a name. It creates an image (icon) using 'iconpath', then creates a 'ToolButton' containing the image and supplied information, and adds this to the supplied 'Toolbar'. It also adds the supplied information to 'Tooltips' which are associated with the 'ToolButton', which the user will see if their pointer is hovered over the button. -} toolButton :: Tooltips -- ^ The 'Tooltips' to be associated with the resulting button. -> Toolbar -- ^ The 'Toolbar' that the resulting button is to be added to. -> ( String, String ) -- ^ The tuple containing ( icon name, button information ) -> IO ToolButton -- ^ The 'ToolButton' created during exectution. toolButton tips toolbar ( iconname, info ) = do image <- imageNewFromFile =<< iconpath iconname toolButton <- toolButtonNew ( Just image ) ( Just iconname ) toolbarInsert toolbar toolButton ( -1 ) toolItemSetTooltip toolButton tips info [] return toolButton {-| Returns a list of tuple's containing icon names and the text and tooltips that these icons should have. These tuples are related to the operations that the user may carry out upon selections that they may have made: * Delete, Delete Selection * Move, Move Selection * Copy, Copy Selection * Rename, Rename Selection -} operationButtons :: [( String, String )] -- ^ List of icon names and info related to operations the user can carry out. operationButtons = [ ( "Delete", "Delete Selection" ), ( "Move", "Move Selection" ), ( "Copy", "Copy Selection" ), ( "Rename", "Rename Selection" ) ] {-| Returns a list of tuple's containing icon names and the text and tooltips that these icons should have. These tuples are related to the browsing actions that a user may carry out while using the file manager: * Home, HomeFolder * Documents, Documents Folder * Up, Move up folder * Refresh, Refresh View -} browseButtons :: [( String, String )] -- ^ List of icon names and info related to browsing. browseButtons = [ ( "Home", "Home Folder" ), ( "Documents", "Documents Folder" ), ( "Up", "Move up folder" ), ( "Refresh", "Refresh View" ) ] {-| Returns a list of tuples containing icon names and the text and tooltups that these icons should have. These tuples are related to providing the users with information and a means of exiting the file manager: * About, About HaskellFM * Close, Exit HaskellFM -} programButtons :: [( String , String )] -- ^ List of icon names and info related to the program. programButtons = [ ( "About", "About HaskellFM" ), ( "Close", "Exit HaskellFM" ) ] {-| Returns an string representing the name of the search buttons icon. -} searchButton :: String -- ^ The name of the search buttons icon. searchButton = "Search"