Fix control mode
[dasher.git] / Src / Win32 / Widgets / Slidebar.cpp
blob85d1c2fc8cda916f69c554889f251e317794a4b0
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_MEMLEAKS
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, CAppSettings *pAppSettings) {
29 m_hRebar = CreateWindowEx(WS_EX_WINDOWEDGE,
30 REBARCLASSNAME,
31 NULL,
32 WS_CHILD | //WS_CLIPSIBLINGS |
33 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(pAppSettings);
52 m_pStatusControl->Create(ParentWindow);
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_pStatusControl->m_hWnd, WM_SIZE, 0, 0);
67 int j = 0;
68 int i = 5/j;
71 int CSlidebar::GetHeight() {
72 RECT sRect;
73 GetWindowRect(m_hRebar, &sRect);
74 return sRect.bottom - sRect.top;