doom3-gpl
Doom 3 GPL source release
|
A simple list view that supports a toggle button. More...
#include <ToggleListView.h>
Public Types | |
enum | { TOGGLE_STATE_DISABLED = 0, TOGGLE_STATE_ON, TOGGLE_STATE_OFF } |
Enumeration that defines the possible states of the toggle button. More... | |
Public Member Functions | |
void | SetToggleIcons (LPCSTR disabled=NULL, LPCSTR on=NULL, LPCSTR off=NULL) |
Sets the tree icons to dispay for each of the three states. More... | |
void | SetToggleState (int index, int toggleState, bool notify=false) |
Sets the state of an item in the list. More... | |
int | GetToggleState (int index) |
Gets the state of an item in the list. More... | |
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct) |
Called as the window is being created and initializes icons and window styles. More... | |
afx_msg void | OnSize (UINT nType, int cx, int cy) |
Called when the window is being resized. More... | |
afx_msg void | MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct) |
Returns the size of each item in the toggle list. More... | |
afx_msg void | OnNMClick (NMHDR *pNMHDR, LRESULT *pResult) |
Toggles the state of an item when the user clicks in the window. More... | |
Protected Member Functions | |
ToggleListView () | |
Protected constructor used by dynamic creation. More... | |
virtual | ~ToggleListView () |
Destructor. More... | |
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs) |
Sets some window styles before the window is created. More... | |
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct) |
Responsible for drawing each list item. More... | |
virtual void | OnStateChanged (int index, int toggleState) |
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. More... | |
Protected Attributes | |
HICON | onIcon |
HICON | offIcon |
HICON | disabledIcon |
A simple list view that supports a toggle button.
ToggleListView is a simple extension to the CListView class that support a toggle button. It is limited to a single column and always uses full row select. The toggle state is stored in the data for each item so users of this class should not attempt to use the data field for storage. lparam can be used instead.
Definition at line 39 of file ToggleListView.h.
anonymous enum |
Enumeration that defines the possible states of the toggle button.
Enumerator | |
---|---|
TOGGLE_STATE_DISABLED | |
TOGGLE_STATE_ON | |
TOGGLE_STATE_OFF |
Definition at line 45 of file ToggleListView.h.
|
protected |
Protected constructor used by dynamic creation.
Definition at line 50 of file ToggleListView.cpp.
|
protectedvirtual |
Destructor.
Definition at line 59 of file ToggleListView.cpp.
|
protected |
Draws a 3d rectangle using the given brushes this code was taken from the gui editor.
Definition at line 288 of file ToggleListView.cpp.
|
protectedvirtual |
Responsible for drawing each list item.
Definition at line 214 of file ToggleListView.cpp.
Gets the state of an item in the list.
index | Index of the item of which to retreive the state. |
Definition at line 115 of file ToggleListView.cpp.
void ToggleListView::MeasureItem | ( | LPMEASUREITEMSTRUCT | lpMeasureItemStruct | ) |
Returns the size of each item in the toggle list.
Definition at line 162 of file ToggleListView.cpp.
int ToggleListView::OnCreate | ( | LPCREATESTRUCT | lpCreateStruct | ) |
Called as the window is being created and initializes icons and window styles.
Definition at line 126 of file ToggleListView.cpp.
void ToggleListView::OnNMClick | ( | NMHDR * | pNMHDR, |
LRESULT * | pResult | ||
) |
Toggles the state of an item when the user clicks in the window.
Definition at line 169 of file ToggleListView.cpp.
Called when the window is being resized.
Definition at line 152 of file ToggleListView.cpp.
Reimplemented in StageView.
Definition at line 76 of file ToggleListView.h.
|
protectedvirtual |
Sets some window styles before the window is created.
Reimplemented in StageView.
Definition at line 203 of file ToggleListView.cpp.
Sets the tree icons to dispay for each of the three states.
Sets the icons to display for each of the three states. The values passed in are the resource name that can be generated using MAKEINTRESOUCE. If the value passed in is NULL then an icon will not be drawn for that state.
disabled | The icon to draw when the state is TOGGLE_STATE_DISABLED. |
on | The icon to draw when the state is TOGGLE_STATE_ON. |
off | The icon to draw when the state is TOGGLE_STATE_OFF. |
Definition at line 73 of file ToggleListView.cpp.
Sets the state of an item in the list.
index | Index of the item whose state should be changed. |
toggleState | The state to set |
notify | Determines if the notification method OnStateChanged should be called. OnStateChanged will also not be called if the state has not changed. |
Definition at line 100 of file ToggleListView.cpp.
|
protected |
Definition at line 83 of file ToggleListView.h.
|
protected |
Definition at line 82 of file ToggleListView.h.
|
protected |
Definition at line 81 of file ToggleListView.h.