1 //$ namespace Upp {
2 //$ class Ctrl {
3 private:
4 	bool         activex:1;
5 	bool         isdhctrl:1;
6 
7 #if WINCARET
8 	static void WndDestroyCaret();
9 	void WndCreateCaret(const Rect& cr);
10 #else
11 	static int                 WndCaretTime;
12 	static bool                WndCaretVisible;
13 	static void AnimateCaret();
14 #endif
15 
16 	static  bool GetMsg(MSG& msg);
17 
18 	static  bool DumpMessage(Ctrl *w, UINT message, WPARAM wParam, LPARAM lParam);
19 
20 	static LRESULT CALLBACK UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
21 	static void RenderFormat(int format);
22 	static void RenderAllFormats();
23 	static void DestroyClipboard();
24 
25 	void UpdateDHCtrls();
26 
27 public:
28 	static Win32Event ExitLoopEvent;
29 	static bool       endsession;
30 	static void       EndSession();
31 	static HINSTANCE  hInstance;
32 
33 protected:
34 	static HCURSOR   hCursor;
35 
36 	static VectorMap< HWND, Ptr<Ctrl> >& Windows();
37 	static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
38 
39 	static Win32Event OverwatchEndSession;
40 	static HWND       OverwatchHWND;
41 	static HANDLE     OverwatchThread;
42 
43 	static LRESULT CALLBACK OverwatchWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
44 	static DWORD WINAPI Win32OverwatchThread(LPVOID);
45 
46 	static Rect GetScreenClient(HWND hwnd);
47 	struct CreateBox;
48 	void  Create0(CreateBox *cr);
49 	void  Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow);
50 	Image DoMouse(int e, Point p, int zd = 0);
51 	static void sProcessMSG(MSG& msg);
52 
53 	static  Vector<Event<> > hotkey;
54 
55 	friend void sSetCursor(Ctrl *ctrl, const Image& m);
56 
57 public:
58 	virtual void    NcCreate(HWND hwnd);
59 	virtual void    NcDestroy();
60 	virtual void    PreDestroy();
61 	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
62 	virtual bool    PreprocessMessage(MSG& msg);
63 
GetHWND()64 	HWND  GetHWND() const              { return parent ? NULL : top ? top->hwnd : NULL; }
65 	HWND  GetOwnerHWND() const;
66 
67 	static Ctrl  *CtrlFromHWND(HWND hwnd);
68 
69 	Ctrl&   ActiveX(bool ax = true)            { activex = ax; return *this; }
NoActiveX()70 	Ctrl&   NoActiveX()                        { return ActiveX(false); }
IsActiveX()71 	bool    IsActiveX() const                  { return activex; }
72 
73 	void   PopUpHWND(HWND hwnd, bool savebits = true, bool activate = true, bool dropshadow = false,
74 	                 bool topmost = false);
75 
76 	static void InitWin32(HINSTANCE hinst);
77 	static void ExitWin32();
GuiFlush()78 	static void GuiFlush()                              { ::GdiFlush(); }
79 //$ };
80 //$ };