1
0

application.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef NULLSOFT_WINAMP_APPLICATION_H
  2. #define NULLSOFT_WINAMP_APPLICATION_H
  3. #include <api/application/api_application.h>
  4. #include <vector>
  5. #include <map>
  6. class Application : public api_application
  7. {
  8. public:
  9. static const char *getServiceName() { return "Application API"; }
  10. static const GUID getServiceGuid() { return applicationApiServiceGuid; }
  11. public:
  12. Application();
  13. ~Application();
  14. const wchar_t *main_getAppName();
  15. const wchar_t *main_getVersionString();
  16. const wchar_t *main_getVersionNumString();
  17. unsigned int main_getBuildNumber();
  18. GUID main_getGUID();
  19. HANDLE main_getMainThreadHandle();
  20. HINSTANCE main_gethInstance();
  21. const wchar_t *main_getCommandLine();
  22. void main_shutdown(int deferred = TRUE);
  23. void main_cancelShutdown();
  24. int main_isShuttingDown();
  25. const wchar_t *path_getAppPath();
  26. const wchar_t *path_getUserSettingsPath();
  27. // added for 5.58+ so gen_ff can fill @SKINSPATH@ in scripts correctly
  28. const wchar_t *path_getSkinSettingsPath();
  29. int app_getInitCount();
  30. intptr_t app_messageLoopStep();
  31. void app_addMessageProcessor(api_messageprocessor *processor);
  32. void app_removeMessageProcessor(api_messageprocessor *processor);
  33. void app_addModelessDialog(HWND hwnd);
  34. void app_removeModelessDialog(HWND hwnd);
  35. // added for 5.34
  36. const wchar_t *path_getWorkingPath();
  37. void path_setWorkingPath(const wchar_t *newPath);
  38. // added for 5.35
  39. /*
  40. int GetMachineID(GUID *id);
  41. */
  42. int GetUserID(GUID *id);
  43. int GetSessionID(GUID *id);
  44. WPARAM MessageLoop();
  45. // added for 5.53
  46. bool app_translateAccelerators(MSG *msg);
  47. void app_addAccelerators(HWND hwnd, HACCEL *phAccel, INT cAccel, UINT translateMode);
  48. void app_removeAccelerators(HWND hwnd);
  49. int app_getAccelerators(HWND hwnd, HACCEL *phAccel, INT cchAccelMax, BOOL bGlobal);
  50. // added for 5.54
  51. void app_registerGlobalWindow(HWND hwnd);
  52. void app_unregisterGlobalWindow(HWND hwnd);
  53. bool isGlobalWindow(HWND hwnd);
  54. /* 5.54 + */
  55. size_t AllocateThreadStorage(); // returns an index, -1 for error
  56. void *GetThreadStorage(size_t index);
  57. void SetThreadStorage(size_t index, void *value);
  58. /* 5.58 + */
  59. bool DirectMouseWheel_RegisterSkipClass(ATOM klass);
  60. bool DirectMouseWheel_UnregisterSkipClass(ATOM klass);
  61. bool DirectMouseWheel_EnableConvertToMouseWheel(HWND hwnd, BOOL enable);
  62. /* 5.64 + */
  63. BOOL DirectMouseWheel_ProcessDialogMessage(HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam, const int controls[], int controlslen);
  64. /* 5.61 + */
  65. void ActiveDialog_Register(HWND hwnd);
  66. void ActiveDialog_Unregister(HWND hwnd);
  67. HWND ActiveDialog_Get();
  68. /* 5.64 + */
  69. const wchar_t *getATFString(); // returns the current ATF formatting string
  70. /* 5.66 + */
  71. // used for dpi scaling so we're consistent in usage throughout the UI, etc
  72. int getScaleX(int x);
  73. int getScaleY(int y);
  74. private:
  75. RECVS_DISPATCH;
  76. bool ProcessMessageLight(MSG *msg);
  77. bool ProcessMessage(MSG *msg);
  78. bool FilterMessage(MSG *msg);
  79. bool DirectMouseWheel_ProccessMessage(MSG *msg);
  80. void DirectMouseWheel_InitBlackList();
  81. friend static BOOL DirectMouseWheel_RegisterMessage();
  82. static LRESULT CALLBACK MessageHookProc(INT code, WPARAM wParam, LPARAM lParam);
  83. private:
  84. typedef struct __ACCELNODE
  85. {
  86. HACCEL hAccel;
  87. UINT translateMode;
  88. __ACCELNODE *pNext;
  89. } ACCELNODE;
  90. typedef std::map<HWND, ACCELNODE*> AccelMap;
  91. private:
  92. int shuttingdown;
  93. std::vector<api_messageprocessor*> messageProcessors;
  94. HWND activeDialog;
  95. AccelMap accelerators;
  96. std::vector<HWND> globalWindows;
  97. std::vector<ATOM> directMouseWheelBlackList;
  98. GUID machineID, userID, sessionID;
  99. DWORD tlsIndex;
  100. LONG threadStorageIndex;
  101. HHOOK messageHook;
  102. bool disableMessageHook;
  103. };
  104. extern Application *application;
  105. #endif