source: svn/branches/kctv/zasc/app/DST_WinManager.cpp

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
File size: 1.9 KB
Line 
1#include "DST_WinManager.h"
2
3// À©µµ¿ì °ü¸® ÇÔ¼ö ¿µ¿ª
4static CWindow *window[WIN_ID_MAX];
5// À©µµ¿ì¸¦ Ãß°¡ÇÑ´Ù.
6void DST_AddWin(WinID nID, CWindow *pData)
7{
8        if (!pData) return;
9        if (window[nID]) delete window[nID];
10        window[nID] = pData;
11}
12// À©µµ¿ì¸¦ Á¦°ÅÇÑ´Ù.
13void DST_RemoveWin(WinID nID)
14{
15        if (window[nID]) delete window[nID];
16        window[nID] = 0;
17}
18// ¸ðµç À©µµ¿ì¸¦ Á¦°ÅÇÑ´Ù.
19void DST_RemoveAllWindows()
20{
21        for (int i=WIN_NULL; i < WIN_ID_MAX; i++)
22        {
23                DST_RemoveWin((WinID)i);
24        }
25}
26
27void DST_RemoveAllWindowExceptBasicWin()
28{
29        for (int i=WIN_NULL; i < WIN_BASIC; i++)
30        {
31                DST_RemoveWin((WinID)i);
32        }
33}
34
35// À©µµ¿ì ¾ÆÀ̵ð·Î À©µµ¿ì Ŭ·¡½º Æ÷ÀÎÅ͸¦ °¡Á®¿Â´Ù.
36CWindow *DST_GetWin(WinID nID)
37{
38        if (nID < WIN_ID_MAX) return window[nID];
39        return 0;
40}
41
42// ¾÷µ¥ÀÌÆ® °ü¸® ÇÔ¼ö ¿µ¿ª
43static DST_RECT rectUpdate;
44// ¾÷µ¥ÀÌÆ® ¿µ¿ª ÃʱâÈ­
45void DST_ResetUpdateRegion()
46{
47        memset(&rectUpdate, 0, sizeof(DST_RECT));
48}
49// ¾÷µ¥ÀÌÆ® ¿µ¿ª Ãß°¡
50#define max(x,y) ((x)>(y)?(x):(y))
51#define min(x,y) ((x)<(y)?(x):(y))     
52void DST_AddUpdateRegion(DST_RECT rectNew)
53{
54        if (rectNew.w == 0 || rectNew.h == 0) return;
55        if (rectUpdate.w == 0 || rectUpdate.h == 0) // Çå¹Ú½ºÀÇ Å©±â°¡ 0ÀÌ¸é »õ¹Ú½ºÀÇ Å©±â·Î ´ëüÇÑ´Ù.
56        {
57                rectUpdate = rectNew;
58                return;
59        }
60        DST_RECT rectTemp = rectUpdate;
61        rectUpdate.x = min(rectTemp.x, rectNew.x );
62        rectUpdate.y = min(rectTemp.y, rectNew.y );
63        rectUpdate.w = max(rectTemp.x + rectTemp.w, rectNew.x + rectNew.w) - rectUpdate.x;
64        rectUpdate.h = max(rectTemp.y + rectTemp.h, rectNew.y + rectNew.h) - rectUpdate.y;
65
66        if (rectUpdate.x < 0) rectUpdate.x = 0;
67        if (rectUpdate.y < 0) rectUpdate.y = 0;
68        if (rectUpdate.w > DST_GetScreenWidth() - rectUpdate.x) rectUpdate.w = DST_GetScreenWidth() - rectUpdate.x;
69        if (rectUpdate.h > DST_GetScreenHeight() - rectUpdate.y) rectUpdate.h = DST_GetScreenHeight() - rectUpdate.y;
70}
71// ¾÷µ¥ÀÌÆ® ¿µ¿ª ¹Ýȯ
72DST_RECT DST_GetUpdateRegion()
73{
74        return rectUpdate;
75}
Note: See TracBrowser for help on using the repository browser.