| 90 | #define DEFAULT_COLOR_FG_STATUS COLOR_WINDOWTEXT |
| 91 | |
| 92 | HWND |
| 93 | mswin_init_status_window(void) |
| 94 | { |
| 95 | static int run_once = 0; |
| 96 | HWND ret; |
| 97 | NHStatusWindow *data; |
| 98 | RECT rt; |
| 99 | int width, height; |
| 100 | |
| 101 | if (!run_once) { |
| 102 | register_status_window_class(); |
| 103 | run_once = 1; |
| 104 | } |
| 105 | |
| 106 | /* get window position */ |
| 107 | if (GetNHApp()->bAutoLayout) { |
| 108 | SetRect(&rt, 0, 0, 0, 0); |
| 109 | } else { |
| 110 | mswin_get_window_placement(NHW_STATUS, &rt); |
| 111 | } |
| 112 | |
| 113 | /* create status window object */ |
| 114 | width = rt.right - rt.left; |
| 115 | height = rt.bottom - rt.top; |
| 116 | ret = CreateWindow(szStatusWindowClass, NULL, |
| 117 | WS_CHILD | WS_CLIPSIBLINGS | WS_SIZEBOX, |
| 118 | rt.left, /* horizontal position of window */ |
| 119 | rt.top, /* vertical position of window */ |
| 120 | width, /* window width */ |
| 121 | height, /* window height */ |
| 122 | GetNHApp()->hMainWnd, NULL, GetNHApp()->hApp, NULL); |
| 123 | if (!ret) |
| 124 | panic("Cannot create status window"); |
| 125 | |
| 126 | /* Set window caption */ |
| 127 | SetWindowText(ret, "Status"); |
| 128 | |
| 129 | /* create window data */ |
| 130 | data = (PNHStatusWindow) malloc(sizeof(NHStatusWindow)); |
| 131 | if (!data) |
| 132 | panic("out of memory"); |
| 133 | |
| 134 | windowdata[NHW_STATUS].address = (genericptr_t) data; |
| 135 | ZeroMemory(data, sizeof(NHStatusWindow)); |
| 136 | SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR) data); |
| 137 | |
| 138 | back_buffer_init(&data->back_buffer, ret, width, height); |
| 139 | |
| 140 | mswin_apply_window_style(ret); |
| 141 | |
| 142 | if (status_bg_brush == NULL) { |
| 143 | status_bg_color = (COLORREF)GetSysColor(DEFAULT_COLOR_BG_STATUS); |
| 144 | status_bg_brush = CreateSolidBrush(status_bg_color); |
| 145 | } |
| 146 | |
| 147 | if (status_fg_brush == NULL) { |
| 148 | status_fg_color = (COLORREF)GetSysColor(DEFAULT_COLOR_FG_STATUS); |
| 149 | status_fg_brush = CreateSolidBrush(status_fg_color); |
no test coverage detected