doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PropTreeInfo.cpp
Go to the documentation of this file.
1 // PropTreeInfo.cpp : implementation file
2 //
3 // Copyright (C) 1998-2001 Scott Ramsay
4 // sramsay@gonavi.com
5 // http://www.gonavi.com
6 //
7 // This material is provided "as is", with absolutely no warranty expressed
8 // or implied. Any use is at your own risk.
9 //
10 // Permission to use or copy this software for any purpose is hereby granted
11 // without fee, provided the above notices are retained on all copies.
12 // Permission to modify the code and to distribute modified code is granted,
13 // provided the above notices are retained, and a notice that the code was
14 // modified is included with the above copyright notice.
15 //
16 // If you use this code, drop me an email. I'd like to know if you find the code
17 // useful.
18 
19 //#include "stdafx.h"
20 #include "../../../idlib/precompiled.h"
21 #pragma hdrstop
22 
23 #include "PropTree.h"
24 #include "../../../sys/win32/rc/proptree_Resource.h"
25 #include "PropTreeInfo.h"
26 
27 #ifdef _DEBUG
28 #define new DEBUG_NEW
29 #undef THIS_FILE
30 static char THIS_FILE[] = __FILE__;
31 #endif
32 
34 // CPropTreeInfo
35 
37  m_pProp(NULL)
38 {
39 }
40 
42 {
43 }
44 
45 
46 BEGIN_MESSAGE_MAP(CPropTreeInfo, CStatic)
47  //{{AFX_MSG_MAP(CPropTreeInfo)
48  ON_WM_PAINT()
49  //}}AFX_MSG_MAP
50 END_MESSAGE_MAP()
51 
53 // CPropTreeInfo message handlers
54 
55 void CPropTreeInfo::SetPropOwner(CPropTree* pProp)
56 {
57  m_pProp = pProp;
58 }
59 
61 {
62  CPaintDC dc(this);
63  CRect rc;
64 
65  GetClientRect(rc);
66 
67  dc.SelectObject(GetSysColorBrush(COLOR_BTNFACE));
68  dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATCOPY);
69 
70  dc.DrawEdge(&rc, BDR_SUNKENOUTER, BF_RECT);
71  rc.DeflateRect(4, 4);
72 
73  ASSERT(m_pProp!=NULL);
74 
76 
77  if (!m_pProp->IsWindowEnabled())
78  dc.SetTextColor(GetSysColor(COLOR_GRAYTEXT));
79  else
80  dc.SetTextColor(GetSysColor(COLOR_BTNTEXT));
81 
82  dc.SetBkMode(TRANSPARENT);
83  dc.SelectObject(m_pProp->GetBoldFont());
84 
85  CString txt;
86 
87  if (!pItem)
88  txt.LoadString(IDS_NOITEMSEL);
89  else
90  txt = pItem->GetLabelText();
91 
92  CRect ir;
93  ir = rc;
94 
95  // draw label
96  dc.DrawText(txt, &ir, DT_SINGLELINE|DT_CALCRECT);
97  dc.DrawText(txt, &ir, DT_SINGLELINE);
98 
99  ir.top = ir.bottom;
100  ir.bottom = rc.bottom;
101  ir.right = rc.right;
102 
103  if (pItem)
104  txt = pItem->GetInfoText();
105  else
106  txt.LoadString(IDS_SELFORINFO);
107 
108  dc.SelectObject(m_pProp->GetNormalFont());
109  dc.DrawText(txt, &ir, DT_WORDBREAK);
110 }
static CFont * GetNormalFont()
Definition: PropTree.cpp:272
LPCTSTR GetInfoText()
afx_msg void OnPaint()
LPCTSTR GetLabelText()
static CFont * GetBoldFont()
Definition: PropTree.cpp:278
CPropTreeItem * GetFocusedItem()
Definition: PropTree.cpp:284
#define NULL
Definition: Lib.h:88
#define IDS_SELFORINFO
virtual ~CPropTreeInfo()
CPropTree * m_pProp
Definition: PropTreeInfo.h:43
#define IDS_NOITEMSEL