Repository navigation
Expand file tree
/
Copy pathStatusBar.cpp
More file actions
75 lines (59 loc) · 1.72 KB
/
Copy pathStatusBar.cpp
File metadata and controls
75 lines (59 loc) · 1.72 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// StatusBar.cpp: implementation of the StatusBar class.
//
//////////////////////////////////////////////////////////////////////
#include "StatusBar.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
StatusBar::StatusBar()
{
this->strControlClass = "";
this->dwStyle = WS_CHILD | WS_VISIBLE;
this->dwExStyle = WS_EX_WINDOWEDGE;
this->uPartCount = 0;
}
StatusBar::~StatusBar()
{
}
BOOL StatusBar::Create(HWND hParent, DWORD dwId, DWORD style, DWORD exStyle)
{
if (style != 0)
this->dwStyle = style;
if (exStyle != 0)
this->dwExStyle = exStyle;
this->hParent = hParent;
this->dwId = dwId;
InitCommonControls();
this->hWnd = CreateStatusWindow( this->dwStyle,
"",
this->hParent,
this->dwId);
if (this->hWnd != NULL)
{
::SendMessage(this->hWnd, SB_SETPARTS, this->uPartCount, (LPARAM)this->uParts);
return TRUE;
}
return FALSE;
}
BOOL StatusBar::AddPart(LPTSTR strTitle, UINT uWidth)
{
if (uWidth < 0)
{
this->uParts[this->uPartCount++] = -1;
SendMessage(this->hWnd, SB_SETPARTS, this->uPartCount, (LPARAM)this->uParts);
SendMessage(this->hWnd, SB_SETTEXT, (WPARAM)this->uPartCount-1|0, (LPARAM)strTitle);
}
else
{
for (UINT i = 0; i < this->uPartCount; i++)
uWidth += this->uParts[i];
this->uParts[this->uPartCount++] = uWidth;
SendMessage(this->hWnd, SB_SETPARTS, this->uPartCount, (LPARAM)this->uParts);
SendMessage(this->hWnd, SB_SETTEXT, (WPARAM)this->uPartCount-1|0, (LPARAM)strTitle);
}
return FALSE;
}
VOID StatusBar::SetPartTitle(UINT uPart, LPTSTR strTitle)
{
::SendMessage(this->hWnd, SB_SETTEXT, (WPARAM)uPart-1|0, (LPARAM)strTitle);
}