doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ToggleListView.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 #pragma once
29 
30 #include <afxcview.h>
31 
39 class ToggleListView : public CListView {
40 
41 public:
45  enum {
49  };
50 
51 public:
52  void SetToggleIcons(LPCSTR disabled = NULL, LPCSTR on = NULL, LPCSTR off = NULL);
53  void SetToggleState(int index, int toggleState, bool notify = false);
54  int GetToggleState(int index);
55 
56  //Windows messages
57  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
58  afx_msg void OnSize(UINT nType, int cx, int cy);
59  afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
60  afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
61 
62  DECLARE_MESSAGE_MAP()
63 
64 
65 protected:
67  virtual ~ToggleListView();
68 
69  DECLARE_DYNCREATE(ToggleListView)
70 
71  //Overrides
72  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
73  virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
74 
75  //Virtual Event Methods for sub-classes
76  virtual void OnStateChanged(int index, int toggleState) {};
77 
78  void Draw3dRect(HDC hDC, RECT* rect, HBRUSH topLeft, HBRUSH bottomRight);
79 
80 protected:
81  HICON onIcon;
82  HICON offIcon;
83  HICON disabledIcon;
84 
85 };
86 
87 
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Sets some window styles before the window is created.
int GetToggleState(int index)
Gets the state of an item in the list.
void SetToggleState(int index, int toggleState, bool notify=false)
Sets the state of an item in the list.
virtual void OnStateChanged(int index, int toggleState)
void SetToggleIcons(LPCSTR disabled=NULL, LPCSTR on=NULL, LPCSTR off=NULL)
Sets the tree icons to dispay for each of the three states.
#define BOOL
Definition: mprintf.c:71
afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
Toggles the state of an item when the user clicks in the window.
GLuint index
Definition: glext.h:3476
#define NULL
Definition: Lib.h:88
HDC hDC
Definition: wglext.h:383
void Draw3dRect(HDC hDC, RECT *rect, HBRUSH topLeft, HBRUSH bottomRight)
Draws a 3d rectangle using the given brushes this code was taken from the gui editor.
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Called as the window is being created and initializes icons and window styles.
afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
Returns the size of each item in the toggle list.
#define protected
Definition: TypeInfo.cpp:31
A simple list view that supports a toggle button.
afx_msg void OnSize(UINT nType, int cx, int cy)
Called when the window is being resized.
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
Responsible for drawing each list item.