github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/client/GUI/onglets/auto.go (about) 1 package onglets 2 3 import ( 4 "github.com/benoitkugler/goACVE/client/controllers" 5 "github.com/benoitkugler/goACVE/server/core/rawdata" 6 "github.com/therecipe/qt/widgets" 7 ) 8 9 // DO NOT EDIT - autogenerated 10 11 func (t Personnes) IsActif() bool { 12 if t.parent == nil { 13 return false 14 } 15 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 16 } 17 18 func (t Personnes) GrabFocus() { 19 if t.parent != nil { 20 t.parent.SetCurrentWidget(t) 21 } 22 } 23 24 func (t Inscriptions) IsActif() bool { 25 if t.parent == nil { 26 return false 27 } 28 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 29 } 30 31 func (t Inscriptions) GrabFocus() { 32 if t.parent != nil { 33 t.parent.SetCurrentWidget(t) 34 } 35 } 36 37 func (t Camps) IsActif() bool { 38 if t.parent == nil { 39 return false 40 } 41 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 42 } 43 44 func (t Camps) GrabFocus() { 45 if t.parent != nil { 46 t.parent.SetCurrentWidget(t) 47 } 48 } 49 50 func (t SuiviDossiers) IsActif() bool { 51 if t.parent == nil { 52 return false 53 } 54 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 55 } 56 57 func (t SuiviDossiers) GrabFocus() { 58 if t.parent != nil { 59 t.parent.SetCurrentWidget(t) 60 } 61 } 62 63 func (t Aides) IsActif() bool { 64 if t.parent == nil { 65 return false 66 } 67 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 68 } 69 70 func (t Aides) GrabFocus() { 71 if t.parent != nil { 72 t.parent.SetCurrentWidget(t) 73 } 74 } 75 76 func (p Paiements) IsActif() bool { 77 if p.parent == nil { 78 return false 79 } 80 return p.parent.IndexOf(p) == p.parent.CurrentIndex() 81 } 82 83 func (p Paiements) GrabFocus() { 84 if p.parent != nil { 85 p.parent.SetCurrentWidget(p) 86 } 87 } 88 89 func (s SuiviCamps) IsActif() bool { 90 if s.parent == nil { 91 return false 92 } 93 return s.parent.IndexOf(s) == s.parent.CurrentIndex() 94 } 95 96 func (s SuiviCamps) GrabFocus() { 97 if s.parent != nil { 98 s.parent.SetCurrentWidget(s) 99 } 100 } 101 102 func (e Equipiers) IsActif() bool { 103 if e.parent == nil { 104 return false 105 } 106 return e.parent.IndexOf(e) == e.parent.CurrentIndex() 107 } 108 109 func (e Equipiers) GrabFocus() { 110 if e.parent != nil { 111 e.parent.SetCurrentWidget(e) 112 } 113 } 114 115 func (t Dons) IsActif() bool { 116 if t.parent == nil { 117 return false 118 } 119 return t.parent.IndexOf(t) == t.parent.CurrentIndex() 120 } 121 122 func (t Dons) GrabFocus() { 123 if t.parent != nil { 124 t.parent.SetCurrentWidget(t) 125 } 126 } 127 128 // NewTabs crée les onglets et les transmet au controller. 129 // Les ajoute aussi sur le QTabWidget renvoyé. 130 func InitTabWidget(mainC controllers.MainController, modules rawdata.Modules, tb *widgets.QToolBar) *widgets.QTabWidget { 131 w := widgets.NewQTabWidget(nil) 132 133 type withToolbar interface { 134 UpdateToolbar() 135 Render() 136 } 137 var tabs []withToolbar 138 139 tabPersonnes := newPersonnes(mainC.Controllers.Personnes) 140 tabPersonnes.toolbar = tb 141 mainC.Controllers.Personnes.Onglet = tabPersonnes 142 if modules.Personnes > 0 { 143 w.AddTab(tabPersonnes, "Personnes") 144 tabPersonnes.parent = w 145 tabs = append(tabs, tabPersonnes) 146 } 147 148 tabInscriptions := newInscriptions(mainC.Controllers.Inscriptions) 149 tabInscriptions.toolbar = tb 150 mainC.Controllers.Inscriptions.Onglet = tabInscriptions 151 if modules.Inscriptions > 0 { 152 w.AddTab(tabInscriptions, "Nouvelles inscriptions") 153 tabInscriptions.parent = w 154 tabs = append(tabs, tabInscriptions) 155 } 156 157 tabCamps := newCamps(mainC.Controllers.Camps) 158 tabCamps.toolbar = tb 159 mainC.Controllers.Camps.Onglet = tabCamps 160 if modules.Camps > 0 { 161 w.AddTab(tabCamps, "Séjours") 162 tabCamps.parent = w 163 tabs = append(tabs, tabCamps) 164 } 165 166 tabSuiviDossiers := newSuiviDossiers(mainC.Controllers.SuiviDossiers) 167 tabSuiviDossiers.toolbar = tb 168 mainC.Controllers.SuiviDossiers.Onglet = tabSuiviDossiers 169 if modules.SuiviDossiers > 0 { 170 w.AddTab(tabSuiviDossiers, "Suivi des dossiers") 171 tabSuiviDossiers.parent = w 172 tabs = append(tabs, tabSuiviDossiers) 173 } 174 175 tabAides := newAides(mainC.Controllers.Aides) 176 tabAides.toolbar = tb 177 mainC.Controllers.Aides.Onglet = tabAides 178 if modules.Aides > 0 { 179 w.AddTab(tabAides, "Aides") 180 tabAides.parent = w 181 tabs = append(tabs, tabAides) 182 } 183 184 tabPaiements := newPaiements(mainC.Controllers.Paiements) 185 tabPaiements.toolbar = tb 186 mainC.Controllers.Paiements.Onglet = tabPaiements 187 if modules.Paiements > 0 { 188 w.AddTab(tabPaiements, "Paiements") 189 tabPaiements.parent = w 190 tabs = append(tabs, tabPaiements) 191 } 192 193 tabSuiviCamps := newSuiviCamps(mainC.Controllers.SuiviCamps) 194 tabSuiviCamps.toolbar = tb 195 mainC.Controllers.SuiviCamps.Onglet = tabSuiviCamps 196 if modules.SuiviCamps > 0 { 197 w.AddTab(tabSuiviCamps, "Suivi des séjours") 198 tabSuiviCamps.parent = w 199 tabs = append(tabs, tabSuiviCamps) 200 } 201 202 tabEquipiers := newEquipiers(mainC.Controllers.Equipiers) 203 tabEquipiers.toolbar = tb 204 mainC.Controllers.Equipiers.Onglet = tabEquipiers 205 if modules.Equipiers > 0 { 206 w.AddTab(tabEquipiers, "Equipiers") 207 tabEquipiers.parent = w 208 tabs = append(tabs, tabEquipiers) 209 } 210 211 tabDons := newDons(mainC.Controllers.Dons) 212 tabDons.toolbar = tb 213 mainC.Controllers.Dons.Onglet = tabDons 214 if modules.Dons > 0 { 215 w.AddTab(tabDons, "Dons") 216 tabDons.parent = w 217 tabs = append(tabs, tabDons) 218 } 219 220 w.ConnectCurrentChanged(func(index int) { 221 tabs[index].UpdateToolbar() 222 tabs[index].Render() 223 }) 224 if len(tabs) > 0 { 225 tabs[0].UpdateToolbar() 226 tabs[0].Render() 227 } 228 return w 229 }