3 * Iconification functions
5 * Copyright 1994 John Richardson
8 static char Copyright
[] = "Copyright John Richardson, 1994";
13 #include "sysmetrics.h"
22 ICON_Iconify(HWND hwnd
)
24 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
30 printf("ICON_Iconify %d\n", hwnd
);
32 parwPtr
= WIN_FindWndPtr(wndPtr
->hwndParent
);
33 if (parwPtr
== NULL
) {
34 printf("argh, the parent is NULL, what to do?\n");
37 wndPtr
->dwStyle
|= WS_MINIMIZE
;
38 XUnmapWindow(display
, wndPtr
->window
);
39 if (wndPtr
->icon
== NULL
) {
40 printf("argh, couldn't find icon\n");
43 printf("parent edge values are %d, %d\n", parwPtr
->rectWindow
.left
,
44 parwPtr
->rectWindow
.bottom
);
45 wndPtr
->ptIconPos
.x
= parwPtr
->rectWindow
.left
+ 10;
46 wndPtr
->ptIconPos
.y
= parwPtr
->rectWindow
.bottom
- 80;
49 wndPtr
->rectWindow
.right
= 100;
50 wndPtr
->rectWindow
.bottom
= 32;
51 wndPtr
->rectNormal
.right
= 1000;
52 wndPtr
->rectNormal
.bottom
= 32;
53 wndPtr
->rectClient
.top
= wndPtr
->ptIconPos
.y
;
54 wndPtr
->rectClient
.left
= wndPtr
->ptIconPos
.x
;
56 wndPtr
->rectClient
.right
= 100;
57 wndPtr
->rectClient
.bottom
= 64;
59 wndPtr
->rectClientSave
= wndPtr
->rectNormal
;
60 myrect
= wndPtr
->rectClient
;
62 MoveWindow(hwnd
, wndPtr
->ptIconPos
.x
, wndPtr
->ptIconPos
.y
,
65 XMoveWindow(display
, wndPtr
->icon
,
66 wndPtr
->ptIconPos
.x
, wndPtr
->ptIconPos
.y
);
68 XMapWindow(display
, wndPtr
->icon
);
70 SendMessage(hwnd
, WM_PAINTICON
, 0, 0);
71 printf("done with iconify\n");
75 BOOL
ICON_isAtPoint(HWND hwnd
, POINT pt
)
77 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
78 int iconWidth
, iconHeight
;
81 if (wndPtr->hwndParent != GetDesktopWindow()) {
82 pt.x -= wndPtr->rectClient.left;
83 pt.y -= wndPtr->rectClient.top;
88 if (wndPtr
->hIcon
!= (HICON
)NULL
) {
90 lpico
= (ICONALLOC
*)GlobalLock(wndPtr
->hIcon
);
91 iconWidth
= (int)lpico
->descriptor
.Width
;
92 iconHeight
= (int)lpico
->descriptor
.Height
;
99 printf("icon x,y is %d,%d\n",
100 wndPtr
->ptIconPos
.x
, wndPtr
->ptIconPos
.y
);
102 printf("icon end x,y is %d,%d\n",
103 wndPtr
->ptIconPos
.x
+ 100,
104 wndPtr
->ptIconPos
.y
+ iconHeight
+ 20);
106 printf("mouse pt x,y is %d,%d\n", pt
.x
, pt
.y
);
108 printf("%d\n", IsIconic(hwnd
));
109 printf("%d\n", (pt
.x
>= wndPtr
->ptIconPos
.x
));
110 printf("%d\n", (pt
.x
< wndPtr
->ptIconPos
.x
+ 100));
111 printf("%d\n", (pt
.y
>= wndPtr
->ptIconPos
.y
));
112 printf("%d\n", (pt
.y
< wndPtr
->ptIconPos
.y
+ iconHeight
+ 20));
113 printf("%d\n", !(wndPtr
->dwStyle
& WS_DISABLED
));
114 printf("%d\n", (wndPtr
->dwStyle
& WS_VISIBLE
));
115 printf("%d\n", !(wndPtr
->dwExStyle
& WS_EX_TRANSPARENT
));
118 if ( IsIconic(hwnd
) &&
119 (pt
.x
>= wndPtr
->ptIconPos
.x
) &&
120 (pt
.x
< wndPtr
->ptIconPos
.x
+ 100) &&
121 (pt
.y
>= wndPtr
->ptIconPos
.y
) &&
122 (pt
.y
< wndPtr
->ptIconPos
.y
+ iconHeight
+ 20) &&
123 !(wndPtr
->dwStyle
& WS_DISABLED
) &&
124 (wndPtr
->dwStyle
& WS_VISIBLE
) &&
125 !(wndPtr
->dwExStyle
& WS_EX_TRANSPARENT
))
127 printf("got a winner!\n");
135 HWND
ICON_findIconFromPoint(POINT pt
)
137 HWND hwnd
= GetTopWindow( GetDesktopWindow() );
143 if ( !(wndPtr
=WIN_FindWndPtr(hwnd
))) return 0;
144 if (ICON_isAtPoint(hwnd
, pt
)) {
145 printf("returning\n");
146 return hwndRet
= hwnd
;
148 printf("checking child\n");
149 hwnd
= wndPtr
->hwndChild
;
156 ICON_Deiconify(HWND hwnd
)
158 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
160 printf("deiconifying\n");
161 XUnmapWindow(display
, wndPtr
->icon
);
162 wndPtr
->dwStyle
&= ~WS_MINIMIZE
;
163 /* wndPtr->rectNormal = myrect;
166 wndPtr
->rectClientSave
.left
,
167 wndPtr
->rectClientSave
.top
,
168 wndPtr
->rectClientSave
.right
- wndPtr
->rectClientSave
.left
,
169 wndPtr
->rectClientSave
.bottom
- wndPtr
->rectClientSave
.top
,
172 XMapWindow(display
, wndPtr
->window
);