Mercurial > dwindows
comparison os2/dw.c @ 1495:3b4dc98d753b
Initial gravity obstacles support for OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2011 04:45:59 +0000 |
parents | 6771fa426ba4 |
children | f8b4d6075cac |
comparison
equal
deleted
inserted
replaced
1494:cf960e266444 | 1495:3b4dc98d753b |
---|---|
60 void _do_resize(Box *thisbox, int x, int y); | 60 void _do_resize(Box *thisbox, int x, int y); |
61 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); | 61 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
62 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height); | 62 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height); |
63 void _free_menu_data(HWND menu); | 63 void _free_menu_data(HWND menu); |
64 ULONG (API_FUNC _PmPrintfString)(char *String) = 0; | 64 ULONG (API_FUNC _PmPrintfString)(char *String) = 0; |
65 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; | |
65 | 66 |
66 char ClassName[] = "dynamicwindows"; | 67 char ClassName[] = "dynamicwindows"; |
67 char SplitbarClassName[] = "dwsplitbar"; | 68 char SplitbarClassName[] = "dwsplitbar"; |
68 char ScrollClassName[] = "dwscroll"; | 69 char ScrollClassName[] = "dwscroll"; |
69 char *DefaultFont = "9.WarpSans"; | 70 char *DefaultFont = "9.WarpSans"; |
77 HWND hwndTrayServer = NULLHANDLE, hwndTaskBar = NULLHANDLE; | 78 HWND hwndTrayServer = NULLHANDLE, hwndTaskBar = NULLHANDLE; |
78 | 79 |
79 PRECORDCORE pCoreEmph = NULL; | 80 PRECORDCORE pCoreEmph = NULL; |
80 ULONG aulBuffer[4]; | 81 ULONG aulBuffer[4]; |
81 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; | 82 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; |
82 HMOD wpconfig = 0, pmprintf = 0; | 83 HMOD wpconfig = 0, pmprintf = 0, pmmerge = 0; |
83 static char _dw_exec_dir[MAX_PATH+1] = {0}; | 84 static char _dw_exec_dir[MAX_PATH+1] = {0}; |
84 | 85 |
85 unsigned long _colors[] = { | 86 unsigned long _colors[] = { |
86 CLR_BLACK, | 87 CLR_BLACK, |
87 CLR_DARKRED, | 88 CLR_DARKRED, |
3996 | 3997 |
3997 /* Load DLLs for providing extra functionality if available */ | 3998 /* Load DLLs for providing extra functionality if available */ |
3998 DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig); | 3999 DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig); |
3999 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf)) | 4000 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf)) |
4000 DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); | 4001 DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); |
4002 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge)) | |
4003 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); | |
4001 return rc; | 4004 return rc; |
4002 } | 4005 } |
4003 | 4006 |
4004 /* | 4007 /* |
4005 * Runs a message loop for Dynamic Windows. | 4008 * Runs a message loop for Dynamic Windows. |
4284 cx = swp.cx; | 4287 cx = swp.cx; |
4285 cy = swp.cy; | 4288 cy = swp.cy; |
4286 /* If the MDI parent isn't visible... | 4289 /* If the MDI parent isn't visible... |
4287 * we can't calculate. Drop out. | 4290 * we can't calculate. Drop out. |
4288 */ | 4291 */ |
4289 if(cx < 1 | cy < 1) | 4292 if(cx < 1 || cy < 1) |
4290 { | 4293 { |
4291 WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MOVE); | 4294 WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MOVE); |
4292 return rc; | 4295 return rc; |
4293 } | 4296 } |
4294 } | 4297 } |
7045 | 7048 |
7046 /* Save the new values */ | 7049 /* Save the new values */ |
7047 *x = newx; | 7050 *x = newx; |
7048 *y = newy; | 7051 *y = newy; |
7049 } | 7052 } |
7053 /* Adjust the values to avoid WarpCenter/XCenter/eCenter if requested */ | |
7054 if(_WinQueryDesktopWorkArea && (horz | vert) & DW_GRAV_OBSTACLES) | |
7055 { | |
7056 RECTL rect; | |
7057 | |
7058 _WinQueryDesktopWorkArea(HWND_DESKTOP, &rect); | |
7059 | |
7060 if(horz & DW_GRAV_OBSTACLES) | |
7061 { | |
7062 if((horz & 0xf) == DW_GRAV_LEFT) | |
7063 *x += rect.xLeft; | |
7064 else if((horz & 0xf) == DW_GRAV_RIGHT) | |
7065 *x -= dw_screen_width() - rect.xRight; | |
7066 } | |
7067 if(vert & DW_GRAV_OBSTACLES) | |
7068 { | |
7069 if((vert & 0xf) == DW_GRAV_BOTTOM) | |
7070 *y += rect.yBottom; | |
7071 else if((vert & 0xf) == DW_GRAV_TOP) | |
7072 *y -= dw_screen_height() - rect.yTop; | |
7073 } | |
7074 } | |
7050 } | 7075 } |
7051 | 7076 |
7052 /* | 7077 /* |
7053 * Sets the position of a given window (widget). | 7078 * Sets the position of a given window (widget). |
7054 * Parameters: | 7079 * Parameters: |