Mercurial > wow > reaction
comparison modules/ModuleTemplate.lua @ 109:410d036c43b2
- reorganize modularity file structure (part 1)
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2009 00:57:27 +0000 |
| parents | |
| children | 729e284b2576 |
comparison
equal
deleted
inserted
replaced
| 108:b2fb8f7dc780 | 109:410d036c43b2 |
|---|---|
| 1 --[[ | |
| 2 ReAction module template | |
| 3 | |
| 4 --]] | |
| 5 | |
| 6 -- local imports | |
| 7 local ReAction = ReAction | |
| 8 local L = ReAction.L | |
| 9 local _G = _G | |
| 10 | |
| 11 -- module declaration | |
| 12 local moduleID = "MyModuleName" | |
| 13 local module = ReAction:NewModule( moduleID, | |
| 14 -- mixins go here | |
| 15 ) | |
| 16 | |
| 17 -- handlers | |
| 18 function module:OnInitialize() | |
| 19 self.db = ReAction.db:RegisterNamespace( moduleID | |
| 20 { | |
| 21 profile = { | |
| 22 -- default profile goes here | |
| 23 } | |
| 24 } | |
| 25 ) | |
| 26 | |
| 27 -- register some common events | |
| 28 ReAction.RegisterCallback(self, "OnCreateBar") | |
| 29 ReAction.RegisterCallback(self, "OnDestroyBar") | |
| 30 ReAction.RegisterCallback(self, "OnRefreshBar") | |
| 31 ReAction.RegisterCallback(self, "OnEraseBar") | |
| 32 ReAction.RegisterCallback(self, "OnRenameBar") | |
| 33 ReAction.RegisterCallback(self, "OnConfigModeChanged") | |
| 34 end | |
| 35 | |
| 36 function module:OnEnable() | |
| 37 | |
| 38 end | |
| 39 | |
| 40 function module:OnDisable() | |
| 41 | |
| 42 end | |
| 43 | |
| 44 -- apply module features and settings to a bar object (see Bar.lua for Bar API) | |
| 45 function module:OnCreateBar(event, bar, name) | |
| 46 | |
| 47 end | |
| 48 | |
| 49 -- remove module features and settings from a bar object | |
| 50 function module:OnDestroyBar(event, bar, name) | |
| 51 | |
| 52 end | |
| 53 | |
| 54 -- refresh module features and settings on a bar object | |
| 55 function module:OnRefreshBar(event, bar, name) | |
| 56 | |
| 57 end | |
| 58 | |
| 59 -- erase any local configuration entries for the supplied bar name | |
| 60 function module:OnEraseBar(event, bar, name) | |
| 61 | |
| 62 end | |
| 63 | |
| 64 -- update any local configuration/option entries with the new bar name index | |
| 65 function module:OnRenameBar(event, bar, oldName, newName) | |
| 66 | |
| 67 end | |
| 68 | |
| 69 -- update any local display/options based on config mode (true/false) | |
| 70 function module:OnConfigModeChanged(event, mode) | |
| 71 | |
| 72 end | |
| 73 |
