SECWellButton Class
class SECWellButton: public SECOwnerDrawButton
The SECWellButton class implements a button which can be used for selecting colors. The face of the button displays the color currently selected. When the user clicks the SECWellButton, a popup color palette is displayed (SECPopupColorWell), which can be used to select the required color.Defined in: SECBTNS.h
Comments
You can specify whether the SECPopupColorWell allows selection of colors other than the 20 system colors with the SetOtherButton function. This will cause the SECPopupColorWell to display a button labeled 'Other', which when clicked will cause a common color selection dialog to be displayed.You can specify whether you want the SECWellButton to support palettes with the SetPaletteRealization function. This will cause any colors selected to be placed into a palette and the palette realized before drawing.
The SECWellButton will send a CWN_COLOR_CHANGE message to its parent when the selected color is changed.
the DDX_Color function can be used for data exchange in dialogs.
See the COLOR sample in the \\OT\\SAMPLES\\STANDARD\\CONTROLS\\COLRWELL directory for a demonstration of this class.
Example
You can attach SECWellButton objects to existing push buttons withm_wellButton.AttachButton(IDC_BUTTON1, this);You can dynamically create an SECWellButton button control with
m_wellButton.Create(NULL, WS_VISIBLE|WS_TABSTOP|
WS_CHILD, rect, this, IDC_BUTTON1);
Class Members
Creation/Initialization
Creates a SECWellButton object.
Attributes
void SetColor(COLORREF cl)
Set the currently selected color.
COLORREF GetColor() const
Get the currently selected color.
void SetOtherButton( BOOL bOther )
Set whether the popup has an other button or not.
BOOL GetOtherButton() const
Returns whether the popup has an other button or not.
void SetPaletteRealization(BOOL bRealizePalette)
Set the current palette realizaion mode.
BOOL GetPaletteRealization() const
Get the current realization mode.
virtual void SetColorDialogFlags(DWORD v)
Sets the flags for customizing the CColorDialog that is display in response to a click on the Other button. Default = CC_RGBINIT|CC_FULLOPEN.
virtual DWORD GetColorDialogFlags() const
Returns the flags for the color common dialog. Default = CC_RGBINIT|CC_FULLOPEN.
virtual void SetCustomColors(COLORREF* pColors)
Sets the array of 16 colors for the custom color boxes in CColorDialog
COLORREF* GetCustomColors() const
Retrieves the array of 16 colors for the custom color boxes in CColorDialog. Default=NULL
void SetPopup(SECPopupColorWell* pPopup)
Sets the Popup to something other than the default.
SECPopupColorWell* GetPopup()
Returns a pointer to the current Popup.
Overridable
virtual void CreatePalette()
Creates and initialises the palette.
virtual void CreatePopup()
Creates the popup color well.
virtual void OnBnClicked()
Called when button is clicked (to create the popup).
afx_msg LRESULT OnColorChange(WPARAM wParam, LPARAM lParam)
Called when a color has been selected.
afx_msg LRESULT OnCustomColor(WPARAM wParam, LPARAM lParam)
Called when the "Other" button has been clicked.
virtual void PreDrawButton(CDC* pScreenDC, CDC* pMemDC)
Called prior to drawing the button.
virtual void PostDrawButton(CDC* pScreenDC, CDC* pMemDC)
Called after drawing the button.
virtual void DrawFocus(CDC* pDC, CRect& rect)
Draws the focus rectangle.
virtual void DrawSpecific(CDC* pDC, LPDRAWITEMSTRUCT lpDS, CRect& rect)
Draws the button face.
Protected data members
SECPopupColorWell* m_pPopup
The popup color well.
CPalette m_palette
Palette used for holding current color.
CPalette* m_pOldPal
Pallete used during drawing.
CPalette* m_pMemOldPal
Pallete used during drawing.
BOOL m_bRealizePalette
TRUE if object should realize our palette before drawing.
BOOL m_bHasOther
TRUE if popup has other button.
DWORD m_dwColorDialogFlags
Flags for customizing the CColorDialog displayed in response to clicking the Other button
COLORREF* m_pCustomColors
Pointer to an array of 16 colors for the custom color boxes in CColorDialog