keyboard events

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
newActions window ... = do
    newa <- actionNew "NEWA" "New"     (Just "Neue Argumentation") (Just stockNew)
    opna <- actionNew "OPNA" "Open"    (Just "Öffne Argumentations-Datei") (Just stockOpen)
    sava <- actionNew "SAVA" "Save"    (Just "Speichern") (Just stockSave)
    svaa <- actionNew "SVAA" "Save As" (Just "Speichern als .. ") (Just stockSaveAs)
    exia <- actionNew "EXIA" "Exit"    (Just "Schließen") (Just stockQuit)
    
    let second_level = [newa,opna,sava,svaa,cuta,copa,psta,hlpa,cona]

    --Action Activate Events
    onActionActivate exia (widgetDestroy window)
    onActionActivate svaa (saveFileDialog ...)
    onActionActivate opna (openFileDialog ...)
    onActionActivate cona (...)

    --ActionGroup
    agr <- actionGroupNew "AGR"
    mapM_ (actionGroupAddAction agr) first_level
    mapM_ (\ act -> actionGroupAddActionWithAccel agr act Nothing)  second_level
    mapM_ prAct second_level

    mapM_ actionConnectAccelerator second_level
    mapM_ (\act -> actionSetSensitive act True) second_level

    --Keyboard Controles
    actionGroupAddActionWithAccel agr exia (Just "<Control>q")
    actionGroupAddActionWithAccel agr svaa (Just "<Ctrl>-s")
    actionGroupAddActionWithAccel agr opna (Just "<Control>o")
    --actionSetAccelPath opna "<Actions>/AGR/OPNA"
    
{- working python equivalent
         exit = gtk.ImageMenuItem(gtk.STOCK_QUIT, agr)
         key, mod = gtk.accelerator_parse("<Control>Q")
         exit.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE) 
         exit.connect("activate", gtk.main_quit)
-} 
    --actionGroupAddActionWithAccel agr cona (Just "<ctrl>e")

    return agr