1
0

svc_accroleserver.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef __SVC_ROLESERVER_H
  2. #define __SVC_ROLESERVER_H
  3. #include <bfc/dispatch.h>
  4. #include <bfc/string/string.h>
  5. #include <bfc/ptrlist.h>
  6. #include <api/service/services.h>
  7. #include <api/script/scriptobj.h>
  8. class ifc_window;
  9. #define FLATTENFLAG_FLATTEN 1
  10. #define FLATTENFLAG_UNFLATTEN -1
  11. #define FLATTENFLAG_ASKPARENT 0
  12. class NOVTABLE roleServerObject : public Dispatchable {
  13. public:
  14. int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  15. HWND gethWnd();
  16. int flattenContent(HWND *w);
  17. enum {
  18. RSO_WNDPROC=0,
  19. RSO_GETHWND=10,
  20. RSO_FLATTENCONTENT=20,
  21. };
  22. };
  23. inline int roleServerObject::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  24. return _call(RSO_WNDPROC, 0, hWnd, uMsg, wParam, lParam);
  25. }
  26. inline HWND roleServerObject::gethWnd() {
  27. return _call(RSO_GETHWND, (HWND)NULL);
  28. }
  29. inline int roleServerObject::flattenContent(HWND *w) {
  30. return _call(RSO_FLATTENCONTENT, 0, w);
  31. }
  32. class roleServerObjectI : public roleServerObject {
  33. public:
  34. roleServerObjectI(HWND parent, ifc_window *w);
  35. virtual ~roleServerObjectI();
  36. virtual int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  37. virtual HWND createWindow(HWND parent)=0;
  38. virtual int flattenContent(HWND *w);
  39. protected:
  40. ScriptObject *getScriptObject();
  41. virtual ifc_window *getWnd();
  42. virtual HWND gethWnd();
  43. WNDPROC getOldProc();
  44. HWND hwnd, parent;
  45. ifc_window *wnd;
  46. long (__stdcall *oldproc)(struct HWND__ *,unsigned int,unsigned int,long);
  47. int triedyet;
  48. RECVS_DISPATCH;
  49. };
  50. class NOVTABLE svc_accRoleServer : public Dispatchable {
  51. public:
  52. static FOURCC getServiceType() { return WaSvc::ACCESSIBILITYROLESERVER; }
  53. int handleRole(int role);
  54. roleServerObject *createObject(HWND parent, ifc_window *attached_wnd);
  55. void destroyObject(roleServerObject *obj);
  56. enum {
  57. RS_HANDLEROLE=10,
  58. RS_CREATEOBJECT=20,
  59. RS_DESTROYOBJECT=30
  60. };
  61. };
  62. inline int svc_accRoleServer::handleRole(int role) {
  63. return _call(RS_HANDLEROLE, 0, role);
  64. }
  65. inline roleServerObject *svc_accRoleServer::createObject(HWND parent, ifc_window *attached_wnd) {
  66. return _call(RS_CREATEOBJECT, (roleServerObject *)NULL, parent, attached_wnd);
  67. }
  68. inline void svc_accRoleServer::destroyObject(roleServerObject *obj) {
  69. _voidcall(RS_DESTROYOBJECT, obj);
  70. }
  71. class svc_accRoleServerI : public svc_accRoleServer {
  72. public:
  73. virtual int handleRole(int role)=0;
  74. virtual roleServerObject *createObject(HWND parent, ifc_window *attached_wnd)=0;
  75. virtual void destroyObject(roleServerObject *obj)=0;
  76. protected:
  77. RECVS_DISPATCH;
  78. };
  79. #include <api/service/servicei.h>
  80. template <class T>
  81. class AccRoleServerCreatorSingle : public waServiceFactoryTSingle<svc_accRoleServer, T> {
  82. public:
  83. svc_accRoleServer *getHandler() {
  84. return getSingleService();
  85. }
  86. };
  87. #include <api/service/svc_enum.h>
  88. #include <bfc/string/string.h>
  89. class AccRoleServerEnum : public SvcEnumT<svc_accRoleServer> {
  90. public:
  91. AccRoleServerEnum(int role) : roletest(role) { }
  92. protected:
  93. virtual int testService(svc_accRoleServer *svc) {
  94. return (svc->handleRole(roletest));
  95. }
  96. private:
  97. int roletest;
  98. };
  99. #endif