aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/service/svcs/svc_accroleserver.h
blob: ad40c1496c5e56ca6539b16c2ca9bcef86a7dd3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#ifndef __SVC_ROLESERVER_H
#define __SVC_ROLESERVER_H

#include <bfc/dispatch.h>
#include <bfc/string/string.h>
#include <bfc/ptrlist.h>
#include <api/service/services.h>
#include <api/script/scriptobj.h>

class ifc_window;

#define FLATTENFLAG_FLATTEN    1
#define FLATTENFLAG_UNFLATTEN -1
#define FLATTENFLAG_ASKPARENT 0

class NOVTABLE roleServerObject : public Dispatchable {
  public:
    int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
    HWND gethWnd();
    int flattenContent(HWND *w);

    enum {
      RSO_WNDPROC=0,
      RSO_GETHWND=10,
      RSO_FLATTENCONTENT=20,
    };
};

inline int roleServerObject::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  return _call(RSO_WNDPROC, 0, hWnd, uMsg, wParam, lParam);
}

inline HWND roleServerObject::gethWnd() {
  return _call(RSO_GETHWND, (HWND)NULL);
}

inline int roleServerObject::flattenContent(HWND *w) {
  return _call(RSO_FLATTENCONTENT, 0, w);
}

class roleServerObjectI : public roleServerObject {
  public:
    
    roleServerObjectI(HWND parent, ifc_window *w);
    virtual ~roleServerObjectI();

    virtual int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
    virtual HWND createWindow(HWND parent)=0;
    virtual int flattenContent(HWND *w);

  protected:

    ScriptObject *getScriptObject();
    virtual ifc_window *getWnd();
    virtual HWND gethWnd();
    WNDPROC getOldProc();

    HWND hwnd, parent;
    ifc_window *wnd;
    long (__stdcall *oldproc)(struct HWND__ *,unsigned int,unsigned int,long);
    int triedyet;

    RECVS_DISPATCH;
};

class NOVTABLE svc_accRoleServer : public Dispatchable {
public:
  static FOURCC getServiceType() { return WaSvc::ACCESSIBILITYROLESERVER; }
  
  int handleRole(int role);
  roleServerObject *createObject(HWND parent, ifc_window *attached_wnd);
  void destroyObject(roleServerObject *obj);

  enum {
    RS_HANDLEROLE=10,
    RS_CREATEOBJECT=20,
    RS_DESTROYOBJECT=30
  };

};

inline int svc_accRoleServer::handleRole(int role) {
  return _call(RS_HANDLEROLE, 0, role);
}

inline roleServerObject *svc_accRoleServer::createObject(HWND parent, ifc_window *attached_wnd) {
  return _call(RS_CREATEOBJECT, (roleServerObject *)NULL, parent, attached_wnd);
}

inline void svc_accRoleServer::destroyObject(roleServerObject *obj) { 
  _voidcall(RS_DESTROYOBJECT, obj);
}



class svc_accRoleServerI : public svc_accRoleServer {
  
  public:

    virtual int handleRole(int role)=0;
    virtual roleServerObject *createObject(HWND parent, ifc_window *attached_wnd)=0;
    virtual void destroyObject(roleServerObject *obj)=0;

  protected:
    RECVS_DISPATCH;
};

#include <api/service/servicei.h>
template <class T>
class AccRoleServerCreatorSingle : public waServiceFactoryTSingle<svc_accRoleServer, T> {
public:
  svc_accRoleServer *getHandler() {
    return getSingleService();
  }
};

#include <api/service/svc_enum.h>
#include <bfc/string/string.h>

class AccRoleServerEnum : public SvcEnumT<svc_accRoleServer> {
public:
  AccRoleServerEnum(int role) : roletest(role) { }
protected:
  virtual int testService(svc_accRoleServer *svc) {
    return (svc->handleRole(roletest));
  }
private:
  int roletest;
};


#endif