forked from ddehilster/visualtext3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutputBarTree.cpp
96 lines (78 loc) · 2.42 KB
/
OutputBarTree.cpp
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*******************************************************************************
Copyright (c) 1999-2010 by Text Analysis International, Inc.
All rights reserved.
*******************************************************************************/
// OutputBarTree.cpp : implementation file
//
#include "stdafx.h"
#include "kb.h"
#include "VisualText.h"
#include "OutputBarTree.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COutputBarTree
COutputBarTree::COutputBarTree()
{
}
COutputBarTree::~COutputBarTree()
{
}
BEGIN_MESSAGE_MAP(COutputBarTree, CTreeCtrl)
//{{AFX_MSG_MAP(COutputBarTree)
ON_WM_WINDOWPOSCHANGED()
ON_NOTIFY_REFLECT(TVN_ITEMEXPANDED, OnItemexpanded)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COutputBarTree message handlers
void COutputBarTree::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
// for the tree control, we'll call ShowScrollBar(SB_HORZ, FALSE) both
// before and after CTreeCtrl::OnWindowPosChanged() - this seems to
// reduce flicker much more
ShowScrollBar(SB_HORZ, FALSE);
CTreeCtrl::OnWindowPosChanged(lpwndpos);
ShowScrollBar(SB_HORZ, FALSE);
ModifyStyle(WS_HSCROLL, 0, SWP_DRAWFRAME);
}
void COutputBarTree::OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// since the newly expanded / collapsed item could affect the horz.
// scroll bar, we'll force a resync here
//((CXTPFlatTabCtrl *)GetParent())->SyncScrollBar();
*pResult = 0;
}
void COutputBarTree::PreSubclassWindow()
{
CTreeCtrl::PreSubclassWindow();
CommonInit();
}
int COutputBarTree::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTreeCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
CommonInit();
return 0;
}
void COutputBarTree::CommonInit()
{
// make tooltips "top-most" so they don't get obscured by the flat tab
// when floating in a dock bar
CToolTipCtrl *pTTCtrl =
#if _MSC_VER >= 1200 // VC6
GetToolTips();
#else
(CToolTipCtrl*)CWnd::FromHandle((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L));
#endif
if (pTTCtrl->GetSafeHwnd())
{
pTTCtrl->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
}