-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJobStatus.cpp
More file actions
41 lines (33 loc) · 1.11 KB
/
Copy pathJobStatus.cpp
File metadata and controls
41 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "JobStatus.h"
#include "wbits.h"
JobStatus::JobStatus(MainWindow * parent, UINT id)
{
this->parent = parent;
this->id = id;
auto parent_window = parent->GetParent();
this->instance = reinterpret_cast<HINSTANCE>(::GetWindowLongPtr(parent_window, GWLP_HINSTANCE));
this->status_bar = ::CreateWindow(STATUSCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 64, 64, parent_window, (HMENU)id, this->instance, nullptr);
if(!this->status_bar)
{
throw STATUS_INVALID_HANDLE;
}
::SendMessage(this->status_bar, SB_SIMPLE, static_cast<WPARAM>(TRUE), 0);
}
JobStatus::~JobStatus()
{
::SendMessage(this->status_bar, WM_CLOSE, 0, 0);
}
void JobStatus::SendResizeMessage(WORD width, WORD height)
{
::SendMessage(this->status_bar, WM_SIZE, 0, MAKELPARAM(width, height));
}
unsigned int JobStatus::GetHeight()
{
RECT r;
::GetWindowRect(this->status_bar, &r);
return static_cast<unsigned int>(r.bottom - r.top);
}
void JobStatus::SetText(const TCHAR * text)
{
::SendMessage(this->status_bar, SB_SETTEXT, static_cast<WPARAM>(SB_SIMPLEID | SBT_NOTABPARSING), reinterpret_cast<LPARAM>(text));
}