diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/wndmgr/appcmds.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/wndmgr/appcmds.cpp')
-rw-r--r-- | Src/Wasabi/api/wndmgr/appcmds.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Src/Wasabi/api/wndmgr/appcmds.cpp b/Src/Wasabi/api/wndmgr/appcmds.cpp new file mode 100644 index 00000000..93b6ab6d --- /dev/null +++ b/Src/Wasabi/api/wndmgr/appcmds.cpp @@ -0,0 +1,61 @@ +#include <precomp.h> +#include "appcmds.h" + +#define CBCLASS AppCmdsI +START_DISPATCH; +CB(APPCMDS_GETNUMCMDS, appcmds_getNumCmds); +CB(APPCMDS_ENUMCMD, appcmds_enumCmd); +VCB(APPCMDS_ONCOMMAND, appcmds_onCommand); +END_DISPATCH; +#undef CBCLASS + +AppCmdsI::~AppCmdsI() +{ + foreach(cmds) + if (cmds.getfor()->autodelete) + delete cmds.getfor(); + endfor +} + +void AppCmdsI::appcmds_addCmd(CmdRec *cmdrec) +{ + cmds.addItem(cmdrec); +} + +void AppCmdsI::appcmds_addCmd(const wchar_t *name, int id, int side) +{ + cmds.addItem(new CmdRec(name, id, side, TRUE)); +} + +void AppCmdsI::appcmds_deleteAll() +{ + foreach(cmds) + if (cmds.getfor()->autodelete) delete cmds.getfor(); + endfor + cmds.removeAll(); +} + +int AppCmdsI::appcmds_getNumCmds() +{ + return cmds.getNumItems(); +} + +const wchar_t *AppCmdsI::appcmds_enumCmd(int n, int *side, int *id) +{ + CmdRec *cr = cmds[n]; + if (cr == NULL) return NULL; + if (side != NULL) *side = cr->side; + if (id != NULL) *id = cr->id; + return cr->cmdname; +} + +void AppCmdsI::appcmds_onCommand(int id, const RECT *buttonRect, int which_button) +{ + foreach(cmds) + if (cmds.getfor()->id == id) + { + cmds.getfor()->onCommand(buttonRect, which_button); + break; + } + endfor +} |