2 * Copyright (c) 2001-2002 Paolo Messina and Jerzy Kaczorowski
4 * The contents of this file are subject to the Artistic License (the "License").
5 * You may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 * http://www.opensource.org/licenses/artistic-license.html
9 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
10 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
11 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 #if !defined(AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_)
16 #define AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_
20 #endif // _MSC_VER > 1000
21 // OddButton.h : header file
24 /// Control's type mask
25 #define ODDBTN_BS_TYPEMASK 0x0000000FL
27 /////////////////////////////////////////////////////////////////////////////
31 \brief Owner-Draw Default Button is a base class for owner-draw buttons that provides basic
32 support for default state handling.
34 Derived class can indicate the default state when appropriate simply by calling
35 COddButton::IsDefault method to determine the default state and using
36 any visual effect (e.g. a thin black frame around the button) when it becomes default.
38 \note A special static method COddButton::SetDefID can be used to set the default button
39 for the dialog to work around the problems with using a CDialog::SetDefID described in MS kb Q67655
40 (<A HREF="http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q67655&">
41 HOWTO: Change or Set the Default Push Button in a Dialog Box
44 class COddButton
: public CButton
46 DECLARE_DYNAMIC(COddButton
)
58 // ClassWizard generated virtual function overrides
59 //{{AFX_VIRTUAL(COddButton)
61 virtual void PreSubclassWindow();
66 virtual ~COddButton();
68 // Generated message map functions
70 //{{AFX_MSG(COddButton)
71 afx_msg UINT
OnGetDlgCode();
73 afx_msg LRESULT
OnSetStyle(WPARAM wParam
, LPARAM lParam
);
79 BOOL m_bCanBeDefault
; /*!< TRUE to enable default state handling */
80 BOOL m_bDefault
; /*!< Set to TRUE when control has default state */
81 UINT m_nTypeStyle
; /*!< Type of control */
86 /// Use to enable or disable default state handling
87 void EnableDefault(BOOL bEnable
);
89 /// Use to know whether the control has a default state
90 BOOL
IsDefault() const;
92 /// Use to know the type of control to draw
93 UINT
GetControlType() const;
96 /// Use to set the dialog's default pushbutton
97 static void SetDefID(CDialog
* pDialog
, const UINT nID
);
100 /////////////////////////////////////////////////////////////////////////////
102 //{{AFX_INSERT_LOCATION}}
103 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
105 #endif // !defined(AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_)