tagging release
[dasher.git] / Src / Win32 / Widgets / Slidebar.cpp
blobe8b57d73eabc359b0008ff87d825ae96988e8c14
1 // Slidebar.h
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge.
6 //
7 /////////////////////////////////////////////////////////////////////////////
9 // TODO: This class is fairly pointless now - it's basically a wrapper around
10 // a rebar control, which is almost definitely duplicating WTL functionality
12 #include "../Common/WinCommon.h"
13 #include "../resource.h"
14 #include "Slidebar.h"
16 using namespace Dasher;
18 // Track memory leaks on Windows to the line that new'd the memory
19 #ifdef _WIN32
20 #ifdef _DEBUG
21 #define DEBUG_NEW new( _NORMAL_BLOCK, THIS_FILE, __LINE__ )
22 #define new DEBUG_NEW
23 #undef THIS_FILE
24 static char THIS_FILE[] = __FILE__;
25 #endif
26 #endif
28 CSlidebar::CSlidebar(HWND ParentWindow, CDasherInterfaceBase *NewDasherInterface) {
29 m_hRebar = CreateWindowEx(WS_EX_TOOLWINDOW,
30 REBARCLASSNAME,
31 NULL,
32 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
33 WS_CLIPCHILDREN | RBS_VARHEIGHT |
34 CCS_BOTTOM | CCS_NODIVIDER,
35 0,0,0,0,
36 ParentWindow, NULL, WinHelper::hInstApp,
37 NULL);
39 REBARINFO rbi;
40 rbi.cbSize = sizeof(REBARINFO);
41 rbi.fMask = 0;
42 rbi.himl = (HIMAGELIST)NULL;
44 SendMessage(m_hRebar, RB_SETBARINFO, 0, (LPARAM)&rbi);
46 REBARBANDINFO rbBand;
47 rbBand.cbSize = sizeof(REBARBANDINFO);
48 rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE;
49 rbBand.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
51 m_pStatusControl = new CStatusControl(NewDasherInterface);
52 m_pStatusControl->Create(m_hRebar);
54 RECT rc;
55 m_pStatusControl->GetWindowRect(&rc);
57 rbBand.hwndChild = m_pStatusControl->m_hWnd;
58 rbBand.cxMinChild = 0;
59 rbBand.cyMinChild = rc.bottom - rc.top;
60 rbBand.cx = 200;
62 SendMessage(m_hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
65 void CSlidebar::Resize() {
66 SendMessage(m_hRebar, WM_SIZE, 0, 0);
69 int CSlidebar::GetHeight() {
70 RECT sRect;
71 GetWindowRect(m_hRebar, &sRect);
72 return sRect.bottom - sRect.top;