User:Araxestroy/Class notes

From sc2k-reverse
Revision as of 10:21, 24 March 2025 by Araxestroy (talk | contribs) (Created page with "=== <code>class CCmdUI</code> === This is a base class in MFC used as a helper for UI update/draw callbacks when eg. menus are drawn. The following is from the MFC 2.1 include file <code>afxwin.h</code>, with additional annotations added: <syntaxhighlight lang="c++" line> class CCmdUI // simple helper class { public: // Attributes UINT m_nID; UINT m_nIndex; // menu item or other index // if a menu item CMenu* m_pMenu; // NULL if not a menu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

class CCmdUI

This is a base class in MFC used as a helper for UI update/draw callbacks when eg. menus are drawn. The following is from the MFC 2.1 include file afxwin.h, with additional annotations added:

class CCmdUI        // simple helper class
{
public:
// Attributes
	UINT m_nID;
	UINT m_nIndex;          // menu item or other index

	// if a menu item
	CMenu* m_pMenu;         // NULL if not a menu
	CMenu* m_pSubMenu;      // sub containing menu item
							// if a popup sub menu - ID is for first in popup

	// if from some other window
	CWnd* m_pOther;         // NULL if a menu or not a CWnd

// Operations to do in ON_UPDATE_COMMAND_UI
	virtual void Enable(BOOL bOn = TRUE);    // [ecx+0]
	virtual void SetCheck(int nCheck = 1);   // [ecx+4] 0, 1 or 2 (indeterminate)
	virtual void SetRadio(BOOL bOn = TRUE);  // [ecx+8]
	virtual void SetText(LPCTSTR lpszText);  // [ecx+12]

// Advanced operation
	void ContinueRouting();

// Implementation
	CCmdUI();
	BOOL m_bEnableChanged;
	BOOL m_bContinueRouting;
	UINT m_nIndexMax;       // last + 1 for iterating m_nIndex

	CMenu* m_pParentMenu;   // NULL if parent menu not easily determined
							//  (probably a secondary popup menu)

	void DoUpdate(CCmdTarget* pTarget, BOOL bDisableIfNoHndler);
};

class CSimcityView

CView-derived class for the main game window.