make CMenuButton a wrapper for CMFCMenuButton with ListHandling
[TortoiseGit.git] / src / Utils / MiscUI / OddButton.h
blob69f6cd9d3312fe856e9606ffcd0b98877ee1802b
1 /*
2 * Copyright (c) 2001-2002 Paolo Messina and Jerzy Kaczorowski
3 *
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
8 *
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_
18 #if _MSC_VER > 1000
19 #pragma once
20 #endif // _MSC_VER > 1000
21 // OddButton.h : header file
24 /// Control's type mask
25 #define ODDBTN_BS_TYPEMASK 0x0000000FL
27 /////////////////////////////////////////////////////////////////////////////
28 // COddButton window
30 /*!
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
42 </A>)
44 class COddButton : public CButton
46 DECLARE_DYNAMIC(COddButton)
47 // Construction
48 public:
49 COddButton();
51 // Attributes
52 public:
54 // Operations
55 public:
57 // Overrides
58 // ClassWizard generated virtual function overrides
59 //{{AFX_VIRTUAL(COddButton)
60 protected:
61 virtual void PreSubclassWindow();
62 //}}AFX_VIRTUAL
64 // Implementation
65 public:
66 virtual ~COddButton();
68 // Generated message map functions
69 protected:
70 //{{AFX_MSG(COddButton)
71 afx_msg UINT OnGetDlgCode();
72 //}}AFX_MSG
73 afx_msg LRESULT OnSetStyle(WPARAM wParam, LPARAM lParam);
75 DECLARE_MESSAGE_MAP()
77 private:
78 // Data members
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 */
83 protected:
84 // Interface
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;
95 public:
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_)